From 86fe9e14f1a816df32b08e0eb677989cc7444948 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Mon, 10 Sep 2012 17:35:32 -0700 Subject: [PATCH] Reducing the click delay while screen magnification is enabled. 1. If screen magnification is enabled the user has to triple tap and lift or triple tap and hold to engage magnification. Hence, we delay the touch events until we are sure that it is no longer possible for the user to perform a multi-tap to engage magnification. While such a delay is unavoidable it feels a bit longer than it should be. This change reduces the delay between taps to be considered a multi-tap, essentially making the click delay shorter. bug:7139918 Change-Id: I2100945171fff99600766193f0effdaef1f1db8f --- .../com/android/server/accessibility/ScreenMagnifier.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/java/com/android/server/accessibility/ScreenMagnifier.java b/services/java/com/android/server/accessibility/ScreenMagnifier.java index ca6140056494b..aa3c82b21c080 100644 --- a/services/java/com/android/server/accessibility/ScreenMagnifier.java +++ b/services/java/com/android/server/accessibility/ScreenMagnifier.java @@ -128,6 +128,8 @@ public final class ScreenMagnifier implements EventStreamTransformation { private static final int DEFAULT_SCREEN_MAGNIFICATION_AUTO_UPDATE = 1; private static final float DEFAULT_WINDOW_ANIMATION_SCALE = 1.0f; + private static final int MULTI_TAP_TIME_SLOP_ADJUSTMENT = 50; + private final IWindowManager mWindowManagerService = IWindowManager.Stub.asInterface( ServiceManager.getService("window")); private final WindowManager mWindowManager; @@ -145,7 +147,8 @@ public final class ScreenMagnifier implements EventStreamTransformation { private final Viewport mViewport; private final int mTapTimeSlop = ViewConfiguration.getTapTimeout(); - private final int mMultiTapTimeSlop = ViewConfiguration.getDoubleTapTimeout(); + private final int mMultiTapTimeSlop = + ViewConfiguration.getDoubleTapTimeout() - MULTI_TAP_TIME_SLOP_ADJUSTMENT; private final int mTapDistanceSlop; private final int mMultiTapDistanceSlop; @@ -617,7 +620,7 @@ public final class ScreenMagnifier implements EventStreamTransformation { } else if (mTapCount < ACTION_TAP_COUNT) { Message message = mHandler.obtainMessage( MESSAGE_TRANSITION_TO_DELEGATING_STATE); - mHandler.sendMessageDelayed(message, mTapTimeSlop + mMultiTapDistanceSlop); + mHandler.sendMessageDelayed(message, mMultiTapTimeSlop); } clearLastDownEvent(); mLastDownEvent = MotionEvent.obtain(event);