Loading services/core/java/com/android/server/wm/ActivityStack.java +1 −1 Original line number Diff line number Diff line Loading @@ -2272,7 +2272,7 @@ class ActivityStack extends Task { ActivityOptions.abort(options); if (DEBUG_STATES) Slog.d(TAG_STATES, "resumeNextFocusableActivityWhenStackIsEmpty: " + reason + ", go home"); return mRootWindowContainer.resumeHomeActivity(prev, reason, getDisplayId()); return mRootWindowContainer.resumeHomeActivity(prev, reason, getDisplayArea()); } void startActivityLocked(ActivityRecord r, ActivityRecord focusedTopActivity, Loading services/core/java/com/android/server/wm/ActivityStackSupervisor.java +25 −15 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import static android.os.Process.INVALID_UID; import static android.os.Process.SYSTEM_UID; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; import static android.view.Display.TYPE_VIRTUAL; import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS; Loading Loading @@ -1378,8 +1377,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { if (DEBUG_STACK) Slog.d(TAG_STACK, "findTaskToMoveToFront: moved to front of stack=" + currentStack); handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED, DEFAULT_DISPLAY, currentStack, forceNonResizeable); handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED, mRootWindowContainer.getDefaultTaskDisplayArea(), currentStack, forceNonResizeable); } private void moveHomeStackToFrontIfNeeded(int flags, TaskDisplayArea taskDisplayArea, Loading Loading @@ -2134,16 +2133,29 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { WindowManagerService.WINDOW_FREEZE_TIMEOUT_DURATION); } // TODO(b/152116619): Remove after complete switch to TaskDisplayArea void handleNonResizableTaskIfNeeded(Task task, int preferredWindowingMode, int preferredDisplayId, ActivityStack actualStack) { handleNonResizableTaskIfNeeded(task, preferredWindowingMode, preferredDisplayId, final DisplayContent preferredDisplayContent = mRootWindowContainer .getDisplayContent(preferredDisplayId); final TaskDisplayArea preferredDisplayArea = preferredDisplayContent != null ? preferredDisplayContent.getDefaultTaskDisplayArea() : null; handleNonResizableTaskIfNeeded(task, preferredWindowingMode, preferredDisplayArea, actualStack); } void handleNonResizableTaskIfNeeded(Task task, int preferredWindowingMode, TaskDisplayArea preferredTaskDisplayArea, ActivityStack actualStack) { handleNonResizableTaskIfNeeded(task, preferredWindowingMode, preferredTaskDisplayArea, actualStack, false /* forceNonResizable */); } void handleNonResizableTaskIfNeeded(Task task, int preferredWindowingMode, int preferredDisplayId, ActivityStack actualStack, boolean forceNonResizable) { final boolean isSecondaryDisplayPreferred = (preferredDisplayId != DEFAULT_DISPLAY && preferredDisplayId != INVALID_DISPLAY); TaskDisplayArea preferredTaskDisplayArea, ActivityStack actualStack, boolean forceNonResizable) { final boolean isSecondaryDisplayPreferred = preferredTaskDisplayArea != null && preferredTaskDisplayArea.getDisplayId() != DEFAULT_DISPLAY; final boolean inSplitScreenMode = actualStack != null && actualStack.getDisplayArea().isSplitScreenModeActivated(); if (((!inSplitScreenMode && preferredWindowingMode != WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) Loading @@ -2153,33 +2165,31 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { // Handle incorrect launch/move to secondary display if needed. if (isSecondaryDisplayPreferred) { final int actualDisplayId = task.getDisplayId(); if (!task.canBeLaunchedOnDisplay(actualDisplayId)) { if (!task.canBeLaunchedOnDisplay(task.getDisplayId())) { throw new IllegalStateException("Task resolved to incompatible display"); } final DisplayContent preferredDisplay = mRootWindowContainer.getDisplayContent(preferredDisplayId); final DisplayContent preferredDisplay = preferredTaskDisplayArea.mDisplayContent; final boolean singleTaskInstance = preferredDisplay != null && preferredDisplay.isSingleTaskInstance(); if (preferredDisplayId != actualDisplayId) { if (preferredDisplay != task.getDisplayContent()) { // Suppress the warning toast if the preferredDisplay was set to singleTask. // The singleTaskInstance displays will only contain one task and any attempt to // launch new task will re-route to the default display. if (singleTaskInstance) { mService.getTaskChangeNotificationController() .notifyActivityLaunchOnSecondaryDisplayRerouted(task.getTaskInfo(), preferredDisplayId); preferredDisplay.mDisplayId); return; } Slog.w(TAG, "Failed to put " + task + " on display " + preferredDisplayId); Slog.w(TAG, "Failed to put " + task + " on display " + preferredDisplay.mDisplayId); // Display a warning toast that we failed to put a task on a secondary display. mService.getTaskChangeNotificationController() .notifyActivityLaunchOnSecondaryDisplayFailed(task.getTaskInfo(), preferredDisplayId); preferredDisplay.mDisplayId); } else if (!forceNonResizable) { handleForcedResizableTaskIfNeeded(task, FORCED_RESIZEABLE_REASON_SECONDARY_DISPLAY); } Loading services/core/java/com/android/server/wm/ActivityStartController.java +8 −7 Original line number Diff line number Diff line Loading @@ -172,7 +172,8 @@ public class ActivityStartController { mLastStarter.postStartActivityProcessing(r, result, targetStack); } void startHomeActivity(Intent intent, ActivityInfo aInfo, String reason, int displayId) { void startHomeActivity(Intent intent, ActivityInfo aInfo, String reason, TaskDisplayArea taskDisplayArea) { final ActivityOptions options = ActivityOptions.makeBasic(); options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN); if (!ActivityRecord.isResolverActivity(aInfo.name)) { Loading @@ -181,20 +182,20 @@ public class ActivityStartController { // foreground instead of bring home stack to front. options.setLaunchActivityType(ACTIVITY_TYPE_HOME); } final int displayId = taskDisplayArea.getDisplayId(); options.setLaunchDisplayId(displayId); // TODO(b/152116619): Enable after complete switch to WindowContainerToken //options.setLaunchWindowContainerToken(taskDisplayArea.getWindowContainerToken()); final DisplayContent display = mService.mRootWindowContainer.getDisplayContent(displayId); // The home activity will be started later, defer resuming to avoid unneccerary operations // (e.g. start home recursively) when creating home stack. mSupervisor.beginDeferResume(); final ActivityStack homeStack; try { // TODO(multi-display-area): Support starting home in a task display area // Make sure home stack exist on display. // Make sure home stack exists on display area. // TODO(b/153624902): Replace with TaskDisplayArea#getOrCreateRootHomeTask() homeStack = display.getDefaultTaskDisplayArea().getOrCreateStack( WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_HOME, ON_TOP); homeStack = taskDisplayArea.getOrCreateStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_HOME, ON_TOP); } finally { mSupervisor.endDeferResume(); } Loading services/core/java/com/android/server/wm/ActivityStarter.java +1 −1 Original line number Diff line number Diff line Loading @@ -2422,7 +2422,7 @@ class ActivityStarter { // be destroyed. mTargetStack = intentActivity.getRootTask(); mSupervisor.handleNonResizableTaskIfNeeded(intentTask, WINDOWING_MODE_UNDEFINED, DEFAULT_DISPLAY, mTargetStack); mRootWindowContainer.getDefaultTaskDisplayArea(), mTargetStack); } private void resumeTargetStackIfNeeded() { Loading services/core/java/com/android/server/wm/LockTaskController.java +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_NEVER; import static android.os.UserHandle.USER_ALL; import static android.os.UserHandle.USER_CURRENT; import static android.telecom.TelecomManager.EMERGENCY_DIALER_COMPONENT; import static android.view.Display.DEFAULT_DISPLAY; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_LOCKTASK; import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_LOCKTASK; Loading Loading @@ -619,7 +618,8 @@ public class LockTaskController { } } else if (lockTaskModeState != LOCK_TASK_MODE_NONE) { mSupervisor.handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED, DEFAULT_DISPLAY, task.getStack(), true /* forceNonResizable */); mSupervisor.mRootWindowContainer.getDefaultTaskDisplayArea(), task.getStack(), true /* forceNonResizable */); } } Loading Loading
services/core/java/com/android/server/wm/ActivityStack.java +1 −1 Original line number Diff line number Diff line Loading @@ -2272,7 +2272,7 @@ class ActivityStack extends Task { ActivityOptions.abort(options); if (DEBUG_STATES) Slog.d(TAG_STATES, "resumeNextFocusableActivityWhenStackIsEmpty: " + reason + ", go home"); return mRootWindowContainer.resumeHomeActivity(prev, reason, getDisplayId()); return mRootWindowContainer.resumeHomeActivity(prev, reason, getDisplayArea()); } void startActivityLocked(ActivityRecord r, ActivityRecord focusedTopActivity, Loading
services/core/java/com/android/server/wm/ActivityStackSupervisor.java +25 −15 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import static android.os.Process.INVALID_UID; import static android.os.Process.SYSTEM_UID; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; import static android.view.Display.TYPE_VIRTUAL; import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS; Loading Loading @@ -1378,8 +1377,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { if (DEBUG_STACK) Slog.d(TAG_STACK, "findTaskToMoveToFront: moved to front of stack=" + currentStack); handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED, DEFAULT_DISPLAY, currentStack, forceNonResizeable); handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED, mRootWindowContainer.getDefaultTaskDisplayArea(), currentStack, forceNonResizeable); } private void moveHomeStackToFrontIfNeeded(int flags, TaskDisplayArea taskDisplayArea, Loading Loading @@ -2134,16 +2133,29 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { WindowManagerService.WINDOW_FREEZE_TIMEOUT_DURATION); } // TODO(b/152116619): Remove after complete switch to TaskDisplayArea void handleNonResizableTaskIfNeeded(Task task, int preferredWindowingMode, int preferredDisplayId, ActivityStack actualStack) { handleNonResizableTaskIfNeeded(task, preferredWindowingMode, preferredDisplayId, final DisplayContent preferredDisplayContent = mRootWindowContainer .getDisplayContent(preferredDisplayId); final TaskDisplayArea preferredDisplayArea = preferredDisplayContent != null ? preferredDisplayContent.getDefaultTaskDisplayArea() : null; handleNonResizableTaskIfNeeded(task, preferredWindowingMode, preferredDisplayArea, actualStack); } void handleNonResizableTaskIfNeeded(Task task, int preferredWindowingMode, TaskDisplayArea preferredTaskDisplayArea, ActivityStack actualStack) { handleNonResizableTaskIfNeeded(task, preferredWindowingMode, preferredTaskDisplayArea, actualStack, false /* forceNonResizable */); } void handleNonResizableTaskIfNeeded(Task task, int preferredWindowingMode, int preferredDisplayId, ActivityStack actualStack, boolean forceNonResizable) { final boolean isSecondaryDisplayPreferred = (preferredDisplayId != DEFAULT_DISPLAY && preferredDisplayId != INVALID_DISPLAY); TaskDisplayArea preferredTaskDisplayArea, ActivityStack actualStack, boolean forceNonResizable) { final boolean isSecondaryDisplayPreferred = preferredTaskDisplayArea != null && preferredTaskDisplayArea.getDisplayId() != DEFAULT_DISPLAY; final boolean inSplitScreenMode = actualStack != null && actualStack.getDisplayArea().isSplitScreenModeActivated(); if (((!inSplitScreenMode && preferredWindowingMode != WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) Loading @@ -2153,33 +2165,31 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { // Handle incorrect launch/move to secondary display if needed. if (isSecondaryDisplayPreferred) { final int actualDisplayId = task.getDisplayId(); if (!task.canBeLaunchedOnDisplay(actualDisplayId)) { if (!task.canBeLaunchedOnDisplay(task.getDisplayId())) { throw new IllegalStateException("Task resolved to incompatible display"); } final DisplayContent preferredDisplay = mRootWindowContainer.getDisplayContent(preferredDisplayId); final DisplayContent preferredDisplay = preferredTaskDisplayArea.mDisplayContent; final boolean singleTaskInstance = preferredDisplay != null && preferredDisplay.isSingleTaskInstance(); if (preferredDisplayId != actualDisplayId) { if (preferredDisplay != task.getDisplayContent()) { // Suppress the warning toast if the preferredDisplay was set to singleTask. // The singleTaskInstance displays will only contain one task and any attempt to // launch new task will re-route to the default display. if (singleTaskInstance) { mService.getTaskChangeNotificationController() .notifyActivityLaunchOnSecondaryDisplayRerouted(task.getTaskInfo(), preferredDisplayId); preferredDisplay.mDisplayId); return; } Slog.w(TAG, "Failed to put " + task + " on display " + preferredDisplayId); Slog.w(TAG, "Failed to put " + task + " on display " + preferredDisplay.mDisplayId); // Display a warning toast that we failed to put a task on a secondary display. mService.getTaskChangeNotificationController() .notifyActivityLaunchOnSecondaryDisplayFailed(task.getTaskInfo(), preferredDisplayId); preferredDisplay.mDisplayId); } else if (!forceNonResizable) { handleForcedResizableTaskIfNeeded(task, FORCED_RESIZEABLE_REASON_SECONDARY_DISPLAY); } Loading
services/core/java/com/android/server/wm/ActivityStartController.java +8 −7 Original line number Diff line number Diff line Loading @@ -172,7 +172,8 @@ public class ActivityStartController { mLastStarter.postStartActivityProcessing(r, result, targetStack); } void startHomeActivity(Intent intent, ActivityInfo aInfo, String reason, int displayId) { void startHomeActivity(Intent intent, ActivityInfo aInfo, String reason, TaskDisplayArea taskDisplayArea) { final ActivityOptions options = ActivityOptions.makeBasic(); options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN); if (!ActivityRecord.isResolverActivity(aInfo.name)) { Loading @@ -181,20 +182,20 @@ public class ActivityStartController { // foreground instead of bring home stack to front. options.setLaunchActivityType(ACTIVITY_TYPE_HOME); } final int displayId = taskDisplayArea.getDisplayId(); options.setLaunchDisplayId(displayId); // TODO(b/152116619): Enable after complete switch to WindowContainerToken //options.setLaunchWindowContainerToken(taskDisplayArea.getWindowContainerToken()); final DisplayContent display = mService.mRootWindowContainer.getDisplayContent(displayId); // The home activity will be started later, defer resuming to avoid unneccerary operations // (e.g. start home recursively) when creating home stack. mSupervisor.beginDeferResume(); final ActivityStack homeStack; try { // TODO(multi-display-area): Support starting home in a task display area // Make sure home stack exist on display. // Make sure home stack exists on display area. // TODO(b/153624902): Replace with TaskDisplayArea#getOrCreateRootHomeTask() homeStack = display.getDefaultTaskDisplayArea().getOrCreateStack( WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_HOME, ON_TOP); homeStack = taskDisplayArea.getOrCreateStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_HOME, ON_TOP); } finally { mSupervisor.endDeferResume(); } Loading
services/core/java/com/android/server/wm/ActivityStarter.java +1 −1 Original line number Diff line number Diff line Loading @@ -2422,7 +2422,7 @@ class ActivityStarter { // be destroyed. mTargetStack = intentActivity.getRootTask(); mSupervisor.handleNonResizableTaskIfNeeded(intentTask, WINDOWING_MODE_UNDEFINED, DEFAULT_DISPLAY, mTargetStack); mRootWindowContainer.getDefaultTaskDisplayArea(), mTargetStack); } private void resumeTargetStackIfNeeded() { Loading
services/core/java/com/android/server/wm/LockTaskController.java +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_NEVER; import static android.os.UserHandle.USER_ALL; import static android.os.UserHandle.USER_CURRENT; import static android.telecom.TelecomManager.EMERGENCY_DIALER_COMPONENT; import static android.view.Display.DEFAULT_DISPLAY; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_LOCKTASK; import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_LOCKTASK; Loading Loading @@ -619,7 +618,8 @@ public class LockTaskController { } } else if (lockTaskModeState != LOCK_TASK_MODE_NONE) { mSupervisor.handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED, DEFAULT_DISPLAY, task.getStack(), true /* forceNonResizable */); mSupervisor.mRootWindowContainer.getDefaultTaskDisplayArea(), task.getStack(), true /* forceNonResizable */); } } Loading