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

Commit f8af3436 authored by Phil Weaver's avatar Phil Weaver Committed by Android (Google) Code Review
Browse files

Merge "Improve accessibility window title behavior" into nyc-dev

parents c94872e9 155edc69
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view.accessibility;

import android.annotation.Nullable;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
@@ -101,8 +102,9 @@ public final class AccessibilityWindowInfo implements Parcelable {
    /**
     * Gets the title of the window.
     *
     * @return The title.
     * @return The title of the window, or {@code null} if none is available.
     */
    @Nullable
    public CharSequence getTitle() {
        return mTitle;
    }
+10 −4
Original line number Diff line number Diff line
@@ -528,18 +528,24 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {

    @Override
    public void setTitle(CharSequence title) {
        setTitle(title, true);
    }

    public void setTitle(CharSequence title, boolean updateAccessibilityTitle) {
        if (mTitleView != null) {
            mTitleView.setText(title);
        } else if (mDecorContentParent != null) {
            mDecorContentParent.setWindowTitle(title);
        }
        mTitle = title;
        if (updateAccessibilityTitle) {
            WindowManager.LayoutParams params = getAttributes();
            if (!TextUtils.equals(title, params.accessibilityTitle)) {
                params.accessibilityTitle = TextUtils.stringOrSpannedString(title);
                dispatchWindowAttributesChanged(getAttributes());
            }
        }
    }

    @Override
    @Deprecated
+7 −2
Original line number Diff line number Diff line
@@ -2589,8 +2589,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            final PhoneWindow win = new PhoneWindow(context);
            win.setIsStartingWindow(true);

            final Resources r = context.getResources();
            win.setTitle(r.getText(labelRes, nonLocalizedLabel));
            CharSequence label = context.getResources().getText(labelRes, null);
            // Only change the accessibility title if the label is localized
            if (label != null) {
                win.setTitle(label, true);
            } else {
                win.setTitle(nonLocalizedLabel, false);
            }

            win.setType(
                WindowManager.LayoutParams.TYPE_APPLICATION_STARTING);
+0 −3
Original line number Diff line number Diff line
@@ -1203,9 +1203,6 @@ final class AccessibilityController {
            window.layer = windowState.mLayer;
            window.token = windowState.mClient.asBinder();
            window.title = windowState.mAttrs.accessibilityTitle;
            if (window.title == null) {
                window.title = windowState.mAttrs.getTitle();
            }
            window.accessibilityIdOfAnchor = windowState.mAttrs.accessibilityIdOfAnchor;

            WindowState attachedWindow = windowState.mAttachedWindow;