From c8e941f4ba5a7ce488deb7606606e2ff6c8f7cf8 Mon Sep 17 00:00:00 2001 From: Zachary Kuznia Date: Thu, 11 Feb 2016 14:15:06 -0800 Subject: [PATCH] Update the timeout values for accessibility gestures. Change-Id: I1e6ed7bbec46b848c1278922be3110733a64dcb6 (cherry picked from commit 0522205fd5fdc460fb7af78a3ac4a17fcb988ac5) --- .../AccessibilityGestureDetector.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java index b79a7ba69b4e0..ad70853f13ba4 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java @@ -110,9 +110,25 @@ class AccessibilityGestureDetector extends GestureDetector.SimpleOnGestureListen // The minimal score for accepting a predicted gesture. private static final float MIN_PREDICTION_SCORE = 2.0f; + // Distance a finger must travel before we decide if it is a gesture or not. private static final int GESTURE_CONFIRM_MM = 10; - private static final long CANCEL_ON_PAUSE_THRESHOLD_STARTED_MS = 1000; - private static final long CANCEL_ON_PAUSE_THRESHOLD_NOT_STARTED_MS = 500; + + // Time threshold used to determine if an interaction is a gesture or not. + // If the first movement of 1cm takes longer than this value, we assume it's + // a slow movement, and therefore not a gesture. + // + // This value was determined by measuring the time for the first 1cm + // movement when gesturing, and touch exploring. Based on user testing, + // all gestures started with the initial movement taking less than 100ms. + // When touch exploring, the first movement almost always takes longer than + // 200ms. From this data, 150ms seems the best value to decide what + // kind of interaction it is. + private static final long CANCEL_ON_PAUSE_THRESHOLD_NOT_STARTED_MS = 150; + + // Time threshold used to determine if a gesture should be cancelled. If + // the finger pauses for longer than this delay, the ongoing gesture is + // cancelled. + private static final long CANCEL_ON_PAUSE_THRESHOLD_STARTED_MS = 500; AccessibilityGestureDetector(Context context, Listener listener) { mListener = listener;