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

Commit 21d99405 authored by Robin Lee's avatar Robin Lee
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
Change-Id: I2bf9f964ded54cfd1b9e328a5d4a6362ee66d45c
parent 0c543465
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
@@ -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.