Merge changes from topic "empty-stack-leak"

* changes:
  Fix ReplaceWindowTests#testReplaceWindow_Dock_Relaunch() failure
  Fix two activity stack leak cases
This commit is contained in:
TreeHugger Robot
2019-09-18 18:20:18 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 5 deletions

View File

@@ -839,11 +839,12 @@ class ActivityStack extends ConfigurationContainer {
// so that the divider matches and remove this logic.
// TODO: This is currently only called when entering split-screen while in another
// task, and from the tests
// TODO (b/78247419): Check if launcher and overview are same then move home stack
// instead of recents stack. Then fix the rotation animation from fullscreen to
// minimized mode
// TODO (b/78247419): Fix the rotation animation from fullscreen to minimized mode
final boolean isRecentsComponentHome =
mService.getRecentTasks().isRecentsComponentHomeActivity(mCurrentUser);
final ActivityStack recentStack = display.getOrCreateStack(
WINDOWING_MODE_SPLIT_SCREEN_SECONDARY, ACTIVITY_TYPE_RECENTS,
WINDOWING_MODE_SPLIT_SCREEN_SECONDARY,
isRecentsComponentHome ? ACTIVITY_TYPE_HOME : ACTIVITY_TYPE_RECENTS,
true /* onTop */);
recentStack.moveToFront("setWindowingMode");
// If task moved to docked stack - show recents if needed.

View File

@@ -2342,7 +2342,12 @@ class ActivityStarter {
REPARENT_MOVE_STACK_TO_FRONT, ANIMATE, DEFER_RESUME,
"reparentingHome");
mMovedToFront = true;
} else if (launchStack.topTask() == null) {
// The task does not need to be reparented to the launch stack. Remove the
// launch stack if there is no activity in it.
launchStack.remove();
}
mOptions = null;
// We are moving a task to the front, use starting window to hide initial drawn

View File

@@ -193,6 +193,9 @@ class RootActivityContainer extends ConfigurationContainer
/** Set when a power hint has started, but not ended. */
private boolean mPowerHintSent;
/** Used to keep ensureActivitiesVisible() from being entered recursively. */
private boolean mInEnsureActivitiesVisible = false;
// The default minimal size that will be used if the activity doesn't specify its minimal size.
// It will be calculated when the default display gets added.
int mDefaultMinSizeOfResizeableTaskDp = -1;
@@ -805,8 +808,14 @@ class RootActivityContainer extends ConfigurationContainer
*/
void ensureActivitiesVisible(ActivityRecord starting, int configChanges,
boolean preserveWindows, boolean notifyClients) {
mStackSupervisor.getKeyguardController().beginActivityVisibilityUpdate();
if (mInEnsureActivitiesVisible) {
// Don't do recursive work.
return;
}
mInEnsureActivitiesVisible = true;
try {
mStackSupervisor.getKeyguardController().beginActivityVisibilityUpdate();
// First the front stacks. In case any are not fullscreen and are in front of home.
for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
final ActivityDisplay display = mActivityDisplays.get(displayNdx);
@@ -815,6 +824,7 @@ class RootActivityContainer extends ConfigurationContainer
}
} finally {
mStackSupervisor.getKeyguardController().endActivityVisibilityUpdate();
mInEnsureActivitiesVisible = false;
}
}