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

Commit 3cd48043 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Set-up dummy animation when setting a replacing window token

Set-up dummy animation so we can start treating windows associated
with the replacing app token like they are in transition before the
new app window is ready for us to run the real transition animation.
This allows us to make the right decisions at various call points
where an animation is expected to be running for a replacing window
but the real animation isn't set yet.

Also, removed unused field indicating if an app token is animating
a replacement window since it was always set to true and checked/set
to the same value as AppWindowToken.mWillReplaceWindow.

Bug: 25645069
Change-Id: Ie216ed5bd60fb2a15da61c7050c9344c48b1c5fb
parent 16b83907
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -3354,11 +3354,10 @@ public final class ActivityStackSupervisor implements DisplayListener {
            // preserve the old window until the new one is drawn. This prevents having a gap
            // between the removal and addition, in which no window is visible. We also want the
            // entrance of the new window to be properly animated.
            mWindowManager.setReplacingWindow(topActivity.appToken, true /* animate */);
            mWindowManager.setReplacingWindow(topActivity.appToken);
        }
        final ActivityStack stack =
                moveTaskToStackUncheckedLocked(task, stackId, toTop, forceFocus,
                        "moveTaskToStack:" + reason);
        final ActivityStack stack = moveTaskToStackUncheckedLocked(
                task, stackId, toTop, forceFocus, "moveTaskToStack:" + reason);

        // Make sure the task has the appropriate bounds/size for the stack it is in.
        if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) {
+0 −2
Original line number Diff line number Diff line
@@ -128,8 +128,6 @@ class AppWindowToken extends WindowToken {
    boolean mWillReplaceWindow;
    // If true, the replaced window was already requested to be removed.
    boolean mReplacingRemoveRequested;
    // Whether the replacement of the window should trigger app transition animation.
    boolean mAnimateReplacingWindow;
    // If not null, the window that will be used to replace the old one. This is being set when
    // the window is added and unset when this window reports its first draw.
    WindowState mReplacingWindow;
+10 −6
Original line number Diff line number Diff line
@@ -2077,7 +2077,7 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    private void prepareWindowReplacementTransition(AppWindowToken atoken) {
        if (atoken == null || !atoken.mWillReplaceWindow || !atoken.mAnimateReplacingWindow) {
        if (atoken == null || !atoken.mWillReplaceWindow) {
            return;
        }
        atoken.allDrawn = false;
@@ -8585,8 +8585,7 @@ public class WindowManagerService extends IWindowManager.Stub
            } else if (wtoken != null) {
                winAnimator.mAnimLayer =
                        w.mLayer + wtoken.mAppAnimator.animLayerAdjustment;
                if (wtoken.mWillReplaceWindow && wtoken.mAnimateReplacingWindow &&
                        wtoken.mReplacingWindow != w) {
                if (wtoken.mWillReplaceWindow && wtoken.mReplacingWindow != w) {
                    // We know that we will be animating a relaunching window in the near future,
                    // which will receive a z-order increase. We want the replaced window to
                    // immediately receive the same treatment, e.g. to be above the dock divider.
@@ -10126,9 +10125,8 @@ public class WindowManagerService extends IWindowManager.Stub
     * Hint to a token that its activity will relaunch, which will trigger removal and addition of
     * a window.
     * @param token Application token for which the activity will be relaunched.
     * @param animate Whether to animate the addition of the new window.
     */
    public void setReplacingWindow(IBinder token, boolean animate) {
    public void setReplacingWindow(IBinder token) {
        synchronized (mWindowMap) {
            AppWindowToken appWindowToken = findAppWindowToken(token);
            if (appWindowToken == null) {
@@ -10139,7 +10137,13 @@ public class WindowManagerService extends IWindowManager.Stub
                    + " as replacing window.");
            appWindowToken.mWillReplaceWindow = true;
            appWindowToken.mHasReplacedWindow = false;
            appWindowToken.mAnimateReplacingWindow = animate;

            // Set-up dummy animation so we can start treating windows associated with this token
            // like they are in transition before the new app window is ready for us to run the
            // real transition animation.
            if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
                    "setReplacingWindow() Setting dummy animation on: " + appWindowToken);
            appWindowToken.mAppAnimator.setDummyAnimation();
        }
    }

+0 −1
Original line number Diff line number Diff line
@@ -1388,7 +1388,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
                && token.mHasReplacedWindow) {
            if (DEBUG_ADD_REMOVE) Slog.d(TAG, "Removing replacing window: " + this);
            token.mWillReplaceWindow = false;
            token.mAnimateReplacingWindow = false;
            token.mReplacingRemoveRequested = false;
            token.mReplacingWindow = null;
            token.mHasReplacedWindow = false;