Merge "Ensure activity display with an empty stack can be released"
This commit is contained in:
@@ -1173,7 +1173,17 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>
|
||||
}
|
||||
|
||||
private void releaseSelfIfNeeded() {
|
||||
if (mStacks.isEmpty() && mRemoved) {
|
||||
if (!mRemoved || mDisplayContent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ActivityStack stack = mStacks.size() == 1 ? mStacks.get(0) : null;
|
||||
if (stack != null && stack.isActivityTypeHome() && stack.getAllTasks().isEmpty()) {
|
||||
// Release this display if an empty home stack is the only thing left.
|
||||
// Since it is the last stack, this display will be released along with the stack
|
||||
// removal.
|
||||
stack.remove();
|
||||
} else if (mStacks.isEmpty()) {
|
||||
mDisplayContent.removeIfPossible();
|
||||
mDisplayContent = null;
|
||||
mRootActivityContainer.removeChild(this);
|
||||
|
||||
@@ -3053,7 +3053,17 @@ class ActivityStack extends ConfigurationContainer {
|
||||
ActivityOptions.abort(options);
|
||||
if (DEBUG_STATES) Slog.d(TAG_STATES,
|
||||
"resumeTopActivityInNextFocusableStack: " + reason + ", go home");
|
||||
return mRootActivityContainer.resumeHomeActivity(prev, reason, mDisplayId);
|
||||
if (isActivityTypeHome()) {
|
||||
// resumeTopActivityUncheckedLocked has been prevented to run recursively. Post a
|
||||
// runnable to resume home since we are currently in the process of resuming top
|
||||
// activity in home stack.
|
||||
// See {@link #mInResumeTopActivity}.
|
||||
mService.mH.post(
|
||||
() -> mRootActivityContainer.resumeHomeActivity(prev, reason, mDisplayId));
|
||||
return true;
|
||||
} else {
|
||||
return mRootActivityContainer.resumeHomeActivity(prev, reason, mDisplayId);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the position the input task should be placed in this stack. */
|
||||
|
||||
Reference in New Issue
Block a user