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

Commit bc91e138 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Stop Wake Lock thread if it is running"

parents b77643d0 d3849e10
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -87,6 +87,17 @@ Return<Result> Sensors::initialize(
    const sp<ISensorsCallback>& sensorsCallback) {
    Result result = Result::OK;

    // Ensure that all sensors are disabled
    for (auto sensor : mSensors) {
        sensor.second->activate(false /* enable */);
    }

    // Stop the Wake Lock thread if it is currently running
    if (mReadWakeLockQueueRun.load()) {
        mReadWakeLockQueueRun = false;
        mWakeLockThread.join();
    }

    // Save a reference to the callback
    mCallback = sensorsCallback;