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

Commit 0c543465 authored by Robin Lee's avatar Robin Lee
Browse files

Set up show/hide in startT/finishT for wallpapers

Historically wallpapers weren't specially animated showing/hiding in
shell transitions because the system server would unilaterally update
wallpaper visibility according to the instantaneous request from visible
windows.

As we can have more than one wallpaper window now, and also as we play
some show/hide animations from shell instead of core, setting up the
visibility in sync with startT and finishT prevents flickers in the
handover between shell and core due to reparenting out of leashes at
the end of the animation.

Flag: com.android.window.flags.ensure_wallpaper_in_transitions
Test: atest FlickerTestsAppLaunch2
Test: atest ShellTransitionTests
Bug: 347593088
Bug: 298186160
Change-Id: Ic0524c97f2922437d7ab20fcaa279aa5793ab7ec
parent 26c01fe0
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -28,12 +28,15 @@ import static android.view.WindowManager.TRANSIT_SLEEP;
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.FLAGS_IS_NON_APP_WINDOW;
import static android.window.TransitionInfo.FLAG_BACK_GESTURE_ANIMATED;
import static android.window.TransitionInfo.FLAG_IS_BEHIND_STARTING_WINDOW;
import static android.window.TransitionInfo.FLAG_IS_OCCLUDED;
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
import static android.window.TransitionInfo.FLAG_NO_ANIMATION;
import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT;

import static com.android.window.flags.Flags.ensureWallpaperInTransitions;
import static com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary;
import static com.android.wm.shell.shared.TransitionUtil.isClosingType;
import static com.android.wm.shell.shared.TransitionUtil.isOpeningType;
@@ -519,12 +522,17 @@ public class Transitions implements RemoteCallable<Transitions>,
        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.hasFlags(TransitionInfo.FLAGS_IS_NON_APP_WINDOW)) {
            if (change.hasFlags(FLAGS_IS_NON_APP_WINDOW & ~FLAG_IS_WALLPAPER)) {
                // Currently system windows are controlled by WindowState, so don't change their
                // 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.
                // This includes IME (associated with app), because there may not be a transition
                // associated with their visibility changes, and currently they don't need a
                // transition animation.
                continue;
            }
            if (change.hasFlags(FLAG_IS_WALLPAPER) && !ensureWallpaperInTransitions()) {
                // Wallpaper is always z-ordered at bottom, and historically is not animated by
                // transition handlers.
                continue;
            }
            final SurfaceControl leash = change.getLeash();