Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 396d5491 authored by Phil Weaver's avatar Phil Weaver
Browse files

Add accessibility window title and anchor.

Plumbing through the title of windows so support multiwindow
accessibility.

Adding ability to determine the anchor of a pop-up window so the pop-up
can be traversed as part of its anchor.

Bug: 27687627
Bug: 8449376

Change-Id: I59e98a29fb90029407a26de5bf3d900fed5dd627
parent ada2c872
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -44294,6 +44294,7 @@ package android.view.accessibility {
  public final class AccessibilityWindowInfo implements android.os.Parcelable {
    method public int describeContents();
    method public android.view.accessibility.AccessibilityNodeInfo getAnchor();
    method public void getBoundsInScreen(android.graphics.Rect);
    method public android.view.accessibility.AccessibilityWindowInfo getChild(int);
    method public int getChildCount();
@@ -44301,6 +44302,7 @@ package android.view.accessibility {
    method public int getLayer();
    method public android.view.accessibility.AccessibilityWindowInfo getParent();
    method public android.view.accessibility.AccessibilityNodeInfo getRoot();
    method public java.lang.CharSequence getTitle();
    method public int getType();
    method public boolean isAccessibilityFocused();
    method public boolean isActive();
+2 −0
Original line number Diff line number Diff line
@@ -47023,6 +47023,7 @@ package android.view.accessibility {
  public final class AccessibilityWindowInfo implements android.os.Parcelable {
    method public int describeContents();
    method public android.view.accessibility.AccessibilityNodeInfo getAnchor();
    method public void getBoundsInScreen(android.graphics.Rect);
    method public android.view.accessibility.AccessibilityWindowInfo getChild(int);
    method public int getChildCount();
@@ -47030,6 +47031,7 @@ package android.view.accessibility {
    method public int getLayer();
    method public android.view.accessibility.AccessibilityWindowInfo getParent();
    method public android.view.accessibility.AccessibilityNodeInfo getRoot();
    method public java.lang.CharSequence getTitle();
    method public int getType();
    method public boolean isAccessibilityFocused();
    method public boolean isActive();
+2 −0
Original line number Diff line number Diff line
@@ -44368,6 +44368,7 @@ package android.view.accessibility {
  public final class AccessibilityWindowInfo implements android.os.Parcelable {
    method public int describeContents();
    method public android.view.accessibility.AccessibilityNodeInfo getAnchor();
    method public void getBoundsInScreen(android.graphics.Rect);
    method public android.view.accessibility.AccessibilityWindowInfo getChild(int);
    method public int getChildCount();
@@ -44375,6 +44376,7 @@ package android.view.accessibility {
    method public int getLayer();
    method public android.view.accessibility.AccessibilityWindowInfo getParent();
    method public android.view.accessibility.AccessibilityNodeInfo getRoot();
    method public java.lang.CharSequence getTitle();
    method public int getType();
    method public boolean isAccessibilityFocused();
    method public boolean isActive();
+11 −1
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ public class WindowInfo implements Parcelable {
    public boolean focused;
    public final Rect boundsInScreen = new Rect();
    public List<IBinder> childTokens;
    public CharSequence title;
    public int accessibilityIdOfAnchor = View.NO_ID;

    private WindowInfo() {
        /* do nothing - hide constructor */
@@ -65,6 +67,8 @@ public class WindowInfo implements Parcelable {
        window.parentToken = other.parentToken;
        window.focused = other.focused;
        window.boundsInScreen.set(other.boundsInScreen);
        window.title = other.title;
        window.accessibilityIdOfAnchor = other.accessibilityIdOfAnchor;

        if (other.childTokens != null && !other.childTokens.isEmpty()) {
            if (window.childTokens == null) {
@@ -95,6 +99,8 @@ public class WindowInfo implements Parcelable {
        parcel.writeStrongBinder(parentToken);
        parcel.writeInt(focused ? 1 : 0);
        boundsInScreen.writeToParcel(parcel, flags);
        parcel.writeCharSequence(title);
        parcel.writeInt(accessibilityIdOfAnchor);

        if (childTokens != null && !childTokens.isEmpty()) {
            parcel.writeInt(1);
@@ -108,13 +114,15 @@ public class WindowInfo implements Parcelable {
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("WindowInfo[");
        builder.append("type=").append(type);
        builder.append("title=").append(title);
        builder.append(", type=").append(type);
        builder.append(", layer=").append(layer);
        builder.append(", token=").append(token);
        builder.append(", bounds=").append(boundsInScreen);
        builder.append(", parent=").append(parentToken);
        builder.append(", focused=").append(focused);
        builder.append(", children=").append(childTokens);
        builder.append(", accessibility anchor=").append(accessibilityIdOfAnchor);
        builder.append(']');
        return builder.toString();
    }
@@ -126,6 +134,8 @@ public class WindowInfo implements Parcelable {
        parentToken = parcel.readStrongBinder();
        focused = (parcel.readInt() == 1);
        boundsInScreen.readFromParcel(parcel);
        title = parcel.readCharSequence();
        accessibilityIdOfAnchor = parcel.readInt();

        final boolean hasChildren = (parcel.readInt() == 1);
        if (hasChildren) {
+17 −0
Original line number Diff line number Diff line
@@ -1693,6 +1693,14 @@ public interface WindowManager extends ViewManager {
         */
        public long userActivityTimeout = -1;

        /**
         * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
         * window.
         *
         * @hide
         */
        public int accessibilityIdOfAnchor = -1;

        public LayoutParams() {
            super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            type = TYPE_APPLICATION;
@@ -1799,6 +1807,7 @@ public interface WindowManager extends ViewManager {
            out.writeInt(surfaceInsets.bottom);
            out.writeInt(hasManualSurfaceInsets ? 1 : 0);
            out.writeInt(needsMenuKey);
            out.writeInt(accessibilityIdOfAnchor);
        }

        public static final Parcelable.Creator<LayoutParams> CREATOR
@@ -1849,6 +1858,7 @@ public interface WindowManager extends ViewManager {
            surfaceInsets.bottom = in.readInt();
            hasManualSurfaceInsets = in.readInt() != 0;
            needsMenuKey = in.readInt();
            accessibilityIdOfAnchor = in.readInt();
        }

        @SuppressWarnings({"PointlessBitwiseExpression"})
@@ -1888,6 +1898,8 @@ public interface WindowManager extends ViewManager {
        /** {@hide} */
        public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
        /** {@hide} */
        public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
        /** {@hide} */
        public static final int EVERYTHING_CHANGED = 0xffffffff;

        // internal buffer to backup/restore parameters under compatibility mode.
@@ -2048,6 +2060,11 @@ public interface WindowManager extends ViewManager {
                changes |= NEEDS_MENU_KEY_CHANGED;
            }

            if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
                accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
                changes |= ACCESSIBILITY_ANCHOR_CHANGED;
            }

            return changes;
        }

Loading