diff options
author | Dave Mankoff <mankoff@google.com> | 2019-10-15 11:39:52 -0400 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-03-20 12:54:20 +0000 |
commit | 842db9303ee169d9dab1c2435894cd9284e27e04 (patch) | |
tree | 1449bd1e13c8ec12e1d3a51d9bc5c38711ac97b7 | |
parent | bccc1232c5d875a7191724cd3443015edfc75658 (diff) | |
download | base-842db9303ee169d9dab1c2435894cd9284e27e04.tar.gz |
Allow two finger swipes down.
Bug: 140715042
Test: atest SystemUITests
Change-Id: Iebfec76045897818cec89f588ebd1d72a782c942
(cherry picked from commit 70db873eeaf11f8e5f882bbbac7f605badb45a92)
3 files changed, 30 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/brightline/PointerCountClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/brightline/PointerCountClassifier.java index 40e141fbf988..6f9e12061974 100644 --- a/packages/SystemUI/src/com/android/systemui/classifier/brightline/PointerCountClassifier.java +++ b/packages/SystemUI/src/com/android/systemui/classifier/brightline/PointerCountClassifier.java @@ -16,6 +16,9 @@ package com.android.systemui.classifier.brightline; +import static com.android.systemui.classifier.Classifier.NOTIFICATION_DRAG_DOWN; +import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS; + import android.view.MotionEvent; /** @@ -27,6 +30,7 @@ import android.view.MotionEvent; class PointerCountClassifier extends FalsingClassifier { private static final int MAX_ALLOWED_POINTERS = 1; + private static final int MAX_ALLOWED_POINTERS_SWIPE_DOWN = 2; private int mMaxPointerCount; PointerCountClassifier(FalsingDataProvider dataProvider) { @@ -48,6 +52,10 @@ class PointerCountClassifier extends FalsingClassifier { @Override public boolean isFalseTouch() { + int interactionType = getInteractionType(); + if (interactionType == QUICK_SETTINGS || interactionType == NOTIFICATION_DRAG_DOWN) { + return mMaxPointerCount > MAX_ALLOWED_POINTERS_SWIPE_DOWN; + } return mMaxPointerCount > MAX_ALLOWED_POINTERS; } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/ClassifierTest.java b/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/ClassifierTest.java index d011e486d2e0..3ba5d1ac79ea 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/ClassifierTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/ClassifierTest.java @@ -16,6 +16,8 @@ package com.android.systemui.classifier.brightline; +import static com.android.systemui.classifier.Classifier.UNLOCK; + import android.util.DisplayMetrics; import android.view.MotionEvent; @@ -42,6 +44,7 @@ public class ClassifierTest extends SysuiTestCase { displayMetrics.widthPixels = 1000; displayMetrics.heightPixels = 1000; mDataProvider = new FalsingDataProvider(displayMetrics); + mDataProvider.setInteractionType(UNLOCK); } @After diff --git a/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/PointerCountClassifierTest.java b/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/PointerCountClassifierTest.java index 341b74b33784..96b2028da326 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/PointerCountClassifierTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/PointerCountClassifierTest.java @@ -16,6 +16,8 @@ package com.android.systemui.classifier.brightline; +import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS; + import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @@ -74,4 +76,21 @@ public class PointerCountClassifierTest extends ClassifierTest { motionEvent.recycle(); assertThat(mClassifier.isFalseTouch(), is(true)); } + + @Test + public void testPass_multiPointerDragDown() { + MotionEvent.PointerProperties[] pointerProperties = + MotionEvent.PointerProperties.createArray(2); + pointerProperties[0].id = 0; + pointerProperties[1].id = 1; + MotionEvent.PointerCoords[] pointerCoords = MotionEvent.PointerCoords.createArray(2); + MotionEvent motionEvent = MotionEvent.obtain( + 1, 1, MotionEvent.ACTION_DOWN, 2, pointerProperties, pointerCoords, 0, 0, 0, 0, 0, + 0, + 0, 0); + mClassifier.onTouchEvent(motionEvent); + motionEvent.recycle(); + getDataProvider().setInteractionType(QUICK_SETTINGS); + assertThat(mClassifier.isFalseTouch(), is(false)); + } } |