diff options
| author | 2020-03-18 20:24:54 +0000 | |
|---|---|---|
| committer | 2020-03-18 20:24:54 +0000 | |
| commit | 964b61262c896774ddb0563fe1c6397b4f9d691d (patch) | |
| tree | 2d9903226b9efaf6a6509a7d2468f4e1e2a1da21 | |
| parent | 5e52236bcc3b3b300b348a80e82936509bceee95 (diff) | |
| parent | 70db873eeaf11f8e5f882bbbac7f605badb45a92 (diff) | |
Merge "Allow two finger swipes down." into qt-qpr1-dev
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)); + } } |