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

Commit 05f2fdc1 authored by Ricardo Garcia's avatar Ricardo Garcia
Browse files

-Making sure mAudioCommands list is empty before going to sleep.

-Wake_lock release before sleeping or quitting threadLoop().

Change-Id: Icab53d7984a3ba3eaf13e514667b4d60f40cbcd6
parent 81e50d0c
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -514,21 +514,23 @@ bool AudioPolicyService::AudioCommandThread::threadLoop()
                break;
            }
        }
        // release delayed commands wake lock
        if (mAudioCommands.isEmpty()) {
            release_wake_lock(mName.string());
        }
        // release mLock before releasing strong reference on the service as
        // AudioPolicyService destructor calls AudioCommandThread::exit() which acquires mLock.
        mLock.unlock();
        svc.clear();
        mLock.lock();
        if (!exitPending()) {
        if (!exitPending() && mAudioCommands.isEmpty()) {
            // release delayed commands wake lock
            release_wake_lock(mName.string());
            ALOGV("AudioCommandThread() going to sleep");
            mWaitWorkCV.waitRelative(mLock, waitTime);
            ALOGV("AudioCommandThread() waking up");
        }
    }
    // release delayed commands wake lock before quitting
    if (!mAudioCommands.isEmpty()) {
        release_wake_lock(mName.string());
    }
    mLock.unlock();
    return false;
}