Always add cookie for each activity when fill TaskInfo.

The LaunchCookie is a token for activity starter to find out where the
activity was start, so it should be allowed to add in TaskInfo even
when the activity is finishing.

Bug: 241070422
Test: Launch an activity which will request finish when receive back
key from Launcher, e.g. calendar widget. Verify
QuickstepTransitionManager can find the LauncherView so it can play
closing to home animation.
Test: atest ActivityRecordTests#testTransferLaunchCookieWhenFinishing

Change-Id: I0351eb76e9a97b718b490d6151b5434f8ef8a42c
This commit is contained in:
wilsonshih
2022-08-11 13:26:44 +08:00
parent e4b7302acc
commit 9550f1c949
2 changed files with 5 additions and 3 deletions

View File

@@ -2652,12 +2652,12 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
@Override
public void accept(ActivityRecord r) {
if (r.finishing) {
return;
}
if (r.mLaunchCookie != null) {
mInfo.addLaunchCookie(r.mLaunchCookie);
}
if (r.finishing) {
return;
}
mInfo.numActivities++;
mInfo.baseActivity = r.mActivityComponent;
if (mTopRunning == null) {

View File

@@ -2314,6 +2314,8 @@ public class ActivityRecordTests extends WindowTestsBase {
assertEquals(launchCookie, activity2.mLaunchCookie);
assertNull(activity1.mLaunchCookie);
activity2.makeFinishingLocked();
assertTrue(activity1.getTask().getTaskInfo().launchCookies.contains(launchCookie));
}
private void verifyProcessInfoUpdate(ActivityRecord activity, State state,