Report enterAnimationComplete when transient launch is committed

Transient launches are not considered "visible-at-end" since their
whole point is being only visible during the transition. If,
however, the transition is "committed", we should still report
enterAnimationComplete, so add an additional check for it.

Bug: 243698723
Test: atest TransitionTests
Change-Id: Ib33d1f7ef55a1da25bfc0e93db6d14d7ffcccbfc
This commit is contained in:
Evan Rosky
2022-08-29 18:59:32 -07:00
parent d3b0c19953
commit c1683f864b
2 changed files with 17 additions and 1 deletions

View File

@@ -728,6 +728,10 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
if (mChanges.get(ar).mVisible != visibleAtTransitionEnd) {
// Legacy dispatch relies on this (for now).
ar.mEnteringAnimation = visibleAtTransitionEnd;
} else if (mTransientLaunches != null && mTransientLaunches.containsKey(ar)
&& ar.isVisible()) {
// Transient launch was committed, so report enteringAnimation
ar.mEnteringAnimation = true;
}
continue;
}

View File

@@ -962,8 +962,17 @@ public class TransitionTests extends WindowTestsBase {
@Test
public void testTransientLaunch() {
final TaskSnapshotController snapshotController = mock(TaskSnapshotController.class);
final ArrayList<ActivityRecord> enteringAnimReports = new ArrayList<>();
final TransitionController controller = new TransitionController(mAtm, snapshotController,
mock(TransitionTracer.class));
mock(TransitionTracer.class)) {
@Override
protected void dispatchLegacyAppTransitionFinished(ActivityRecord ar) {
if (ar.mEnteringAnimation) {
enteringAnimReports.add(ar);
}
super.dispatchLegacyAppTransitionFinished(ar);
}
};
final ITransitionPlayer player = new ITransitionPlayer.Default();
controller.registerTransitionPlayer(player, null /* playerProc */);
final Transition openTransition = controller.createTransition(TRANSIT_OPEN);
@@ -1008,6 +1017,7 @@ public class TransitionTests extends WindowTestsBase {
activity1.mVisibleRequested = false;
activity2.mVisibleRequested = true;
activity2.setVisible(true);
// Using abort to force-finish the sync (since we obviously can't wait for drawing).
// We didn't call abort on the actual transition, so it will still run onTransactionReady
@@ -1018,9 +1028,11 @@ public class TransitionTests extends WindowTestsBase {
// called until finish).
verify(snapshotController, times(0)).recordTaskSnapshot(eq(task1), eq(false));
enteringAnimReports.clear();
closeTransition.finishTransition();
verify(snapshotController, times(1)).recordTaskSnapshot(eq(task1), eq(false));
assertTrue(enteringAnimReports.contains(activity2));
}
@Test