Merge "[ActivityManager] Avoid improper resume top activity."

This commit is contained in:
Olawale Ogunwale
2015-04-02 16:39:18 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 14 deletions

View File

@@ -4592,17 +4592,13 @@ public final class ActivityManagerService extends ActivityManagerNative
finishInstrumentationLocked(app, Activity.RESULT_CANCELED, info); finishInstrumentationLocked(app, Activity.RESULT_CANCELED, info);
} }
if (!restarting) { if (!restarting && hasVisibleActivities && !mStackSupervisor.resumeTopActivitiesLocked()) {
if (!mStackSupervisor.resumeTopActivitiesLocked()) { // If there was nothing to resume, and we are not already
// If there was nothing to resume, and we are not already // restarting this process, but there is a visible activity that
// restarting this process, but there is a visible activity that // is hosted by the process... then make sure all visible
// is hosted by the process... then make sure all visible // activities are running, taking care of restarting this
// activities are running, taking care of restarting this // process.
// process. mStackSupervisor.ensureActivitiesVisibleLocked(null, 0);
if (hasVisibleActivities) {
mStackSupervisor.ensureActivitiesVisibleLocked(null, 0);
}
}
} }
} }

View File

@@ -3390,6 +3390,9 @@ final class ActivityStack {
if (DEBUG_CLEANUP) Slog.v( if (DEBUG_CLEANUP) Slog.v(
TAG, "Record #" + i + " " + r + ": app=" + r.app); TAG, "Record #" + i + " " + r + ": app=" + r.app);
if (r.app == app) { if (r.app == app) {
if (r.visible) {
hasVisibleActivities = true;
}
boolean remove; boolean remove;
if ((!r.haveState && !r.stateNotNeeded) || r.finishing) { if ((!r.haveState && !r.stateNotNeeded) || r.finishing) {
// Don't currently have state for the activity, or // Don't currently have state for the activity, or
@@ -3431,9 +3434,6 @@ final class ActivityStack {
// it can be restarted later when needed. // it can be restarted later when needed.
if (localLOGV) Slog.v( if (localLOGV) Slog.v(
TAG, "Keeping entry, setting app to null"); TAG, "Keeping entry, setting app to null");
if (r.visible) {
hasVisibleActivities = true;
}
if (DEBUG_APP) Slog.v(TAG, "Clearing app during removeHistory for activity " if (DEBUG_APP) Slog.v(TAG, "Clearing app during removeHistory for activity "
+ r); + r);
r.app = null; r.app = null;