Preload recents on phones with hard nav keys
Also refactor recents code across Phone/Tablet
Change-Id: Id557c5cb0f7d9378f81c40b20511a5d98bf4078e
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index f8dfa8f..37ab58a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -61,8 +61,10 @@
private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT;
private static final int MSG_TOGGLE_RECENT_APPS = 11 << MSG_SHIFT;
+ private static final int MSG_PRELOAD_RECENT_APPS = 12 << MSG_SHIFT;
+ private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 13 << MSG_SHIFT;
- private static final int MSG_SET_NAVIGATION_ICON_HINTS = 13 << MSG_SHIFT;
+ private static final int MSG_SET_NAVIGATION_ICON_HINTS = 14 << MSG_SHIFT;
private StatusBarIconList mList;
private Callbacks mCallbacks;
@@ -92,6 +94,8 @@
public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
public void setHardKeyboardStatus(boolean available, boolean enabled);
public void toggleRecentApps();
+ public void preloadRecentApps();
+ public void cancelPreloadRecentApps();
public void setNavigationIconHints(int hints);
}
@@ -199,6 +203,20 @@
}
}
+ public void preloadRecentApps() {
+ synchronized (mList) {
+ mHandler.removeMessages(MSG_PRELOAD_RECENT_APPS);
+ mHandler.obtainMessage(MSG_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
+ }
+ }
+
+ public void cancelPreloadRecentApps() {
+ synchronized (mList) {
+ mHandler.removeMessages(MSG_CANCEL_PRELOAD_RECENT_APPS);
+ mHandler.obtainMessage(MSG_CANCEL_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
+ }
+ }
+
public void setNavigationIconHints(int hints) {
synchronized (mList) {
mHandler.removeMessages(MSG_SET_NAVIGATION_ICON_HINTS);
@@ -275,6 +293,12 @@
case MSG_TOGGLE_RECENT_APPS:
mCallbacks.toggleRecentApps();
break;
+ case MSG_PRELOAD_RECENT_APPS:
+ mCallbacks.preloadRecentApps();
+ break;
+ case MSG_CANCEL_PRELOAD_RECENT_APPS:
+ mCallbacks.cancelPreloadRecentApps();
+ break;
case MSG_SET_NAVIGATION_ICON_HINTS:
mCallbacks.setNavigationIconHints(msg.arg1);
break;