Loading services/core/java/com/android/server/wm/ActivityRecord.java +2 −1 Original line number Diff line number Diff line Loading @@ -2679,7 +2679,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // DisplayContent#topRunningActivity(). final ActivityRecord next = display.topRunningActivity(); final boolean isLastStackOverEmptyHome = next == null && stack.isFocusedStackOnDisplay() && display.getRootHomeTask() != null; next == null && stack.isFocusedStackOnDisplay() && display.getOrCreateRootHomeTask() != null; if (isLastStackOverEmptyHome) { // Don't destroy activity immediately if this is the last activity on the display and // the display contains home stack. Although there is no next activity at the moment, Loading services/core/java/com/android/server/wm/ActivityStarter.java +1 −1 Original line number Diff line number Diff line Loading @@ -1374,7 +1374,7 @@ class ActivityStarter { break; case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY: final ActivityStack homeStack = startedActivityStack.getDisplay().getRootHomeTask(); startedActivityStack.getDisplay().getOrCreateRootHomeTask(); if (homeStack != null && homeStack.shouldBeVisible(null /* starting */)) { mService.mWindowManager.showRecentApps(); } Loading services/core/java/com/android/server/wm/DisplayContent.java +16 −5 Original line number Diff line number Diff line Loading @@ -1937,6 +1937,20 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return mTaskContainers.getRootHomeTask(); } /** * Returns the existing home stack or creates and returns a new one if it should exist for the * display. */ @Nullable ActivityStack getOrCreateRootHomeTask() { ActivityStack homeTask = getRootHomeTask(); if (homeTask == null && supportsSystemDecorations() && !isUntrustedVirtualDisplay()) { homeTask = createStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, false /* onTop */); } return homeTask; } /** @return The primary split-screen task, and {@code null} otherwise. */ ActivityStack getRootSplitScreenPrimaryTask() { return mTaskContainers.getRootSplitScreenPrimaryTask(); Loading Loading @@ -4258,9 +4272,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } ActivityStack getRootHomeTask() { if (mRootHomeTask == null && mDisplayId == DEFAULT_DISPLAY) { Slog.e(TAG_WM, "getHomeStack: Returning null from this=" + this); } return mRootHomeTask; } Loading Loading @@ -6011,7 +6022,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } finally { final ActivityStack topFullscreenStack = getTopStackInWindowingMode(WINDOWING_MODE_FULLSCREEN); final ActivityStack homeStack = getRootHomeTask(); final ActivityStack homeStack = getOrCreateRootHomeTask(); if (topFullscreenStack != null && homeStack != null && !isTopStack(homeStack)) { // Whenever split-screen is dismissed we want the home stack directly behind the // current top fullscreen stack so it shows up when the top stack is finished. Loading Loading @@ -6577,7 +6588,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } void moveHomeStackToFront(String reason) { final ActivityStack homeStack = getRootHomeTask(); final ActivityStack homeStack = getOrCreateRootHomeTask(); if (homeStack != null) { homeStack.moveToFront(reason); } Loading services/core/java/com/android/server/wm/RootWindowContainer.java +7 −5 Original line number Diff line number Diff line Loading @@ -1998,8 +1998,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> removeStacksInWindowingModes(WINDOWING_MODE_PINNED); mUserStackInFront.put(mCurrentUser, focusStackId); final int restoreStackId = mUserStackInFront.get(userId, getDefaultDisplay().getRootHomeTask().getRootTaskId()); mCurrentUser = userId; mStackSupervisor.mStartingUsers.add(uss); Loading @@ -2011,9 +2009,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent> } } final int restoreStackId = mUserStackInFront.get(userId); ActivityStack stack = getStack(restoreStackId); if (stack == null) { stack = getDefaultDisplay().getRootHomeTask(); stack = getDefaultDisplay().getOrCreateRootHomeTask(); } final boolean homeInFront = stack.isActivityTypeHome(); if (stack.isOnHomeDisplay()) { Loading @@ -2035,8 +2034,11 @@ class RootWindowContainer extends WindowContainer<DisplayContent> */ void updateUserStack(int userId, ActivityStack stack) { if (userId != mCurrentUser) { mUserStackInFront.put(userId, stack != null ? stack.getRootTaskId() : getDefaultDisplay().getRootHomeTask().getRootTaskId()); if (stack == null) { stack = getDefaultDisplay().getOrCreateRootHomeTask(); } mUserStackInFront.put(userId, stack.getRootTaskId()); } } Loading services/core/java/com/android/server/wm/WindowState.java +2 −1 Original line number Diff line number Diff line Loading @@ -1493,7 +1493,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // Some system windows (e.g. "Power off" dialog) don't have a task, but we would still // associate them with some stack to enable dimming. final DisplayContent dc = getDisplayContent(); return mAttrs.type >= FIRST_SYSTEM_WINDOW && dc != null ? dc.getRootHomeTask() : null; return mAttrs.type >= FIRST_SYSTEM_WINDOW && dc != null ? dc.getOrCreateRootHomeTask() : null; } /** Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +2 −1 Original line number Diff line number Diff line Loading @@ -2679,7 +2679,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // DisplayContent#topRunningActivity(). final ActivityRecord next = display.topRunningActivity(); final boolean isLastStackOverEmptyHome = next == null && stack.isFocusedStackOnDisplay() && display.getRootHomeTask() != null; next == null && stack.isFocusedStackOnDisplay() && display.getOrCreateRootHomeTask() != null; if (isLastStackOverEmptyHome) { // Don't destroy activity immediately if this is the last activity on the display and // the display contains home stack. Although there is no next activity at the moment, Loading
services/core/java/com/android/server/wm/ActivityStarter.java +1 −1 Original line number Diff line number Diff line Loading @@ -1374,7 +1374,7 @@ class ActivityStarter { break; case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY: final ActivityStack homeStack = startedActivityStack.getDisplay().getRootHomeTask(); startedActivityStack.getDisplay().getOrCreateRootHomeTask(); if (homeStack != null && homeStack.shouldBeVisible(null /* starting */)) { mService.mWindowManager.showRecentApps(); } Loading
services/core/java/com/android/server/wm/DisplayContent.java +16 −5 Original line number Diff line number Diff line Loading @@ -1937,6 +1937,20 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return mTaskContainers.getRootHomeTask(); } /** * Returns the existing home stack or creates and returns a new one if it should exist for the * display. */ @Nullable ActivityStack getOrCreateRootHomeTask() { ActivityStack homeTask = getRootHomeTask(); if (homeTask == null && supportsSystemDecorations() && !isUntrustedVirtualDisplay()) { homeTask = createStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, false /* onTop */); } return homeTask; } /** @return The primary split-screen task, and {@code null} otherwise. */ ActivityStack getRootSplitScreenPrimaryTask() { return mTaskContainers.getRootSplitScreenPrimaryTask(); Loading Loading @@ -4258,9 +4272,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } ActivityStack getRootHomeTask() { if (mRootHomeTask == null && mDisplayId == DEFAULT_DISPLAY) { Slog.e(TAG_WM, "getHomeStack: Returning null from this=" + this); } return mRootHomeTask; } Loading Loading @@ -6011,7 +6022,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } finally { final ActivityStack topFullscreenStack = getTopStackInWindowingMode(WINDOWING_MODE_FULLSCREEN); final ActivityStack homeStack = getRootHomeTask(); final ActivityStack homeStack = getOrCreateRootHomeTask(); if (topFullscreenStack != null && homeStack != null && !isTopStack(homeStack)) { // Whenever split-screen is dismissed we want the home stack directly behind the // current top fullscreen stack so it shows up when the top stack is finished. Loading Loading @@ -6577,7 +6588,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } void moveHomeStackToFront(String reason) { final ActivityStack homeStack = getRootHomeTask(); final ActivityStack homeStack = getOrCreateRootHomeTask(); if (homeStack != null) { homeStack.moveToFront(reason); } Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +7 −5 Original line number Diff line number Diff line Loading @@ -1998,8 +1998,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> removeStacksInWindowingModes(WINDOWING_MODE_PINNED); mUserStackInFront.put(mCurrentUser, focusStackId); final int restoreStackId = mUserStackInFront.get(userId, getDefaultDisplay().getRootHomeTask().getRootTaskId()); mCurrentUser = userId; mStackSupervisor.mStartingUsers.add(uss); Loading @@ -2011,9 +2009,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent> } } final int restoreStackId = mUserStackInFront.get(userId); ActivityStack stack = getStack(restoreStackId); if (stack == null) { stack = getDefaultDisplay().getRootHomeTask(); stack = getDefaultDisplay().getOrCreateRootHomeTask(); } final boolean homeInFront = stack.isActivityTypeHome(); if (stack.isOnHomeDisplay()) { Loading @@ -2035,8 +2034,11 @@ class RootWindowContainer extends WindowContainer<DisplayContent> */ void updateUserStack(int userId, ActivityStack stack) { if (userId != mCurrentUser) { mUserStackInFront.put(userId, stack != null ? stack.getRootTaskId() : getDefaultDisplay().getRootHomeTask().getRootTaskId()); if (stack == null) { stack = getDefaultDisplay().getOrCreateRootHomeTask(); } mUserStackInFront.put(userId, stack.getRootTaskId()); } } Loading
services/core/java/com/android/server/wm/WindowState.java +2 −1 Original line number Diff line number Diff line Loading @@ -1493,7 +1493,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // Some system windows (e.g. "Power off" dialog) don't have a task, but we would still // associate them with some stack to enable dimming. final DisplayContent dc = getDisplayContent(); return mAttrs.type >= FIRST_SYSTEM_WINDOW && dc != null ? dc.getRootHomeTask() : null; return mAttrs.type >= FIRST_SYSTEM_WINDOW && dc != null ? dc.getOrCreateRootHomeTask() : null; } /** Loading