diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-04-19 19:10:46 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-04-19 19:10:46 +0000 |
commit | 85a99c394b8fac30a99c7316a4e1e8f6070bd67c (patch) | |
tree | 968e2ea2511207fcff67c29626ade1e63f84816c | |
parent | cc9e2873dfaacc649956c21b5fd2e8d6dc9b43cb (diff) | |
parent | f89d8571b80829495fa93a2ebf39030d272e91bd (diff) |
Merge "Suppress singletap wakeup gesture while pulsing on dock" into qt-dev
3 files changed, 32 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index a381bbc47657..3f33ba633d77 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -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); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index 28db28c7a845..44996acafc63 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -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; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java index 43bc21b1943f..fb16465d3486 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java @@ -681,6 +681,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); assertFalse(mStatusBar.isFullScreenUserSwitcherState()); |