diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-04-18 18:55:24 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-18 18:55:24 -0700 |
| commit | 2c23a14a3b86f84ad94725dd402985eb228e87db (patch) | |
| tree | 907d0889bcbc026623d70a8c247dc4954cd6be77 /core/java/android | |
| parent | b7c30a847ae3526cee28e2e3e96b010a6fe7961c (diff) | |
| parent | 0846e29d0b5640cfad4496c8484fb9aaa2ba4ccf (diff) | |
| download | frameworks_base-2c23a14a3b86f84ad94725dd402985eb228e87db.zip frameworks_base-2c23a14a3b86f84ad94725dd402985eb228e87db.tar.gz frameworks_base-2c23a14a3b86f84ad94725dd402985eb228e87db.tar.bz2 | |
Merge "Adding API for getting the root node info in the active window."
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/accessibilityservice/AccessibilityService.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index eed8aa6..4e340c0 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -426,13 +426,11 @@ public abstract class AccessibilityService extends Service { throw new IllegalStateException("AccessibilityService not connected." + " Did you receive a call of onServiceConnected()?"); } - AccessibilityNodeInfo root = AccessibilityInteractionClient.getInstance() - .findAccessibilityNodeInfoByAccessibilityId(connectionId, - AccessibilityNodeInfo.ACTIVE_WINDOW_ID, AccessibilityNodeInfo.ROOT_NODE_ID, - AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS); + AccessibilityNodeInfo root = getRootInActiveWindow(); if (root == null) { return; } + AccessibilityNodeInfo current = root.findFocus(AccessibilityNodeInfo.FOCUS_ACCESSIBILITY); if (current == null) { current = root; @@ -480,6 +478,19 @@ public abstract class AccessibilityService extends Service { } /** + * Gets the root node in the currently active window if this service + * can retrieve window content. + * + * @return The root node if this service can retrieve window content. + */ + public AccessibilityNodeInfo getRootInActiveWindow() { + return AccessibilityInteractionClient.getInstance() + .findAccessibilityNodeInfoByAccessibilityId(mConnectionId, + AccessibilityNodeInfo.ACTIVE_WINDOW_ID, AccessibilityNodeInfo.ROOT_NODE_ID, + AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS); + } + + /** * Performs a global action. Such an action can be performed * at any moment regardless of the current application or user * location in that application. For example going back, going |
