Loading core/java/android/view/ScaleGestureDetector.java +25 −4 Original line number Diff line number Diff line Loading @@ -200,11 +200,32 @@ public class ScaleGestureDetector { */ public ScaleGestureDetector(@NonNull Context context, @NonNull OnScaleGestureListener listener, @Nullable Handler handler) { this(context, ViewConfiguration.get(context).getScaledTouchSlop() * 2, ViewConfiguration.get(context).getScaledMinimumScalingSpan(), handler, listener); } /** * Creates a ScaleGestureDetector with span slop and min span. * * @param context the application's context. * @param spanSlop the threshold for interpreting a touch movement as scaling. * @param minSpan the minimum threshold of scaling span. The span could be * overridden by other usages to specify a different scaling span, for instance, * if you need pinch gestures to continue closer together than the default. * @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. * * @throws NullPointerException if {@code listener} is null. * * @hide */ public ScaleGestureDetector(@NonNull Context context, @NonNull int spanSlop, @NonNull int minSpan, @Nullable Handler handler, @NonNull OnScaleGestureListener listener) { mContext = context; mListener = listener; final ViewConfiguration viewConfiguration = ViewConfiguration.get(context); mSpanSlop = viewConfiguration.getScaledTouchSlop() * 2; mMinSpan = viewConfiguration.getScaledMinimumScalingSpan(); mSpanSlop = spanSlop; mMinSpan = minSpan; mHandler = handler; // Quick scale is enabled by default after JB_MR2 final int targetSdkVersion = context.getApplicationInfo().targetSdkVersion; Loading services/accessibility/accessibility.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -34,3 +34,10 @@ flag { description: "Calls WMS.addWindowToken without holding A11yManagerService#mLock" bug: "297972548" } flag { name: "pinch_zoom_zero_min_span" namespace: "accessibility" description: "Whether to set min span of ScaleGestureDetector to zero." bug: "295327792" } No newline at end of file services/accessibility/java/com/android/server/accessibility/magnification/PanningScalingHandler.java +9 −1 Original line number Diff line number Diff line Loading @@ -28,8 +28,10 @@ import android.util.TypedValue; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.ViewConfiguration; import com.android.internal.R; import com.android.server.accessibility.Flags; /** * Handles the behavior while receiving scaling and panning gestures if it's enabled. Loading Loading @@ -70,7 +72,13 @@ class PanningScalingHandler extends mMaxScale = maxScale; mMinScale = minScale; mBlockScroll = blockScroll; if (Flags.pinchZoomZeroMinSpan()) { mScaleGestureDetector = new ScaleGestureDetector(context, ViewConfiguration.get(context).getScaledTouchSlop() * 2, /* minSpan= */ 0, Handler.getMain(), this); } else { mScaleGestureDetector = new ScaleGestureDetector(context, this, Handler.getMain()); } mScrollGestureDetector = new GestureDetector(context, this, Handler.getMain()); mScaleGestureDetector.setQuickScaleEnabled(false); mMagnificationDelegate = magnificationDelegate; Loading Loading
core/java/android/view/ScaleGestureDetector.java +25 −4 Original line number Diff line number Diff line Loading @@ -200,11 +200,32 @@ public class ScaleGestureDetector { */ public ScaleGestureDetector(@NonNull Context context, @NonNull OnScaleGestureListener listener, @Nullable Handler handler) { this(context, ViewConfiguration.get(context).getScaledTouchSlop() * 2, ViewConfiguration.get(context).getScaledMinimumScalingSpan(), handler, listener); } /** * Creates a ScaleGestureDetector with span slop and min span. * * @param context the application's context. * @param spanSlop the threshold for interpreting a touch movement as scaling. * @param minSpan the minimum threshold of scaling span. The span could be * overridden by other usages to specify a different scaling span, for instance, * if you need pinch gestures to continue closer together than the default. * @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. * * @throws NullPointerException if {@code listener} is null. * * @hide */ public ScaleGestureDetector(@NonNull Context context, @NonNull int spanSlop, @NonNull int minSpan, @Nullable Handler handler, @NonNull OnScaleGestureListener listener) { mContext = context; mListener = listener; final ViewConfiguration viewConfiguration = ViewConfiguration.get(context); mSpanSlop = viewConfiguration.getScaledTouchSlop() * 2; mMinSpan = viewConfiguration.getScaledMinimumScalingSpan(); mSpanSlop = spanSlop; mMinSpan = minSpan; mHandler = handler; // Quick scale is enabled by default after JB_MR2 final int targetSdkVersion = context.getApplicationInfo().targetSdkVersion; Loading
services/accessibility/accessibility.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -34,3 +34,10 @@ flag { description: "Calls WMS.addWindowToken without holding A11yManagerService#mLock" bug: "297972548" } flag { name: "pinch_zoom_zero_min_span" namespace: "accessibility" description: "Whether to set min span of ScaleGestureDetector to zero." bug: "295327792" } No newline at end of file
services/accessibility/java/com/android/server/accessibility/magnification/PanningScalingHandler.java +9 −1 Original line number Diff line number Diff line Loading @@ -28,8 +28,10 @@ import android.util.TypedValue; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.ViewConfiguration; import com.android.internal.R; import com.android.server.accessibility.Flags; /** * Handles the behavior while receiving scaling and panning gestures if it's enabled. Loading Loading @@ -70,7 +72,13 @@ class PanningScalingHandler extends mMaxScale = maxScale; mMinScale = minScale; mBlockScroll = blockScroll; if (Flags.pinchZoomZeroMinSpan()) { mScaleGestureDetector = new ScaleGestureDetector(context, ViewConfiguration.get(context).getScaledTouchSlop() * 2, /* minSpan= */ 0, Handler.getMain(), this); } else { mScaleGestureDetector = new ScaleGestureDetector(context, this, Handler.getMain()); } mScrollGestureDetector = new GestureDetector(context, this, Handler.getMain()); mScaleGestureDetector.setQuickScaleEnabled(false); mMagnificationDelegate = magnificationDelegate; Loading