From 5ea4cc204fd422a608e4296edb28d6401b6790b9 Mon Sep 17 00:00:00 2001 From: Yeabkal Wubshit Date: Fri, 16 Jun 2023 23:25:40 -0700 Subject: [PATCH] Fix PowerKeyGestureTests#testPowerSinglePress In ag/23249820, we moved the code to fetch power key behaviors from PhoneWindowManager#init to PhoneWindowManager#updateSettings. Since the PowerKeyGestureTests mocks out the updateSettings method, the key behaviors were not being read properly. This CL fixes the issue by explicitly setting the power button short press behavior (which used to be implicitly assumed in the specific test case). Bug: 287561423 Test: atest com.android.server.policy.PowerKeyGestureTests#testPowerSinglePress Change-Id: I446efafb5695d8fc76aa75d2338d8862e538cb01 --- .../src/com/android/server/policy/PowerKeyGestureTests.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/tests/wmtests/src/com/android/server/policy/PowerKeyGestureTests.java b/services/tests/wmtests/src/com/android/server/policy/PowerKeyGestureTests.java index 6a9f283c9c4c4..c3b784995231c 100644 --- a/services/tests/wmtests/src/com/android/server/policy/PowerKeyGestureTests.java +++ b/services/tests/wmtests/src/com/android/server/policy/PowerKeyGestureTests.java @@ -21,6 +21,7 @@ import static android.view.KeyEvent.KEYCODE_VOLUME_UP; import static com.android.server.policy.PhoneWindowManager.LONG_PRESS_POWER_ASSISTANT; import static com.android.server.policy.PhoneWindowManager.LONG_PRESS_POWER_GLOBAL_ACTIONS; import static com.android.server.policy.PhoneWindowManager.SHORT_PRESS_POWER_DREAM_OR_SLEEP; +import static com.android.server.policy.PhoneWindowManager.SHORT_PRESS_POWER_GO_TO_SLEEP; import android.provider.Settings; import android.view.Display; @@ -39,6 +40,7 @@ public class PowerKeyGestureTests extends ShortcutKeyTestBase { */ @Test public void testPowerSinglePress() { + mPhoneWindowManager.overrideShortPressOnPower(SHORT_PRESS_POWER_GO_TO_SLEEP); sendKey(KEYCODE_POWER); mPhoneWindowManager.assertPowerSleep();