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

Commit 1ae4b6ce authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am fe6db33a: am 4ef1dc2d: Merge "Only increase the counter when we do take a wakelock"

* commit 'fe6db33a':
  Only increase the counter when we do take a wakelock
parents 9f875b27 fe6db33a
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ sp<TimedEventQueue::Event> TimedEventQueue::removeEventFromQueue_l(

void TimedEventQueue::acquireWakeLock_l()
{
    if (mWakeLockCount++ == 0) {
    if (mWakeLockCount == 0) {
        CHECK(mWakeLockToken == 0);
        if (mPowerManager == 0) {
            // use checkService() to avoid blocking if power service is not up yet
@@ -341,21 +341,23 @@ void TimedEventQueue::acquireWakeLock_l()
            IPCThreadState::self()->restoreCallingIdentity(token);
            if (status == NO_ERROR) {
                mWakeLockToken = binder;
                mWakeLockCount++;
            }
        }
    } else {
        mWakeLockCount++;
    }
}

void TimedEventQueue::releaseWakeLock_l(bool force)
{
    if (force) {
    if (mWakeLockCount == 0) {
        return;
    }
    if (force) {
        // Force wakelock release below by setting reference count to 1.
        mWakeLockCount = 1;
    }
    CHECK(mWakeLockCount != 0);
    if (--mWakeLockCount == 0) {
        CHECK(mWakeLockToken != 0);
        if (mPowerManager != 0) {