From 4b89e85c438077ece4ca38d743d06a2004768cd1 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Thu, 5 May 2022 23:00:47 +0800 Subject: [PATCH] Avoid extra force-relayout for sync The related steps of launching app with shell transition: 1. Set sync state 2. Start/resume the app 3. Add app or starting window and calls relayoutWindow 4. relayoutWindow - performSurfacePlacement - updateResizingWindowIfNeeded - Return sync id because sync state was set 5. The client finishes drawing with sync draw transaction If updateResizingWindowIfNeeded still includes the window to redraw, there will be extra non-sync relayoutWindow/finishDrawing, because the sync seq id doesn't increase. That is unnecessary cost. Bug: 231435331 Test: Enable shell transition. While cold/warm/hot launch app or swipe to recents, the 2nd doFrame of app window should not call relayoutWindow. Change-Id: I6faad4b9adac7334df7caf3d23df59bd3e96bfd9 --- services/core/java/com/android/server/wm/WindowState.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index d5c07aff2a5c3..3e0ed32eb3c98 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -6043,6 +6043,11 @@ class WindowState extends WindowContainer implements WindowManagerP if (mRedrawForSyncReported) { return false; } + if (mInRelayout) { + // The last sync seq id will return to the client, so there is no need to request the + // client to redraw. + return false; + } return useBLASTSync(); }