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

Commit c0a1b64b authored by Ashley Holton's avatar Ashley Holton
Browse files

Add display ID parameter to window policy wakeUp()

Supports the per-display wake by touch project, as WindowWakeUpPolicy's
wakeUp() will need to pass on a display ID to PowerManager's wakeUp().
Since WindowWakeUpPolicy's wakeUp() currently has no way to know the
display ID of the display to wake, pass as a parameter.

Flag: EXEMPT refactor
Bug: 360916757
Test: atest WmTests:WindowWakeUpPolicyTests
Change-Id: Ib308c1ece3c0c3767eb671f71284d9f845412d9b
parent c51a772b
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -1140,9 +1140,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        + mShortPressOnPowerBehavior);

        if (count == 2) {
            powerMultiPressAction(eventTime, interactive, mDoublePressOnPowerBehavior);
            powerMultiPressAction(displayId, eventTime, interactive, mDoublePressOnPowerBehavior);
        } else if (count == 3) {
            powerMultiPressAction(eventTime, interactive, mTriplePressOnPowerBehavior);
            powerMultiPressAction(displayId, eventTime, interactive, mTriplePressOnPowerBehavior);
        } else if (count > 3 && count <= getMaxMultiPressPowerCount()) {
            Slog.d(TAG, "No behavior defined for power press count " + count);
        } else if (count == 1 && shouldHandleShortPressPowerAction(interactive, eventTime)) {
@@ -1306,7 +1306,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    private void powerMultiPressAction(long eventTime, boolean interactive, int behavior) {
    private void powerMultiPressAction(int displayId, long eventTime, boolean interactive,
            int behavior) {
        switch (behavior) {
            case MULTI_PRESS_POWER_NOTHING:
                break;
@@ -1321,7 +1322,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Settings.Global.putInt(mContext.getContentResolver(),
                            Settings.Global.THEATER_MODE_ON, 0);
                    if (!interactive) {
                        wakeUpFromWakeKey(eventTime, KEYCODE_POWER, /* isDown= */ false);
                        wakeUpFromWakeKey(displayId, eventTime, KEYCODE_POWER, /* isDown= */ false);
                    }
                } else {
                    Slog.i(TAG, "Toggling theater mode on.");
@@ -1337,7 +1338,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case MULTI_PRESS_POWER_BRIGHTNESS_BOOST:
                Slog.i(TAG, "Starting brightness boost.");
                if (!interactive) {
                    wakeUpFromWakeKey(eventTime, KEYCODE_POWER, /* isDown= */ false);
                    wakeUpFromWakeKey(displayId, eventTime, KEYCODE_POWER, /* isDown= */ false);
                }
                mPowerManager.boostScreenBrightness(eventTime);
                break;
@@ -5538,7 +5539,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        if (mRequestedOrSleepingDefaultDisplay) {
            mCameraGestureTriggeredDuringGoingToSleep = true;
            // Wake device up early to prevent display doing redundant turning off/on stuff.
            mWindowWakeUpPolicy.wakeUpFromPowerKeyCameraGesture();
            mWindowWakeUpPolicy.wakeUpFromPowerKeyCameraGesture(event.getDisplayId());
        }
        return true;
    }
@@ -5636,8 +5637,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    public int interceptMotionBeforeQueueingNonInteractive(int displayId, int source, int action,
            long whenNanos, int policyFlags) {
        if ((policyFlags & FLAG_WAKE) != 0) {
            if (mWindowWakeUpPolicy.wakeUpFromMotion(
                        whenNanos / 1000000, source, action == MotionEvent.ACTION_DOWN)) {
            if (mWindowWakeUpPolicy.wakeUpFromMotion(displayId, whenNanos / 1000000, source,
                    action == MotionEvent.ACTION_DOWN)) {
                // Woke up. Pass motion events to user.
                return ACTION_PASS_TO_USER;
            }
@@ -5651,8 +5652,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        // there will be no dream to intercept the touch and wake into ambient.  The device should
        // wake up in this case.
        if (isTheaterModeEnabled() && (policyFlags & FLAG_WAKE) != 0) {
            if (mWindowWakeUpPolicy.wakeUpFromMotion(
                        whenNanos / 1000000, source, action == MotionEvent.ACTION_DOWN)) {
            if (mWindowWakeUpPolicy.wakeUpFromMotion(displayId, whenNanos / 1000000, source,
                    action == MotionEvent.ACTION_DOWN)) {
                // Woke up. Pass motion events to user.
                return ACTION_PASS_TO_USER;
            }
@@ -5994,13 +5995,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            return;
        }
        wakeUpFromWakeKey(
                event.getDisplayId(),
                event.getEventTime(),
                event.getKeyCode(),
                event.getAction() == KeyEvent.ACTION_DOWN);
    }

    private void wakeUpFromWakeKey(long eventTime, int keyCode, boolean isDown) {
        if (mWindowWakeUpPolicy.wakeUpFromKey(eventTime, keyCode, isDown)) {
    private void wakeUpFromWakeKey(int displayId, long eventTime, int keyCode, boolean isDown) {
        if (mWindowWakeUpPolicy.wakeUpFromKey(displayId, eventTime, keyCode, isDown)) {
            final boolean keyCanLaunchHome = keyCode == KEYCODE_HOME || keyCode == KEYCODE_POWER;
            // Start HOME with "reason" extra if sleeping for more than mWakeUpToLastStateTimeout
            if (shouldWakeUpWithHomeIntent() &&  keyCanLaunchHome) {
+20 −10
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.os.PowerManager.WAKE_REASON_WAKE_MOTION;
import static android.view.KeyEvent.KEYCODE_POWER;

import static com.android.server.policy.Flags.supportInputWakeupDelegate;
import static com.android.server.power.feature.flags.Flags.perDisplayWakeByTouch;

import android.annotation.Nullable;
import android.content.Context;
@@ -107,13 +108,14 @@ class WindowWakeUpPolicy {
    /**
     * Wakes up from a key event.
     *
     * @param displayId the id of the display to wake.
     * @param eventTime the timestamp of the event in {@link SystemClock#uptimeMillis()}.
     * @param keyCode the {@link android.view.KeyEvent} key code of the key event.
     * @param isDown {@code true} if the event's action is {@link KeyEvent#ACTION_DOWN}.
     * @return {@code true} if the policy allows the requested wake up and the request has been
     *      executed; {@code false} otherwise.
     */
    boolean wakeUpFromKey(long eventTime, int keyCode, boolean isDown) {
    boolean wakeUpFromKey(int displayId, long eventTime, int keyCode, boolean isDown) {
        final boolean wakeAllowedDuringTheaterMode =
                keyCode == KEYCODE_POWER
                        ? mAllowTheaterModeWakeFromPowerKey
@@ -127,6 +129,7 @@ class WindowWakeUpPolicy {
            return true;
        }
        wakeUp(
                displayId,
                eventTime,
                keyCode == KEYCODE_POWER ? WAKE_REASON_POWER_BUTTON : WAKE_REASON_WAKE_KEY,
                keyCode == KEYCODE_POWER ? "POWER" : "KEY");
@@ -136,12 +139,13 @@ class WindowWakeUpPolicy {
    /**
     * Wakes up from a motion event.
     *
     * @param displayId the id of the display to wake.
     * @param eventTime the timestamp of the event in {@link SystemClock#uptimeMillis()}.
     * @param isDown {@code true} if the event's action is {@link MotionEvent#ACTION_DOWN}.
     * @return {@code true} if the policy allows the requested wake up and the request has been
     *      executed; {@code false} otherwise.
     */
    boolean wakeUpFromMotion(long eventTime, int source, boolean isDown) {
    boolean wakeUpFromMotion(int displayId, long eventTime, int source, boolean isDown) {
        if (!canWakeUp(mAllowTheaterModeWakeFromMotion)) {
            if (DEBUG) Slog.d(TAG, "Unable to wake up from motion.");
            return false;
@@ -150,7 +154,7 @@ class WindowWakeUpPolicy {
                && mInputWakeUpDelegate.wakeUpFromMotion(eventTime, source, isDown)) {
            return true;
        }
        wakeUp(eventTime, WAKE_REASON_WAKE_MOTION, "MOTION");
        wakeUp(displayId, eventTime, WAKE_REASON_WAKE_MOTION, "MOTION");
        return true;
    }

@@ -166,7 +170,7 @@ class WindowWakeUpPolicy {
            if (DEBUG) Slog.d(TAG, "Unable to wake up from camera cover.");
            return false;
        }
        wakeUp(eventTime, WAKE_REASON_CAMERA_LAUNCH, "CAMERA_COVER");
        wakeUp(Display.DEFAULT_DISPLAY, eventTime, WAKE_REASON_CAMERA_LAUNCH, "CAMERA_COVER");
        return true;
    }

@@ -181,22 +185,24 @@ class WindowWakeUpPolicy {
            if (DEBUG) Slog.d(TAG, "Unable to wake up from lid.");
            return false;
        }
        wakeUp(mClock.uptimeMillis(), WAKE_REASON_LID, "LID");
        wakeUp(Display.DEFAULT_DISPLAY, mClock.uptimeMillis(), WAKE_REASON_LID, "LID");
        return true;
    }

    /**
     * Wakes up to prevent sleeping when opening camera through power button.
     *
     * @param displayId the id of the display to wake.
     * @return {@code true} if the policy allows the requested wake up and the request has been
     *      executed; {@code false} otherwise.
     */
    boolean wakeUpFromPowerKeyCameraGesture() {
    boolean wakeUpFromPowerKeyCameraGesture(int displayId) {
        if (!canWakeUp(mAllowTheaterModeWakeFromPowerKey)) {
            if (DEBUG) Slog.d(TAG, "Unable to wake up from power key camera gesture.");
            return false;
        }
        wakeUp(mClock.uptimeMillis(), WAKE_REASON_CAMERA_LAUNCH, "CAMERA_GESTURE_PREVENT_LOCK");
        wakeUp(displayId, mClock.uptimeMillis(), WAKE_REASON_CAMERA_LAUNCH,
                "CAMERA_GESTURE_PREVENT_LOCK");
        return true;
    }

@@ -211,7 +217,7 @@ class WindowWakeUpPolicy {
            if (DEBUG) Slog.d(TAG, "Unable to wake up from gesture.");
            return false;
        }
        wakeUp(mClock.uptimeMillis(), WAKE_REASON_GESTURE, "GESTURE");
        wakeUp(Display.DEFAULT_DISPLAY, mClock.uptimeMillis(), WAKE_REASON_GESTURE, "GESTURE");
        return true;
    }

@@ -234,7 +240,11 @@ class WindowWakeUpPolicy {
    }

    /** Wakes up {@link PowerManager}. */
    private void wakeUp(long wakeTime, @WakeReason int reason, String details) {
    private void wakeUp(int displayId, long wakeTime, @WakeReason int reason, String details) {
        if (perDisplayWakeByTouch()) {
            mPowerManager.wakeUp(wakeTime, reason, "android.policy:" + details, displayId);
        } else {
            mPowerManager.wakeUp(wakeTime, reason, "android.policy:" + details);
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -700,7 +700,7 @@ class TestPhoneWindowManager {
    void assertPowerWakeUp() {
        mTestLooper.dispatchAll();
        verify(mWindowWakeUpPolicy)
                .wakeUpFromKey(anyLong(), eq(KeyEvent.KEYCODE_POWER), anyBoolean());
                .wakeUpFromKey(anyInt(), anyLong(), eq(KeyEvent.KEYCODE_POWER), anyBoolean());
    }

    void assertNoPowerSleep() {
+70 −12
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import static com.android.internal.R.bool.config_allowTheaterModeWakeFromCameraL
import static com.android.internal.R.bool.config_allowTheaterModeWakeFromLidSwitch;
import static com.android.internal.R.bool.config_allowTheaterModeWakeFromGesture;
import static com.android.server.policy.Flags.FLAG_SUPPORT_INPUT_WAKEUP_DELEGATE;
import static com.android.server.power.feature.flags.Flags.FLAG_PER_DISPLAY_WAKE_BY_TOUCH;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
@@ -43,6 +44,7 @@ import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -52,6 +54,8 @@ import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Resources;
import android.os.PowerManager;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;
import android.provider.Settings;
import android.view.Display;
@@ -125,6 +129,7 @@ public final class WindowWakeUpPolicyTests {
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testMotionWakeUpDelegation_wakePowerManagerIfDelegateDoesNotHandleWake() {
        setTheaterModeEnabled(false);
        mSetFlagsRule.enableFlags(FLAG_SUPPORT_INPUT_WAKEUP_DELEGATE);
@@ -136,7 +141,8 @@ public final class WindowWakeUpPolicyTests {

        // Verify the policy wake up call succeeds because of the call on the delegate, and not
        // because of a PowerManager wake up.
        assertThat(mPolicy.wakeUpFromMotion(200, SOURCE_TOUCHSCREEN, true)).isTrue();
        assertThat(mPolicy.wakeUpFromMotion(
                mDefaultDisplay.getDisplayId(), 200, SOURCE_TOUCHSCREEN, true)).isTrue();
        verify(mInputWakeUpDelegate).wakeUpFromMotion(200, SOURCE_TOUCHSCREEN, true);
        verifyNoPowerManagerWakeUp();

@@ -144,12 +150,14 @@ public final class WindowWakeUpPolicyTests {

        // Verify the policy wake up call succeeds because of the PowerManager wake up, since the
        // delegate would not handle the wake up request.
        assertThat(mPolicy.wakeUpFromMotion(300, SOURCE_ROTARY_ENCODER, false)).isTrue();
        assertThat(mPolicy.wakeUpFromMotion(
                mDefaultDisplay.getDisplayId(), 300, SOURCE_ROTARY_ENCODER, false)).isTrue();
        verify(mInputWakeUpDelegate).wakeUpFromMotion(300, SOURCE_ROTARY_ENCODER, false);
        verify(mPowerManager).wakeUp(300, WAKE_REASON_WAKE_MOTION, "android.policy:MOTION");
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testKeyWakeUpDelegation_wakePowerManagerIfDelegateDoesNotHandleWake() {
        setTheaterModeEnabled(false);
        mSetFlagsRule.enableFlags(FLAG_SUPPORT_INPUT_WAKEUP_DELEGATE);
@@ -161,7 +169,8 @@ public final class WindowWakeUpPolicyTests {

        // Verify the policy wake up call succeeds because of the call on the delegate, and not
        // because of a PowerManager wake up.
        assertThat(mPolicy.wakeUpFromKey(200, KEYCODE_POWER, true)).isTrue();
        assertThat(mPolicy.wakeUpFromKey(
                mDefaultDisplay.getDisplayId(), 200, KEYCODE_POWER, true)).isTrue();
        verify(mInputWakeUpDelegate).wakeUpFromKey(200, KEYCODE_POWER, true);
        verifyNoPowerManagerWakeUp();

@@ -169,7 +178,8 @@ public final class WindowWakeUpPolicyTests {

        // Verify the policy wake up call succeeds because of the PowerManager wake up, since the
        // delegate would not handle the wake up request.
        assertThat(mPolicy.wakeUpFromKey(300, KEYCODE_STEM_PRIMARY, false)).isTrue();
        assertThat(mPolicy.wakeUpFromKey(
                mDefaultDisplay.getDisplayId(), 300, KEYCODE_STEM_PRIMARY, false)).isTrue();
        verify(mInputWakeUpDelegate).wakeUpFromKey(300, KEYCODE_STEM_PRIMARY, false);
        verify(mPowerManager).wakeUp(300, WAKE_REASON_WAKE_KEY, "android.policy:KEY");
    }
@@ -186,7 +196,8 @@ public final class WindowWakeUpPolicyTests {
                .setInputWakeUpDelegate(mInputWakeUpDelegate);

        // Check that the wake up does not happen because the theater mode policy check fails.
        assertThat(mPolicy.wakeUpFromKey(200, KEYCODE_POWER, true)).isFalse();
        assertThat(mPolicy.wakeUpFromKey(
                mDefaultDisplay.getDisplayId(), 200, KEYCODE_POWER, true)).isFalse();
        verify(mInputWakeUpDelegate, never()).wakeUpFromKey(anyLong(), anyInt(), anyBoolean());
    }

@@ -201,11 +212,13 @@ public final class WindowWakeUpPolicyTests {
                .setInputWakeUpDelegate(mInputWakeUpDelegate);

        // Check that the wake up does not happen because the theater mode policy check fails.
        assertThat(mPolicy.wakeUpFromMotion(200, SOURCE_TOUCHSCREEN, true)).isFalse();
        assertThat(mPolicy.wakeUpFromMotion(
                mDefaultDisplay.getDisplayId(), 200, SOURCE_TOUCHSCREEN, true)).isFalse();
        verify(mInputWakeUpDelegate, never()).wakeUpFromMotion(anyLong(), anyInt(), anyBoolean());
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testTheaterModeChecksNotAppliedWhenScreenIsOn() {
        mSetFlagsRule.enableFlags(FLAG_SUPPORT_INPUT_WAKEUP_DELEGATE);
        setDefaultDisplayState(Display.STATE_ON);
@@ -213,30 +226,69 @@ public final class WindowWakeUpPolicyTests {
        setBooleanRes(config_allowTheaterModeWakeFromMotion, false);
        mPolicy = new WindowWakeUpPolicy(mContextSpy, mClock);

        mPolicy.wakeUpFromMotion(200L, SOURCE_TOUCHSCREEN, true);
        mPolicy.wakeUpFromMotion(mDefaultDisplay.getDisplayId(), 200L, SOURCE_TOUCHSCREEN, true);

        verify(mPowerManager).wakeUp(200L, WAKE_REASON_WAKE_MOTION, "android.policy:MOTION");
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testWakeUpFromMotion() {
        runPowerManagerUpChecks(
                () -> mPolicy.wakeUpFromMotion(mClock.uptimeMillis(), SOURCE_TOUCHSCREEN, true),
                () -> mPolicy.wakeUpFromMotion(mDefaultDisplay.getDisplayId(),
                        mClock.uptimeMillis(), SOURCE_TOUCHSCREEN, true),
                config_allowTheaterModeWakeFromMotion,
                WAKE_REASON_WAKE_MOTION,
                "android.policy:MOTION");
    }

    @Test
    @EnableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testWakeUpFromMotion_perDisplayWakeByTouchEnabled() {
        setTheaterModeEnabled(false);
        final int displayId = 555;
        mPolicy = new WindowWakeUpPolicy(mContextSpy, mClock);

        boolean displayWokeUp = mPolicy.wakeUpFromMotion(
                displayId, mClock.uptimeMillis(), SOURCE_TOUCHSCREEN, /* isDown= */ true);

        // Verify that display is woken up
        assertThat(displayWokeUp).isTrue();
        verify(mPowerManager).wakeUp(anyLong(), eq(WAKE_REASON_WAKE_MOTION),
                eq("android.policy:MOTION"), eq(displayId));
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testWakeUpFromMotion_perDisplayWakeByTouchDisabled() {
        setTheaterModeEnabled(false);
        final int displayId = 555;
        mPolicy = new WindowWakeUpPolicy(mContextSpy, mClock);

        boolean displayWokeUp = mPolicy.wakeUpFromMotion(
                displayId, mClock.uptimeMillis(), SOURCE_TOUCHSCREEN, /* isDown= */ true);

        // Verify that power is woken up and display isn't woken up individually
        assertThat(displayWokeUp).isTrue();
        verify(mPowerManager).wakeUp(
                anyLong(), eq(WAKE_REASON_WAKE_MOTION), eq("android.policy:MOTION"));
        verify(mPowerManager, never()).wakeUp(anyLong(), eq(WAKE_REASON_WAKE_MOTION),
                eq("android.policy:MOTION"), eq(displayId));
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testWakeUpFromKey_nonPowerKey() {
        runPowerManagerUpChecks(
                () -> mPolicy.wakeUpFromKey(mClock.uptimeMillis(), KEYCODE_HOME, true),
                () -> mPolicy.wakeUpFromKey(
                        mDefaultDisplay.getDisplayId(), mClock.uptimeMillis(), KEYCODE_HOME, true),
                config_allowTheaterModeWakeFromKey,
                WAKE_REASON_WAKE_KEY,
                "android.policy:KEY");
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testWakeUpFromKey_powerKey() {
        // Disable the resource affecting all wake keys because it affects power key as well.
        // That way, power key wake during theater mode will solely be controlled by
@@ -245,7 +297,8 @@ public final class WindowWakeUpPolicyTests {

        // Test with power key
        runPowerManagerUpChecks(
                () -> mPolicy.wakeUpFromKey(mClock.uptimeMillis(), KEYCODE_POWER, true),
                () -> mPolicy.wakeUpFromKey(
                        mDefaultDisplay.getDisplayId(), mClock.uptimeMillis(), KEYCODE_POWER, true),
                config_allowTheaterModeWakeFromPowerKey,
                WAKE_REASON_POWER_BUTTON,
                "android.policy:POWER");
@@ -254,13 +307,15 @@ public final class WindowWakeUpPolicyTests {
        // even if the power-key specific theater mode config is disabled.
        setBooleanRes(config_allowTheaterModeWakeFromPowerKey, false);
        runPowerManagerUpChecks(
                () -> mPolicy.wakeUpFromKey(mClock.uptimeMillis(), KEYCODE_POWER, false),
                () -> mPolicy.wakeUpFromKey(mDefaultDisplay.getDisplayId(), mClock.uptimeMillis(),
                        KEYCODE_POWER, false),
                config_allowTheaterModeWakeFromKey,
                WAKE_REASON_POWER_BUTTON,
                "android.policy:POWER");
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testWakeUpFromLid() {
        runPowerManagerUpChecks(
                () -> mPolicy.wakeUpFromLid(),
@@ -270,6 +325,7 @@ public final class WindowWakeUpPolicyTests {
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testWakeUpFromWakeGesture() {
        runPowerManagerUpChecks(
                () -> mPolicy.wakeUpFromWakeGesture(),
@@ -279,6 +335,7 @@ public final class WindowWakeUpPolicyTests {
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testwakeUpFromCameraCover() {
        runPowerManagerUpChecks(
                () -> mPolicy.wakeUpFromCameraCover(mClock.uptimeMillis()),
@@ -288,6 +345,7 @@ public final class WindowWakeUpPolicyTests {
    }

    @Test
    @DisableFlags({FLAG_PER_DISPLAY_WAKE_BY_TOUCH})
    public void testWakeUpFromPowerKeyCameraGesture() {
        // Disable the resource affecting all wake keys because it affects power key as well.
        // That way, power key wake during theater mode will solely be controlled by
@@ -295,7 +353,7 @@ public final class WindowWakeUpPolicyTests {
        setBooleanRes(config_allowTheaterModeWakeFromKey, false);

        runPowerManagerUpChecks(
                () -> mPolicy.wakeUpFromPowerKeyCameraGesture(),
                () -> mPolicy.wakeUpFromPowerKeyCameraGesture(mDefaultDisplay.getDisplayId()),
                config_allowTheaterModeWakeFromPowerKey,
                WAKE_REASON_CAMERA_LAUNCH,
                "android.policy:CAMERA_GESTURE_PREVENT_LOCK");