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

Commit f89d8571 authored by Jerry Chang's avatar Jerry Chang
Browse files

Suppress singletap wakeup gesture while pulsing on dock

Fix: 129788726
Test: atest SystemUITests
Test: manual
Change-Id: I6a147ea2dce542eb578a29338f437fb58b8490ee
parent 3da53d52
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);
                }

+6 −1
Original line number Diff line number Diff line
@@ -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;
+19 −0
Original line number Diff line number Diff line
@@ -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);