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

Commit 964c68e0 authored by Phil Weaver's avatar Phil Weaver
Browse files

Send accessibility event on window title change.

Forcing the layout params to be sent to
WindowManagerService, and from there to accessibility
to generate the event.

Bug: 27857482
Test: Adding corresponding CTS.
Change-Id: I24fc97e16b95799259e4c472b6f1052a1dd00a56
parent b4ff25b4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5611,6 +5611,13 @@ public final class ViewRootImpl implements ViewParent,
        }
    }

    /**
     * Notify that the window title changed
     */
    public void onWindowTitleChanged() {
        mAttachInfo.mForceReportNewAttributes = true;
    }

    public void handleDispatchWindowShown() {
        mAttachInfo.mTreeObserver.dispatchOnWindowShown();
    }
+7 −0
Original line number Diff line number Diff line
@@ -540,6 +540,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            WindowManager.LayoutParams params = getAttributes();
            if (!TextUtils.equals(title, params.accessibilityTitle)) {
                params.accessibilityTitle = TextUtils.stringOrSpannedString(title);
                if (mDecor != null) {
                    // ViewRootImpl will make sure the change propagates to WindowManagerService
                    ViewRootImpl vr = mDecor.getViewRootImpl();
                    if (vr != null) {
                        vr.onWindowTitleChanged();
                    }
                }
                dispatchWindowAttributesChanged(getAttributes());
            }
        }
+0 −1
Original line number Diff line number Diff line
@@ -1034,7 +1034,6 @@ final class AccessibilityController {
                boolean focusedWindowAdded = false;

                final int visibleWindowCount = visibleWindows.size();
                int skipRemainingWindowsForTaskId = -1;
                HashSet<Integer> skipRemainingWindowsForTasks = new HashSet<>();
                for (int i = visibleWindowCount - 1; i >= 0; i--) {
                    final WindowState windowState = visibleWindows.valueAt(i);
+6 −0
Original line number Diff line number Diff line
@@ -1932,6 +1932,12 @@ public class WindowManagerService extends IWindowManager.Stub
                        || (flagChanges & FLAG_DISMISS_KEYGUARD) != 0)) {
                    win.mAppToken.checkKeyguardFlagsChanged();
                }
                if (((attrChanges & LayoutParams.ACCESSIBILITY_TITLE_CHANGED) != 0)
                        && (mAccessibilityController != null)
                        && (win.getDisplayId() == DEFAULT_DISPLAY)) {
                    // No move or resize, but the controller checks for title changes as well
                    mAccessibilityController.onSomeWindowResizedOrMovedLocked();
                }
            }

            if (DEBUG_LAYOUT) Slog.v(TAG_WM, "Relayout " + win + ": viewVisibility=" + viewVisibility