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

Commit 659fb5a5 authored by Nicolò Mazzucato's avatar Nicolò Mazzucato Committed by Android (Google) Code Review
Browse files

Merge "Force report resizing after window token is reparented" into main

parents ea91d37c 473cd952
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -3161,6 +3161,11 @@ public class WindowManagerService extends IWindowManager.Stub
                    // Reparent the window created for this window context.
                    // Reparent the window created for this window context.
                    dc.reParentWindowToken(token);
                    dc.reParentWindowToken(token);
                    hideUntilNextDraw(token);
                    hideUntilNextDraw(token);
                    // Prevent a race condition where VRI temporarily reverts the context display ID
                    // before the onDisplayMoved callback arrives. This caused incorrect display IDs
                    // during configuration changes, breaking SysUI layouts dependent on it.
                    // Forcing a resize report ensures VRI has the correct ID before the update.
                    forceReportResizing(token);
                    // This makes sure there is a traversal scheduled that will eventually report
                    // This makes sure there is a traversal scheduled that will eventually report
                    // the window resize to the client.
                    // the window resize to the client.
                    dc.setLayoutNeeded();
                    dc.setLayoutNeeded();
@@ -3182,6 +3187,14 @@ public class WindowManagerService extends IWindowManager.Stub
        }
        }
    }
    }


    private void forceReportResizing(@NonNull WindowContainer<?> wc) {
        wc.forAllWindows(w -> {
            if (!mResizingWindows.contains(w)) {
                mResizingWindows.add(w);
            }
        }, true /* traverseTopToBottom */);
    }

    private void hideUntilNextDraw(@NonNull WindowToken token) {
    private void hideUntilNextDraw(@NonNull WindowToken token) {
        final WindowState topChild = token.getTopChild();
        final WindowState topChild = token.getTopChild();
        if (topChild != null) {
        if (topChild != null) {