summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Svetoslav Ganov <svetoslavganov@google.com> 2012-06-07 16:35:04 -0700
committer Svetoslav Ganov <svetoslavganov@google.com> 2012-06-07 16:35:11 -0700
commit385d9f24b5ce2acb86c0dc192ce702718ab01c39 (patch)
treec04565ea56a1e8839636d014affe18ece26c9b04
parent86783474fdec98a22bc22e224462767eab13e273 (diff)
Cannot click on the last touch explored auto-completion item.
1. When typing into an auto completion edit field a list of completions pops up and if the user touch explores the list and tries to double tap to select the touched completion the latter is not selected. The auto completion is a popup that does not take input focus and is overlaid on top of the window that has input focus. The touch explorer was clicking on the location of the accessibility focus if the last touch explored location is within the bounds of the active window. In this case this was the window with the edit text into which the user is typing. The check performed by the touch explorer was missing the case when the last touch explored location was within the bounds of the active window but it actually was deloverd to another overlaid window. Now we are poking on the accessibility focus location if the last explored location is within the active window and was delivered to it. bug:6629535 Change-Id: Ie66d5bb81ab021f2bb0414339b7de26d96826191
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityManagerService.java4
-rw-r--r--services/java/com/android/server/accessibility/TouchExplorer.java40
2 files changed, 30 insertions, 14 deletions
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 3bddd9d025e0..9399fe932018 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -588,6 +588,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
}
+ int getActiveWindowId() {
+ return mSecurityPolicy.mActiveWindowId;
+ }
+
private Service getQueryBridge() {
if (mQueryBridge == null) {
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index 14784dce89d0..a36c67305d35 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -190,6 +190,9 @@ public class TouchExplorer {
// The long pressing pointer Y if coordinate remapping is needed.
private int mLongPressingPointerDeltaY;
+ // The id of the last touch explored window.
+ private int mLastTouchedWindowId;
+
/**
* Creates a new instance.
*
@@ -305,6 +308,11 @@ public class TouchExplorer {
mInjectedPointerTracker.mLastInjectedHoverEvent.recycle();
mInjectedPointerTracker.mLastInjectedHoverEvent = null;
}
+ mLastTouchedWindowId = -1;
+ } break;
+ case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER:
+ case AccessibilityEvent.TYPE_VIEW_HOVER_EXIT: {
+ mLastTouchedWindowId = event.getWindowId();
} break;
}
}
@@ -1078,13 +1086,15 @@ public class TouchExplorer {
clickLocationX = (int) lastExploreEvent.getX(lastExplorePointerIndex);
clickLocationY = (int) lastExploreEvent.getY(lastExplorePointerIndex);
Rect activeWindowBounds = mTempRect;
- mAms.getActiveWindowBounds(activeWindowBounds);
- if (activeWindowBounds.contains(clickLocationX, clickLocationY)) {
- Rect focusBounds = mTempRect;
- if (mAms.getAccessibilityFocusBoundsInActiveWindow(focusBounds)) {
- if (!focusBounds.contains(clickLocationX, clickLocationY)) {
- clickLocationX = focusBounds.centerX();
- clickLocationY = focusBounds.centerY();
+ if (mLastTouchedWindowId == mAms.getActiveWindowId()) {
+ mAms.getActiveWindowBounds(activeWindowBounds);
+ if (activeWindowBounds.contains(clickLocationX, clickLocationY)) {
+ Rect focusBounds = mTempRect;
+ if (mAms.getAccessibilityFocusBoundsInActiveWindow(focusBounds)) {
+ if (!focusBounds.contains(clickLocationX, clickLocationY)) {
+ clickLocationX = focusBounds.centerX();
+ clickLocationY = focusBounds.centerY();
+ }
}
}
}
@@ -1308,13 +1318,15 @@ public class TouchExplorer {
clickLocationX = (int) lastExploreEvent.getX(lastExplorePointerIndex);
clickLocationY = (int) lastExploreEvent.getY(lastExplorePointerIndex);
Rect activeWindowBounds = mTempRect;
- mAms.getActiveWindowBounds(activeWindowBounds);
- if (activeWindowBounds.contains(clickLocationX, clickLocationY)) {
- Rect focusBounds = mTempRect;
- if (mAms.getAccessibilityFocusBoundsInActiveWindow(focusBounds)) {
- if (!focusBounds.contains(clickLocationX, clickLocationY)) {
- clickLocationX = focusBounds.centerX();
- clickLocationY = focusBounds.centerY();
+ if (mLastTouchedWindowId == mAms.getActiveWindowId()) {
+ mAms.getActiveWindowBounds(activeWindowBounds);
+ if (activeWindowBounds.contains(clickLocationX, clickLocationY)) {
+ Rect focusBounds = mTempRect;
+ if (mAms.getAccessibilityFocusBoundsInActiveWindow(focusBounds)) {
+ if (!focusBounds.contains(clickLocationX, clickLocationY)) {
+ clickLocationX = focusBounds.centerX();
+ clickLocationY = focusBounds.centerY();
+ }
}
}
}