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

Commit 7c3c1a32 authored by Robin Lee's avatar Robin Lee Committed by Android (Google) Code Review
Browse files

Merge changes I2bf9f964,Ic0524c97 into main

* changes:
  Send WallpaperToken visibility to SyncTransaction
  Set up show/hide in startT/finishT for wallpapers
parents 10d9ef8c 21d99405
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();
+15 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.os.RemoteException;
import android.util.SparseArray;

import com.android.internal.protolog.common.ProtoLog;
import com.android.window.flags.Flags;

import java.util.function.Consumer;

@@ -80,6 +81,20 @@ class WallpaperWindowToken extends WindowToken {
        mDisplayContent.mWallpaperController.removeWallpaperToken(this);
    }

    @Override
    public void prepareSurfaces() {
        super.prepareSurfaces();

        if (Flags.ensureWallpaperInTransitions()) {
            // Similar to Task.prepareSurfaces, outside of transitions we need to apply visibility
            // changes directly. In transitions the transition player will take care of applying the
            // visibility change.
            if (!mTransitionController.inTransition(this)) {
                getSyncTransaction().setVisibility(mSurfaceControl, isVisible());
            }
        }
    }

    /**
     * Controls whether this wallpaper shows underneath the keyguard or is hidden and only
     * revealed once keyguard is dismissed.
+11 −4
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import android.view.animation.AnimationUtils;

import com.android.internal.protolog.common.LogLevel;
import com.android.internal.protolog.common.ProtoLog;
import com.android.window.flags.Flags;
import com.android.server.policy.WindowManagerPolicy;

import java.io.PrintWriter;
@@ -374,9 +375,13 @@ class WindowStateAnimator {
            ProtoLog.i(WM_SHOW_SURFACE_ALLOC, "SURFACE DESTROY: %s. %s",
                    mWin, new RuntimeException().fillInStackTrace());
            destroySurface(t);
            // Don't hide wallpaper if we're deferring the surface destroy
            // because of a surface change.
            if (Flags.ensureWallpaperInTransitions()) {
                if (mWallpaperControllerLocked.isWallpaperTarget(mWin)) {
                    mWin.requestUpdateWallpaperIfNeeded();
                }
            } else {
                mWallpaperControllerLocked.hideWallpapers(mWin);
            }
        } catch (RuntimeException e) {
            Slog.w(TAG, "Exception thrown when destroying Window " + this
                    + " surface " + mSurfaceController + " session " + mSession + ": "
@@ -431,7 +436,9 @@ class WindowStateAnimator {

        if (!w.isOnScreen()) {
            hide(t, "prepareSurfaceLocked");
            if (!w.mIsWallpaper || !Flags.ensureWallpaperInTransitions()) {
                mWallpaperControllerLocked.hideWallpapers(w);
            }

            // If we are waiting for this window to handle an orientation change. If this window is
            // really hidden (gone for layout), there is no point in still waiting for it.