Merge "Do not notify transition finish for a initializing activity" into udc-dev

This commit is contained in:
Riddle Hsu
2023-06-07 07:34:57 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 1 deletions

View File

@@ -1190,7 +1190,11 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
// processed all the participants first (in particular, we want to trigger pip-enter first)
for (int i = 0; i < mParticipants.size(); ++i) {
final ActivityRecord ar = mParticipants.valueAt(i).asActivityRecord();
if (ar != null) {
// If the activity was just inserted to an invisible task, it will keep INITIALIZING
// state. Then no need to notify the callback to avoid clearing some states
// unexpectedly, e.g. launch-task-behind.
if (ar != null && (ar.isVisibleRequested()
|| !ar.isState(ActivityRecord.State.INITIALIZING))) {
mController.dispatchLegacyAppTransitionFinished(ar);
}
}

View File

@@ -1346,6 +1346,16 @@ public class TransitionTests extends WindowTestsBase {
activity1.setVisible(false);
abortTransition.abort();
assertTrue(activity1.isVisible());
// The mLaunchTaskBehind flag of an invisible initializing activity should not be cleared.
final Transition noChangeTransition = controller.createTransition(TRANSIT_OPEN);
noChangeTransition.collect(activity1);
activity1.setVisibleRequested(false);
activity1.setState(ActivityRecord.State.INITIALIZING, "test");
activity1.mLaunchTaskBehind = true;
mWm.mSyncEngine.abort(noChangeTransition.getSyncId());
noChangeTransition.finishTransition();
assertTrue(activity1.mLaunchTaskBehind);
}
@Test