Update recent tasks order when the last resumed activity changed

Ensure to update recent tasks order when the last resumed activity
chagned to cover cases like dismissing the focused side of split screen
to the background.

Fix: 259648295
Test: atest ActivityTaskSupervisorTests
Change-Id: I9a18c35da40f13163977da47eac5c12605afabdf
This commit is contained in:
Jerry Chang
2023-01-07 16:21:48 +00:00
parent 846ed06579
commit 4c770bf2c6
2 changed files with 14 additions and 0 deletions

View File

@@ -4715,6 +4715,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
mTaskChangeNotificationController.notifyTaskFocusChanged(prevTask.mTaskId, false);
}
mTaskChangeNotificationController.notifyTaskFocusChanged(task.mTaskId, true);
mTaskSupervisor.mRecentTasks.add(task);
}
applyUpdateLockStateLocked(r);

View File

@@ -248,6 +248,19 @@ public class ActivityTaskSupervisorTests extends WindowTestsBase {
eq(true) /* focused */);
}
/**
* Ensures it updates recent tasks order when the last resumed activity changed.
*/
@Test
public void testUpdateRecentTasksForTopResumed() {
spyOn(mSupervisor.mRecentTasks);
final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build();
final Task task = activity.getTask();
mAtm.setLastResumedActivityUncheckLocked(activity, "test");
verify(mSupervisor.mRecentTasks).add(eq(task));
}
/**
* Ensures that a trusted display can launch arbitrary activity and an untrusted display can't.
*/