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

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

Fixes the wrong layer order of the windows

When removing some embedded windows from the WindowInfo list, the
layer order of each window in the list becomes incorrect. So we
need to re-order the layer of each window in the list.

Bug: 225287307
Test: a11y CTS & unit tests
Change-Id: If3166cc101eac6454ec9aef5de51e39dd7cb320c
parent dced8d4a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -553,12 +553,17 @@ public class AccessibilityWindowManager {
                shouldClearAccessibilityFocus = mAccessibilityFocusedWindowId
                    != AccessibilityWindowInfo.UNDEFINED_WINDOW_ID;
            }

            boolean hasWindowIgnore = false;
            if (windowCount > 0) {
                for (int i = 0; i < windowCount; i++) {
                    final WindowInfo windowInfo = windows.get(i);
                    final AccessibilityWindowInfo window;
                    if (mTrackingWindows) {
                        window = populateReportedWindowLocked(userId, windowInfo);
                        if (window == null) {
                            hasWindowIgnore = true;
                        }
                    } else {
                        window = null;
                    }
@@ -587,6 +592,13 @@ public class AccessibilityWindowManager {
                    }
                }
                final int accessibilityWindowCount = mWindows.size();
                // Re-order the window layer of all windows in the windows list because there's
                // window not been added into the windows list.
                if (hasWindowIgnore) {
                    for (int i = 0; i < accessibilityWindowCount; i++) {
                        mWindows.get(i).setLayer(accessibilityWindowCount - 1 - i);
                    }
                }
                if (isTopFocusedDisplay) {
                    if (mTouchInteractionInProgress && activeWindowGone) {
                        mActiveWindowId = mTopFocusedWindowId;