Reduce falsing on swipe down for notification shade.

b/116879058

Change-Id: If3dde635cdff09faf27dbab2cd022b9d246c7c2b
This commit is contained in:
Hyunyoung Song 2018-10-01 10:02:45 -07:00
parent ff2d0d0a9e
commit be2307bbea
2 changed files with 11 additions and 5 deletions

View File

@ -84,7 +84,8 @@ public class StatusBarTouchController implements TouchController {
}
if (action == ACTION_MOVE) {
float dy = ev.getY() - mTranslator.getDownY();
if (dy > mTouchSlop) {
float dx = ev.getX() - mTranslator.getDownX();
if (dy > mTouchSlop && dy > Math.abs(dx)) {
mTranslator.dispatchDownEvents(ev);
mTranslator.processMotionEvent(ev);
return true;

View File

@ -19,7 +19,6 @@ import android.graphics.PointF;
import android.util.Log;
import android.util.Pair;
import android.util.SparseArray;
import android.util.SparseLongArray;
import android.view.MotionEvent;
import android.view.MotionEvent.PointerCoords;
import android.view.MotionEvent.PointerProperties;
@ -37,13 +36,15 @@ public class TouchEventTranslator {
private class DownState {
long timeStamp;
float downX;
float downY;
public DownState(long timeStamp, float downY) {
public DownState(long timeStamp, float downX, float downY) {
this.timeStamp = timeStamp;
this.downX = downX;
this.downY = downY;
}
};
private final DownState ZERO = new DownState(0, 0f);
private final DownState ZERO = new DownState(0, 0f, 0f);
private final Consumer<MotionEvent> mListener;
@ -65,12 +66,16 @@ public class TouchEventTranslator {
mFingers.clear();
}
public float getDownX() {
return mDownEvents.get(0).downX;
}
public float getDownY() {
return mDownEvents.get(0).downY;
}
public void setDownParameters(int idx, MotionEvent e) {
DownState ev = new DownState(e.getEventTime(), e.getY(idx));
DownState ev = new DownState(e.getEventTime(), e.getX(idx), e.getY(idx));
mDownEvents.append(idx, ev);
}