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

Commit f44882ff authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Separate out animations from layout."

parents 27fa5270 e32c3078
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.util.Slog;
import android.view.IApplicationToken;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManagerPolicy;
import android.view.animation.Animation;
import android.view.animation.Transformation;

@@ -37,7 +38,7 @@ import java.util.ArrayList;
 * Version of WindowToken that is specifically for a particular application (or
 * really activity) that is displaying windows.
 */
class AppWindowToken extends WindowToken implements WindowManagerService.StepAnimator {
class AppWindowToken extends WindowToken {
    // Non-null only for application tokens.
    final IApplicationToken appToken;

@@ -195,8 +196,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.StepAni
        }
    }

    @Override
    public boolean stepAnimation(long currentTime) {

    private boolean stepAnimation(long currentTime) {
        if (animation == null) {
            return false;
        }
@@ -216,7 +217,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.StepAni
    }

    // This must be called while inside a transaction.
    boolean startAndFinishAnimationLocked(long currentTime, int dw, int dh) {
    boolean stepAnimationLocked(long currentTime, int dw, int dh) {
        if (!service.mDisplayFrozen && service.mPolicy.isScreenOnFully()) {
            // We will run animations as long as the display isn't frozen.

@@ -240,7 +241,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.StepAni
                    animating = true;
                }
                // we're done!
                return true;
                return stepAnimation(currentTime);
            }
        } else if (animation != null) {
            // If the display is frozen, and there is a pending animation,
@@ -255,6 +256,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.StepAni
            return false;
        }

        service.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
        clearAnimation();
        animating = false;
        if (animLayerAdjustment != 0) {
+5 −6
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Transformation;

class ScreenRotationAnimation implements WindowManagerService.StepAnimator {
class ScreenRotationAnimation {
    static final String TAG = "ScreenRotationAnimation";
    static final boolean DEBUG_STATE = false;
    static final boolean DEBUG_TRANSFORMS = false;
@@ -540,8 +540,7 @@ class ScreenRotationAnimation implements WindowManagerService.StepAnimator {
                || mRotateFrameAnimation != null;
    }

    @Override
    public boolean stepAnimation(long now) {
    private boolean stepAnimation(long now) {

        if (mFinishAnimReady && mFinishAnimStartTime < 0) {
            if (DEBUG_STATE) Slog.v(TAG, "Step: finish anim now ready");
@@ -725,7 +724,7 @@ class ScreenRotationAnimation implements WindowManagerService.StepAnimator {
        setSnapshotTransform(mSnapshotFinalMatrix, mExitTransformation.getAlpha());
    }
    
    public boolean startAndFinishAnimationLocked(long now) {
    public boolean stepAnimationLocked(long now) {
        if (!isAnimating()) {
            if (DEBUG_STATE) Slog.v(TAG, "Step: no animations running");
            mFinishAnimReady = false;
@@ -764,7 +763,7 @@ class ScreenRotationAnimation implements WindowManagerService.StepAnimator {
            mAnimRunning = true;
        }

        return true;
        return stepAnimation(now);
    }

    public Transformation getEnterTransformation() {
+177 −172

File changed.

Preview size limit exceeded, changes collapsed.

+7 −6
Original line number Diff line number Diff line
@@ -54,8 +54,7 @@ import java.util.ArrayList;
/**
 * A window in the window manager.
 */
final class WindowState implements WindowManagerPolicy.WindowState,
        WindowManagerService.StepAnimator {
final class WindowState implements WindowManagerPolicy.WindowState {
    static final boolean DEBUG_VISIBILITY = WindowManagerService.DEBUG_VISIBILITY;
    static final boolean SHOW_TRANSACTIONS = WindowManagerService.SHOW_TRANSACTIONS;
    static final boolean SHOW_LIGHT_TRANSACTIONS = WindowManagerService.SHOW_LIGHT_TRANSACTIONS;
@@ -995,8 +994,7 @@ final class WindowState implements WindowManagerPolicy.WindowState,
        return true;
    }

    @Override
    public boolean stepAnimation(long currentTime) {
    private boolean stepAnimation(long currentTime) {
        if ((mAnimation == null) || !mLocalAnimating || (mAnimState != ANIM_STATE_RUNNING)) {
            return false;
        }
@@ -1013,7 +1011,7 @@ final class WindowState implements WindowManagerPolicy.WindowState,

    // This must be called while inside a transaction.  Returns true if
    // there is more animation to run.
    boolean startAndFinishAnimationLocked(long currentTime) {
    boolean stepAnimationLocked(long currentTime) {
        // Save the animation state as it was before this step so WindowManagerService can tell if
        // we just started or just stopped animating by comparing mWasAnimating with isAnimating().
        mWasAnimating = mAnimating;
@@ -1038,7 +1036,7 @@ final class WindowState implements WindowManagerPolicy.WindowState,
                }
                if ((mAnimation != null) && mLocalAnimating && 
                        (mAnimState != ANIM_STATE_STOPPING)) {
                    return true;
                    return stepAnimation(currentTime);
                }
                if (WindowManagerService.DEBUG_ANIM) Slog.v(
                    WindowManagerService.TAG, "Finished animation in " + this +
@@ -1133,6 +1131,7 @@ final class WindowState implements WindowManagerPolicy.WindowState,
        }

        finishExit();
        mService.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;

        if (mAppToken != null) {
            mAppToken.updateReportedVisibilityLocked();
@@ -1608,6 +1607,7 @@ final class WindowState implements WindowManagerPolicy.WindowState,

    boolean showLw(boolean doAnimation, boolean requestAnim) {
        if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
            // Already showing.
            return false;
        }
        if (DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "Policy visibility true: " + this);
@@ -1647,6 +1647,7 @@ final class WindowState implements WindowManagerPolicy.WindowState,
        boolean current = doAnimation ? mPolicyVisibilityAfterAnim
                : mPolicyVisibility;
        if (!current) {
            // Already hiding.
            return false;
        }
        if (doAnimation) {