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

Commit b596505c authored by Issei Suzuki's avatar Issei Suzuki Committed by Android (Google) Code Review
Browse files

Merge "Make sure that IRemoteAnimationController is always triggered." into sc-dev

parents 592bdb62 6bf84692
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -307,6 +307,12 @@
      "group": "WM_DEBUG_STARTING_WINDOW",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-1777196134": {
      "message": "goodToGo(): No apps to animate, mPendingAnimations=%d",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "-1770075711": {
      "message": "Adding window client %s that is dead, aborting.",
      "level": "WARN",
@@ -1987,12 +1993,6 @@
      "group": "WM_DEBUG_STATES",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "194124419": {
      "message": "goodToGo(): Animation finished already, canceled=%s mPendingAnimations=%d",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "200829729": {
      "message": "ScreenRotationAnimation onAnimationEnd",
      "level": "DEBUG",
@@ -2089,6 +2089,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/DragState.java"
    },
    "269976641": {
      "message": "goodToGo(): Animation canceled already",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "274773837": {
      "message": "applyAnimation: anim=%s nextAppTransition=ANIM_CLIP_REVEAL transit=%s Callers=%s",
      "level": "VERBOSE",
+7 −4
Original line number Diff line number Diff line
@@ -104,11 +104,11 @@ class RemoteAnimationController implements DeathRecipient {
     */
    void goodToGo(@WindowManager.TransitionOldType int transit) {
        ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "goodToGo()");
        if (mPendingAnimations.isEmpty() || mCanceled) {
        if (mCanceled) {
            ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS,
                    "goodToGo(): Animation finished already, canceled=%s mPendingAnimations=%d",
                    mCanceled, mPendingAnimations.size());
                    "goodToGo(): Animation canceled already");
            onAnimationFinished();
            invokeAnimationCancelled();
            return;
        }

@@ -120,8 +120,11 @@ class RemoteAnimationController implements DeathRecipient {
        // Create the app targets
        final RemoteAnimationTarget[] appTargets = createAppAnimations();
        if (appTargets.length == 0) {
            ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "goodToGo(): No apps to animate");
            ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS,
                    "goodToGo(): No apps to animate, mPendingAnimations=%d",
                    mPendingAnimations.size());
            onAnimationFinished();
            invokeAnimationCancelled();
            return;
        }

+11 −6
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMAT

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;

@@ -208,18 +210,20 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
    }

    @Test
    public void testZeroAnimations() {
    public void testZeroAnimations() throws Exception {
        mController.goodToGo(TRANSIT_OLD_NONE);
        verifyNoMoreInteractionsExceptAsBinder(mMockRunner);
        verify(mMockRunner, never()).onAnimationStart(anyInt(), any(), any(), any(), any());
        verify(mMockRunner).onAnimationCancelled();
    }

    @Test
    public void testNotReallyStarted() {
    public void testNotReallyStarted() throws Exception {
        final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
        mController.createRemoteAnimationRecord(win.mActivityRecord,
                new Point(50, 100), null, new Rect(50, 100, 150, 150), null);
        mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
        verifyNoMoreInteractionsExceptAsBinder(mMockRunner);
        verify(mMockRunner, never()).onAnimationStart(anyInt(), any(), any(), any(), any());
        verify(mMockRunner).onAnimationCancelled();
    }

    @Test
@@ -250,7 +254,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
    }

    @Test
    public void testRemovedBeforeStarted() {
    public void testRemovedBeforeStarted() throws Exception {
        final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
        final AnimationAdapter adapter = mController.createRemoteAnimationRecord(win.mActivityRecord,
                new Point(50, 100), null, new Rect(50, 100, 150, 150), null).mAdapter;
@@ -258,7 +262,8 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
                mFinishedCallback);
        win.mActivityRecord.removeImmediately();
        mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
        verifyNoMoreInteractionsExceptAsBinder(mMockRunner);
        verify(mMockRunner, never()).onAnimationStart(anyInt(), any(), any(), any(), any());
        verify(mMockRunner).onAnimationCancelled();
        verify(mFinishedCallback).onAnimationFinished(eq(ANIMATION_TYPE_APP_TRANSITION),
                eq(adapter));
    }