When removing a task that was on home, put home on top.

Killing an app that was launched from home was not relaunching home.
Previous situations relaunched the next app (i.e. home) based on the
task flag. However, when an app dies the relaunch is deferred until
the TaskRecord has long been forgotten. This fix rearranges the stacks
immediately upon the TaskRecord being removed from the stack. Then the
next resumeTopActivities() call will start the home task.

Fixes bug 11189555.

Change-Id: I0e09350a7db55ea8b38cce7bf4b69923a6b99494
This commit is contained in:
Craig Mautner
2013-10-11 17:36:59 -07:00
parent 09cb9bdcc8
commit 8e5695778f
3 changed files with 12 additions and 5 deletions

View File

@ -3466,7 +3466,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
// Remove this application's activities from active lists.
boolean hasVisibleActivities = mStackSupervisor.handleAppDiedLocked(app, restarting);
boolean hasVisibleActivities = mStackSupervisor.handleAppDiedLocked(app);
app.activities.clear();

View File

@ -2629,6 +2629,9 @@ final class ActivityStack {
if (DEBUG_STACK) Slog.i(TAG,
"removeActivityFromHistoryLocked: last activity removed from " + this);
mStackSupervisor.removeTask(task);
if (task.mOnTopOfHome) {
mStackSupervisor.moveHomeToTop();
}
}
r.takeFromHistory();
removeTimeoutsForActivityLocked(r);

View File

@ -278,12 +278,16 @@ public final class ActivityStackSupervisor {
}
}
boolean resumeHomeActivity(ActivityRecord prev) {
void moveHomeToTop() {
moveHomeStack(true);
mHomeStack.moveHomeTaskToTop();
}
boolean resumeHomeActivity(ActivityRecord prev) {
moveHomeToTop();
if (prev != null) {
prev.task.mOnTopOfHome = false;
}
mHomeStack.moveHomeTaskToTop();
ActivityRecord r = mHomeStack.topRunningActivityLocked(null);
if (r != null && r.isHomeActivity()) {
mService.setFocusedActivityLocked(r);
@ -625,7 +629,7 @@ public final class ActivityStackSupervisor {
}
void startHomeActivity(Intent intent, ActivityInfo aInfo) {
moveHomeStack(true);
moveHomeToTop();
startActivityLocked(null, intent, null, aInfo, null, null, 0, 0, 0, null, 0,
null, false, null);
}
@ -1906,7 +1910,7 @@ public final class ActivityStackSupervisor {
return r;
}
boolean handleAppDiedLocked(ProcessRecord app, boolean restarting) {
boolean handleAppDiedLocked(ProcessRecord app) {
boolean hasVisibleActivities = false;
for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
hasVisibleActivities |= mStacks.get(stackNdx).handleAppDiedLocked(app);