Merge "Update recent tasks order when the last resumed activity changed" into tm-qpr-dev am: d7f0da6718

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20923371

Change-Id: I1256882417832ef8da43adc0d7689b16b5af5f0c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jerry Chang
2023-01-18 03:54:28 +00:00
committed by Automerger Merge Worker
2 changed files with 14 additions and 0 deletions

View File

@@ -4724,6 +4724,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.
*/