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

Commit 03d290ae authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Release WakeLock on unaquired lock doesn't throw

Test: atest WakeLockTest
Bug: 168002974
Change-Id: Icdc165686a4fe701255f3e02df4765d30a2d949c
parent 386c3fcc
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.util.wakelock;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import android.os.Build;
import android.os.PowerManager;

import androidx.test.filters.SmallTest;
@@ -85,4 +86,14 @@ public class WakeLockTest extends SysuiTestCase {
        assertTrue(ran[0]);
        assertFalse(mInner.isHeld());
    }

    @Test
    public void prodBuild_wakeLock_releaseWithoutAcquire_noThrow() {
        if (Build.IS_ENG) {
            return;
        }

        // shouldn't throw an exception on production builds
        mWakeLock.release(WHY);
    }
}
 No newline at end of file