Merge "Fix incorrect setting of TaskRecord.frontOfTask. DO NOT MERGE." into klp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
477897ad7b
@@ -1288,17 +1288,7 @@ final class ActivityStack {
|
|||||||
if (prevTask != null && prevTask.mOnTopOfHome && prev.finishing && prev.frontOfTask) {
|
if (prevTask != null && prevTask.mOnTopOfHome && prev.finishing && prev.frontOfTask) {
|
||||||
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
|
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
|
||||||
if (prevTask == nextTask) {
|
if (prevTask == nextTask) {
|
||||||
ArrayList<ActivityRecord> activities = prevTask.mActivities;
|
prevTask.setFrontOfTask();
|
||||||
final int numActivities = activities.size();
|
|
||||||
for (int activityNdx = 0; activityNdx < numActivities; ++activityNdx) {
|
|
||||||
final ActivityRecord r = activities.get(activityNdx);
|
|
||||||
// r is usually the same as next, but what if two activities were launched
|
|
||||||
// before prev finished?
|
|
||||||
if (!r.finishing) {
|
|
||||||
r.frontOfTask = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (prevTask != topTask()) {
|
} else if (prevTask != topTask()) {
|
||||||
// This task is going away but it was supposed to return to the home task.
|
// This task is going away but it was supposed to return to the home task.
|
||||||
// Now the task above it has to return to the home task instead.
|
// Now the task above it has to return to the home task instead.
|
||||||
@@ -1750,9 +1740,9 @@ final class ActivityStack {
|
|||||||
if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Adding activity " + r + " to stack to task " + task,
|
if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Adding activity " + r + " to stack to task " + task,
|
||||||
new RuntimeException("here").fillInStackTrace());
|
new RuntimeException("here").fillInStackTrace());
|
||||||
task.addActivityToTop(r);
|
task.addActivityToTop(r);
|
||||||
|
task.setFrontOfTask();
|
||||||
|
|
||||||
r.putInHistory();
|
r.putInHistory();
|
||||||
r.frontOfTask = newTask;
|
|
||||||
if (!isHomeStack() || numActivities() > 0) {
|
if (!isHomeStack() || numActivities() > 0) {
|
||||||
// We want to show the starting preview window if we are
|
// We want to show the starting preview window if we are
|
||||||
// switching to a new task, or the next activity's process is
|
// switching to a new task, or the next activity's process is
|
||||||
@@ -2413,15 +2403,12 @@ final class ActivityStack {
|
|||||||
final ArrayList<ActivityRecord> activities = r.task.mActivities;
|
final ArrayList<ActivityRecord> activities = r.task.mActivities;
|
||||||
final int index = activities.indexOf(r);
|
final int index = activities.indexOf(r);
|
||||||
if (index < (activities.size() - 1)) {
|
if (index < (activities.size() - 1)) {
|
||||||
ActivityRecord next = activities.get(index+1);
|
r.task.setFrontOfTask();
|
||||||
if (r.frontOfTask) {
|
|
||||||
// The next activity is now the front of the task.
|
|
||||||
next.frontOfTask = true;
|
|
||||||
}
|
|
||||||
if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) != 0) {
|
if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) != 0) {
|
||||||
// If the caller asked that this activity (and all above it)
|
// If the caller asked that this activity (and all above it)
|
||||||
// be cleared when the task is reset, don't lose that information,
|
// be cleared when the task is reset, don't lose that information,
|
||||||
// but propagate it up to the next activity.
|
// but propagate it up to the next activity.
|
||||||
|
ActivityRecord next = activities.get(index+1);
|
||||||
next.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
next.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,18 +159,33 @@ final class TaskRecord extends ThumbnailHolder {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Call after activity movement or finish to make sure that frontOfTask is set correctly */
|
||||||
|
final void setFrontOfTask() {
|
||||||
|
boolean foundFront = false;
|
||||||
|
final int numActivities = mActivities.size();
|
||||||
|
for (int activityNdx = 0; numActivities < activityNdx; ++activityNdx) {
|
||||||
|
final ActivityRecord r = mActivities.get(activityNdx);
|
||||||
|
if (foundFront || r.finishing) {
|
||||||
|
r.frontOfTask = false;
|
||||||
|
} else {
|
||||||
|
r.frontOfTask = true;
|
||||||
|
// Set frontOfTask false for every following activity.
|
||||||
|
foundFront = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reorder the history stack so that the activity at the given index is
|
* Reorder the history stack so that the passed activity is brought to the front.
|
||||||
* brought to the front.
|
|
||||||
*/
|
*/
|
||||||
final void moveActivityToFrontLocked(ActivityRecord newTop) {
|
final void moveActivityToFrontLocked(ActivityRecord newTop) {
|
||||||
if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + newTop
|
if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + newTop
|
||||||
+ " to stack at top", new RuntimeException("here").fillInStackTrace());
|
+ " to stack at top", new RuntimeException("here").fillInStackTrace());
|
||||||
|
|
||||||
getTopActivity().frontOfTask = false;
|
|
||||||
mActivities.remove(newTop);
|
mActivities.remove(newTop);
|
||||||
mActivities.add(newTop);
|
mActivities.add(newTop);
|
||||||
newTop.frontOfTask = true;
|
|
||||||
|
setFrontOfTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addActivityAtBottom(ActivityRecord r) {
|
void addActivityAtBottom(ActivityRecord r) {
|
||||||
|
|||||||
Reference in New Issue
Block a user