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

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

Various debugging enhancements.

Also moved DummyAnimation into AppWindowAnimator where it belongs.

Change-Id: I7da254a8b99030b898e2ff8d983500d7ce0b2b65
parent 1579a67e
Loading
Loading
Loading
Loading
+24 −12
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import java.io.PrintWriter;
 *
 */
public class AppWindowAnimator {
    static final String TAG = "AppWindowAnimator";

    final AppWindowToken mAppToken;
    final WindowManagerService mService;
@@ -43,6 +44,8 @@ public class AppWindowAnimator {
    Animation thumbnailAnimation;
    final Transformation thumbnailTransformation = new Transformation();

    static final Animation sDummyAnimation = new DummyAnimation();

    public AppWindowAnimator(final WindowManagerService service, final AppWindowToken atoken) {
        mService = service;
        mAppToken = atoken;
@@ -51,7 +54,7 @@ public class AppWindowAnimator {

    public void setAnimation(Animation anim, boolean initialized) {
        if (WindowManagerService.localLOGV) Slog.v(
            WindowManagerService.TAG, "Setting animation in " + this + ": " + anim);
            TAG, "Setting animation in " + this + ": " + anim);
        animation = anim;
        animating = false;
        animInitialized = initialized;
@@ -78,8 +81,8 @@ public class AppWindowAnimator {
    public void setDummyAnimation() {
        if (animation == null) {
            if (WindowManagerService.localLOGV) Slog.v(
                WindowManagerService.TAG, "Setting dummy animation in " + this);
            animation = WindowManagerService.sDummyAnimation;
                TAG, "Setting dummy animation in " + this);
            animation = sDummyAnimation;
            animInitialized = false;
        }
    }
@@ -111,7 +114,7 @@ public class AppWindowAnimator {
            if (winAnimator.mAnimLayer > thumbnailLayer) {
                thumbnailLayer = winAnimator.mAnimLayer;
            }
            if (WindowManagerService.DEBUG_LAYERS) Slog.v(WindowManagerService.TAG, "Updating layer " + w + ": "
            if (WindowManagerService.DEBUG_LAYERS) Slog.v(TAG, "Updating layer " + w + ": "
                    + winAnimator.mAnimLayer);
            if (w == mService.mInputMethodTarget && !mService.mInputMethodTargetWaitingAnim) {
                mService.setInputMethodAnimLayerAdjustment(adj);
@@ -162,14 +165,12 @@ public class AppWindowAnimator {
        transformation.clear();
        final boolean more = animation.getTransformation(currentTime, transformation);
        if (WindowManagerService.DEBUG_ANIM) Slog.v(
            WindowManagerService.TAG, "Stepped animation in " + this +
            ": more=" + more + ", xform=" + transformation);
            TAG, "Stepped animation in " + this + ": more=" + more + ", xform=" + transformation);
        if (!more) {
            animation = null;
            clearThumbnail();
            if (WindowManagerService.DEBUG_ANIM) Slog.v(
                WindowManagerService.TAG, "Finished animation in " + this +
                " @ " + currentTime);
                TAG, "Finished animation in " + this + " @ " + currentTime);
        }
        hasTransformation = more;
        return more;
@@ -180,7 +181,7 @@ public class AppWindowAnimator {
        if (mService.okToDisplay()) {
            // We will run animations as long as the display isn't frozen.

            if (animation == WindowManagerService.sDummyAnimation) {
            if (animation == sDummyAnimation) {
                // This guy is going to animate, but not yet.  For now count
                // it as not animating for purposes of scheduling transactions;
                // when it is really time to animate, this will be set to
@@ -192,7 +193,7 @@ public class AppWindowAnimator {
                    && animation != null) {
                if (!animating) {
                    if (WindowManagerService.DEBUG_ANIM) Slog.v(
                        WindowManagerService.TAG, "Starting animation in " + this +
                        TAG, "Starting animation in " + this +
                        " @ " + currentTime + ": dw=" + dw + " dh=" + dh
                        + " scale=" + mService.mTransitionAnimationScale
                        + " allDrawn=" + mAppToken.allDrawn + " animating=" + animating);
@@ -245,7 +246,7 @@ public class AppWindowAnimator {
        }

        if (WindowManagerService.DEBUG_ANIM) Slog.v(
                WindowManagerService.TAG, "Animation done in " + this
                TAG, "Animation done in " + this
                + ": reportedVisible=" + mAppToken.reportedVisible);

        transformation.clear();
@@ -264,7 +265,7 @@ public class AppWindowAnimator {
        final int NW = mAppToken.allAppWindows.size();
        for (int i=0; i<NW; i++) {
            WindowStateAnimator winAnimator = mAppToken.allAppWindows.get(i).mWinAnimator;
            if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
            if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
                    "performing show on: " + winAnimator);
            winAnimator.performShowLocked();
            isAnimating |= winAnimator.isAnimating();
@@ -298,4 +299,15 @@ public class AppWindowAnimator {
                    pw.println(thumbnailTransformation.toShortString());
        }
    }

    // This is an animation that does nothing: it just immediately finishes
    // itself every time it is called.  It is used as a stub animation in cases
    // where we want to synchronize multiple things that may be animating.
    static final class DummyAnimation extends Animation {
        @Override
        public boolean getTransformation(long currentTime, Transformation outTransformation) {
            return false;
        }
    }

}
+2 −2
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ public class WindowAnimator {
        for (i=0; i<NAT; i++) {
            final AppWindowAnimator appAnimator = mService.mAppTokens.get(i).mAppAnimator;
            final boolean wasAnimating = appAnimator.animation != null
                    && appAnimator.animation != WindowManagerService.sDummyAnimation;
                    && appAnimator.animation != AppWindowAnimator.sDummyAnimation;
            if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
                mAnimating = true;
            } else if (wasAnimating) {
@@ -147,7 +147,7 @@ public class WindowAnimator {
        for (i=0; i<NEAT; i++) {
            final AppWindowAnimator appAnimator = mService.mExitingAppTokens.get(i).mAppAnimator;
            final boolean wasAnimating = appAnimator.animation != null
                    && appAnimator.animation != WindowManagerService.sDummyAnimation;
                    && appAnimator.animation != AppWindowAnimator.sDummyAnimation;
            if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
                mAnimating = true;
            } else if (wasAnimating) {
+1 −11
Original line number Diff line number Diff line
@@ -4111,7 +4111,7 @@ public class WindowManagerService extends IWindowManager.Stub
            boolean runningAppAnimation = false;

            if (transit != WindowManagerPolicy.TRANSIT_UNSET) {
                if (wtoken.mAppAnimator.animation == sDummyAnimation) {
                if (wtoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation) {
                    wtoken.mAppAnimator.animation = null;
                }
                if (applyAnimationLocked(wtoken, lp, transit, visible)) {
@@ -6580,16 +6580,6 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    // This is an animation that does nothing: it just immediately finishes
    // itself every time it is called.  It is used as a stub animation in cases
    // where we want to synchronize multiple things that may be animating.
    static final class DummyAnimation extends Animation {
        public boolean getTransformation(long currentTime, Transformation outTransformation) {
            return false;
        }
    }
    static final Animation sDummyAnimation = new DummyAnimation();

    // -------------------------------------------------------------
    // Async Handler
    // -------------------------------------------------------------
+3 −2
Original line number Diff line number Diff line
@@ -390,10 +390,10 @@ class WindowStateAnimator {

    // This must be called while inside a transaction.
    boolean commitFinishDrawingLocked(long currentTime) {
        //Slog.i(TAG, "commitFinishDrawingLocked: " + mSurface);
        if (mDrawState != COMMIT_DRAW_PENDING) {
            return false;
        }
        //Slog.i(TAG, "commitFinishDrawingLocked: Draw pending. " + mSurface);
        mDrawState = READY_TO_SHOW;
        final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING;
        final AppWindowToken atoken = mWin.mAppToken;
@@ -515,7 +515,8 @@ class WindowStateAnimator {

        @Override
        public String toString() {
            return "Surface " + mName + ": shown=" + mShown + " layer=" + mLayer
            return "Surface " + Integer.toHexString(System.identityHashCode(this)) + " "
                    + mName + ": shown=" + mShown + " layer=" + mLayer
                    + " alpha=" + mSurfaceTraceAlpha + " " + mPosition.x + "," + mPosition.y
                    + " " + mSize.x + "x" + mSize.y;
        }