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

Commit eeb90eea authored by Robin Lee's avatar Robin Lee Committed by Cherrypicker Worker
Browse files

Send WallpaperToken visibility to SyncTransaction

Since we commit wallpaper token visibility at the WindowToken level at
the end of transitions we also need to commit wallpaper token visibility
at times when we are not sending a transition too - this is mostly just
the case for when the display is off.

Flag: com.android.window.flags.ensure_wallpaper_in_transitions
Bug: 347593088
Bug: 298186160
Bug: 303010980
Test: atest FlickerTestsAppLaunch2
Test: atest ShellTransitionTests
Test: atest CtsWallpaperTestCases
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:21d99405899f22b99d29654f040eb54211e403f9)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:fb8be370d149c8048582bee76586cf55309e85f0)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:0ff0d1ca8e210b850a02f1c44b60f454496cc0ca)
Merged-In: I2bf9f964ded54cfd1b9e328a5d4a6362ee66d45c
Change-Id: I2bf9f964ded54cfd1b9e328a5d4a6362ee66d45c
parent 7c3c33a2
Loading
Loading
Loading
Loading
+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
@@ -61,6 +61,7 @@ import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

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

import java.io.PrintWriter;
@@ -370,9 +371,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 + ": "
@@ -427,7 +432,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.