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

This commit is contained in:
TreeHugger Robot
2021-05-18 20:07:17 +00:00
committed by Android (Google) Code Review
2 changed files with 22 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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));
}
}