clearProfilerLocked();
}
- mStackSupervisor.handleAppDiedLocked(app, restarting);
+ // Remove this application's activities from active lists.
+ boolean hasVisibleActivities = mStackSupervisor.handleAppDiedLocked(app, restarting);
app.activities.clear();
info.putString("shortMsg", "Process crashed.");
finishInstrumentationLocked(app, Activity.RESULT_CANCELED, info);
}
+
+ if (!restarting) {
+ if (!mStackSupervisor.resumeTopActivitiesLocked()) {
+ // If there was nothing to resume, and we are not already
+ // restarting this process, but there is a visible activity that
+ // is hosted by the process... then make sure all visible
+ // activities are running, taking care of restarting this
+ // process.
+ if (hasVisibleActivities) {
+ mStackSupervisor.ensureActivitiesVisibleLocked(null, 0);
+ }
+ }
+ }
}
private final int getLRURecordIndexForAppLocked(IApplicationThread thread) {
/**
* Reset local parameters because an app's activity died.
* @param app The app of the activity that died.
- * @return true if home should be launched next.
+ * @return result from removeHistoryRecordsForAppLocked.
*/
boolean handleAppDiedLocked(ProcessRecord app) {
- if (!containsApp(app)) {
- return false;
- }
-
if (mPausingActivity != null && mPausingActivity.app == app) {
if (DEBUG_PAUSE || DEBUG_CLEANUP) Slog.v(TAG,
"App died while pausing: " + mPausingActivity);
mLastNoHistoryActivity = null;
}
- // Determine if the top task is exiting and should return to home. Do this before it gets
- // removed in removeHistoryRecordsForAppsLocked.
- boolean launchHomeNext = false;
- TaskRecord topTask = mTaskHistory.get(mTaskHistory.size() - 1);
- ArrayList<ActivityRecord> activities = topTask.mActivities;
- int activityNdx;
- for (activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
- ActivityRecord r = activities.get(activityNdx);
- if (r.finishing) {
- continue;
- }
- if (r.app != app) {
- // This is the dying activity.
- break;
- }
- }
- if (activityNdx < 0) {
- // All activities in task belong to app. Set launchHomeNext to task's value.
- launchHomeNext = topTask.mOnTopOfHome;
- }
-
- removeHistoryRecordsForAppLocked(app);
-
- return launchHomeNext;
+ return removeHistoryRecordsForAppLocked(app);
}
void handleAppCrashLocked(ProcessRecord app) {
return r;
}
- void handleAppDiedLocked(ProcessRecord app, boolean restarting) {
- boolean launchHomeTaskNext = false;
- final ActivityStack focusedStack = getFocusedStack();
- final int numStacks = mStacks.size();
- for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) {
- final ActivityStack stack = mStacks.get(stackNdx);
- // Only update launchHomeTaskNext for the focused stack.
- launchHomeTaskNext |= (stack.handleAppDiedLocked(app) && stack == focusedStack);
- }
-
- if (!restarting) {
- if (launchHomeTaskNext) {
- resumeHomeActivity(null);
- } else {
- if (!resumeTopActivitiesLocked(focusedStack, null, null)) {
- // If there was nothing to resume, and we are not already
- // restarting this process, but there is a visible activity that
- // is hosted by the process... then make sure all visible
- // activities are running, taking care of restarting this
- // process.
- ensureActivitiesVisibleLocked(null, 0);
- }
- }
+ boolean handleAppDiedLocked(ProcessRecord app, boolean restarting) {
+ boolean hasVisibleActivities = false;
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ hasVisibleActivities |= mStacks.get(stackNdx).handleAppDiedLocked(app);
}
+ return hasVisibleActivities;
}
void closeSystemDialogsLocked() {