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

Commit 54378a00 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add synchronization when EventFlagQueue is created in sensors HAL init" into main

parents 7c690b96 960022da
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -85,9 +85,6 @@ ScopedAStatus Sensors::initialize(
    ALOGI("Sensors initializing");
    ScopedAStatus result = ScopedAStatus::ok();

    mEventQueue = std::make_unique<AidlMessageQueue<Event, SynchronizedReadWrite>>(
            in_eventQueueDescriptor, true /* resetPointers */);

    // Ensure that all sensors are disabled.
    for (auto sensor : mSensors) {
        sensor.second->activate(false);
@@ -106,6 +103,9 @@ ScopedAStatus Sensors::initialize(
        // Hold the lock to ensure that re-creation of event flag is atomic
        std::lock_guard<std::mutex> lock(mWriteLock);

        mEventQueue = std::make_unique<AidlMessageQueue<Event, SynchronizedReadWrite>>(
                in_eventQueueDescriptor, true /* resetPointers */);

        // Ensure that any existing EventFlag is properly deleted
        deleteEventFlagLocked();