summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/accessibility/TouchExplorer.java
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2011-09-03 19:52:36 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2011-09-03 20:03:35 -0700
commit12a024ca681d877fe16b7e087356f7aff175a218 (patch)
tree560ba37cd5552510cbfedce98ecbdbde55e77358 /services/java/com/android/server/accessibility/TouchExplorer.java
parent37c5cd6ee960804afa9a78910f1d3a7bd1963a78 (diff)
downloadframeworks_base-12a024ca681d877fe16b7e087356f7aff175a218.zip
frameworks_base-12a024ca681d877fe16b7e087356f7aff175a218.tar.gz
frameworks_base-12a024ca681d877fe16b7e087356f7aff175a218.tar.bz2
Tuning the TouchExplorer
1. Tuned the max angle between two moving fingers in touch exploration mode for a gesture to be considered a drag. The previous value was too aggressive and it was fairly easy for the user to get out of dragging state if she ingreases the distance between her fingers. bug:5223787 2. Before clicking the explorer was sending hover enter and exit resulting in firing the corresponding accessibility events which leads to announcement of the content under the tap that triggered the click. However, the click is actually performed on the last touch explored location (if in the distance slop of course) instead of the actual tapping pointer location. Before fixing that the user was confused since he was hearing announcement of one content but actually was clicking on something else. bug:5225721 Change-Id: I79fec704878f98c95f181bf8a9647e0bb1bd10ef
Diffstat (limited to 'services/java/com/android/server/accessibility/TouchExplorer.java')
-rw-r--r--services/java/com/android/server/accessibility/TouchExplorer.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index 496210c..eb399ad 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -84,7 +84,7 @@ public class TouchExplorer implements Explorer {
// The minimum of the cosine between the vectors of two moving
// pointers so they can be considered moving in the same direction.
- private static final float MIN_ANGLE_COS = 0.866025404f; // cos(pi/6)
+ private static final float MAX_DRAGGING_ANGLE_COS = 0.525321989f; // cos(pi/4)
// The delay for sending a hover enter event.
private static final long DELAY_SEND_HOVER_ENTER = 200;
@@ -364,13 +364,13 @@ public class TouchExplorer implements Explorer {
}
mPerformLongPressDelayed.remove();
- mSendHoverDelayed.forceSendAndRemove();
- ensureHoverExitSent(event, pointerIdBits, policyFlags);
// If touch exploring announce the end of the gesture.
// Also do not click on the last explored location.
if (mTouchExploreGestureInProgress) {
mTouchExploreGestureInProgress = false;
+ mSendHoverDelayed.forceSendAndRemove();
+ ensureHoverExitSent(event, pointerIdBits, policyFlags);
mLastTouchExploreEvent = MotionEvent.obtain(event);
sendAccessibilityEvent(TYPE_TOUCH_EXPLORATION_GESTURE_END);
break;
@@ -384,6 +384,8 @@ public class TouchExplorer implements Explorer {
final long exploreTime = mLastTouchExploreEvent.getEventTime();
final long deltaTime = eventTime - exploreTime;
if (deltaTime > ACTIVATION_TIME_SLOP) {
+ mSendHoverDelayed.forceSendAndRemove();
+ ensureHoverExitSent(event, pointerIdBits, policyFlags);
mLastTouchExploreEvent = MotionEvent.obtain(event);
break;
}
@@ -396,14 +398,25 @@ public class TouchExplorer implements Explorer {
- event.getY(pointerIndex);
final float deltaMove = (float) Math.hypot(deltaX, deltaY);
if (deltaMove > mTouchExplorationTapSlop) {
+ mSendHoverDelayed.forceSendAndRemove();
+ ensureHoverExitSent(event, pointerIdBits, policyFlags);
mLastTouchExploreEvent = MotionEvent.obtain(event);
break;
}
+ // This is a tap so do not send hover events since
+ // this events will result in firing the corresponding
+ // accessibility events confusing the user about what
+ // is actually clicked.
+ mSendHoverDelayed.remove();
+ ensureHoverExitSent(event, pointerIdBits, policyFlags);
+
// All preconditions are met, so click the last explored location.
sendActionDownAndUp(mLastTouchExploreEvent, policyFlags);
mLastTouchExploreEvent = null;
} else {
+ mSendHoverDelayed.forceSendAndRemove();
+ ensureHoverExitSent(event, pointerIdBits, policyFlags);
mLastTouchExploreEvent = MotionEvent.obtain(event);
}
} break;
@@ -782,7 +795,7 @@ public class TouchExplorer implements Explorer {
final float angleCos =
firstXNormalized * secondXNormalized + firstYNormalized * secondYNormalized;
- if (angleCos < MIN_ANGLE_COS) {
+ if (angleCos < MAX_DRAGGING_ANGLE_COS) {
return false;
}