diff options
author | Henrik Baard <henrik.baard@sonymobile.com> | 2017-08-09 14:45:05 +0200 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2017-10-03 14:45:34 -0600 |
commit | 8d475ca0586ca7315d0660be429d5eebe114303b (patch) | |
tree | b961b0fb67c75d12b510f59390ea7a3b03c1c989 /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | efed687188dbe4266ac385998bb022663c0e482e (diff) |
Prevent WakeLock count ending up in an incorrect state
WakeLock can end up in a bad state if the following sequence
is executed:
1. mWakeLock = mPowerManager.newWakeLock(...)
2. mWakeLock.acquire(TIMEOUT_MS);
3. timeout TIMEOUT_MS occurs before release() is called
4. release is called()
[1] mInternalCount = mExternalCount = 0
[2] mInternalCount = 1, mExternalCount = 1
[3] mInternalCount = 0, mExternalCount = 1
[4] mInternalCount = -1, mExternalCount = 0
If acquireLocked is called on the same object after this sequence,
mInternalCount is incremented to 0 which results in no wakelock
being requested from PowerManagerService.
Bug: 64676694
Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.cts.PowerManager_WakeLockTest
Change-Id: I133812aefb5d92eec2e2dde1a36f81dc9ffd7625
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions