Merge "Don't ignore gestures on pulsing." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c1c3ab17ea
@@ -257,7 +257,9 @@ class FalsingCollectorImpl implements FalsingCollector {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTouchEvent(MotionEvent ev) {
|
public void onTouchEvent(MotionEvent ev) {
|
||||||
if (!mKeyguardStateController.isShowing() || mStatusBarStateController.isDozing()) {
|
if (!mKeyguardStateController.isShowing()
|
||||||
|
|| (mStatusBarStateController.isDozing()
|
||||||
|
&& !mStatusBarStateController.isPulsing())) {
|
||||||
avoidGesture();
|
avoidGesture();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static org.mockito.ArgumentMatchers.argThat;
|
|||||||
import static org.mockito.Mockito.inOrder;
|
import static org.mockito.Mockito.inOrder;
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.reset;
|
import static org.mockito.Mockito.reset;
|
||||||
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ public class FalsingCollectorImplTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvoidDozing() {
|
public void testAvoidDozingNotPulsing() {
|
||||||
MotionEvent down = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0, 0, 0);
|
MotionEvent down = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0, 0, 0);
|
||||||
MotionEvent up = MotionEvent.obtain(0, 0, MotionEvent.ACTION_UP, 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);
|
mFalsingCollector.onTouchEvent(up);
|
||||||
verify(mFalsingDataProvider, never()).onMotionEvent(any(MotionEvent.class));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user