Merge change 22673 into eclair

* changes:
  Make SINGLE_TOP work with CLEAR_TOP.
This commit is contained in:
Android (Google) Code Review
2009-08-27 13:10:54 -07:00
2 changed files with 10 additions and 7 deletions

View File

@@ -2128,12 +2128,14 @@ public class Intent implements Parcelable {
* of activity B, then C and D will be finished and B receive the given
* Intent, resulting in the stack now being: A, B.
*
* <p>The currently running instance of task B in the above example will
* <p>The currently running instance of activity B in the above example will
* either receive the new intent you are starting here in its
* onNewIntent() method, or be itself finished and restarted with the
* new intent. If it has declared its launch mode to be "multiple" (the
* default) it will be finished and re-created; for all other launch modes
* it will receive the Intent in the current instance.
* default) and you have not set {@link #FLAG_ACTIVITY_SINGLE_TOP} in
* the same intent, then it will be finished and re-created; for all other
* launch modes or if {@link #FLAG_ACTIVITY_SINGLE_TOP} is set then this
* Intent will be delivered to the current instance's onNewIntent().
*
* <p>This launch mode can also be used to good effect in conjunction with
* {@link #FLAG_ACTIVITY_NEW_TASK}: if used to start the root activity

View File

@@ -2915,7 +2915,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
* or null if none was found.
*/
private final HistoryRecord performClearTaskLocked(int taskId,
HistoryRecord newR, boolean doClear) {
HistoryRecord newR, int launchFlags, boolean doClear) {
int i = mHistory.size();
// First find the requested task.
@@ -2958,7 +2958,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// Finally, if this is a normal launch mode (that is, not
// expecting onNewIntent()), then we will finish the current
// instance of the activity so a new fresh one can be started.
if (ret.launchMode == ActivityInfo.LAUNCH_MULTIPLE) {
if (ret.launchMode == ActivityInfo.LAUNCH_MULTIPLE
&& (launchFlags&Intent.FLAG_ACTIVITY_SINGLE_TOP) == 0) {
if (!ret.finishing) {
int index = indexOfTokenLocked(ret);
if (index >= 0) {
@@ -3355,7 +3356,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// cases this means we are resetting the task to its
// initial state.
HistoryRecord top = performClearTaskLocked(
taskTop.task.taskId, r, true);
taskTop.task.taskId, r, launchFlags, true);
if (top != null) {
if (top.frontOfTask) {
// Activity aliases may mean we use different
@@ -3498,7 +3499,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// task, but the caller has asked to clear that task if the
// activity is already running.
HistoryRecord top = performClearTaskLocked(
sourceRecord.task.taskId, r, true);
sourceRecord.task.taskId, r, launchFlags, true);
if (top != null) {
logStartActivity(LOG_AM_NEW_INTENT, r, top.task);
deliverNewIntentLocked(top, r.intent);