[DO NOT MERGE] Fix hardly to perform 3-finger swipe from the bottom
We accidentky checked invalid pointers down position. In stead of checking all pointers, we check the pointer ids from the motion event. Bug: 165576902 Test: manually test atest TouchExplorerTest Change-Id: Id530bf4b760351215726b2afd781433b590f57ce
This commit is contained in:
@@ -622,18 +622,9 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
if (mGestureDetector.isMultiFingerGesturesEnabled()) {
|
||||
if (mGestureDetector.isTwoFingerPassthroughEnabled()) {
|
||||
if (event.getPointerCount() == 3) {
|
||||
boolean isOnBottomEdge = true;
|
||||
// If three fingers went down on the bottom edge of the screen, delegate
|
||||
// immediately.
|
||||
final long screenHeight =
|
||||
mContext.getResources().getDisplayMetrics().heightPixels;
|
||||
for (int i = 0; i < TouchState.MAX_POINTER_COUNT; ++i) {
|
||||
if (mReceivedPointerTracker.getReceivedPointerDownY(i)
|
||||
< (screenHeight - mEdgeSwipeHeightPixels)) {
|
||||
isOnBottomEdge = false;
|
||||
}
|
||||
}
|
||||
if (isOnBottomEdge) {
|
||||
if (allPointersDownOnBottomEdge(event)) {
|
||||
if (DEBUG) {
|
||||
Slog.d(LOG_TAG, "Three-finger edge swipe detected.");
|
||||
}
|
||||
@@ -1050,6 +1041,22 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
return downEvent;
|
||||
}
|
||||
|
||||
private boolean allPointersDownOnBottomEdge(MotionEvent event) {
|
||||
final long screenHeight =
|
||||
mContext.getResources().getDisplayMetrics().heightPixels;
|
||||
for (int i = 0; i < event.getPointerCount(); ++i) {
|
||||
final int pointerId = event.getPointerId(i);
|
||||
final float pointerDownY = mReceivedPointerTracker.getReceivedPointerDownY(pointerId);
|
||||
if (pointerDownY < (screenHeight - mEdgeSwipeHeightPixels)) {
|
||||
if (DEBUG) {
|
||||
Slog.d(LOG_TAG, "The pointer is not on the bottom edge" + pointerDownY);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public TouchState getState() {
|
||||
return mState;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user