OSDN Git Service

Fixing several issues with accessibility
[android-x86/frameworks-base.git] / packages / SystemUI / src / com / android / systemui / recents / misc / Utilities.java
index 9fb8bd5..2c5c437 100644 (file)
@@ -34,6 +34,7 @@ import android.util.IntProperty;
 import android.util.Property;
 import android.util.TypedValue;
 import android.view.View;
+import android.view.ViewGroup;
 import android.view.ViewParent;
 import android.view.ViewStub;
 
@@ -285,6 +286,26 @@ public class Utilities {
     }
 
     /**
+     * Returns whether this view, or one of its descendants have accessibility focus.
+     */
+    public static boolean isDescendentAccessibilityFocused(View v) {
+        if (v.isAccessibilityFocused()) {
+            return true;
+        }
+
+        if (v instanceof ViewGroup) {
+            ViewGroup vg = (ViewGroup) v;
+            int childCount = vg.getChildCount();
+            for (int i = 0; i < childCount; i++) {
+                if (isDescendentAccessibilityFocused(vg.getChildAt(i))) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
      * Returns the application configuration, which is independent of the activity's current
      * configuration in multiwindow.
      */