summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/recents
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-10-24 22:08:11 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-24 22:08:12 +0000
commit0841cf7f37d7b20a08fa894c366f32fde55ea7e9 (patch)
tree2ed06d975c5fa6b1d6edf3f2f9b09cfe94ddbe08 /packages/SystemUI/src/com/android/systemui/recents
parent74a4a8d6162dde06297ff6c3ef264e7f9066b88f (diff)
parentbac679b0d47aee0c9f3228ce2957ab4fe5b3609e (diff)
downloadframeworks_base-0841cf7f37d7b20a08fa894c366f32fde55ea7e9.zip
frameworks_base-0841cf7f37d7b20a08fa894c366f32fde55ea7e9.tar.gz
frameworks_base-0841cf7f37d7b20a08fa894c366f32fde55ea7e9.tar.bz2
Merge "Preloading task metadata to improve Recents startup time after reboot. (Bug 18057321)" into lmp-mr1-dev
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recents')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java16
3 files changed, 33 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 97c3ad9..76e8181 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -126,6 +126,9 @@ public class AlternateRecentsComponent {
}
}
}
+
+ // When we start, preload the metadata associated with the previous tasks
+ RecentsTaskLoader.getInstance().preload(mContext);
}
public void onBootCompleted() {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 2b55c1f..d2c55f7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -28,6 +28,8 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
import android.os.UserHandle;
import android.util.Pair;
import android.view.KeyEvent;
@@ -102,8 +104,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
public void run() {
// Mark Recents as no longer visible
- AlternateRecentsComponent.notifyVisibilityChanged(false);
- mVisible = false;
+ onRecentsActivityVisibilityChanged(false);
// Finish Recents
if (mLaunchIntent != null) {
if (mLaunchOpts != null) {
@@ -155,6 +156,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
if (action.equals(Intent.ACTION_SCREEN_OFF)) {
// When the screen turns off, dismiss Recents to Home
dismissRecentsToHome(false);
+ // Start preloading some tasks in the background
+ RecentsTaskLoader.getInstance().preload(RecentsActivity.this);
} else if (action.equals(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED)) {
// When the search activity changes, update the Search widget
refreshSearchWidget();
@@ -425,6 +428,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
}
+ /** Called when the configuration changes. */
void onConfigurationChange() {
// Update RecentsConfiguration
mConfig = RecentsConfiguration.reinitialize(this,
@@ -437,6 +441,14 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
mScrimViews.startEnterRecentsAnimation();
}
+ /** Handles changes to the activity visibility. */
+ void onRecentsActivityVisibilityChanged(boolean visible) {
+ if (!visible) {
+ AlternateRecentsComponent.notifyVisibilityChanged(visible);
+ }
+ mVisible = visible;
+ }
+
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
@@ -473,7 +485,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
super.onResume();
// Mark Recents as visible
- mVisible = true;
+ onRecentsActivityVisibilityChanged(true);
}
@Override
@@ -605,8 +617,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
public void onTaskViewClicked() {
// Mark recents as no longer visible
- AlternateRecentsComponent.notifyVisibilityChanged(false);
- mVisible = false;
+ onRecentsActivityVisibilityChanged(false);
}
@Override
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 114e93f..594eb0e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
@@ -418,13 +418,25 @@ public class RecentsTaskLoader {
root.setStack(stack);
// Start the task loader and add all the tasks we need to load
- mLoader.start(context);
mLoadQueue.addTasks(tasksToLoad);
+ mLoader.start(context);
+
return root;
}
+ /** Preloads the set of recent tasks (not including thumbnails). */
+ public void preload(Context context) {
+ ArrayList<Task> tasksToLoad = new ArrayList<Task>();
+ getTaskStack(mSystemServicesProxy, context.getResources(),
+ -1, -1, true, true, null, tasksToLoad);
+
+ // Start the task loader and add all the tasks we need to load
+ mLoadQueue.addTasks(tasksToLoad);
+ mLoader.start(context);
+ }
+
/** Creates a lightweight stack of the current recent tasks, without thumbnails and icons. */
- public TaskStack getTaskStack(SystemServicesProxy ssp, Resources res,
+ public synchronized TaskStack getTaskStack(SystemServicesProxy ssp, Resources res,
int preloadTaskId, int preloadTaskCount,
boolean loadTaskThumbnails, boolean isTopTaskHome,
List<Task.TaskKey> taskKeysOut, List<Task> tasksToLoadOut) {