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

Commit 2465038b authored by Matt Sziklay's avatar Matt Sziklay Committed by Android (Google) Code Review
Browse files

Merge "Reverse the iteration order for focus check." into main

parents 80094cc2 9451dd4d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -888,7 +888,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;