Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -51028,6 +51028,7 @@ package android.view { public class ViewConfiguration { ctor @Deprecated public ViewConfiguration(); method public static android.view.ViewConfiguration get(android.content.Context); method @FloatRange(from=1.0) public static float getAmbiguousGestureMultiplier(); method public static long getDefaultActionModeHideDuration(); method public static int getDoubleTapTimeout(); method @Deprecated public static int getEdgeSlop(); core/java/android/view/GestureDetector.java +4 −13 Original line number Diff line number Diff line Loading @@ -237,16 +237,6 @@ public class GestureDetector { private static final int LONG_PRESS = 2; private static final int TAP = 3; /** * If a MotionEvent has CLASSIFICATION_AMBIGUOUS_GESTURE set, then certain actions, such as * scrolling, will be inhibited. However, to account for the possibility of incorrect * classification, the default scrolling will only be inhibited if the gesture moves beyond * (default touch slop * AMBIGUOUS_GESTURE_MULTIPLIER). Likewise, the default long press * timeout will be increased for some situations where the default behaviour * is to cancel it. */ private static final int AMBIGUOUS_GESTURE_MULTIPLIER = 2; private final Handler mHandler; @UnsupportedAppUsage private final OnGestureListener mListener; Loading Loading @@ -636,6 +626,7 @@ public class GestureDetector { hasPendingLongPress && ambiguousGesture; if (shouldInhibitDefaultAction) { // Inhibit default long press final float multiplier = ViewConfiguration.getAmbiguousGestureMultiplier(); if (distance > slopSquare) { // The default action here is to remove long press. But if the touch // slop below gets increased, and we never exceed the modified touch Loading @@ -643,15 +634,15 @@ public class GestureDetector { // will happen in response to user input. To prevent this, // reschedule long press with a modified timeout. mHandler.removeMessages(LONG_PRESS); final int longPressTimeout = ViewConfiguration.getLongPressTimeout(); final long longPressTimeout = ViewConfiguration.getLongPressTimeout(); mHandler.sendEmptyMessageAtTime(LONG_PRESS, ev.getDownTime() + longPressTimeout * AMBIGUOUS_GESTURE_MULTIPLIER); + (long) (longPressTimeout * multiplier)); } // Inhibit default scroll. If a gesture is ambiguous, we prevent scroll // until the gesture is resolved. // However, for safety, simply increase the touch slop in case the // classification is erroneous. Since the value is squared, multiply twice. slopSquare *= AMBIGUOUS_GESTURE_MULTIPLIER * AMBIGUOUS_GESTURE_MULTIPLIER; slopSquare *= multiplier * multiplier; } if (distance > slopSquare) { Loading core/java/android/view/View.java +5 −12 Original line number Diff line number Diff line Loading @@ -3985,15 +3985,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public static final int SCROLL_AXIS_VERTICAL = 1 << 1; /** * If a MotionEvent has CLASSIFICATION_AMBIGUOUS_GESTURE set, then certain the default * long press action will be inhibited. However, to account for the possibility of incorrect * classification, the default long press timeout will instead be increased for some situations * by the following factor. * Likewise, the touch slop for allowing long press will be increased when gesture is uncertain. */ private static final int AMBIGUOUS_GESTURE_MULTIPLIER = 2; /** * Controls the over-scroll mode for this view. * See {@link #overScrollBy(int, int, int, int, int, int, int, int, boolean)}, Loading Loading @@ -14807,18 +14798,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback, motionClassification == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE; int touchSlop = mTouchSlop; if (ambiguousGesture && hasPendingLongPressCallback()) { final float ambiguousMultiplier = ViewConfiguration.getAmbiguousGestureMultiplier(); if (!pointInView(x, y, touchSlop)) { // The default action here is to cancel long press. But instead, we // just extend the timeout here, in case the classification // stays ambiguous. removeLongPressCallback(); long delay = ViewConfiguration.getLongPressTimeout() * AMBIGUOUS_GESTURE_MULTIPLIER; long delay = (long) (ViewConfiguration.getLongPressTimeout() * ambiguousMultiplier); // Subtract the time already spent delay -= event.getEventTime() - event.getDownTime(); checkForLongClick(delay, x, y); } touchSlop *= AMBIGUOUS_GESTURE_MULTIPLIER; touchSlop *= ambiguousMultiplier; } // Be lenient about moving outside of buttons core/java/android/view/ViewConfiguration.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.annotation.FloatRange; import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.app.AppGlobals; Loading Loading @@ -286,6 +287,11 @@ public class ViewConfiguration { private static final int HAS_PERMANENT_MENU_KEY_TRUE = 1; private static final int HAS_PERMANENT_MENU_KEY_FALSE = 2; /** * The multiplication factor for inhibiting default gestures. */ private static final float AMBIGUOUS_GESTURE_MULTIPLIER = 2f; private final int mEdgeSlop; private final int mFadingEdgeLength; private final int mMinimumFlingVelocity; Loading Loading @@ -910,6 +916,22 @@ public class ViewConfiguration { return ACTION_MODE_HIDE_DURATION_DEFAULT; } /** * If a MotionEvent has CLASSIFICATION_AMBIGUOUS_GESTURE set, then certain actions, such as * scrolling, will be inhibited. * However, to account for the possibility of incorrect classification, * the default scrolling will only be inhibited if the pointer travels less than * (getScaledTouchSlop() * this factor). * Likewise, the default long press timeout will be increased by this factor for some situations * where the default behaviour is to cancel it. * * @return The multiplication factor for inhibiting default gestures. */ @FloatRange(from = 1.0) public static float getAmbiguousGestureMultiplier() { return AMBIGUOUS_GESTURE_MULTIPLIER; } /** * Report if the device has a permanent menu key available to the user. * Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -51028,6 +51028,7 @@ package android.view { public class ViewConfiguration { ctor @Deprecated public ViewConfiguration(); method public static android.view.ViewConfiguration get(android.content.Context); method @FloatRange(from=1.0) public static float getAmbiguousGestureMultiplier(); method public static long getDefaultActionModeHideDuration(); method public static int getDoubleTapTimeout(); method @Deprecated public static int getEdgeSlop();
core/java/android/view/GestureDetector.java +4 −13 Original line number Diff line number Diff line Loading @@ -237,16 +237,6 @@ public class GestureDetector { private static final int LONG_PRESS = 2; private static final int TAP = 3; /** * If a MotionEvent has CLASSIFICATION_AMBIGUOUS_GESTURE set, then certain actions, such as * scrolling, will be inhibited. However, to account for the possibility of incorrect * classification, the default scrolling will only be inhibited if the gesture moves beyond * (default touch slop * AMBIGUOUS_GESTURE_MULTIPLIER). Likewise, the default long press * timeout will be increased for some situations where the default behaviour * is to cancel it. */ private static final int AMBIGUOUS_GESTURE_MULTIPLIER = 2; private final Handler mHandler; @UnsupportedAppUsage private final OnGestureListener mListener; Loading Loading @@ -636,6 +626,7 @@ public class GestureDetector { hasPendingLongPress && ambiguousGesture; if (shouldInhibitDefaultAction) { // Inhibit default long press final float multiplier = ViewConfiguration.getAmbiguousGestureMultiplier(); if (distance > slopSquare) { // The default action here is to remove long press. But if the touch // slop below gets increased, and we never exceed the modified touch Loading @@ -643,15 +634,15 @@ public class GestureDetector { // will happen in response to user input. To prevent this, // reschedule long press with a modified timeout. mHandler.removeMessages(LONG_PRESS); final int longPressTimeout = ViewConfiguration.getLongPressTimeout(); final long longPressTimeout = ViewConfiguration.getLongPressTimeout(); mHandler.sendEmptyMessageAtTime(LONG_PRESS, ev.getDownTime() + longPressTimeout * AMBIGUOUS_GESTURE_MULTIPLIER); + (long) (longPressTimeout * multiplier)); } // Inhibit default scroll. If a gesture is ambiguous, we prevent scroll // until the gesture is resolved. // However, for safety, simply increase the touch slop in case the // classification is erroneous. Since the value is squared, multiply twice. slopSquare *= AMBIGUOUS_GESTURE_MULTIPLIER * AMBIGUOUS_GESTURE_MULTIPLIER; slopSquare *= multiplier * multiplier; } if (distance > slopSquare) { Loading
core/java/android/view/View.java +5 −12 Original line number Diff line number Diff line Loading @@ -3985,15 +3985,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public static final int SCROLL_AXIS_VERTICAL = 1 << 1; /** * If a MotionEvent has CLASSIFICATION_AMBIGUOUS_GESTURE set, then certain the default * long press action will be inhibited. However, to account for the possibility of incorrect * classification, the default long press timeout will instead be increased for some situations * by the following factor. * Likewise, the touch slop for allowing long press will be increased when gesture is uncertain. */ private static final int AMBIGUOUS_GESTURE_MULTIPLIER = 2; /** * Controls the over-scroll mode for this view. * See {@link #overScrollBy(int, int, int, int, int, int, int, int, boolean)}, Loading Loading @@ -14807,18 +14798,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback, motionClassification == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE; int touchSlop = mTouchSlop; if (ambiguousGesture && hasPendingLongPressCallback()) { final float ambiguousMultiplier = ViewConfiguration.getAmbiguousGestureMultiplier(); if (!pointInView(x, y, touchSlop)) { // The default action here is to cancel long press. But instead, we // just extend the timeout here, in case the classification // stays ambiguous. removeLongPressCallback(); long delay = ViewConfiguration.getLongPressTimeout() * AMBIGUOUS_GESTURE_MULTIPLIER; long delay = (long) (ViewConfiguration.getLongPressTimeout() * ambiguousMultiplier); // Subtract the time already spent delay -= event.getEventTime() - event.getDownTime(); checkForLongClick(delay, x, y); } touchSlop *= AMBIGUOUS_GESTURE_MULTIPLIER; touchSlop *= ambiguousMultiplier; } // Be lenient about moving outside of buttons
core/java/android/view/ViewConfiguration.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.annotation.FloatRange; import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.app.AppGlobals; Loading Loading @@ -286,6 +287,11 @@ public class ViewConfiguration { private static final int HAS_PERMANENT_MENU_KEY_TRUE = 1; private static final int HAS_PERMANENT_MENU_KEY_FALSE = 2; /** * The multiplication factor for inhibiting default gestures. */ private static final float AMBIGUOUS_GESTURE_MULTIPLIER = 2f; private final int mEdgeSlop; private final int mFadingEdgeLength; private final int mMinimumFlingVelocity; Loading Loading @@ -910,6 +916,22 @@ public class ViewConfiguration { return ACTION_MODE_HIDE_DURATION_DEFAULT; } /** * If a MotionEvent has CLASSIFICATION_AMBIGUOUS_GESTURE set, then certain actions, such as * scrolling, will be inhibited. * However, to account for the possibility of incorrect classification, * the default scrolling will only be inhibited if the pointer travels less than * (getScaledTouchSlop() * this factor). * Likewise, the default long press timeout will be increased by this factor for some situations * where the default behaviour is to cancel it. * * @return The multiplication factor for inhibiting default gestures. */ @FloatRange(from = 1.0) public static float getAmbiguousGestureMultiplier() { return AMBIGUOUS_GESTURE_MULTIPLIER; } /** * Report if the device has a permanent menu key available to the user. * Loading