Skip to content

Commit d0d4bb8

Browse files
committed
Fixing preloading recents for all devices
- Fixed for tablets and phones with hard nav buttons Change-Id: I1dc2249376b3f376c283598f5cef6e326b191ace
1 parent 8481980 commit d0d4bb8

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,9 @@ public void run() {
254254
public boolean onTouch(View v, MotionEvent ev) {
255255
int action = ev.getAction() & MotionEvent.ACTION_MASK;
256256
if (action == MotionEvent.ACTION_DOWN) {
257-
mHandler.post(mPreloadTasksRunnable);
257+
preloadRecentTasksList();
258258
} else if (action == MotionEvent.ACTION_CANCEL) {
259-
cancelLoadingThumbnailsAndIcons();
260-
mHandler.removeCallbacks(mPreloadTasksRunnable);
259+
cancelPreloadingRecentTasksList();
261260
} else if (action == MotionEvent.ACTION_UP) {
262261
// Remove the preloader if we haven't called it yet
263262
mHandler.removeCallbacks(mPreloadTasksRunnable);
@@ -269,6 +268,15 @@ public boolean onTouch(View v, MotionEvent ev) {
269268
return false;
270269
}
271270

271+
public void preloadRecentTasksList() {
272+
mHandler.post(mPreloadTasksRunnable);
273+
}
274+
275+
public void cancelPreloadingRecentTasksList() {
276+
cancelLoadingThumbnailsAndIcons();
277+
mHandler.removeCallbacks(mPreloadTasksRunnable);
278+
}
279+
272280
public void cancelLoadingThumbnailsAndIcons(RecentsPanelView caller) {
273281
// Only oblige this request if it comes from the current RecentsPanel
274282
// (eg when you rotate, the old RecentsPanel request should be ignored)

packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -594,25 +594,11 @@ public void handleMessage(Message m) {
594594
break;
595595
case MSG_PRELOAD_RECENT_APPS:
596596
if (DEBUG) Slog.d(TAG, "preloading recents");
597-
{
598-
// TODO:
599-
// need to implement this
600-
//final RecentsPanelView recentsPanel = getRecentsPanel();
601-
//if (recentsPanel != null) {
602-
//recentsPanel.preloadRecentTasksList();
603-
//}
604-
}
597+
getRecentTasksLoader().preloadRecentTasksList();
605598
break;
606599
case MSG_CANCEL_PRELOAD_RECENT_APPS:
607600
if (DEBUG) Slog.d(TAG, "cancel preloading recents");
608-
{
609-
// TODO:
610-
// need to implement this
611-
//final RecentsPanelView recentsPanel = getRecentsPanel();
612-
//if (recentsPanel != null) {
613-
//recentsPanel.clearRecentTasksList();
614-
//}
615-
}
601+
getRecentTasksLoader().cancelPreloadingRecentTasksList();
616602
break;
617603
case MSG_OPEN_SEARCH_PANEL:
618604
if (DEBUG) Slog.d(TAG, "opening search panel");

packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ protected void addPanelWindows() {
355355

356356
mWindowManager.addView(mCompatModePanel, lp);
357357

358-
//mRecentButton.setOnTouchListener(mRecentsPanel); //TODO: plumb this
358+
mRecentButton.setOnTouchListener(getRecentTasksLoader());
359359

360360
mPile = (NotificationRowLayout)mNotificationPanel.findViewById(R.id.content);
361361
mPile.removeAllViews();

0 commit comments

Comments
 (0)