Loading services/core/java/com/android/server/am/ActivityDisplay.java +14 −10 Original line number Diff line number Diff line Loading @@ -321,16 +321,6 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> + windowingMode); } if (windowingMode == WINDOWING_MODE_UNDEFINED) { // TODO: Should be okay to have stacks with with undefined windowing mode long term, but // have to set them to something for now due to logic that depending on them. windowingMode = getWindowingMode(); // Put in current display's windowing mode if (windowingMode == WINDOWING_MODE_UNDEFINED) { // Else fullscreen for now... windowingMode = WINDOWING_MODE_FULLSCREEN; } } final int stackId = getNextStackId(); return createStackUnchecked(windowingMode, activityType, stackId, onTop); } Loading Loading @@ -647,7 +637,21 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> windowingMode = getWindowingMode(); } } return validateWindowingMode(windowingMode, r, task, activityType); } /** * Check that the requested windowing-mode is appropriate for the specified task and/or activity * on this display. * * @param windowingMode The windowing-mode to validate. * @param r The {@link ActivityRecord} to check against. * @param task The {@link TaskRecord} to check against. * @param activityType An activity type. * @return The provided windowingMode or the closest valid mode which is appropriate. */ int validateWindowingMode(int windowingMode, @Nullable ActivityRecord r, @Nullable TaskRecord task, int activityType) { // Make sure the windowing mode we are trying to use makes sense for what is supported. final ActivityTaskManagerService service = mSupervisor.mService; boolean supportsMultiWindow = service.mSupportsMultiWindow; Loading services/core/java/com/android/server/am/ActivityStack.java +15 −19 Original line number Diff line number Diff line Loading @@ -540,15 +540,17 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai final ActivityStack splitScreenStack = display.getSplitScreenPrimaryStack(); mTmpOptions.setLaunchWindowingMode(preferredWindowingMode); int windowingMode = preferredWindowingMode; // Need to make sure windowing mode is supported. If we in the process of creating the stack // no need to resolve the windowing mode again as it is already resolved to the right mode. int windowingMode = creating ? preferredWindowingMode : display.resolveWindowingMode( null /* ActivityRecord */, mTmpOptions, topTask, getActivityType()); if (splitScreenStack == this && windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) { // Resolution to split-screen secondary for the primary split-screen stack means we want // to go fullscreen. if (!creating) { windowingMode = display.validateWindowingMode(windowingMode, null /* ActivityRecord */, topTask, getActivityType()); } if (splitScreenStack == this && windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) { // Resolution to split-screen secondary for the primary split-screen stack means // we want to go fullscreen. windowingMode = WINDOWING_MODE_FULLSCREEN; } Loading Loading @@ -598,6 +600,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai mStackSupervisor.mNoAnimActivities.add(topActivity); } super.setWindowingMode(windowingMode); windowingMode = getWindowingMode(); if (creating) { // Nothing else to do if we don't have a window container yet. E.g. call from ctor. Loading @@ -624,15 +627,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai mTmpRect2.setEmpty(); if (windowingMode != WINDOWING_MODE_FULLSCREEN) { mWindowContainerController.getRawBounds(mTmpRect2); if (windowingMode == WINDOWING_MODE_FREEFORM) { if (topTask != null) { // TODO: Can we consolidate this and other sites that call this methods? Rect bounds = topTask().getLaunchBounds(); if (bounds != null) { mTmpRect2.set(bounds); } } } } if (!Objects.equals(getOverrideBounds(), mTmpRect2)) { Loading Loading @@ -4812,9 +4806,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai // For freeform stack we don't adjust the size of the tasks to match that // of the stack, but we do try to make sure the tasks are still contained // with the bounds of the stack. if (task.getOverrideBounds() != null) { mTmpRect2.set(task.getOverrideBounds()); fitWithinBounds(mTmpRect2, bounds); task.updateOverrideConfiguration(mTmpRect2); } } else { task.updateOverrideConfiguration(taskBounds, insetBounds); } Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +9 −12 Original line number Diff line number Diff line Loading @@ -2339,6 +2339,9 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } /** * This doesn't just find a task, it also moves the task to front. */ void findTaskToMoveToFront(TaskRecord task, int flags, ActivityOptions options, String reason, boolean forceNonResizeable) { final ActivityStack currentStack = task.getStack(); Loading Loading @@ -2608,19 +2611,13 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D case ACTIVITY_TYPE_RECENTS: return r.isActivityTypeRecents(); case ACTIVITY_TYPE_ASSISTANT: return r.isActivityTypeAssistant(); } switch (stack.getWindowingMode()) { case WINDOWING_MODE_FULLSCREEN: return true; case WINDOWING_MODE_FREEFORM: return r.supportsFreeform(); case WINDOWING_MODE_PINNED: return r.supportsPictureInPicture(); case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY: return r.supportsSplitScreenWindowingMode(); case WINDOWING_MODE_SPLIT_SCREEN_SECONDARY: return r.supportsSplitScreenWindowingMode(); } if (!stack.isOnHomeDisplay()) { return r.canBeLaunchedOnDisplay(displayId); } Slog.e(TAG, "isValidLaunchStack: Unexpected stack=" + stack); // There is a 1-to-1 relationship between stack and task when not in // primary split-windowing mode. if (stack.getWindowingMode() != WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) { return false; } else { return r.supportsSplitScreenWindowingMode(); } } /** Loading services/core/java/com/android/server/am/TaskRecord.java +10 −2 Original line number Diff line number Diff line Loading @@ -1747,6 +1747,14 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi return updateOverrideConfiguration(bounds, null /* insetBounds */); } void setLastNonFullscreenBounds(Rect bounds) { if (mLastNonFullscreenBounds == null) { mLastNonFullscreenBounds = new Rect(bounds); } else { mLastNonFullscreenBounds.set(bounds); } } /** * Update task's override configuration based on the bounds. * @param bounds The bounds of the task. Loading @@ -1768,7 +1776,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi final boolean persistBounds = getWindowConfiguration().persistTaskBounds(); if (matchParentBounds) { if (!currentBounds.isEmpty() && persistBounds) { mLastNonFullscreenBounds = currentBounds; setLastNonFullscreenBounds(currentBounds); } setBounds(null); newConfig.unset(); Loading @@ -1778,7 +1786,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi setBounds(mTmpRect); if (mStack == null || persistBounds) { mLastNonFullscreenBounds = getOverrideBounds(); setLastNonFullscreenBounds(getOverrideBounds()); } computeOverrideConfiguration(newConfig, mTmpRect, insetBounds, mTmpRect.right != bounds.right, mTmpRect.bottom != bounds.bottom); Loading Loading
services/core/java/com/android/server/am/ActivityDisplay.java +14 −10 Original line number Diff line number Diff line Loading @@ -321,16 +321,6 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> + windowingMode); } if (windowingMode == WINDOWING_MODE_UNDEFINED) { // TODO: Should be okay to have stacks with with undefined windowing mode long term, but // have to set them to something for now due to logic that depending on them. windowingMode = getWindowingMode(); // Put in current display's windowing mode if (windowingMode == WINDOWING_MODE_UNDEFINED) { // Else fullscreen for now... windowingMode = WINDOWING_MODE_FULLSCREEN; } } final int stackId = getNextStackId(); return createStackUnchecked(windowingMode, activityType, stackId, onTop); } Loading Loading @@ -647,7 +637,21 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> windowingMode = getWindowingMode(); } } return validateWindowingMode(windowingMode, r, task, activityType); } /** * Check that the requested windowing-mode is appropriate for the specified task and/or activity * on this display. * * @param windowingMode The windowing-mode to validate. * @param r The {@link ActivityRecord} to check against. * @param task The {@link TaskRecord} to check against. * @param activityType An activity type. * @return The provided windowingMode or the closest valid mode which is appropriate. */ int validateWindowingMode(int windowingMode, @Nullable ActivityRecord r, @Nullable TaskRecord task, int activityType) { // Make sure the windowing mode we are trying to use makes sense for what is supported. final ActivityTaskManagerService service = mSupervisor.mService; boolean supportsMultiWindow = service.mSupportsMultiWindow; Loading
services/core/java/com/android/server/am/ActivityStack.java +15 −19 Original line number Diff line number Diff line Loading @@ -540,15 +540,17 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai final ActivityStack splitScreenStack = display.getSplitScreenPrimaryStack(); mTmpOptions.setLaunchWindowingMode(preferredWindowingMode); int windowingMode = preferredWindowingMode; // Need to make sure windowing mode is supported. If we in the process of creating the stack // no need to resolve the windowing mode again as it is already resolved to the right mode. int windowingMode = creating ? preferredWindowingMode : display.resolveWindowingMode( null /* ActivityRecord */, mTmpOptions, topTask, getActivityType()); if (splitScreenStack == this && windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) { // Resolution to split-screen secondary for the primary split-screen stack means we want // to go fullscreen. if (!creating) { windowingMode = display.validateWindowingMode(windowingMode, null /* ActivityRecord */, topTask, getActivityType()); } if (splitScreenStack == this && windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) { // Resolution to split-screen secondary for the primary split-screen stack means // we want to go fullscreen. windowingMode = WINDOWING_MODE_FULLSCREEN; } Loading Loading @@ -598,6 +600,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai mStackSupervisor.mNoAnimActivities.add(topActivity); } super.setWindowingMode(windowingMode); windowingMode = getWindowingMode(); if (creating) { // Nothing else to do if we don't have a window container yet. E.g. call from ctor. Loading @@ -624,15 +627,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai mTmpRect2.setEmpty(); if (windowingMode != WINDOWING_MODE_FULLSCREEN) { mWindowContainerController.getRawBounds(mTmpRect2); if (windowingMode == WINDOWING_MODE_FREEFORM) { if (topTask != null) { // TODO: Can we consolidate this and other sites that call this methods? Rect bounds = topTask().getLaunchBounds(); if (bounds != null) { mTmpRect2.set(bounds); } } } } if (!Objects.equals(getOverrideBounds(), mTmpRect2)) { Loading Loading @@ -4812,9 +4806,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai // For freeform stack we don't adjust the size of the tasks to match that // of the stack, but we do try to make sure the tasks are still contained // with the bounds of the stack. if (task.getOverrideBounds() != null) { mTmpRect2.set(task.getOverrideBounds()); fitWithinBounds(mTmpRect2, bounds); task.updateOverrideConfiguration(mTmpRect2); } } else { task.updateOverrideConfiguration(taskBounds, insetBounds); } Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +9 −12 Original line number Diff line number Diff line Loading @@ -2339,6 +2339,9 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } /** * This doesn't just find a task, it also moves the task to front. */ void findTaskToMoveToFront(TaskRecord task, int flags, ActivityOptions options, String reason, boolean forceNonResizeable) { final ActivityStack currentStack = task.getStack(); Loading Loading @@ -2608,19 +2611,13 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D case ACTIVITY_TYPE_RECENTS: return r.isActivityTypeRecents(); case ACTIVITY_TYPE_ASSISTANT: return r.isActivityTypeAssistant(); } switch (stack.getWindowingMode()) { case WINDOWING_MODE_FULLSCREEN: return true; case WINDOWING_MODE_FREEFORM: return r.supportsFreeform(); case WINDOWING_MODE_PINNED: return r.supportsPictureInPicture(); case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY: return r.supportsSplitScreenWindowingMode(); case WINDOWING_MODE_SPLIT_SCREEN_SECONDARY: return r.supportsSplitScreenWindowingMode(); } if (!stack.isOnHomeDisplay()) { return r.canBeLaunchedOnDisplay(displayId); } Slog.e(TAG, "isValidLaunchStack: Unexpected stack=" + stack); // There is a 1-to-1 relationship between stack and task when not in // primary split-windowing mode. if (stack.getWindowingMode() != WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) { return false; } else { return r.supportsSplitScreenWindowingMode(); } } /** Loading
services/core/java/com/android/server/am/TaskRecord.java +10 −2 Original line number Diff line number Diff line Loading @@ -1747,6 +1747,14 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi return updateOverrideConfiguration(bounds, null /* insetBounds */); } void setLastNonFullscreenBounds(Rect bounds) { if (mLastNonFullscreenBounds == null) { mLastNonFullscreenBounds = new Rect(bounds); } else { mLastNonFullscreenBounds.set(bounds); } } /** * Update task's override configuration based on the bounds. * @param bounds The bounds of the task. Loading @@ -1768,7 +1776,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi final boolean persistBounds = getWindowConfiguration().persistTaskBounds(); if (matchParentBounds) { if (!currentBounds.isEmpty() && persistBounds) { mLastNonFullscreenBounds = currentBounds; setLastNonFullscreenBounds(currentBounds); } setBounds(null); newConfig.unset(); Loading @@ -1778,7 +1786,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi setBounds(mTmpRect); if (mStack == null || persistBounds) { mLastNonFullscreenBounds = getOverrideBounds(); setLastNonFullscreenBounds(getOverrideBounds()); } computeOverrideConfiguration(newConfig, mTmpRect, insetBounds, mTmpRect.right != bounds.right, mTmpRect.bottom != bounds.bottom); Loading