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

Commit 28117e06 authored by Chong Zhang's avatar Chong Zhang Committed by android-build-merger
Browse files

Wallpaper target selection during animation am: b0d26704

am: f74e7ee4

Change-Id: Iacf65c88743cdbd2b40cfee0be4ba844fb122be8
parents 2f2d490e f74e7ee4
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ class AppWindowToken extends WindowToken {
    }

    void clearAnimatingFlags() {
        boolean wallpaperMightChange = false;
        for (int i = allAppWindows.size() - 1; i >= 0; i--) {
            final WindowState win = allAppWindows.get(i);
            // We don't want to clear it out for windows that get replaced, because the
@@ -350,7 +351,6 @@ class AppWindowToken extends WindowToken {
            // by the client. We should let animation proceed and not clear this flag or
            // they won't eventually be removed by WindowStateAnimator#finishExit.
            if (!win.mWillReplaceWindow && !win.mRemoveOnExit) {
                win.mAnimatingExit = false;
                // Clear mAnimating flag together with mAnimatingExit. When animation
                // changes from exiting to entering, we need to clear this flag until the
                // new animation gets applied, so that isAnimationStarting() becomes true
@@ -358,16 +358,25 @@ class AppWindowToken extends WindowToken {
                // Otherwise applySurfaceChangesTransaction will faill to skip surface
                // placement for this window during this period, one or more frame will
                // show up with wrong position or scale.
                if (win.mAnimatingExit) {
                    win.mAnimatingExit = false;
                    wallpaperMightChange = true;
                }
                if (win.mWinAnimator.mAnimating) {
                    win.mWinAnimator.mAnimating = false;

                    wallpaperMightChange = true;
                }
                if (win.mDestroying) {
                    win.mDestroying = false;
                    service.mDestroySurface.remove(win);
                    wallpaperMightChange = true;
                }
            }
        }
        if (wallpaperMightChange) {
            requestUpdateWallpaperIfNeeded();
        }
    }

    void destroySurfaces() {
        destroySurfaces(false /*cleanupOnResume*/);
+21 −9
Original line number Diff line number Diff line
@@ -586,9 +586,14 @@ class WallpaperController {
                    if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG,
                            "New i: " + wallpaperTargetIndex + " old i: " + oldI);
                    if (oldI >= 0) {
                        if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG,
                                "Animating wallpapers: old#" + oldI + "=" + oldW + "; new#"
                                + wallpaperTargetIndex + "=" + wallpaperTarget);
                        final boolean newTargetHidden =
                                wallpaperTarget.mAppToken != null && wallpaperTarget.mAppToken.hiddenRequested;
                        final boolean oldTargetHidden =
                                oldW.mAppToken != null && oldW.mAppToken.hiddenRequested;
                        if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "Animating wallpapers:"
                                + " old#" + oldI + "=" + oldW + " hidden=" + oldTargetHidden
                                + " new#" + wallpaperTargetIndex + "=" + wallpaperTarget
                                + " hidden=" + newTargetHidden);

                        // Set the upper and lower wallpaper targets correctly,
                        // and make sure that we are positioning the wallpaper below the lower.
@@ -598,6 +603,7 @@ class WallpaperController {
                                    "Found target above old target.");
                            mUpperWallpaperTarget = wallpaperTarget;
                            mLowerWallpaperTarget = oldW;

                            wallpaperTarget = oldW;
                            wallpaperTargetIndex = oldI;
                        } else {
@@ -607,15 +613,21 @@ class WallpaperController {
                            mUpperWallpaperTarget = oldW;
                            mLowerWallpaperTarget = wallpaperTarget;
                        }

                        // If the new target is going hidden, set it back to the old target.
                        if (wallpaperTarget.mAppToken != null
                                && wallpaperTarget.mAppToken.hiddenRequested) {
                        if (newTargetHidden && !oldTargetHidden) {
                            if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG,
                                    "Old wallpaper still the target.");
                            // Use the old target if new target is hidden but old target
                            // is not. If they're both hidden, still use the new target.
                            mWallpaperTarget = oldW;
                        } else if (newTargetHidden == oldTargetHidden
                                && !mService.mOpeningApps.contains(wallpaperTarget.mAppToken)
                                    && (mService.mOpeningApps.contains(oldW.mAppToken)
                                    || mService.mClosingApps.contains(oldW.mAppToken))) {
                            // If they're both hidden (or both not hidden), prefer the one that's
                            // currently in opening or closing app list, this allows transition
                            // selection logic to better determine the wallpaper status of
                            // opening/closing apps.
                            mWallpaperTarget = oldW;
                            wallpaperTarget = oldW;
                            wallpaperTargetIndex = oldI;
                        }
                    }
                }