diff options
| author | 2018-01-25 15:06:13 +0100 | |
|---|---|---|
| committer | 2018-01-29 19:16:34 +0100 | |
| commit | 93f9fe342be78bc90dc8aede1dd32e55be32657e (patch) | |
| tree | 1853c661f9751cad7f200543bb9e1da8dee760b1 | |
| parent | 5511634f52fe7b760b1819f06bcd1c4d4acc9cd2 (diff) | |
If nothing to animate, don't call remote animator
Otherwise we'll end up with weird transitions when just switching
focus because focus switch causes an app transition to run.
Test: go/wm-smoke
Test: Enter PIP, click on PIP window, click on launcher window
to execute an empty app transition.
Change-Id: Ie42ad808ff4d4646570c122fd3b964e3255a57bc
| -rw-r--r-- | services/core/java/com/android/server/wm/RemoteAnimationController.java | 4 | ||||
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/RemoteAnimationController.java b/services/core/java/com/android/server/wm/RemoteAnimationController.java index 8515dcb69970..00489837cca8 100644 --- a/services/core/java/com/android/server/wm/RemoteAnimationController.java +++ b/services/core/java/com/android/server/wm/RemoteAnimationController.java @@ -88,6 +88,10 @@ class RemoteAnimationController { * Called when the transition is ready to be started, and all leashes have been set up. */ void goodToGo() { + if (mPendingAnimations.isEmpty()) { + onAnimationFinished(); + return; + } mHandler.postDelayed(mTimeoutRunnable, TIMEOUT_MS); try { mRemoteAnimationAdapter.getRunner().onAnimationStart(createAnimations(), diff --git a/services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java b/services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java index 897be34e36fe..f860195bd6ea 100644 --- a/services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java @@ -20,6 +20,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; import android.graphics.Point; import android.graphics.Rect; @@ -134,4 +135,10 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { verify(mMockRunner).onAnimationCancelled(); verify(mFinishedCallback).onAnimationFinished(eq(adapter)); } + + @Test + public void testZeroAnimations() throws Exception { + mController.goodToGo(); + verifyZeroInteractions(mMockRunner); + } } |