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

Commit 9451dd4d authored by mattsziklay's avatar mattsziklay
Browse files

Reverse the iteration order for focus check.

Iterates the SparseArray of window decors in reverse order when
searching for focused task. This avoids an issue where the decor of a
closed task that has the isFocused flag set to true is found, preventing
fullscreen tasks from being dragged into desktop.

Bug: 296921167
Test: Manual; open a test app via studio, lock the screen, open the same
test app through studio again. Confirm drag to desktop works after doing
this.

Change-Id: I64ff0414e38109fb15905d37cf7cb7d7ec4ead5a
parent ebdb4991
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -877,7 +877,10 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
    private DesktopModeWindowDecoration getFocusedDecor() {
        final int size = mWindowDecorByTaskId.size();
        DesktopModeWindowDecoration focusedDecor = null;
        for (int i = 0; i < size; i++) {
        // TODO(b/323251951): We need to iterate this in reverse to avoid potentially getting
        //  a decor for a closed task. This is a short term fix while the core issue is addressed,
        //  which involves refactoring the window decor lifecycle to be visibility based.
        for (int i = size - 1; i >= 0; i--) {
            final DesktopModeWindowDecoration decor = mWindowDecorByTaskId.valueAt(i);
            if (decor != null && decor.isFocused()) {
                focusedDecor = decor;