From 0cf6a2a28d8b132c0b2650ad92f62348991c08dd Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 8 Nov 2022 18:11:27 +0800 Subject: [PATCH] Skip setting surface start state of non app window Currently wallpaper and IME don't have transition animation in shell, and may not always change with transition. So skip all operation of their surfaces to avoid unexpected crop or visibility. Bug: 258156220 Test: Enable shell transition, swipe up landscape app. Change-Id: I5b9b5183e664b85861a48048bc471349347446ce --- .../wm/shell/transition/Transitions.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index 2830fa967011f..857decf65567f 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -24,7 +24,6 @@ import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManager.fixScale; -import static android.window.TransitionInfo.FLAG_IS_INPUT_METHOD; import static android.window.TransitionInfo.FLAG_IS_OCCLUDED; import static android.window.TransitionInfo.FLAG_IS_WALLPAPER; import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT; @@ -333,9 +332,12 @@ public class Transitions implements RemoteCallable { boolean isOpening = isOpeningType(info.getType()); for (int i = info.getChanges().size() - 1; i >= 0; --i) { final TransitionInfo.Change change = info.getChanges().get(i); - if ((change.getFlags() & TransitionInfo.FLAG_IS_SYSTEM_WINDOW) != 0) { + if (change.hasFlags(TransitionInfo.FLAGS_IS_NON_APP_WINDOW)) { // Currently system windows are controlled by WindowState, so don't change their - // surfaces. Otherwise their window tokens could be hidden unexpectedly. + // surfaces. Otherwise their surfaces could be hidden or cropped unexpectedly. + // This includes Wallpaper (always z-ordered at bottom) and IME (associated with + // app), because there may not be a transition associated with their visibility + // changes, and currently they don't need transition animation. continue; } final SurfaceControl leash = change.getLeash(); @@ -372,16 +374,7 @@ public class Transitions implements RemoteCallable { finishT.setAlpha(leash, 1.f); } } else if (mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK) { - // Wallpaper/IME are anomalies: their visibility is tied to other WindowStates. - // As a result, we actually can't hide their WindowTokens because there may not be a - // transition associated with them becoming visible again. Fortunately, since - // wallpapers are always z-ordered to the back, we don't have to worry about it - // flickering to the front during reparenting. Similarly, the IME is reparented to - // the associated app, so its visibility is coupled. So, an explicit hide is not - // needed visually anyways. - if ((change.getFlags() & (FLAG_IS_WALLPAPER | FLAG_IS_INPUT_METHOD)) == 0) { - finishT.hide(leash); - } + finishT.hide(leash); } } }