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

Commit b23c46a6 authored by Evan Rosky's avatar Evan Rosky
Browse files

Set visibleRequested false on wallpapers that are going away

visibleRequested isn't being used properly in wallpaper logic.
Because wallpaper logic deviates so far from activity, fixing
it properly will take time. In the mean-time, we can just set
visibleRequested upon transition readiness so that it is at-
least included in the transition properly.

Bug: 350617801
Flag: com.android.window.flags.ensure_wallpaper_in_transitions
Test: open any app from launcher and observe transitionInfo
Change-Id: Ibc149a038a79273b1179f8ea157b1e87234b1e8b
parent 5627a898
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -2125,6 +2125,16 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        }
    }

    /**

     * Wallpaper will set itself as target if it wants to keep itself visible without a target.
     */
    private static boolean wallpaperIsOwnTarget(WallpaperWindowToken wallpaper) {
        final WindowState target =
                wallpaper.getDisplayContent().mWallpaperController.getWallpaperTarget();
        return target != null && target.isDescendantOf(wallpaper);
    }

    /**
     * Reset waitingToshow for all wallpapers, and commit the visibility of the visible ones
     */
@@ -2133,8 +2143,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        for (int i = mParticipants.size() - 1; i >= 0; --i) {
            final WallpaperWindowToken wallpaper = mParticipants.valueAt(i).asWallpaperToken();
            if (wallpaper != null) {
                if (!wallpaper.isVisible() && wallpaper.isVisibleRequested()) {
                if (!wallpaper.isVisible() && (wallpaper.isVisibleRequested()
                        || (Flags.ensureWallpaperInTransitions() && showWallpaper))) {
                    wallpaper.commitVisibility(showWallpaper);
                } else if (Flags.ensureWallpaperInTransitions() && wallpaper.isVisible()
                        && !showWallpaper && !wallpaper.getDisplayContent().isKeyguardLocked()
                        && !wallpaperIsOwnTarget(wallpaper)) {
                    wallpaper.setVisibleRequested(false);
                }
                if (showWallpaper && Flags.ensureWallpaperInTransitions()
                        && wallpaper.isVisibleRequested()
@@ -2556,11 +2571,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            if (wc.asWindowState() != null) continue;

            final ChangeInfo changeInfo = changes.get(wc);
            // Reject no-ops, unless wallpaper
            if (!changeInfo.hasChanged()
                    && (!Flags.ensureWallpaperInTransitions() || wc.asWallpaperToken() == null)) {
            // Reject no-ops
            if (!changeInfo.hasChanged()) {
                ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
                        "  Rejecting as no-op: %s", wc);
                        "  Rejecting as no-op: %s  vis: %b", wc, wc.isVisibleRequested());
                continue;
            }
            targets.add(changeInfo);