summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/accessibility/TouchExplorer.java
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2012-06-14 10:30:00 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2012-06-14 10:40:12 -0700
commit5d043ce8cc2f588fdfb336cc843fb3b07b196f83 (patch)
treef16b22fd57768b3559911bd91cec4bdc1d651de4 /services/java/com/android/server/accessibility/TouchExplorer.java
parent95068e5d1bea47091e97955f271c789264994550 (diff)
downloadframeworks_base-5d043ce8cc2f588fdfb336cc843fb3b07b196f83.zip
frameworks_base-5d043ce8cc2f588fdfb336cc843fb3b07b196f83.tar.gz
frameworks_base-5d043ce8cc2f588fdfb336cc843fb3b07b196f83.tar.bz2
Active window not updated window not updated properly.
1. Accessibility allows querying only of the active window. The active window is the one that has input focus or the one the user is touching. Hence, if the user is touching a window that does not have input focus this window is the active one and as soon as the user stops touching it the active window becomes the one that has input focus. Currently the active window is not updated properly when the user lifts his finger. This leads to a scenario of traversal actions sent to the wrong window and the user being stuck. The reason is that the last touch explored event that is used to determine where to click is cleared when accessibility focus moves but this event is also used to determine when to send the hover exit and touch exploration gesture end events. The problem is that the last hover event is cleared before it is used for sending the right exit events, thus the event stream is inconsistent and the accessibility manager service relies on this stream to update the active window. Now we are keeping separate copies of the last touch event - one for clicking and one for determining the which events to inject to ensure consistent stream. bug:6666041 Change-Id: Ie9961e562a42ef8a9463afacfff2246adcb66303
Diffstat (limited to 'services/java/com/android/server/accessibility/TouchExplorer.java')
-rw-r--r--services/java/com/android/server/accessibility/TouchExplorer.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index a8296f8..152e188 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -312,9 +312,9 @@ public class TouchExplorer {
switch (eventType) {
case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: {
- if (mInjectedPointerTracker.mLastInjectedHoverEvent != null) {
- mInjectedPointerTracker.mLastInjectedHoverEvent.recycle();
- mInjectedPointerTracker.mLastInjectedHoverEvent = null;
+ if (mInjectedPointerTracker.mLastInjectedHoverEventForClick != null) {
+ mInjectedPointerTracker.mLastInjectedHoverEventForClick.recycle();
+ mInjectedPointerTracker.mLastInjectedHoverEventForClick = null;
}
mLastTouchedWindowId = -1;
} break;
@@ -1077,7 +1077,8 @@ public class TouchExplorer {
final int pointerId = secondTapUp.getPointerId(secondTapUp.getActionIndex());
final int pointerIndex = secondTapUp.findPointerIndex(pointerId);
- MotionEvent lastExploreEvent = mInjectedPointerTracker.getLastInjectedHoverEvent();
+ MotionEvent lastExploreEvent =
+ mInjectedPointerTracker.getLastInjectedHoverEventForClick();
if (lastExploreEvent == null) {
// No last touch explored event but there is accessibility focus in
// the active window. We click in the middle of the focus bounds.
@@ -1328,7 +1329,8 @@ public class TouchExplorer {
final int pointerId = mEvent.getPointerId(mEvent.getActionIndex());
final int pointerIndex = mEvent.findPointerIndex(pointerId);
- MotionEvent lastExploreEvent = mInjectedPointerTracker.getLastInjectedHoverEvent();
+ MotionEvent lastExploreEvent =
+ mInjectedPointerTracker.getLastInjectedHoverEventForClick();
if (lastExploreEvent == null) {
// No last touch explored event but there is accessibility focus in
// the active window. We click in the middle of the focus bounds.
@@ -1482,6 +1484,9 @@ public class TouchExplorer {
// The last injected hover event.
private MotionEvent mLastInjectedHoverEvent;
+ // The last injected hover event used for performing clicks.
+ private MotionEvent mLastInjectedHoverEventForClick;
+
/**
* Processes an injected {@link MotionEvent} event.
*
@@ -1513,6 +1518,10 @@ public class TouchExplorer {
mLastInjectedHoverEvent.recycle();
}
mLastInjectedHoverEvent = MotionEvent.obtain(event);
+ if (mLastInjectedHoverEventForClick != null) {
+ mLastInjectedHoverEventForClick.recycle();
+ }
+ mLastInjectedHoverEventForClick = MotionEvent.obtain(event);
} break;
}
if (DEBUG) {
@@ -1566,6 +1575,13 @@ public class TouchExplorer {
return mLastInjectedHoverEvent;
}
+ /**
+ * @return The the last injected hover event.
+ */
+ public MotionEvent getLastInjectedHoverEventForClick() {
+ return mLastInjectedHoverEventForClick;
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();