Fixes failing PowerMenuTest.
mSingleKeyGestureDetector.interceptKey() for long press power events is skipped. Long presses can be triggered for SingleKeyRules as follows: 1. If key down is sent and no following onKeyUp is sent within longPressTimeoutMs, SingleKeyRule.onLongPress() is triggered. 2. An explicit onKeyDown with flag LONG_PRESS event is injected into the system, which is called by mSingleKeyGestureDetector.interceptKey(), which triggers SingleKeyRule.onLongPress(). When testing manually, long presses are triggered only via the 1st mechanism. However, when using "adb shell input --keyevent", both mechanisms are triggered (since the method inserts an explicit LONG_PRESS KeyEvent), which results in two long presses being triggered, which is why the test is failing. This test only allows for the 1st mechanism (which is how events are triggered on-device when not using adb). Bug: 382133936 Test: Manual test (1x, 2x, 5x, long-press of power button in captured and non-capturable windows). Test: atest PowerKeyGestureTests && atest GestureLauncherServiceTest Test: atest PowerMenuTest && atest PowerMenuButtonTest Flag: com.android.hardware.input.override_power_key_behavior_in_focused_window Change-Id: I41b894ad562cf4aba7d863d7abb5c63aec3cc12f
Loading
Please register or sign in to comment