Keeps power key intercepted during a panic gesture

The GestureLauncherService is used to detect camera and sos emergency
gesture by multi-pressing power, if it intercept power key, we should
return the intercept state that could prevent the following detector
processing the power key cause unexpected single tap.

Bug: 194522413
Test: keep pressing power to see if screen would turn off.
Test: atest GestureLauncherServiceTest
Change-Id: I3db7390df720f24f9b312946b1d8e01d672e6ef3
This commit is contained in:
Arthur Hung
2021-07-26 15:48:42 +08:00
parent 8e31f85e02
commit 5fceebd597

View File

@@ -3844,9 +3844,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
mCameraGestureTriggered = false;
final MutableBoolean outLaunched = new MutableBoolean(false);
mGestureLauncherService.interceptPowerKeyDown(event, interactive, outLaunched);
final boolean intercept =
mGestureLauncherService.interceptPowerKeyDown(event, interactive, outLaunched);
if (!outLaunched.value) {
return false;
// If GestureLauncherService intercepted the power key, but didn't launch camera app,
// we should still return the intercept result. This prevents the single key gesture
// detector from processing the power key later on.
return intercept;
}
mCameraGestureTriggered = true;
if (mRequestedOrSleepingDefaultDisplay) {