summaryrefslogtreecommitdiffstats
path: root/services/accessibility
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2014-09-25 16:48:53 -0700
committerSvetoslav <svetoslavganov@google.com>2014-09-25 16:57:11 -0700
commit3f92ffc369c31c98620e22b66366adb93c60a5f8 (patch)
treee6779a0e9970fb076485725036d67e45cad61707 /services/accessibility
parentdd81183bbea34109e1ae2d75667fe4784be6132f (diff)
downloadframeworks_base-3f92ffc369c31c98620e22b66366adb93c60a5f8.zip
frameworks_base-3f92ffc369c31c98620e22b66366adb93c60a5f8.tar.gz
frameworks_base-3f92ffc369c31c98620e22b66366adb93c60a5f8.tar.bz2
Invalid active window if temporary disabling accessibility for test tools.
If accessibility is enabled and a test tool based on the accessibility APIs connects to the system we suspend the current accessibility services while the tool is running (to avoid inteference as the tool is such a service) and after the tool disconnects we restore the accessibility state. The issue is that when clearing the accessibility state we were also wrongly clearing the active window. We are now careful to not clear the active window in such a case. It is also possible that the active window was never initilaized before the tool is run so now it is lazily loaded such that if we do not know which one it is, we get the one the has input focus. The definition of an active window is the one that has input focus or the user is touching. bug:17663432 Change-Id: I8868866a5126c590d3bddad099ababb97978227a
Diffstat (limited to 'services/accessibility')
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 008830d..4c00b7e 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -759,7 +759,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
int getActiveWindowId() {
- return mSecurityPolicy.mActiveWindowId;
+ return mSecurityPolicy.getActiveWindowId();
}
void onTouchInteractionStart() {
@@ -2822,7 +2822,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private int resolveAccessibilityWindowIdLocked(int accessibilityWindowId) {
if (accessibilityWindowId == AccessibilityNodeInfo.ACTIVE_WINDOW_ID) {
- return mSecurityPolicy.mActiveWindowId;
+ return mSecurityPolicy.getActiveWindowId();
}
return accessibilityWindowId;
}
@@ -3283,7 +3283,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
public void clearWindowsLocked() {
List<AccessibilityWindowInfo> windows = Collections.emptyList();
+ final int activeWindowId = mActiveWindowId;
updateWindowsLocked(windows);
+ mActiveWindowId = activeWindowId;
mWindows = null;
}
@@ -3496,6 +3498,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
}
+ public int getActiveWindowId() {
+ if (mActiveWindowId == INVALID_WINDOW_ID && !mTouchInteractionInProgress) {
+ mActiveWindowId = getFocusedWindowId();
+ }
+ return mActiveWindowId;
+ }
+
private void setActiveWindowLocked(int windowId) {
if (mActiveWindowId != windowId) {
mActiveWindowId = windowId;