Fix crash in recents

Bug: 7128044

Change-Id: Icaec50ef9dfbc5da78d71925215c3363f58d7d3d
This commit is contained in:
Michael Jurka
2012-09-13 11:05:59 -07:00
parent 568e3ebb5e
commit 482f159dc4
2 changed files with 16 additions and 15 deletions

View File

@@ -164,13 +164,15 @@ public class RecentsActivity extends Activity {
super.onNewIntent(intent);
if (TOGGLE_RECENTS_INTENT.equals(intent.getAction())) {
if (mRecentsPanel != null && !mRecentsPanel.isShowing()) {
final SystemUIApplication app = (SystemUIApplication) getApplication();
final RecentTasksLoader recentTasksLoader = app.getRecentTasksLoader();
mRecentsPanel.show(true, recentTasksLoader.getLoadedTasks(),
recentTasksLoader.isFirstScreenful());
} else if ((mRecentsPanel != null && mRecentsPanel.isShowing())) {
dismissAndGoBack();
if (mRecentsPanel != null) {
if (mRecentsPanel.isShowing() && mForeground) {
dismissAndGoBack();
} else {
final SystemUIApplication app = (SystemUIApplication) getApplication();
final RecentTasksLoader recentTasksLoader = app.getRecentTasksLoader();
mRecentsPanel.show(true, recentTasksLoader.getLoadedTasks(),
recentTasksLoader.isFirstScreenful());
}
}
}
}

View File

@@ -33,6 +33,7 @@ import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.UserHandle;
import android.provider.Settings;
@@ -581,25 +582,23 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
bm = holder.thumbnailViewImage.getDrawingCache();
usingDrawingCache = true;
}
if (bm == null) {
throw new RuntimeException("Recents thumbnail is null");
}
ActivityOptions opts = ActivityOptions.makeThumbnailScaleUpAnimation(
holder.thumbnailViewImage, bm, 0, 0, null);
Bundle opts = (bm == null) ?
null :
ActivityOptions.makeThumbnailScaleUpAnimation(
holder.thumbnailViewImage, bm, 0, 0, null).toBundle();
show(false);
if (ad.taskId >= 0) {
// This is an active task; it should just go to the foreground.
am.moveTaskToFront(ad.taskId, ActivityManager.MOVE_TASK_WITH_HOME,
opts.toBundle());
opts);
} else {
Intent intent = ad.intent;
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
| Intent.FLAG_ACTIVITY_TASK_ON_HOME
| Intent.FLAG_ACTIVITY_NEW_TASK);
if (DEBUG) Log.v(TAG, "Starting activity " + intent);
context.startActivityAsUser(intent, opts.toBundle(),
context.startActivityAsUser(intent, opts,
new UserHandle(UserHandle.USER_CURRENT));
}
if (usingDrawingCache) {