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

Commit 8e188424 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Don't ignore gestures on pulsing.

When a notifiction hun's/pulses, the screen ist still considered to
be dozing. Before this change we were ignoring all gestuers while
dozing. With this change, we no longer ignore gestures if #isDozing
returns true.

Fixes: 187833497
Test: manual && atest SystemUITests
Change-Id: Ifec028da330e9f6d4be997313bbbd93fd4d466ea
parent 6eb35894
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -257,7 +257,9 @@ class FalsingCollectorImpl implements FalsingCollector {

    @Override
    public void onTouchEvent(MotionEvent ev) {
        if (!mKeyguardStateController.isShowing() || mStatusBarStateController.isDozing()) {
        if (!mKeyguardStateController.isShowing()
                || (mStatusBarStateController.isDozing()
                    && !mStatusBarStateController.isPulsing())) {
            avoidGesture();
            return;
        }
+19 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@@ -185,7 +186,7 @@ public class FalsingCollectorImplTest extends SysuiTestCase {
    }

    @Test
    public void testAvoidDozing() {
    public void testAvoidDozingNotPulsing() {
        MotionEvent down = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0, 0, 0);
        MotionEvent up = MotionEvent.obtain(0, 0, MotionEvent.ACTION_UP, 0, 0, 0);

@@ -199,4 +200,21 @@ public class FalsingCollectorImplTest extends SysuiTestCase {
        mFalsingCollector.onTouchEvent(up);
        verify(mFalsingDataProvider, never()).onMotionEvent(any(MotionEvent.class));
    }

    @Test
    public void testAvoidDozingButPulsing() {
        MotionEvent down = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0, 0, 0);
        MotionEvent up = MotionEvent.obtain(0, 0, MotionEvent.ACTION_UP, 0, 0, 0);

        when(mStatusBarStateController.isDozing()).thenReturn(true);
        when(mStatusBarStateController.isPulsing()).thenReturn(true);

        // Nothing passed initially
        mFalsingCollector.onTouchEvent(down);
        verify(mFalsingDataProvider, never()).onMotionEvent(any(MotionEvent.class));

        // Up event would flushes
        mFalsingCollector.onTouchEvent(up);
        verify(mFalsingDataProvider, times(2)).onMotionEvent(any(MotionEvent.class));
    }
}