Skip to content

Commit 482f159

Browse files
committed
Fix crash in recents
Bug: 7128044 Change-Id: Icaec50ef9dfbc5da78d71925215c3363f58d7d3d
1 parent 568e3eb commit 482f159

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,15 @@ private void handleIntent(Intent intent) {
164164
super.onNewIntent(intent);
165165

166166
if (TOGGLE_RECENTS_INTENT.equals(intent.getAction())) {
167-
if (mRecentsPanel != null && !mRecentsPanel.isShowing()) {
168-
final SystemUIApplication app = (SystemUIApplication) getApplication();
169-
final RecentTasksLoader recentTasksLoader = app.getRecentTasksLoader();
170-
mRecentsPanel.show(true, recentTasksLoader.getLoadedTasks(),
171-
recentTasksLoader.isFirstScreenful());
172-
} else if ((mRecentsPanel != null && mRecentsPanel.isShowing())) {
173-
dismissAndGoBack();
167+
if (mRecentsPanel != null) {
168+
if (mRecentsPanel.isShowing() && mForeground) {
169+
dismissAndGoBack();
170+
} else {
171+
final SystemUIApplication app = (SystemUIApplication) getApplication();
172+
final RecentTasksLoader recentTasksLoader = app.getRecentTasksLoader();
173+
mRecentsPanel.show(true, recentTasksLoader.getLoadedTasks(),
174+
recentTasksLoader.isFirstScreenful());
175+
}
174176
}
175177
}
176178
}

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import android.graphics.drawable.BitmapDrawable;
3434
import android.graphics.drawable.Drawable;
3535
import android.net.Uri;
36+
import android.os.Bundle;
3637
import android.os.RemoteException;
3738
import android.os.UserHandle;
3839
import android.provider.Settings;
@@ -581,25 +582,23 @@ public void handleOnClick(View view) {
581582
bm = holder.thumbnailViewImage.getDrawingCache();
582583
usingDrawingCache = true;
583584
}
584-
585-
if (bm == null) {
586-
throw new RuntimeException("Recents thumbnail is null");
587-
}
588-
ActivityOptions opts = ActivityOptions.makeThumbnailScaleUpAnimation(
589-
holder.thumbnailViewImage, bm, 0, 0, null);
585+
Bundle opts = (bm == null) ?
586+
null :
587+
ActivityOptions.makeThumbnailScaleUpAnimation(
588+
holder.thumbnailViewImage, bm, 0, 0, null).toBundle();
590589

591590
show(false);
592591
if (ad.taskId >= 0) {
593592
// This is an active task; it should just go to the foreground.
594593
am.moveTaskToFront(ad.taskId, ActivityManager.MOVE_TASK_WITH_HOME,
595-
opts.toBundle());
594+
opts);
596595
} else {
597596
Intent intent = ad.intent;
598597
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
599598
| Intent.FLAG_ACTIVITY_TASK_ON_HOME
600599
| Intent.FLAG_ACTIVITY_NEW_TASK);
601600
if (DEBUG) Log.v(TAG, "Starting activity " + intent);
602-
context.startActivityAsUser(intent, opts.toBundle(),
601+
context.startActivityAsUser(intent, opts,
603602
new UserHandle(UserHandle.USER_CURRENT));
604603
}
605604
if (usingDrawingCache) {

0 commit comments

Comments
 (0)