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

Commit b5962e73 authored by Jake Hamby's avatar Jake Hamby
Browse files

Fix race condition in WakeLocks.

A previous fix to PowerManager.WakeLock introduced a new bug. When
a reference counted wakelock (such as SMSDispatcher) is acquired
multiple times in quick succession with a timeout, the first timeout
would remove the second callback from the handler, decrement the
reference count, but then the wakelock never gets released because
the second callback has been removed.

Bug: 4535237
Change-Id: I4f1240189bf3ed3396c86200c687282597b107d6
parent 0a4d51d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -313,8 +313,8 @@ public class PowerManager
         */
        public void release(int flags) {
            synchronized (mToken) {
                mHandler.removeCallbacks(mReleaser);
                if (!mRefCounted || --mCount == 0) {
                    mHandler.removeCallbacks(mReleaser);
                    try {
                        mService.releaseWakeLock(mToken, flags);
                    } catch (RemoteException e) {