diff options
author | Winson Chung <winsonc@google.com> | 2019-06-25 14:44:05 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2019-06-25 14:44:05 -0700 |
commit | df9fc63e8c0dd75af1bd1d50d090f9821fd62fc6 (patch) | |
tree | f1fc7a606f71e1b38b9468a625c30ea2b55dc1ee /quickstep/src | |
parent | a90531cd00ad64fb8501c8190f99e068f9d581d6 (diff) | |
download | android_packages_apps_Trebuchet-df9fc63e8c0dd75af1bd1d50d090f9821fd62fc6.tar.gz android_packages_apps_Trebuchet-df9fc63e8c0dd75af1bd1d50d090f9821fd62fc6.tar.bz2 android_packages_apps_Trebuchet-df9fc63e8c0dd75af1bd1d50d090f9821fd62fc6.zip |
Clean up some more refs to thumbnail data
- Always return a copy of the task list to ensure that the model doesn't
hold refs to the thumbnail data if it was loaded into the same task
- Always clear the task thumbnail data ref once the visibility of the
task view changes to be invisible
Bug: 132309376
Test: Enter overview scroll to the end of the list, relaunch app and take
heap dump
Change-Id: I4437fd30172a5fe2a78c111f780163a1e6bbbb54
Diffstat (limited to 'quickstep/src')
-rw-r--r-- | quickstep/src/com/android/quickstep/RecentTasksList.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index 353837312..f27ba8538 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -84,7 +84,7 @@ public class RecentTasksList extends TaskStackChangeListener { final int requestLoadId = mChangeId; Runnable resultCallback = callback == null ? () -> { } - : () -> callback.accept(mTasks); + : () -> callback.accept(copyOf(mTasks)); if (mLastLoadedId == mChangeId && (!mLastLoadHadKeysOnly || loadKeysOnly)) { // The list is up to date, callback with the same list @@ -183,4 +183,14 @@ public class RecentTasksList extends TaskStackChangeListener { return allTasks; } + + private ArrayList<Task> copyOf(ArrayList<Task> tasks) { + ArrayList<Task> newTasks = new ArrayList<>(); + for (int i = 0; i < tasks.size(); i++) { + Task t = tasks.get(i); + newTasks.add(new Task(t.key, t.colorPrimary, t.colorBackground, t.isDockable, + t.isLocked, t.taskDescription, t.topActivity)); + } + return newTasks; + } }
\ No newline at end of file |