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

Commit 6e3806fc authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Don't release WakeLock w/o active client

Once we see the WakeLock isn't held, we should return before attempting
to release a non-existent WakeLock.

Bug: 168002974
Test: manual
Change-Id: I0172c637d7f6f22888c126da42d4fd1fe45fe0db
(cherry picked from commit 386c3fcc)
parent 4488005e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ public interface WakeLock {
    static final String REASON_WRAP = "wrap";

    /**
     * Default wake-lock timeout, to avoid battery regressions.
     * Default wake-lock timeout in milliseconds, to avoid battery regressions.
     */
    long DEFAULT_MAX_TIMEOUT = 20000;

@@ -104,6 +104,7 @@ public interface WakeLock {
                if (count == null) {
                    Log.wtf(TAG, "Releasing WakeLock with invalid reason: " + why,
                            new Throwable());
                    return;
                } else if (count == 1) {
                    mActiveClients.remove(why);
                } else {