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

Skip to content
Commit 22bbefcc authored by Charles Wang's avatar Charles Wang
Browse files

Allow focused window to capture power button - try 3.

This is a combination of ag/30154729 + ag/30763741, which was originally
reverted due to b/382133936 (SysUI PowerMenuTest failing).

The tests are passing in combination with ag/30850517. ABTD results:
https://android-build.corp.google.com/abtd/run/L66200030008426443/
https://android-build.corp.google.com/abtd/run/L94300030008415110/

With this feature enabled, focused windows with the
OVERRIDE_SYSTEM_KEY_BEHAVIOR_IN_FOCUSED_WINDOW permission and the window
flag INPUT_FEATURE_RECEIVE_POWER_KEY_DOUBLE_PRESS set will receive KEYCODE_POWER KeyEvents.

The window can override the double-tap gesture default behavior (launching
camera) by handling the second onKeyDown event of a double tap. If the
app does not handle this event, or if the windw does not have the
permissions to receive KEYCODE_POWER, the default behavior of launching
camera is performed.

A double tap is defined as two consecutive KEYCODE_POWER key down events
within a 300 ms threshold.

Single, long-press and non double-press gestures behaviors will all be
default behavior, regardless of app handling the events or not.

Turning display on and off is unaffected, with the following exception:
In a privileged, focused window that doesn't handle the KEYCODE_POWER
event, there will be a 300 ms delay in turning off the screen.

More details at go/power-button-dd.

Bug: 357144512
Test: atest WmTests:PowerKeyGestureTests
Test: manual testing (single, long-press, double-press, 5x press of
power button on non-privileged windows and privileged windows that
handle and don't handle the KEYCODE_POWER KeyEvent.)
Flag: com.android.hardware.input.override_power_key_behavior_in_focused_window

Change-Id: Ieb09581ccae1b0b4d536e8f8105c7d24f5e8a40d
parent 399ee78c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment