Only update the task description when the task/description changes
- Instead of updating again for every task when we fetch recents, only update
when the activities change
Bug: 69166452
Test: android.app.cts.TaskDescriptionTest
Change-Id: Idb66ee4c3ca6f637b6ab52c6d52dd1a09926c48f
diff --git a/services/core/java/com/android/server/am/RecentTasks.java b/services/core/java/com/android/server/am/RecentTasks.java
index d35c37b..c742f68 100644
--- a/services/core/java/com/android/server/am/RecentTasks.java
+++ b/services/core/java/com/android/server/am/RecentTasks.java
@@ -1426,9 +1426,6 @@
* Creates a new RecentTaskInfo from a TaskRecord.
*/
ActivityManager.RecentTaskInfo createRecentTaskInfo(TaskRecord tr) {
- // Update the task description to reflect any changes in the task stack
- tr.updateTaskDescription();
-
// Compose the recent task info
ActivityManager.RecentTaskInfo rti = new ActivityManager.RecentTaskInfo();
rti.id = tr.getTopActivity() == null ? INVALID_TASK_ID : tr.taskId;
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 949f51f..290bebf 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -1616,6 +1616,9 @@
final int effectiveRootIndex = findEffectiveRootIndex();
final ActivityRecord r = mActivities.get(effectiveRootIndex);
setIntent(r);
+
+ // Update the task description when the activities change
+ updateTaskDescription();
}
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {