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

Commit c1c3ab17 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't ignore gestures on pulsing." into sc-dev

parents faf3969c 8e188424
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));
    }
}