Merge "Fixing issue with old thumbnails on first launch of app. (Bug 18718114)" into lmp-mr1-dev
This commit is contained in:
@@ -111,14 +111,23 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
|
|||||||
public void run() {
|
public void run() {
|
||||||
RecentsConfiguration config = RecentsConfiguration.getInstance();
|
RecentsConfiguration config = RecentsConfiguration.getInstance();
|
||||||
if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) {
|
if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) {
|
||||||
|
ActivityManager.RunningTaskInfo runningTaskInfo = getTopMostTask();
|
||||||
|
|
||||||
// Load the next task only if we aren't svelte
|
// Load the next task only if we aren't svelte
|
||||||
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
|
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
|
||||||
RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
|
RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
|
||||||
loader.preloadTasks(plan, true /* isTopTaskHome */);
|
loader.preloadTasks(plan, true /* isTopTaskHome */);
|
||||||
RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
|
RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
|
||||||
launchOpts.numVisibleTasks = 1;
|
// This callback is made when a new activity is launched and the old one is paused
|
||||||
launchOpts.numVisibleTaskThumbnails = 1;
|
// so ignore the current activity and try and preload the thumbnail for the
|
||||||
|
// previous one.
|
||||||
|
if (runningTaskInfo != null) {
|
||||||
|
launchOpts.runningTaskId = runningTaskInfo.id;
|
||||||
|
}
|
||||||
|
launchOpts.numVisibleTasks = 2;
|
||||||
|
launchOpts.numVisibleTaskThumbnails = 2;
|
||||||
launchOpts.onlyLoadForCache = true;
|
launchOpts.onlyLoadForCache = true;
|
||||||
|
launchOpts.onlyLoadPausedActivities = true;
|
||||||
loader.loadTasks(mContext, plan, launchOpts);
|
loader.loadTasks(mContext, plan, launchOpts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class RecentsTaskLoadPlan {
|
|||||||
public boolean loadIcons = true;
|
public boolean loadIcons = true;
|
||||||
public boolean loadThumbnails = true;
|
public boolean loadThumbnails = true;
|
||||||
public boolean onlyLoadForCache = false;
|
public boolean onlyLoadForCache = false;
|
||||||
|
public boolean onlyLoadPausedActivities = false;
|
||||||
public int numVisibleTasks = 0;
|
public int numVisibleTasks = 0;
|
||||||
public int numVisibleTaskThumbnails = 0;
|
public int numVisibleTaskThumbnails = 0;
|
||||||
}
|
}
|
||||||
@@ -141,6 +142,7 @@ public class RecentsTaskLoadPlan {
|
|||||||
activityColor, (i == (taskCount - 1)), mConfig.lockToAppEnabled, icon,
|
activityColor, (i == (taskCount - 1)), mConfig.lockToAppEnabled, icon,
|
||||||
iconFilename);
|
iconFilename);
|
||||||
task.thumbnail = loader.getAndUpdateThumbnail(taskKey, mSystemServicesProxy, false);
|
task.thumbnail = loader.getAndUpdateThumbnail(taskKey, mSystemServicesProxy, false);
|
||||||
|
if (DEBUG) Log.d(TAG, "\tthumbnail: " + taskKey + ", " + task.thumbnail);
|
||||||
loadedTasks.add(task);
|
loadedTasks.add(task);
|
||||||
}
|
}
|
||||||
mStack.setTasks(loadedTasks);
|
mStack.setTasks(loadedTasks);
|
||||||
@@ -186,6 +188,11 @@ public class RecentsTaskLoadPlan {
|
|||||||
boolean isVisibleTask = i >= (taskCount - opts.numVisibleTasks);
|
boolean isVisibleTask = i >= (taskCount - opts.numVisibleTasks);
|
||||||
boolean isVisibleThumbnail = i >= (taskCount - opts.numVisibleTaskThumbnails);
|
boolean isVisibleThumbnail = i >= (taskCount - opts.numVisibleTaskThumbnails);
|
||||||
|
|
||||||
|
// If requested, skip the running task
|
||||||
|
if (opts.onlyLoadPausedActivities && isRunningTask) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (opts.loadIcons && (isRunningTask || isVisibleTask)) {
|
if (opts.loadIcons && (isRunningTask || isVisibleTask)) {
|
||||||
if (task.activityIcon == null) {
|
if (task.activityIcon == null) {
|
||||||
if (DEBUG) Log.d(TAG, "\tLoading icon: " + taskKey);
|
if (DEBUG) Log.d(TAG, "\tLoading icon: " + taskKey);
|
||||||
@@ -194,7 +201,7 @@ public class RecentsTaskLoadPlan {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opts.loadThumbnails && (isRunningTask || isVisibleThumbnail)) {
|
if (opts.loadThumbnails && (isRunningTask || isVisibleThumbnail)) {
|
||||||
if (task.thumbnail == null) {
|
if (task.thumbnail == null || isRunningTask) {
|
||||||
if (DEBUG) Log.d(TAG, "\tLoading thumbnail: " + taskKey);
|
if (DEBUG) Log.d(TAG, "\tLoading thumbnail: " + taskKey);
|
||||||
if (mConfig.svelteLevel <= RecentsConfiguration.SVELTE_LIMIT_CACHE) {
|
if (mConfig.svelteLevel <= RecentsConfiguration.SVELTE_LIMIT_CACHE) {
|
||||||
task.thumbnail = loader.getAndUpdateThumbnail(taskKey, mSystemServicesProxy,
|
task.thumbnail = loader.getAndUpdateThumbnail(taskKey, mSystemServicesProxy,
|
||||||
|
|||||||
Reference in New Issue
Block a user