diff options
author | Eric Laurent <elaurent@google.com> | 2014-01-27 11:20:16 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-01-27 11:20:16 -0800 |
commit | fe6db33a4b6454f441c6f0f5ff622d7527c5680c (patch) | |
tree | b2b7920d97df54457aadc1de109d86f2268d0f1f | |
parent | 8ba3192fc5f3fd72217f5946e8bd1831f0854749 (diff) | |
parent | 4ef1dc2d5b5f5df93b173b0b4c4719d4484e031d (diff) | |
download | frameworks_av-fe6db33a4b6454f441c6f0f5ff622d7527c5680c.zip frameworks_av-fe6db33a4b6454f441c6f0f5ff622d7527c5680c.tar.gz frameworks_av-fe6db33a4b6454f441c6f0f5ff622d7527c5680c.tar.bz2 |
am 4ef1dc2d: Merge "Only increase the counter when we do take a wakelock"
* commit '4ef1dc2d5b5f5df93b173b0b4c4719d4484e031d':
Only increase the counter when we do take a wakelock
-rw-r--r-- | media/libstagefright/TimedEventQueue.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp index dedd186..0afac69 100644 --- a/media/libstagefright/TimedEventQueue.cpp +++ b/media/libstagefright/TimedEventQueue.cpp @@ -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 (mWakeLockCount == 0) { + return; + } if (force) { - if (mWakeLockCount == 0) { - return; - } // Force wakelock release below by setting reference count to 1. mWakeLockCount = 1; } - CHECK(mWakeLockCount != 0); if (--mWakeLockCount == 0) { CHECK(mWakeLockToken != 0); if (mPowerManager != 0) { |