Merge "Fixing crash in querying the task stack from a fresh load plan. (Bug 18371946)" into lmp-mr1-dev
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user