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

Commit e32c3078 authored by Craig Mautner's avatar Craig Mautner
Browse files

Separate out animations from layout.

(Dianne) pulled the animation steps out of the layout. Changes to
exposed layers cause repeated calls to layout code.

Combined animation steps into start and finish animation code.

Change-Id: I3602d1d6249d20987d102a54e3a67a7a39361b55
parent a1b09a92
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() {