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

Commit df7c2e4d authored by Jacky Kao's avatar Jacky Kao
Browse files

Fix no correct window observer of an embedded display

The window observer of an embedded display could not be set to the
window observer of its parent display if the activity on it launched
before A11y service on. Doing this mapping to make sure the behavior
on embedded display could be correct when this situation happened.

Bug: 143113272
Test: a11y CTS & unit tests
Test: manual testing
Change-Id: Ic00a752db421179d80439662f69d0cfa1f28254a
parent 324eb4df
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -132,18 +132,21 @@ final class AccessibilityController {
                return false;
            }

            if (mWindowsForAccessibilityObserver.get(displayId) != null) {
            final Display display = dc.getDisplay();
            if (display.getType() == Display.TYPE_VIRTUAL && dc.getParentWindow() != null) {
                    // The window observer of this embedded display had been set from
                    // window manager after setting its parent window.
                // If this display is an embedded one, its window observer should have been set from
                // window manager after setting its parent window. But if its window observer is
                // empty, that means this mapping didn't be set, and needs to do this again.
                // This happened when accessibility window observer is disabled and enabled again.
                if (mWindowsForAccessibilityObserver.get(displayId) == null) {
                    handleWindowObserverOfEmbeddedDisplayLocked(displayId, dc.getParentWindow());
                }
                return false;
                } else {
            } else if (mWindowsForAccessibilityObserver.get(displayId) != null) {
                throw new IllegalStateException(
                        "Windows for accessibility callback of display "
                                + displayId + " already set!");
            }
            }
            mWindowsForAccessibilityObserver.put(displayId,
                    new WindowsForAccessibilityObserver(mService, displayId, callback));
        } else {