File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -542,14 +542,18 @@ public void acquire(long timeout) {
542542
543543 private void acquireLocked () {
544544 if (!mRefCounted || mCount ++ == 0 ) {
545+ // Do this even if the wake lock is already thought to be held (mHeld == true)
546+ // because non-reference counted wake locks are not always properly released.
547+ // For example, the keyguard's wake lock might be forcibly released by the
548+ // power manager without the keyguard knowing. A subsequent call to acquire
549+ // should immediately acquire the wake lock once again despite never having
550+ // been explicitly released by the keyguard.
545551 mHandler .removeCallbacks (mReleaser );
546- if (!mHeld ) {
547- try {
548- mService .acquireWakeLock (mFlags , mToken , mTag , mWorkSource );
549- } catch (RemoteException e ) {
550- }
551- mHeld = true ;
552+ try {
553+ mService .acquireWakeLock (mFlags , mToken , mTag , mWorkSource );
554+ } catch (RemoteException e ) {
552555 }
556+ mHeld = true ;
553557 }
554558 }
555559
You can’t perform that action at this time.
0 commit comments