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

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

Fix flaky test at AccessibilityEmbeddedDisplayTest

When starting to track a display, the display's DisplayWindowsObserver
doesn't need to be used and put into sparse array if it is an embedded
display. Then when getting all windows on all displays, this kind of
embedded display won't be accounted into the display lists, and could
fix this flaky issue.

Bug: 142615729
Test: a11y CTS & unit tests
Test: atest AccessibilityEmbeddedDisplayTest -v -- --retry-strategy
 ITERATIONS --max-testcase-run-count 20
Test: Forrest Run 20 times

Change-Id: I1495848ab71162c7a6b19e946c138f4714154679
parent b44570bc
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -116,6 +116,14 @@ final class AccessibilityController {
        return result;
    }

    /**
     * Sets a callback for observing which windows are touchable for the purposes
     * of accessibility on specified display.
     *
     * @param displayId The logical display id.
     * @param callback The callback.
     * @return {@code false} if display id is not valid or an embedded display.
     */
    public boolean setWindowsForAccessibilityCallbackLocked(int displayId,
            WindowsForAccessibilityCallback callback) {
        if (callback != null) {
@@ -129,7 +137,7 @@ final class AccessibilityController {
                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.
                    return true;
                    return false;
                } else {
                    throw new IllegalStateException(
                            "Windows for accessibility callback of display "
+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ public abstract class WindowManagerInternal {
     *
     * @param displayId The logical display id.
     * @param callbacks The callbacks to invoke.
     * @return {@code false} if display id is not valid.
     * @return {@code false} if display id is not valid or an embedded display.
     */
    public abstract boolean setMagnificationCallbacks(int displayId,
            @Nullable MagnificationCallbacks callbacks);