summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java16
4 files changed, 20 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index b5a6dacbec5c..bb9a10563b02 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -138,14 +138,15 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
}
}
- // When we start, preload the metadata and icons associated with the recent tasks.
+ // When we start, preload the data associated with the previous recent tasks.
// We can use a new plan since the caches will be the same.
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
loader.preloadTasks(plan, true /* isTopTaskHome */);
RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
launchOpts.numVisibleTasks = loader.getApplicationIconCacheSize();
- launchOpts.loadThumbnails = false;
+ launchOpts.numVisibleTaskThumbnails = loader.getThumbnailCacheSize();
+ launchOpts.onlyLoadForCache = true;
loader.loadTasks(mContext, plan, launchOpts);
}
@@ -510,6 +511,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
launchOpts.runningTaskId = topTask.id;
launchOpts.loadThumbnails = false;
+ launchOpts.onlyLoadForCache = true;
loader.loadTasks(mContext, sInstanceLoadPlan, launchOpts);
// Try starting with a thumbnail transition
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 9a7fec4c8117..d1eadd880ffe 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -213,10 +213,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
RecentsTaskLoadPlan plan = AlternateRecentsComponent.consumeInstanceLoadPlan();
if (plan == null) {
plan = loader.createLoadPlan(this);
- loader.preloadTasks(plan, mConfig.launchedFromHome);
}
// Start loading tasks according to the load plan
+ if (plan.getTaskStack() == null) {
+ loader.preloadTasks(plan, mConfig.launchedFromHome);
+ }
RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
loadOpts.runningTaskId = mConfig.launchedToTaskId;
loadOpts.numVisibleTasks = numVisibleTasks;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
index 41251c841950..33c4b055c07d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
@@ -49,6 +49,7 @@ public class RecentsTaskLoadPlan {
public int runningTaskId = -1;
public boolean loadIcons = true;
public boolean loadThumbnails = true;
+ public boolean onlyLoadForCache = false;
public int numVisibleTasks = 0;
public int numVisibleTaskThumbnails = 0;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
index 6fd738d01377..599d3cee3847 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
@@ -418,28 +418,36 @@ public class RecentsTaskLoader {
return mMaxIconCacheSize;
}
+ /** Returns the size of the thumbnail cache. */
+ public int getThumbnailCacheSize() {
+ return mMaxThumbnailCacheSize;
+ }
+
+ /** Creates a new plan for loading the recent tasks. */
public RecentsTaskLoadPlan createLoadPlan(Context context) {
RecentsConfiguration config = RecentsConfiguration.getInstance();
RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(context, config, mSystemServicesProxy);
return plan;
}
+ /** Preloads recents tasks using the specified plan to store the output. */
public void preloadTasks(RecentsTaskLoadPlan plan, boolean isTopTaskHome) {
plan.preloadPlan(this, isTopTaskHome);
}
+ /** Begins loading the heavy task data according to the specified options. */
public void loadTasks(Context context, RecentsTaskLoadPlan plan,
RecentsTaskLoadPlan.Options opts) {
if (opts == null) {
throw new RuntimeException("Requires load options");
}
plan.executePlan(opts, this);
- if (opts.numVisibleTasks > 0) {
+ if (!opts.onlyLoadForCache) {
mNumVisibleTasksLoaded = opts.numVisibleTasks;
- }
- // Start the loader
- mLoader.start(context);
+ // Start the loader
+ mLoader.start(context);
+ }
}
/** Acquires the task resource data directly from the pool. */