Skip to content

Commit 86fe9e1

Browse files
committed
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
1 parent 6625389 commit 86fe9e1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

services/java/com/android/server/accessibility/ScreenMagnifier.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ public final class ScreenMagnifier implements EventStreamTransformation {
128128
private static final int DEFAULT_SCREEN_MAGNIFICATION_AUTO_UPDATE = 1;
129129
private static final float DEFAULT_WINDOW_ANIMATION_SCALE = 1.0f;
130130

131+
private static final int MULTI_TAP_TIME_SLOP_ADJUSTMENT = 50;
132+
131133
private final IWindowManager mWindowManagerService = IWindowManager.Stub.asInterface(
132134
ServiceManager.getService("window"));
133135
private final WindowManager mWindowManager;
@@ -145,7 +147,8 @@ public final class ScreenMagnifier implements EventStreamTransformation {
145147
private final Viewport mViewport;
146148

147149
private final int mTapTimeSlop = ViewConfiguration.getTapTimeout();
148-
private final int mMultiTapTimeSlop = ViewConfiguration.getDoubleTapTimeout();
150+
private final int mMultiTapTimeSlop =
151+
ViewConfiguration.getDoubleTapTimeout() - MULTI_TAP_TIME_SLOP_ADJUSTMENT;
149152
private final int mTapDistanceSlop;
150153
private final int mMultiTapDistanceSlop;
151154

@@ -617,7 +620,7 @@ public void onMotionEvent(MotionEvent event, int policyFlags) {
617620
} else if (mTapCount < ACTION_TAP_COUNT) {
618621
Message message = mHandler.obtainMessage(
619622
MESSAGE_TRANSITION_TO_DELEGATING_STATE);
620-
mHandler.sendMessageDelayed(message, mTapTimeSlop + mMultiTapDistanceSlop);
623+
mHandler.sendMessageDelayed(message, mMultiTapTimeSlop);
621624
}
622625
clearLastDownEvent();
623626
mLastDownEvent = MotionEvent.obtain(event);

0 commit comments

Comments
 (0)