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

Commit 8261910c authored by Liran Binyamin's avatar Liran Binyamin Committed by Android (Google) Code Review
Browse files

Merge "Clean up stale external transitions" into main

parents 508ee99a 95ca764c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -641,6 +641,15 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV
        }
        if (pending.mExternalTransition != null) {
            pending.mClaimed = pending.mExternalTransition.start();
            if (pending.mClaimed == null) {
                ProtoLog.w(WM_SHELL_BUBBLES_NOISY, "TaskViewTransitions.startNextTransition(): "
                        + "taskView=%d starting the external transition returned a null claim "
                        + "token. it may have already finished. removing it so that it does not "
                        + "block other transitions.", pending.mTaskView.hashCode());
                mPending.remove(pending);
                startNextTransition();
                return;
            }
        } else {
            pending.mClaimed = mTransitions.startTransition(pending.mType, pending.mWct, this);
        }
+3 −0
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ public class BubbleTransitionsTest extends ShellTestCase {
    @Test
    public void testConvertToBubble() {
        // Basic walk-through of convert-to-bubble transition stages
        when(mTransitions.startTransition(anyInt(), any(), any())).thenReturn(mock(IBinder.class));
        final ActivityManager.RunningTaskInfo taskInfo = setupBubble();
        final BubbleTransitions.BubbleTransition bt = mBubbleTransitions.startConvertToBubble(
                mBubble, taskInfo, mExpandedViewManager, mTaskViewFactory, mBubblePositioner,
@@ -318,6 +319,7 @@ public class BubbleTransitionsTest extends ShellTestCase {

    @Test
    public void testConvertFromBubble() {
        when(mTransitions.startTransition(anyInt(), any(), any())).thenReturn(mock(IBinder.class));
        final ActivityManager.RunningTaskInfo taskInfo = setupBubble();
        final BubbleTransitions.BubbleTransition bt = mBubbleTransitions.startConvertFromBubble(
                mBubble, taskInfo);
@@ -432,6 +434,7 @@ public class BubbleTransitionsTest extends ShellTestCase {
        when(bev.getViewRootImpl()).thenReturn(vri);
        when(mBubble.getBubbleBarExpandedView()).thenReturn(null);
        when(mBubble.getExpandedView()).thenReturn(bev);
        when(mTransitions.startTransition(anyInt(), any(), any())).thenReturn(mock(IBinder.class));

        final ActivityManager.RunningTaskInfo taskInfo = setupBubble();
        final BubbleTransitions.BubbleTransition bt = mBubbleTransitions.startConvertFromBubble(
+16 −0
Original line number Diff line number Diff line
@@ -435,6 +435,22 @@ public class TaskViewTransitionsTest extends ShellTestCase {
                .isEqualTo(bounds);
    }

    @Test
    public void externalTransitionPending_alreadyFinished_removed() {
        IBinder transition = mock(IBinder.class);
        mTaskViewTransitions.enqueueExternal(mTaskViewTaskController, () -> transition);
        assertThat(mTaskViewTransitions.hasPending()).isTrue();

        // enqueue an external transition, that when started returns a null token as if it has
        // already finished
        mTaskViewTransitions.enqueueExternal(mTaskViewTaskController, () -> null);
        assertThat(mTaskViewTransitions.hasPending()).isTrue();

        mTaskViewTransitions.onExternalDone(transition);

        assertThat(mTaskViewTransitions.hasPending()).isFalse();
    }

    private SurfaceControl.Transaction createMockTransaction() {
        SurfaceControl.Transaction transaction = mock(SurfaceControl.Transaction.class);
        when(transaction.reparent(any(), any())).thenReturn(transaction);