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

Commit db20b5f7 authored by Chong Zhang's avatar Chong Zhang
Browse files

Use saved window surface to start entering animation

When app is paused, keep the window surface around. Use it to start
enter animation if size remains unchanged on next launch.

bug: 19940527
Change-Id: Icf88d81f08b59e8bd946e410611f5098b253eb10
parent ac7062e7
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -2876,13 +2876,16 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }

        if (stackId != task.stack.mStackId) {
            moveTaskToStackUncheckedLocked(task, stackId, ON_TOP, FORCE_FOCUS, reason);
        } else {
            task.stack.moveTaskToFrontLocked(task, false /* noAnimation */, options,
                task.getTopActivity() == null ? null : task.getTopActivity().appTimeTracker,
                reason);
            moveTaskToStackUncheckedLocked(task, stackId, ON_TOP, !FORCE_FOCUS, reason);

            // moveTaskToStackUncheckedLocked() should already placed the task on top,
            // still need moveTaskToFrontLocked() below for any transition settings.
        }

        final ActivityRecord r = task.getTopActivity();
        task.stack.moveTaskToFrontLocked(task, false /* noAnimation */, options,
                r == null ? null : r.appTimeTracker, reason);

        if (DEBUG_STACK) Slog.d(TAG_STACK,
                "findTaskToMoveToFront: moved to front of stack=" + task.stack);
    }
+2 −1
Original line number Diff line number Diff line
@@ -300,7 +300,8 @@ public class AppWindowAnimator {
                return false;
            }

            if ((mAppToken.allDrawn || animating || mAppToken.startingDisplayed)
            if ((mAppToken.allDrawn || mAppToken.mAnimatingWithSavedSurface
                    || animating || mAppToken.startingDisplayed)
                    && animation != null) {
                if (!animating) {
                    if (DEBUG_ANIM) Slog.v(TAG,
+13 −3
Original line number Diff line number Diff line
@@ -52,6 +52,13 @@ class AppWindowToken extends WindowToken {

    final boolean voiceInteraction;

    // Whether the window has a saved surface from last pause, which can be
    // used to start an entering animation earlier.
    boolean mHasSavedSurface;

    // Whether we're performing an entering animation with a saved surface.
    boolean mAnimatingWithSavedSurface;

    Task mTask;
    boolean appFullscreen;
    int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
@@ -260,9 +267,12 @@ class AppWindowToken extends WindowToken {
        final int N = allAppWindows.size();
        for (int i=0; i<N; i++) {
            WindowState win = allAppWindows.get(i);
            // If we're animating with a saved surface, we're already visible.
            // Return true so that the alpha doesn't get cleared.
            if (!win.mAppFreezing
                    && (win.mViewVisibility == View.VISIBLE ||
                        (win.mWinAnimator.isAnimating() &&
                    && (win.mViewVisibility == View.VISIBLE
                    || mAnimatingWithSavedSurface
                    || (win.mWinAnimator.isAnimating() &&
                            !service.mAppTransition.isTransitionSet()))
                    && !win.mDestroying && win.isDrawnLw()) {
                return true;
+5 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.wm;

import static android.app.ActivityManager.DOCKED_STACK_ID;
import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.HOME_STACK_ID;
import static android.app.ActivityManager.PINNED_STACK_ID;
import static android.app.ActivityManager.RESIZE_MODE_SYSTEM_SCREEN_ROTATION;
import static com.android.server.wm.WindowManagerService.TAG;
@@ -324,6 +325,10 @@ class Task implements DimLayer.DimLayerUser {
        return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showForAllUsers;
    }

    boolean inHomeStack() {
        return mStack != null && mStack.mStackId == HOME_STACK_ID;
    }

    boolean inFreeformWorkspace() {
        return mStack != null && mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID;
    }
+1 −1
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ public class WindowAnimator {

            final AppWindowToken atoken = win.mAppToken;
            if (winAnimator.mDrawState == WindowStateAnimator.READY_TO_SHOW) {
                if (atoken == null || atoken.allDrawn) {
                if (atoken == null || atoken.allDrawn || atoken.mAnimatingWithSavedSurface) {
                    if (winAnimator.performShowLocked()) {
                        setPendingLayoutChanges(displayId,
                                WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM);
Loading