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

Commit 72669d18 authored by Craig Mautner's avatar Craig Mautner
Browse files

Fixes to clean up icon launching during animations.

Several problems were causing animations to jump to the end when
launching an app while a previous app was animating away.

- Keep the two app token lists in tighter synch. These were separated
when we hoped to completely separate layout form animation. This is
not as critical a goal any more.

- Use new test criteria for starting and stopping animations.

Bug 7885350 fixed.

Change-Id: Ib679117f627d0957cda17cc6ffca2bc2cdd6ecdd
parent 5b88cd72
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -58,9 +58,9 @@ public class AppWindowAnimator {
    }

    public void setAnimation(Animation anim, int width, int height) {
        if (WindowManagerService.localLOGV) Slog.v(
            TAG, "Setting animation in " + mAppToken + ": " + anim
                    + " wxh=" + width + "x" + height);
        if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting animation in " + mAppToken
                + ": " + anim + " wxh=" + width + "x" + height
                + " isVisible=" + mAppToken.isVisible());
        animation = anim;
        animating = false;
        if (!anim.isInitialized()) {
@@ -82,16 +82,17 @@ public class AppWindowAnimator {
        }
        // Start out animation gone if window is gone, or visible if window is visible.
        transformation.clear();
        transformation.setAlpha(mAppToken.reportedVisible ? 1 : 0);
        transformation.setAlpha(mAppToken.isVisible() ? 1 : 0);
        hasTransformation = true;
    }

    public void setDummyAnimation() {
        if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting dummy animation in " + mAppToken);
        if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting dummy animation in " + mAppToken
                + " isVisible=" + mAppToken.isVisible());
        animation = sDummyAnimation;
        hasTransformation = true;
        transformation.clear();
        transformation.setAlpha(mAppToken.reportedVisible ? 1 : 0);
        transformation.setAlpha(mAppToken.isVisible() ? 1 : 0);
    }

    public void clearAnimation() {
+16 −0
Original line number Diff line number Diff line
@@ -223,6 +223,22 @@ class AppWindowToken extends WindowToken {
        return null;
    }

    boolean isVisible() {
        final int N = allAppWindows.size();
        // TODO: Consider using allDrawn instead of a single window.
        for (int i=0; i<N; i++) {
            WindowState win = allAppWindows.get(i);
            if (!win.mAppFreezing
                    && (win.mViewVisibility == View.VISIBLE ||
                        (win.mWinAnimator.isAnimating() &&
                                !service.mAppTransition.isTransitionSet()))
                    && !win.mDestroying && win.isDrawnLw()) {
                return true;
            }
        }
        return false;
    }

    @Override
    void dump(PrintWriter pw, String prefix) {
        super.dump(pw, prefix);
+9 −15
Original line number Diff line number Diff line
@@ -4476,8 +4476,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if (DEBUG_TOKEN_MOVEMENT || DEBUG_REORDER) Slog.v(TAG,
                    "Start moving token " + wtoken + " initially at "
                    + oldIndex);
            if (oldIndex > index && mAppTransition.isTransitionSet()
                    && !mAppTransition.isRunning()) {
            if (oldIndex > index && mAppTransition.isTransitionSet()) {
                // animation towards back has not started, copy old list for duration of animation.
                mAnimatingAppTokens.clear();
                mAnimatingAppTokens.addAll(mAppTokens);
@@ -4491,7 +4490,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if (DEBUG_REORDER) Slog.v(TAG, "Moved " + token + " to " + index + ":");
            else if (DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "Moved " + token + " to " + index);
            if (DEBUG_REORDER) dumpAppTokensLocked();
            if (!mAppTransition.isTransitionSet() && !mAppTransition.isRunning()) {
            if (!mAppTransition.isTransitionSet()) {
                // Not animating, bring animating app list in line with mAppTokens.
                mAnimatingAppTokens.clear();
                mAnimatingAppTokens.addAll(mAppTokens);
@@ -4612,12 +4611,10 @@ public class WindowManagerService extends IWindowManager.Stub
                }
            }

            if (!mAppTransition.isRunning()) {
            mAnimatingAppTokens.clear();
            mAnimatingAppTokens.addAll(mAppTokens);
            moveAppWindowsLocked(tokens, mAppTokens.size());
        }
        }
        Binder.restoreCallingIdentity(origId);
    }

@@ -4631,7 +4628,7 @@ public class WindowManagerService extends IWindowManager.Stub
        final long origId = Binder.clearCallingIdentity();
        synchronized(mWindowMap) {
            final int N = tokens.size();
            if (N > 0 && !mAppTransition.isRunning()) {
            if (N > 0) {
                // animating towards back, hang onto old list for duration of animation.
                mAnimatingAppTokens.clear();
                mAnimatingAppTokens.addAll(mAppTokens);
@@ -4651,12 +4648,10 @@ public class WindowManagerService extends IWindowManager.Stub
                }
            }

            if (!mAppTransition.isRunning()) {
            mAnimatingAppTokens.clear();
            mAnimatingAppTokens.addAll(mAppTokens);
            moveAppWindowsLocked(tokens, 0);
        }
        }
        Binder.restoreCallingIdentity(origId);
    }

@@ -7949,7 +7944,6 @@ public class WindowManagerService extends IWindowManager.Stub
                final AppWindowAnimator appAnimator = wtoken.mAppAnimator;
                if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Now opening app" + wtoken);
                appAnimator.clearThumbnail();
                wtoken.reportedVisible = false;
                wtoken.inPendingTransaction = false;
                appAnimator.animation = null;
                setTokenVisibilityLocked(wtoken, animLp, true, transit, false);
+1 −1
Original line number Diff line number Diff line
@@ -1223,7 +1223,7 @@ class WindowStateAnimator {
        if (mIsWallpaper && !mWin.mWallpaperVisible) {
            // Wallpaper is no longer visible and there is no wp target => hide it.
            hide();
        } else if (w.mAttachedHidden || !w.isReadyForDisplay()) {
        } else if (w.mAttachedHidden || !w.isOnScreen()) {
            hide();
            mAnimator.hideWallpapersLocked(w);