Merge "Prevent WakeLock count ending up in an incorrect state"

This commit is contained in:
TreeHugger Robot
2017-10-03 23:04:57 +00:00
committed by Android (Google) Code Review

View File

@@ -1412,7 +1412,11 @@ public final class PowerManager {
*/
public void release(int flags) {
synchronized (mToken) {
mInternalCount--;
if (mInternalCount > 0) {
// internal count must only be decreased if it is > 0 or state of
// the WakeLock object is broken.
mInternalCount--;
}
if ((flags & RELEASE_FLAG_TIMEOUT) == 0) {
mExternalCount--;
}