summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/view/AccessibilityInteractionController.java10
-rw-r--r--core/java/android/view/accessibility/AccessibilityNodeProvider.java15
3 files changed, 24 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt
index 3b8fa2d..22fe71e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -29528,6 +29528,7 @@ package android.view.accessibility {
ctor public AccessibilityNodeProvider();
method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo(int);
method public java.util.List<android.view.accessibility.AccessibilityNodeInfo> findAccessibilityNodeInfosByText(java.lang.String, int);
+ method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
method public boolean performAction(int, int, android.os.Bundle);
}
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index e835a97..41d3700 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -423,9 +423,15 @@ final class AccessibilityInteractionController {
}
} break;
case AccessibilityNodeInfo.FOCUS_INPUT: {
- // Input focus cannot go to virtual views.
View target = root.findFocus();
- if (target != null && isShown(target)) {
+ if (target == null || !isShown(target)) {
+ break;
+ }
+ AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider();
+ if (provider != null) {
+ focused = provider.findFocus(focusType);
+ }
+ if (focused == null) {
focused = target.createAccessibilityNodeInfo();
}
} break;
diff --git a/core/java/android/view/accessibility/AccessibilityNodeProvider.java b/core/java/android/view/accessibility/AccessibilityNodeProvider.java
index 688cbdf..718c32f 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeProvider.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeProvider.java
@@ -132,4 +132,19 @@ public abstract class AccessibilityNodeProvider {
int virtualViewId) {
return null;
}
+
+ /**
+ * Find the virtual view, i.e. a descendant of the host View, that has the
+ * specified focus type.
+ *
+ * @param focus The focus to find. One of
+ * {@link AccessibilityNodeInfo#FOCUS_INPUT} or
+ * {@link AccessibilityNodeInfo#FOCUS_ACCESSIBILITY}.
+ * @return The node info of the focused view or null.
+ * @see AccessibilityNodeInfo#FOCUS_INPUT
+ * @see AccessibilityNodeInfo#FOCUS_ACCESSIBILITY
+ */
+ public AccessibilityNodeInfo findFocus(int focus) {
+ return null;
+ }
}