Merge "Exception if receive move withouth down" into rvc-dev am: 46c51b716d

Original change: undetermined

Change-Id: I182305111785a8ecc5e830598c0b939dbbd0fc18
This commit is contained in:
TreeHugger Robot
2020-06-02 17:53:00 +00:00
committed by Automerger Merge Worker

View File

@@ -288,6 +288,11 @@ public class GestureDetector {
*/
private VelocityTracker mVelocityTracker;
/**
* True if the detector can throw exception when touch steam is unexpected .
*/
private boolean mExceptionForTouchStream;
/**
* Consistency verifier for debugging purposes.
*/
@@ -467,6 +472,8 @@ public class GestureDetector {
mTouchSlopSquare = touchSlop * touchSlop;
mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;
mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
mExceptionForTouchStream = context != null
&& context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R;
}
/**
@@ -639,6 +646,13 @@ public class GestureDetector {
break;
case MotionEvent.ACTION_MOVE:
if (mExceptionForTouchStream && !mStillDown) {
throw new IllegalStateException("Incomplete event stream received: "
+ "Received ACTION_MOVE before ACTION_DOWN. ACTION_DOWN must precede "
+ "ACTION_MOVE following ACTION_UP or ACTION_CANCEL, or when this "
+ "GestureDetector has not yet received any events.");
}
if (mInLongPress || mInContextClick) {
break;
}