Loading core/java/android/view/GestureDetector.java +23 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import static android.os.StrictMode.vmIncorrectContextUseEnabled; import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DEEP_PRESS; import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DOUBLE_TAP; import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__LONG_PRESS; Loading @@ -26,9 +28,12 @@ import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFI import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.StrictMode; import android.os.SystemClock; import android.util.Log; import com.android.internal.util.FrameworkStatsLog; Loading Loading @@ -228,6 +233,7 @@ public class GestureDetector { } } private static final String TAG = GestureDetector.class.getSimpleName(); @UnsupportedAppUsage private int mTouchSlopSquare; private int mDoubleTapTouchSlopSquare; Loading Loading @@ -378,7 +384,8 @@ public class GestureDetector { * You may only use this constructor from a {@link android.os.Looper} thread. * @see android.os.Handler#Handler() * * @param context the application's context * @param context An {@link android.app.Activity} or a {@link Context} created from * {@link Context#createWindowContext(int, Bundle)} * @param listener the listener invoked for all the callbacks, this must * not be null. If the listener implements the {@link OnDoubleTapListener} or * {@link OnContextClickListener} then it will also be set as the listener for Loading @@ -395,7 +402,8 @@ public class GestureDetector { * thread associated with the supplied {@link android.os.Handler}. * @see android.os.Handler#Handler() * * @param context the application's context * @param context An {@link android.app.Activity} or a {@link Context} created from * {@link Context#createWindowContext(int, Bundle)} * @param listener the listener invoked for all the callbacks, this must * not be null. If the listener implements the {@link OnDoubleTapListener} or * {@link OnContextClickListener} then it will also be set as the listener for Loading Loading @@ -425,7 +433,8 @@ public class GestureDetector { * thread associated with the supplied {@link android.os.Handler}. * @see android.os.Handler#Handler() * * @param context the application's context * @param context An {@link android.app.Activity} or a {@link Context} created from * {@link Context#createWindowContext(int, Bundle)} * @param listener the listener invoked for all the callbacks, this must * not be null. * @param handler the handler to use for running deferred listener events. Loading Loading @@ -456,6 +465,17 @@ public class GestureDetector { mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity(); mAmbiguousGestureMultiplier = ViewConfiguration.getAmbiguousGestureMultiplier(); } else { if (!context.isUiContext() && vmIncorrectContextUseEnabled()) { final String errorMessage = "Tried to access UI constants from a non-visual Context."; final String message = "GestureDetector must be accessed from Activity or other " + "visual Context. Use an Activity or a Context created with " + "Context#createWindowContext(int, Bundle), which are adjusted to the " + "configuration and visual bounds of an area on screen."; final Exception exception = new IllegalArgumentException(errorMessage); StrictMode.onIncorrectContextUsed(message, exception); Log.e(TAG, errorMessage + message, exception); } final ViewConfiguration configuration = ViewConfiguration.get(context); touchSlop = configuration.getScaledTouchSlop(); doubleTapTouchSlop = configuration.getScaledDoubleTapTouchSlop(); Loading Loading
core/java/android/view/GestureDetector.java +23 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import static android.os.StrictMode.vmIncorrectContextUseEnabled; import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DEEP_PRESS; import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__DOUBLE_TAP; import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__LONG_PRESS; Loading @@ -26,9 +28,12 @@ import static com.android.internal.util.FrameworkStatsLog.TOUCH_GESTURE_CLASSIFI import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.StrictMode; import android.os.SystemClock; import android.util.Log; import com.android.internal.util.FrameworkStatsLog; Loading Loading @@ -228,6 +233,7 @@ public class GestureDetector { } } private static final String TAG = GestureDetector.class.getSimpleName(); @UnsupportedAppUsage private int mTouchSlopSquare; private int mDoubleTapTouchSlopSquare; Loading Loading @@ -378,7 +384,8 @@ public class GestureDetector { * You may only use this constructor from a {@link android.os.Looper} thread. * @see android.os.Handler#Handler() * * @param context the application's context * @param context An {@link android.app.Activity} or a {@link Context} created from * {@link Context#createWindowContext(int, Bundle)} * @param listener the listener invoked for all the callbacks, this must * not be null. If the listener implements the {@link OnDoubleTapListener} or * {@link OnContextClickListener} then it will also be set as the listener for Loading @@ -395,7 +402,8 @@ public class GestureDetector { * thread associated with the supplied {@link android.os.Handler}. * @see android.os.Handler#Handler() * * @param context the application's context * @param context An {@link android.app.Activity} or a {@link Context} created from * {@link Context#createWindowContext(int, Bundle)} * @param listener the listener invoked for all the callbacks, this must * not be null. If the listener implements the {@link OnDoubleTapListener} or * {@link OnContextClickListener} then it will also be set as the listener for Loading Loading @@ -425,7 +433,8 @@ public class GestureDetector { * thread associated with the supplied {@link android.os.Handler}. * @see android.os.Handler#Handler() * * @param context the application's context * @param context An {@link android.app.Activity} or a {@link Context} created from * {@link Context#createWindowContext(int, Bundle)} * @param listener the listener invoked for all the callbacks, this must * not be null. * @param handler the handler to use for running deferred listener events. Loading Loading @@ -456,6 +465,17 @@ public class GestureDetector { mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity(); mAmbiguousGestureMultiplier = ViewConfiguration.getAmbiguousGestureMultiplier(); } else { if (!context.isUiContext() && vmIncorrectContextUseEnabled()) { final String errorMessage = "Tried to access UI constants from a non-visual Context."; final String message = "GestureDetector must be accessed from Activity or other " + "visual Context. Use an Activity or a Context created with " + "Context#createWindowContext(int, Bundle), which are adjusted to the " + "configuration and visual bounds of an area on screen."; final Exception exception = new IllegalArgumentException(errorMessage); StrictMode.onIncorrectContextUsed(message, exception); Log.e(TAG, errorMessage + message, exception); } final ViewConfiguration configuration = ViewConfiguration.get(context); touchSlop = configuration.getScaledTouchSlop(); doubleTapTouchSlop = configuration.getScaledDoubleTapTouchSlop(); Loading