Loading services/core/java/com/android/server/wm/SurfaceAnimator.java +3 −59 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.server.wm; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_ANIM; import static com.android.server.wm.SurfaceAnimatorProto.ANIMATION_ADAPTER; import static com.android.server.wm.SurfaceAnimatorProto.ANIMATION_START_DELAYED; import static com.android.server.wm.SurfaceAnimatorProto.LEASH; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; Loading Loading @@ -90,8 +89,6 @@ public class SurfaceAnimator { @Nullable private Runnable mAnimationCancelledCallback; private boolean mAnimationStartDelayed; private boolean mAnimationFinished; /** Loading Loading @@ -188,10 +185,6 @@ public class SurfaceAnimator { mAnimatable.onAnimationLeashCreated(t, mLeash); } mAnimatable.onLeashAnimationStarting(t, mLeash); if (mAnimationStartDelayed) { ProtoLog.i(WM_DEBUG_ANIM, "Animation start delayed for %s", mAnimatable); return; } mAnimation.startAnimation(mLeash, t, type, mInnerAnimationFinishedCallback); if (ProtoLog.isEnabled(WM_DEBUG_ANIM, LogLevel.DEBUG)) { StringWriter sw = new StringWriter(); Loading @@ -215,36 +208,7 @@ public class SurfaceAnimator { null /* animationCancelledCallback */, null /* snapshotAnim */, null /* freezer */); } /** * Begins with delaying all animations to start. Any subsequent call to {@link #startAnimation} * will not start the animation until {@link #endDelayingAnimationStart} is called. When an * animation start is being delayed, the animator is considered animating already. */ void startDelayingAnimationStart() { // We only allow delaying animation start we are not currently animating if (!isAnimating()) { mAnimationStartDelayed = true; } } /** * See {@link #startDelayingAnimationStart}. */ void endDelayingAnimationStart() { final boolean delayed = mAnimationStartDelayed; mAnimationStartDelayed = false; if (delayed && mAnimation != null) { mAnimation.startAnimation(mLeash, mAnimatable.getSyncTransaction(), mAnimationType, mInnerAnimationFinishedCallback); mAnimatable.commitPendingTransaction(); } } /** * @return Whether we are currently running an animation, or we have a pending animation that * is waiting to be started with {@link #endDelayingAnimationStart} */ /** Returns whether it is currently running an animation. */ boolean isAnimating() { return mAnimation != null; } Loading Loading @@ -289,15 +253,6 @@ public class SurfaceAnimator { t.setRelativeLayer(mLeash != null ? mLeash : mAnimatable.getSurfaceControl(), relativeTo, layer); } /** * Reparents the surface. * * @see #setLayer */ void reparent(Transaction t, SurfaceControl newParent) { t.reparent(mLeash != null ? mLeash : mAnimatable.getSurfaceControl(), newParent); } /** * @return True if the surface is attached to the leash; false otherwise. */ Loading @@ -319,7 +274,6 @@ public class SurfaceAnimator { Slog.w(TAG, "Unable to transfer animation, because " + from + " animation is finished"); return; } endDelayingAnimationStart(); final Transaction t = mAnimatable.getSyncTransaction(); cancelAnimation(t, true /* restarting */, true /* forwardCancel */); mLeash = from.mLeash; Loading @@ -336,10 +290,6 @@ public class SurfaceAnimator { mService.mAnimationTransferMap.put(mAnimation, this); } boolean isAnimationStartDelayed() { return mAnimationStartDelayed; } /** * Cancels the animation, and resets the leash. * Loading @@ -361,7 +311,7 @@ public class SurfaceAnimator { final SurfaceFreezer.Snapshot snapshot = mSnapshot; reset(t, false); if (animation != null) { if (!mAnimationStartDelayed && forwardCancel) { if (forwardCancel) { animation.onAnimationCancelled(leash); if (animationCancelledCallback != null) { animationCancelledCallback.run(); Loading @@ -386,10 +336,6 @@ public class SurfaceAnimator { mService.scheduleAnimationLocked(); } } if (!restarting) { mAnimationStartDelayed = false; } } private void reset(Transaction t, boolean destroyLeash) { Loading Loading @@ -495,14 +441,12 @@ public class SurfaceAnimator { if (mLeash != null) { mLeash.dumpDebug(proto, LEASH); } proto.write(ANIMATION_START_DELAYED, mAnimationStartDelayed); proto.end(token); } void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.print("mLeash="); pw.print(mLeash); pw.print(" mAnimationType=" + animationTypeToString(mAnimationType)); pw.println(mAnimationStartDelayed ? " mAnimationStartDelayed=true" : ""); pw.print(" mAnimationType="); pw.println(animationTypeToString(mAnimationType)); pw.print(prefix); pw.print("Animation: "); pw.println(mAnimation); if (mAnimation != null) { mAnimation.dump(pw, prefix + " "); Loading services/core/java/com/android/server/wm/WindowContainer.java +1 −16 Original line number Diff line number Diff line Loading @@ -3215,8 +3215,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< final boolean isChanging = AppTransition.isChangeTransitOld(transit) && enter && isChangingAppTransition(); // Delaying animation start isn't compatible with remote animations at all. if (controller != null && !mSurfaceAnimator.isAnimationStartDelayed()) { if (controller != null) { // Here we load App XML in order to read com.android.R.styleable#Animation_showBackdrop. boolean showBackdrop = false; // Optionally set backdrop color if App explicitly provides it through Loading Loading @@ -3639,20 +3638,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return getAnimatingContainer(PARENTS, ANIMATION_TYPE_ALL); } /** * @see SurfaceAnimator#startDelayingAnimationStart */ void startDelayingAnimationStart() { mSurfaceAnimator.startDelayingAnimationStart(); } /** * @see SurfaceAnimator#endDelayingAnimationStart */ void endDelayingAnimationStart() { mSurfaceAnimator.endDelayingAnimationStart(); } @Override public int getSurfaceWidth() { return mSurfaceControl.getWidth(); Loading services/tests/wmtests/src/com/android/server/wm/SurfaceAnimatorTest.java +0 −26 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyZeroInteractions; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; import static org.junit.Assert.assertEquals; Loading Loading @@ -164,31 +163,6 @@ public class SurfaceAnimatorTest extends WindowTestsBase { verify(mTransaction).remove(eq(mAnimatable.mLeash)); } @Test public void testDelayingAnimationStart() { mAnimatable.mSurfaceAnimator.startDelayingAnimationStart(); mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */, ANIMATION_TYPE_APP_TRANSITION); verifyZeroInteractions(mSpec); assertAnimating(mAnimatable); assertTrue(mAnimatable.mSurfaceAnimator.isAnimationStartDelayed()); mAnimatable.mSurfaceAnimator.endDelayingAnimationStart(); verify(mSpec).startAnimation(any(), any(), eq(ANIMATION_TYPE_APP_TRANSITION), any()); } @Test public void testDelayingAnimationStartAndCancelled() { mAnimatable.mSurfaceAnimator.startDelayingAnimationStart(); mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */, ANIMATION_TYPE_APP_TRANSITION); mAnimatable.mSurfaceAnimator.cancelAnimation(); verifyZeroInteractions(mSpec); assertNotAnimating(mAnimatable); assertTrue(mAnimatable.mFinishedCallbackCalled); assertEquals(ANIMATION_TYPE_APP_TRANSITION, mAnimatable.mFinishedAnimationType); verify(mTransaction).remove(eq(mAnimatable.mLeash)); } @Test public void testTransferAnimation() { mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */, Loading Loading
services/core/java/com/android/server/wm/SurfaceAnimator.java +3 −59 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.server.wm; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_ANIM; import static com.android.server.wm.SurfaceAnimatorProto.ANIMATION_ADAPTER; import static com.android.server.wm.SurfaceAnimatorProto.ANIMATION_START_DELAYED; import static com.android.server.wm.SurfaceAnimatorProto.LEASH; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; Loading Loading @@ -90,8 +89,6 @@ public class SurfaceAnimator { @Nullable private Runnable mAnimationCancelledCallback; private boolean mAnimationStartDelayed; private boolean mAnimationFinished; /** Loading Loading @@ -188,10 +185,6 @@ public class SurfaceAnimator { mAnimatable.onAnimationLeashCreated(t, mLeash); } mAnimatable.onLeashAnimationStarting(t, mLeash); if (mAnimationStartDelayed) { ProtoLog.i(WM_DEBUG_ANIM, "Animation start delayed for %s", mAnimatable); return; } mAnimation.startAnimation(mLeash, t, type, mInnerAnimationFinishedCallback); if (ProtoLog.isEnabled(WM_DEBUG_ANIM, LogLevel.DEBUG)) { StringWriter sw = new StringWriter(); Loading @@ -215,36 +208,7 @@ public class SurfaceAnimator { null /* animationCancelledCallback */, null /* snapshotAnim */, null /* freezer */); } /** * Begins with delaying all animations to start. Any subsequent call to {@link #startAnimation} * will not start the animation until {@link #endDelayingAnimationStart} is called. When an * animation start is being delayed, the animator is considered animating already. */ void startDelayingAnimationStart() { // We only allow delaying animation start we are not currently animating if (!isAnimating()) { mAnimationStartDelayed = true; } } /** * See {@link #startDelayingAnimationStart}. */ void endDelayingAnimationStart() { final boolean delayed = mAnimationStartDelayed; mAnimationStartDelayed = false; if (delayed && mAnimation != null) { mAnimation.startAnimation(mLeash, mAnimatable.getSyncTransaction(), mAnimationType, mInnerAnimationFinishedCallback); mAnimatable.commitPendingTransaction(); } } /** * @return Whether we are currently running an animation, or we have a pending animation that * is waiting to be started with {@link #endDelayingAnimationStart} */ /** Returns whether it is currently running an animation. */ boolean isAnimating() { return mAnimation != null; } Loading Loading @@ -289,15 +253,6 @@ public class SurfaceAnimator { t.setRelativeLayer(mLeash != null ? mLeash : mAnimatable.getSurfaceControl(), relativeTo, layer); } /** * Reparents the surface. * * @see #setLayer */ void reparent(Transaction t, SurfaceControl newParent) { t.reparent(mLeash != null ? mLeash : mAnimatable.getSurfaceControl(), newParent); } /** * @return True if the surface is attached to the leash; false otherwise. */ Loading @@ -319,7 +274,6 @@ public class SurfaceAnimator { Slog.w(TAG, "Unable to transfer animation, because " + from + " animation is finished"); return; } endDelayingAnimationStart(); final Transaction t = mAnimatable.getSyncTransaction(); cancelAnimation(t, true /* restarting */, true /* forwardCancel */); mLeash = from.mLeash; Loading @@ -336,10 +290,6 @@ public class SurfaceAnimator { mService.mAnimationTransferMap.put(mAnimation, this); } boolean isAnimationStartDelayed() { return mAnimationStartDelayed; } /** * Cancels the animation, and resets the leash. * Loading @@ -361,7 +311,7 @@ public class SurfaceAnimator { final SurfaceFreezer.Snapshot snapshot = mSnapshot; reset(t, false); if (animation != null) { if (!mAnimationStartDelayed && forwardCancel) { if (forwardCancel) { animation.onAnimationCancelled(leash); if (animationCancelledCallback != null) { animationCancelledCallback.run(); Loading @@ -386,10 +336,6 @@ public class SurfaceAnimator { mService.scheduleAnimationLocked(); } } if (!restarting) { mAnimationStartDelayed = false; } } private void reset(Transaction t, boolean destroyLeash) { Loading Loading @@ -495,14 +441,12 @@ public class SurfaceAnimator { if (mLeash != null) { mLeash.dumpDebug(proto, LEASH); } proto.write(ANIMATION_START_DELAYED, mAnimationStartDelayed); proto.end(token); } void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.print("mLeash="); pw.print(mLeash); pw.print(" mAnimationType=" + animationTypeToString(mAnimationType)); pw.println(mAnimationStartDelayed ? " mAnimationStartDelayed=true" : ""); pw.print(" mAnimationType="); pw.println(animationTypeToString(mAnimationType)); pw.print(prefix); pw.print("Animation: "); pw.println(mAnimation); if (mAnimation != null) { mAnimation.dump(pw, prefix + " "); Loading
services/core/java/com/android/server/wm/WindowContainer.java +1 −16 Original line number Diff line number Diff line Loading @@ -3215,8 +3215,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< final boolean isChanging = AppTransition.isChangeTransitOld(transit) && enter && isChangingAppTransition(); // Delaying animation start isn't compatible with remote animations at all. if (controller != null && !mSurfaceAnimator.isAnimationStartDelayed()) { if (controller != null) { // Here we load App XML in order to read com.android.R.styleable#Animation_showBackdrop. boolean showBackdrop = false; // Optionally set backdrop color if App explicitly provides it through Loading Loading @@ -3639,20 +3638,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return getAnimatingContainer(PARENTS, ANIMATION_TYPE_ALL); } /** * @see SurfaceAnimator#startDelayingAnimationStart */ void startDelayingAnimationStart() { mSurfaceAnimator.startDelayingAnimationStart(); } /** * @see SurfaceAnimator#endDelayingAnimationStart */ void endDelayingAnimationStart() { mSurfaceAnimator.endDelayingAnimationStart(); } @Override public int getSurfaceWidth() { return mSurfaceControl.getWidth(); Loading
services/tests/wmtests/src/com/android/server/wm/SurfaceAnimatorTest.java +0 −26 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyZeroInteractions; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; import static org.junit.Assert.assertEquals; Loading Loading @@ -164,31 +163,6 @@ public class SurfaceAnimatorTest extends WindowTestsBase { verify(mTransaction).remove(eq(mAnimatable.mLeash)); } @Test public void testDelayingAnimationStart() { mAnimatable.mSurfaceAnimator.startDelayingAnimationStart(); mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */, ANIMATION_TYPE_APP_TRANSITION); verifyZeroInteractions(mSpec); assertAnimating(mAnimatable); assertTrue(mAnimatable.mSurfaceAnimator.isAnimationStartDelayed()); mAnimatable.mSurfaceAnimator.endDelayingAnimationStart(); verify(mSpec).startAnimation(any(), any(), eq(ANIMATION_TYPE_APP_TRANSITION), any()); } @Test public void testDelayingAnimationStartAndCancelled() { mAnimatable.mSurfaceAnimator.startDelayingAnimationStart(); mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */, ANIMATION_TYPE_APP_TRANSITION); mAnimatable.mSurfaceAnimator.cancelAnimation(); verifyZeroInteractions(mSpec); assertNotAnimating(mAnimatable); assertTrue(mAnimatable.mFinishedCallbackCalled); assertEquals(ANIMATION_TYPE_APP_TRANSITION, mAnimatable.mFinishedAnimationType); verify(mTransaction).remove(eq(mAnimatable.mLeash)); } @Test public void testTransferAnimation() { mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */, Loading