Suppress singletap wakeup gesture while pulsing on dock

Fix: 129788726
Test: atest SystemUITests
Test: manual
Change-Id: I6a147ea2dce542eb578a29338f437fb58b8490ee
This commit is contained in:
Jerry Chang
2019-04-18 11:09:13 +08:00
parent 3da53d5297
commit f89d8571b8
3 changed files with 32 additions and 1 deletions

View File

@@ -3926,6 +3926,10 @@ public class StatusBar extends SystemUI implements DemoMode,
mScrimController.setWakeLockScreenSensorActive(true);
}
if (reason == DozeLog.PULSE_REASON_DOCKING && mStatusBarWindow != null) {
mStatusBarWindow.suppressWakeUpGesture(true);
}
boolean passiveAuthInterrupt = reason == DozeLog.PULSE_REASON_NOTIFICATION;
// Set the state to pulsing, so ScrimController will know what to do once we ask it to
// execute the transition. The pulse callback will then be invoked when the scrims
@@ -3945,6 +3949,9 @@ public class StatusBar extends SystemUI implements DemoMode,
callback.onPulseFinished();
updateNotificationPanelTouchState();
mScrimController.setWakeLockScreenSensorActive(false);
if (mStatusBarWindow != null) {
mStatusBarWindow.suppressWakeUpGesture(false);
}
setPulsing(false);
}

View File

@@ -107,12 +107,13 @@ public class StatusBarWindowView extends FrameLayout {
private boolean mTouchActive;
private boolean mExpandAnimationRunning;
private boolean mExpandAnimationPending;
private boolean mSuppressingWakeUpGesture;
private final GestureDetector.SimpleOnGestureListener mGestureListener =
new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
if (mSingleTapEnabled) {
if (mSingleTapEnabled && !mSuppressingWakeUpGesture) {
mService.wakeUpIfDozing(SystemClock.uptimeMillis(), StatusBarWindowView.this,
"SINGLE_TAP");
return true;
@@ -327,6 +328,10 @@ public class StatusBarWindowView extends FrameLayout {
mTouchActive = touchActive;
}
void suppressWakeUpGesture(boolean suppress) {
mSuppressingWakeUpGesture = suppress;
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
boolean isDown = ev.getActionMasked() == MotionEvent.ACTION_DOWN;

View File

@@ -680,6 +680,25 @@ public class StatusBarTest extends SysuiTestCase {
}
}
@Test
public void testPulseWhileDozingWithDockingReason_suppressWakeUpGesture() {
// Keep track of callback to be able to stop the pulse
final DozeHost.PulseCallback[] pulseCallback = new DozeHost.PulseCallback[1];
doAnswer(invocation -> {
pulseCallback[0] = invocation.getArgument(0);
return null;
}).when(mDozeScrimController).pulse(any(), anyInt());
// Starting a pulse while docking should suppress wakeup gesture
mStatusBar.mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class),
DozeLog.PULSE_REASON_DOCKING);
verify(mStatusBarWindowView).suppressWakeUpGesture(eq(true));
// Ending a pulse should restore wakeup gesture
pulseCallback[0].onPulseFinished();
verify(mStatusBarWindowView).suppressWakeUpGesture(eq(false));
}
@Test
public void testSetState_changesIsFullScreenUserSwitcherState() {
mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);