Merge "Allow two finger swipes down."
This commit is contained in:
committed by
Android (Google) Code Review
commit
8357dd73ae
@@ -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;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -29,6 +32,7 @@ import java.util.Locale;
|
||||
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) {
|
||||
@@ -50,6 +54,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user