Merge "Make no-history activity be finished with different tasks" into sc-dev
This commit is contained in:
@@ -211,12 +211,6 @@
|
||||
"group": "WM_DEBUG_WINDOW_ORGANIZER",
|
||||
"at": "com\/android\/server\/wm\/TaskOrganizerController.java"
|
||||
},
|
||||
"-1890326172": {
|
||||
"message": "no-history finish of %s on new resume",
|
||||
"level": "DEBUG",
|
||||
"group": "WM_DEBUG_STATES",
|
||||
"at": "com\/android\/server\/wm\/Task.java"
|
||||
},
|
||||
"-1884933373": {
|
||||
"message": "enableScreenAfterBoot: mDisplayEnabled=%b mForceDisplayEnabled=%b mShowingBootMessages=%b mSystemBooted=%b. %s",
|
||||
"level": "INFO",
|
||||
@@ -1429,6 +1423,12 @@
|
||||
"group": "WM_ERROR",
|
||||
"at": "com\/android\/server\/wm\/WindowManagerService.java"
|
||||
},
|
||||
"-484194149": {
|
||||
"message": "no-history finish of %s on new resume",
|
||||
"level": "DEBUG",
|
||||
"group": "WM_DEBUG_STATES",
|
||||
"at": "com\/android\/server\/wm\/ActivityTaskSupervisor.java"
|
||||
},
|
||||
"-481924678": {
|
||||
"message": "handleNotObscuredLocked w: %s, w.mHasSurface: %b, w.isOnScreen(): %b, w.isDisplayedLw(): %b, w.mAttrs.userActivityTimeout: %d",
|
||||
"level": "DEBUG",
|
||||
|
||||
@@ -2824,6 +2824,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
final Transition newTransition = (!mAtmService.getTransitionController().isCollecting()
|
||||
&& mAtmService.getTransitionController().getTransitionPlayer() != null)
|
||||
? mAtmService.getTransitionController().createTransition(TRANSIT_CLOSE) : null;
|
||||
mTaskSupervisor.mNoHistoryActivities.remove(this);
|
||||
makeFinishingLocked();
|
||||
// Make a local reference to its task since this.task could be set to null once this
|
||||
// activity is destroyed and detached from task.
|
||||
|
||||
@@ -277,6 +277,13 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
|
||||
* settle down before doing so. It contains ActivityRecord objects. */
|
||||
final ArrayList<ActivityRecord> mFinishingActivities = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
final ArrayList<ActivityRecord> mNoHistoryActivities = new ArrayList<>();
|
||||
|
||||
/** List of activities whose multi-window mode changed that we need to report to the
|
||||
* application */
|
||||
private final ArrayList<ActivityRecord> mMultiWindowModeChangedActivities = new ArrayList<>();
|
||||
@@ -479,6 +486,20 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
|
||||
}
|
||||
}
|
||||
|
||||
void finishNoHistoryActivitiesIfNeeded(ActivityRecord next) {
|
||||
for (int i = mNoHistoryActivities.size() - 1; i >= 0; --i) {
|
||||
final ActivityRecord noHistoryActivity = mNoHistoryActivities.get(i);
|
||||
if (!noHistoryActivity.finishing && noHistoryActivity != next
|
||||
&& next.occludesParent()
|
||||
&& noHistoryActivity.getDisplayId() == next.getDisplayId()) {
|
||||
ProtoLog.d(WM_DEBUG_STATES, "no-history finish of %s on new resume",
|
||||
noHistoryActivity);
|
||||
noHistoryActivity.finishIfPossible("resume-no-history", false /* oomAdj */);
|
||||
mNoHistoryActivities.remove(noHistoryActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int nextTaskIdForUser(int taskId, int userId) {
|
||||
int nextTaskId = taskId + 1;
|
||||
if (nextTaskId == (userId + 1) * MAX_TASK_IDS_PER_USER) {
|
||||
|
||||
@@ -585,13 +585,6 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
*/
|
||||
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.
|
||||
* Only set at leaf tasks.
|
||||
@@ -5756,7 +5749,9 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
ProtoLog.v(WM_DEBUG_STATES, "Moving to PAUSING: %s", prev);
|
||||
mPausingActivity = prev;
|
||||
mLastPausedActivity = prev;
|
||||
mLastNoHistoryActivity = prev.isNoHistory() ? prev : null;
|
||||
if (prev.isNoHistory() && !mTaskSupervisor.mNoHistoryActivities.contains(prev)) {
|
||||
mTaskSupervisor.mNoHistoryActivities.add(prev);
|
||||
}
|
||||
prev.setState(PAUSING, "startPausingLocked");
|
||||
prev.getTask().touchActiveTime();
|
||||
|
||||
@@ -5802,13 +5797,13 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
Slog.w(TAG, "Exception thrown during pause", e);
|
||||
mPausingActivity = null;
|
||||
mLastPausedActivity = null;
|
||||
mLastNoHistoryActivity = null;
|
||||
mTaskSupervisor.mNoHistoryActivities.remove(prev);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mPausingActivity = null;
|
||||
mLastPausedActivity = null;
|
||||
mLastNoHistoryActivity = null;
|
||||
mTaskSupervisor.mNoHistoryActivities.remove(prev);
|
||||
}
|
||||
|
||||
// If we are not going to sleep, we want to ensure the device is
|
||||
@@ -6319,13 +6314,8 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
// 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.
|
||||
if (shouldSleepActivities() && mLastNoHistoryActivity != null
|
||||
&& !mLastNoHistoryActivity.finishing
|
||||
&& mLastNoHistoryActivity != next) {
|
||||
ProtoLog.d(WM_DEBUG_STATES, "no-history finish of %s on new resume",
|
||||
mLastNoHistoryActivity);
|
||||
mLastNoHistoryActivity.finishIfPossible("resume-no-history", false /* oomAdj */);
|
||||
mLastNoHistoryActivity = null;
|
||||
if (shouldSleepActivities()) {
|
||||
mTaskSupervisor.finishNoHistoryActivitiesIfNeeded(next);
|
||||
}
|
||||
|
||||
if (prev != null && prev != next && next.nowVisible) {
|
||||
@@ -7334,8 +7324,10 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
isPausingDied = true;
|
||||
}
|
||||
if (mLastPausedActivity != null && mLastPausedActivity.app == app) {
|
||||
if (mLastPausedActivity.isNoHistory()) {
|
||||
mTaskSupervisor.mNoHistoryActivities.remove(mLastPausedActivity);
|
||||
}
|
||||
mLastPausedActivity = null;
|
||||
mLastNoHistoryActivity = null;
|
||||
}
|
||||
return isPausingDied;
|
||||
}
|
||||
@@ -7371,8 +7363,6 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
if (dumpAll) {
|
||||
printed |= printThisActivity(pw, mLastPausedActivity, dumpPackage, false,
|
||||
" mLastPausedActivity: ", null);
|
||||
printed |= printThisActivity(pw, mLastNoHistoryActivity, dumpPackage,
|
||||
false, " mLastNoHistoryActivity: ", null);
|
||||
}
|
||||
|
||||
printed |= dumpActivities(fd, pw, dumpAll, dumpClient, dumpPackage, false, headerPrinter);
|
||||
|
||||
Reference in New Issue
Block a user