From 355cc15c17e209cb5c78c98b2ab259ab9153c53e Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 16 May 2022 20:34:16 +0800 Subject: [PATCH] Reduce unnecessary redraw of wallpaper with shell transition Wallpaper only needs to draw once in most of cases. It usually only changes visibility, so the redraw doesn't make any effect but the latency. This may reduce ~20ms latency while swiping up to recents with shell transition. Also limit adjustWallpaperWindows for shell rotation in ensureActivitiesVisible, because only shell rotation needs to capture a closing state of wallpaper. Bug: 231435331 Test: adb shell setprop persist.wm.debug.shell_transit 1; reboot adb shell wm logging enable-text WM_DEBUG_DRAW Swipe to recents and check there is no log "finishDrawing" of wallpaper. Change-Id: Iee1bed1ebee986c096f930759571eb147abad56d --- .../core/java/com/android/server/wm/DisplayContent.java | 3 ++- services/core/java/com/android/server/wm/Transition.java | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 1f73a784932e6..2dc163c96bfb1 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -6080,7 +6080,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp rootTask.ensureActivitiesVisible(starting, configChanges, preserveWindows, notifyClients); }); - if (mTransitionController.isCollecting() + if (mTransitionController.useShellTransitionsRotation() + && mTransitionController.isCollecting() && mWallpaperController.getWallpaperTarget() != null) { // Also update wallpapers so that their requestedVisibility immediately reflects // the changes to activity visibility. diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index d5acf4fed330b..56afc07909480 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -299,7 +299,12 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe } } if (mParticipants.contains(wc)) return; - mSyncEngine.addToSyncSet(mSyncId, wc); + // Wallpaper is like in a static drawn state unless display may have changes, so exclude + // the case to reduce transition latency waiting for the unchanged wallpaper to redraw. + final boolean needSyncDraw = !isWallpaper(wc) || mParticipants.contains(wc.mDisplayContent); + if (needSyncDraw) { + mSyncEngine.addToSyncSet(mSyncId, wc); + } ChangeInfo info = mChanges.get(wc); if (info == null) { info = new ChangeInfo(wc);