Power button press behavior should account for default display state
When pressing the power button to control default display on or not, the interactive state would be checked when key down. While user is streaming to another device in a multi-displays enviroment, the default display may be turned off and cause the gesture detector check the wrong state. To correct this, we should account whether the default display is turned on or not. This allows for correct behavior when power key pressed. Bug: 184694398 Test: manual - toggle on and off screen with power button in multi-displays. Test: manual - trigger camera with power button double press Change-Id: Ia1fc97fe89f01df832010b7d5a04b2002ddc6fea
This commit is contained in:
@@ -3408,8 +3408,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
return interceptKeyBeforeQueueing(event, policyFlags);
|
||||
}
|
||||
|
||||
// This could prevent some wrong state in multi-displays environment,
|
||||
// the default display may turned off but interactive is true.
|
||||
final boolean isDefaultDisplayOn = Display.isOnState(mDefaultDisplay.getState());
|
||||
final boolean interactiveAndOn = interactive && isDefaultDisplayOn;
|
||||
if ((event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) {
|
||||
handleKeyGesture(event, interactive);
|
||||
handleKeyGesture(event, interactiveAndOn);
|
||||
}
|
||||
|
||||
// Enable haptics if down and virtual key without multiple repetitions. If this is a hard
|
||||
@@ -3556,8 +3560,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
// Any activity on the power button stops the accessibility shortcut
|
||||
result &= ~ACTION_PASS_TO_USER;
|
||||
isWakeKey = false; // wake-up will be handled separately
|
||||
final boolean isDefaultDisplayOn = Display.isOnState(mDefaultDisplay.getState());
|
||||
final boolean interactiveAndOn = interactive && isDefaultDisplayOn;
|
||||
if (down) {
|
||||
interceptPowerKeyDown(event, interactiveAndOn);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user