Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e71b00bc authored by Madhav Iyengar's avatar Madhav Iyengar Committed by Android (Google) Code Review
Browse files

Merge "Fixes possible race in example Sensors HAL" into main

parents 6271ac09 04b9c2c6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -97,9 +97,13 @@ class Sensors : public BnSensors, public ISensorsEventCallback {
            return;
        }
        if (mEventQueue->write(&events.front(), events.size())) {
            if (mEventQueueFlag == nullptr) {
                // Don't take the wake lock if we can't wake the receiver to avoid holding it
                // indefinitely.
                return;
            }
            mEventQueueFlag->wake(
                    static_cast<uint32_t>(BnSensors::EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS));

            if (wakeup) {
                // Keep track of the number of outstanding WAKE_UP events in order to properly hold
                // a wake lock until the framework has secured a wake lock