summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Craig Mautner <cmautner@google.com> 2013-08-06 19:56:50 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2013-08-06 19:56:50 +0000
commit4373232037606285fc44b816b57c34c95ca444b4 (patch)
treefcf93845f357e2106335b890500299d1f4476b8f
parent445b5f460fd083a0f267669db450d2e2fa049f08 (diff)
parent0f922749f45ba0717c317a765286f880bb9a1cce (diff)
Merge "Extend clearing of mLastPausedActivity."
-rw-r--r--services/java/com/android/server/am/ActivityStack.java30
-rw-r--r--services/java/com/android/server/am/ActivityStackSupervisor.java8
2 files changed, 27 insertions, 11 deletions
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index cc1be98e589b..6e552846465b 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -177,6 +177,13 @@ final class ActivityStack {
ActivityRecord mLastPausedActivity = null;
/**
+ * Activities that specify No History must be removed once the user navigates away from them.
+ * If the device goes to sleep with such an activity in the paused state then we save it here
+ * and finish it later if another activity replaces it on wakeup.
+ */
+ ActivityRecord mLastNoHistoryActivity = null;
+
+ /**
* Current activity that is resumed, or null if there is none.
*/
ActivityRecord mResumedActivity = null;
@@ -710,6 +717,8 @@ final class ActivityStack {
mResumedActivity = null;
mPausingActivity = prev;
mLastPausedActivity = prev;
+ mLastNoHistoryActivity = (prev.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_HISTORY) != 0
+ || (prev.info.flags & ActivityInfo.FLAG_NO_HISTORY) != 0 ? prev : null;
prev.state = ActivityState.PAUSING;
prev.task.touchActiveTime();
clearLaunchTime(prev);
@@ -732,10 +741,12 @@ final class ActivityStack {
Slog.w(TAG, "Exception thrown during pause", e);
mPausingActivity = null;
mLastPausedActivity = null;
+ mLastNoHistoryActivity = null;
}
} else {
mPausingActivity = null;
mLastPausedActivity = null;
+ mLastNoHistoryActivity = null;
}
// If we are not going to sleep, we want to ensure the device is
@@ -1333,16 +1344,13 @@ final class ActivityStack {
// If the most recent activity was noHistory but was only stopped rather
// than stopped+finished because the device went to sleep, we need to make
// sure to finish it as we're making a new activity topmost.
- final ActivityRecord last = mLastPausedActivity;
- if (mService.mSleeping && last != null && !last.finishing) {
- if ((last.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_HISTORY) != 0
- || (last.info.flags&ActivityInfo.FLAG_NO_HISTORY) != 0) {
- if (DEBUG_STATES) {
- Slog.d(TAG, "no-history finish of " + last + " on new resume");
- }
- requestFinishActivityLocked(last.appToken, Activity.RESULT_CANCELED, null,
- "no-history", false);
- }
+ if (mService.mSleeping && mLastNoHistoryActivity != null &&
+ !mLastNoHistoryActivity.finishing) {
+ if (DEBUG_STATES) Slog.d(TAG, "no-history finish of " + mLastNoHistoryActivity +
+ " on new resume");
+ requestFinishActivityLocked(mLastNoHistoryActivity.appToken, Activity.RESULT_CANCELED,
+ null, "no-history", false);
+ mLastNoHistoryActivity = null;
}
if (prev != null && prev != next) {
@@ -2949,7 +2957,6 @@ final class ActivityStack {
mWindowManager.moveTaskToTop(tr.taskId);
- mLastPausedActivity = null;
mStackSupervisor.resumeTopActivitiesLocked();
EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, tr.taskId);
@@ -3368,6 +3375,7 @@ final class ActivityStack {
}
if (mLastPausedActivity != null && mLastPausedActivity.app == app) {
mLastPausedActivity = null;
+ mLastNoHistoryActivity = null;
}
final ActivityRecord top = topRunningActivityLocked(null);
final boolean launchHomeTaskNext =
diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java
index 1681c2de1067..dd125656dd92 100644
--- a/services/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1398,6 +1398,7 @@ public final class ActivityStackSupervisor {
r.task = intentActivity.task;
}
targetStack = intentActivity.task.stack;
+ targetStack.mLastPausedActivity = null;
moveHomeStack(targetStack.isHomeStack());
if (intentActivity.task.intent == null) {
// This task was started because of movement of
@@ -1575,6 +1576,7 @@ public final class ActivityStackSupervisor {
top.task);
// For paranoia, make sure we have correctly
// resumed the top activity.
+ topStack.mLastPausedActivity = null;
if (doResume) {
setLaunchHomeTaskNextFlag(sourceRecord, null, topStack);
resumeTopActivitiesLocked();
@@ -1653,6 +1655,7 @@ public final class ActivityStackSupervisor {
top.deliverNewIntentLocked(callingUid, r.intent);
// For paranoia, make sure we have correctly
// resumed the top activity.
+ targetStack.mLastPausedActivity = null;
if (doResume) {
setLaunchHomeTaskNextFlag(sourceRecord, null, targetStack);
targetStack.resumeTopActivityLocked(null);
@@ -1675,6 +1678,7 @@ public final class ActivityStackSupervisor {
ActivityStack.logStartActivity(EventLogTags.AM_NEW_INTENT, r, task);
top.updateOptionsLocked(options);
top.deliverNewIntentLocked(callingUid, r.intent);
+ targetStack.mLastPausedActivity = null;
if (doResume) {
setLaunchHomeTaskNextFlag(sourceRecord, null, targetStack);
targetStack.resumeTopActivityLocked(null);
@@ -1714,6 +1718,7 @@ public final class ActivityStackSupervisor {
}
ActivityStack.logStartActivity(EventLogTags.AM_CREATE_ACTIVITY, r, r.task);
setLaunchHomeTaskNextFlag(sourceRecord, r, targetStack);
+ targetStack.mLastPausedActivity = null;
targetStack.startActivityLocked(r, newTask, doResume, keepCurTransition, options);
mService.setFocusedActivityLocked(r);
return ActivityManager.START_SUCCESS;
@@ -2390,7 +2395,10 @@ public final class ActivityStackSupervisor {
" mLastPausedActivity: ");
if (pr) {
printed = true;
+ needSep = true;
}
+ printed |= printThisActivity(pw, stack.mLastNoHistoryActivity, dumpPackage,
+ needSep, " mLastNoHistoryActivity: ");
}
needSep = printed;
}