diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-06-02 16:26:44 -0700 |
---|---|---|
committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-06-02 16:26:59 -0700 |
commit | ebac1b79c4a355d8cd73b49df059deb00d7aa256 (patch) | |
tree | cc655a6fa6296a5840353e1cb5379159a5177c10 /services/java/com/android/server/accessibility/TouchExplorer.java | |
parent | 01827ce9f2d5f4441c7f7b0211d2739824320daf (diff) | |
download | frameworks_base-ebac1b79c4a355d8cd73b49df059deb00d7aa256.zip frameworks_base-ebac1b79c4a355d8cd73b49df059deb00d7aa256.tar.gz frameworks_base-ebac1b79c4a355d8cd73b49df059deb00d7aa256.tar.bz2 |
Fixing a crash in the TouchExplorer.
1. If the runnable for performing a long press is not
removed when all pointers are up and it is executed
the explorer gets into delegating mode with no pointer
down and the next down crashes the explorer. Added
code to remove the long press runnable in a few places
it was missing and also added a safety in the runnable
to avoid executing it in case there are no active pointers.
bug:6557183
Change-Id: I9dab3de88fd08d8e2b38af18249ac551837c0736
Diffstat (limited to 'services/java/com/android/server/accessibility/TouchExplorer.java')
-rw-r--r-- | services/java/com/android/server/accessibility/TouchExplorer.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java index 67bdabd..d97b022 100644 --- a/services/java/com/android/server/accessibility/TouchExplorer.java +++ b/services/java/com/android/server/accessibility/TouchExplorer.java @@ -327,9 +327,10 @@ public class TouchExplorer { if (mSendHoverEnterDelayed.isPending()) { mSendHoverEnterDelayed.remove(); mSendHoverExitDelayed.remove(); - mPerformLongPressDelayed.remove(); } + mPerformLongPressDelayed.remove(); + // If we have the first tap schedule a long press and break // since we do not want to schedule hover enter because // the delayed callback will kick in before the long click. @@ -396,6 +397,7 @@ public class TouchExplorer { // exploring so start sending events. mSendHoverEnterDelayed.forceSendAndRemove(); mSendHoverExitDelayed.remove(); + mPerformLongPressDelayed.remove(); sendMotionEvent(event, MotionEvent.ACTION_HOVER_MOVE, pointerIdBits, policyFlags); } @@ -422,6 +424,7 @@ public class TouchExplorer { mSendHoverExitDelayed.remove(); mPerformLongPressDelayed.remove(); } else { + mPerformLongPressDelayed.remove(); // If the user is touch exploring the second pointer may be // performing a double tap to activate an item without need // for the user to lift his exploring finger. @@ -446,9 +449,6 @@ public class TouchExplorer { if (isDraggingGesture(event)) { // Two pointers moving in the same direction within // a given distance perform a drag. - mSendHoverEnterDelayed.remove(); - mSendHoverExitDelayed.remove(); - mPerformLongPressDelayed.remove(); mCurrentState = STATE_DRAGGING; mDraggingPointerId = pointerId; sendMotionEvent(event, MotionEvent.ACTION_DOWN, pointerIdBits, @@ -469,6 +469,7 @@ public class TouchExplorer { mSendHoverExitDelayed.remove(); mPerformLongPressDelayed.remove(); } else { + mPerformLongPressDelayed.remove(); // We are sending events so send exit and gesture // end since we transition to another state. sendExitEventsIfNeeded(policyFlags); @@ -1247,6 +1248,11 @@ public class TouchExplorer { @Override public void run() { + // Active pointers should not be zero when running this command. + if (mReceivedPointerTracker.getActivePointerCount() == 0) { + return; + } + // If the last touched explored location is not within the focused // window we will long press at that exact spot, otherwise we find the // accessibility focus and if the tap is within its bounds we long press |