Loading libs/WindowManager/Shell/res/values/dimen.xml +4 −0 Original line number Diff line number Diff line Loading @@ -419,4 +419,8 @@ <dimen name="freeform_resize_handle">15dp</dimen> <dimen name="freeform_resize_corner">44dp</dimen> <!-- The height of the area at the top of the screen where a freeform task will transition to fullscreen if dragged until the top bound of the task is within the area. --> <dimen name="desktop_mode_transition_area_height">16dp</dimen> </resources> libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +10 −8 Original line number Diff line number Diff line Loading @@ -100,6 +100,10 @@ class DesktopTasksController( } } private val transitionAreaHeight get() = context.resources.getDimensionPixelSize( com.android.wm.shell.R.dimen.desktop_mode_transition_area_height) init { desktopMode = DesktopModeImpl() if (DesktopModeStatus.isProto2Enabled()) { Loading Loading @@ -700,13 +704,12 @@ class DesktopTasksController( y: Float ) { if (taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) { val statusBarHeight = getStatusBarHeight(taskInfo) if (y <= statusBarHeight && visualIndicator == null) { if (y <= transitionAreaHeight && visualIndicator == null) { visualIndicator = DesktopModeVisualIndicator(syncQueue, taskInfo, displayController, context, taskSurface, shellTaskOrganizer, rootTaskDisplayAreaOrganizer) visualIndicator?.createFullscreenIndicatorWithAnimatedBounds() } else if (y > statusBarHeight && visualIndicator != null) { } else if (y > transitionAreaHeight && visualIndicator != null) { releaseVisualIndicator() } } Loading @@ -726,8 +729,7 @@ class DesktopTasksController( y: Float, windowDecor: DesktopModeWindowDecoration ) { val statusBarHeight = getStatusBarHeight(taskInfo) if (y <= statusBarHeight && taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) { if (y <= transitionAreaHeight && taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) { windowDecor.incrementRelayoutBlock() moveToFullscreenWithAnimation(taskInfo, position) } Loading @@ -746,9 +748,9 @@ class DesktopTasksController( taskSurface: SurfaceControl, y: Float ) { // If the motion event is above the status bar, return since we do not need to show the // visual indicator at this point. if (y < getStatusBarHeight(taskInfo)) { // If the motion event is above the status bar and the visual indicator is not yet visible, // return since we do not need to show the visual indicator at this point. if (y < getStatusBarHeight(taskInfo) && visualIndicator == null) { return } if (visualIndicator == null) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +1 −1 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { final DragPositioningCallback dragPositioningCallback = new FluidResizeTaskPositioner(mTaskOrganizer, windowDecoration, mDisplayController, null /* disallowedAreaForEndBounds */); 0 /* disallowedAreaForEndBoundsHeight */); final CaptionTouchEventListener touchEventListener = new CaptionTouchEventListener(taskInfo, dragPositioningCallback); windowDecoration.setCaptionListeners(touchEventListener, touchEventListener); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +8 −15 Original line number Diff line number Diff line Loading @@ -845,7 +845,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { windowDecoration.createResizeVeil(); final DragPositioningCallback dragPositioningCallback = createDragPositioningCallback( windowDecoration, taskInfo); windowDecoration); final DesktopModeTouchEventListener touchEventListener = new DesktopModeTouchEventListener(taskInfo, dragPositioningCallback); Loading @@ -858,24 +858,17 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { incrementEventReceiverTasks(taskInfo.displayId); } private DragPositioningCallback createDragPositioningCallback( @NonNull DesktopModeWindowDecoration windowDecoration, @NonNull RunningTaskInfo taskInfo) { final int screenWidth = mDisplayController.getDisplayLayout(taskInfo.displayId).width(); final Rect disallowedAreaForEndBounds; if (DesktopModeStatus.isProto2Enabled()) { disallowedAreaForEndBounds = new Rect(0, 0, screenWidth, getStatusBarHeight(taskInfo.displayId)); } else { disallowedAreaForEndBounds = null; } @NonNull DesktopModeWindowDecoration windowDecoration) { final int transitionAreaHeight = mContext.getResources().getDimensionPixelSize( R.dimen.desktop_mode_transition_area_height); if (!DesktopModeStatus.isVeiledResizeEnabled()) { return new FluidResizeTaskPositioner(mTaskOrganizer, windowDecoration, mDisplayController, disallowedAreaForEndBounds, mDragStartListener, mTransactionFactory); mDisplayController, mDragStartListener, mTransactionFactory, transitionAreaHeight); } else { return new VeiledResizeTaskPositioner(mTaskOrganizer, windowDecoration, mDisplayController, disallowedAreaForEndBounds, mDragStartListener, mTransitions); mDisplayController, mDragStartListener, mTransitions, transitionAreaHeight); } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallbackUtility.java +18 −3 Original line number Diff line number Diff line Loading @@ -83,8 +83,6 @@ public class DragPositioningCallbackUtility { // Make sure the new resizing destination in any direction falls within the stable bounds. // If not, set the bounds back to the old location that was valid to avoid conflicts with // some regions such as the gesture area. displayController.getDisplayLayout(windowDecoration.mDisplay.getDisplayId()) .getStableBounds(stableBounds); if ((ctrlType & CTRL_TYPE_LEFT) != 0) { final int candidateLeft = repositionTaskBounds.left + (int) delta.x; repositionTaskBounds.left = (candidateLeft > stableBounds.left) Loading Loading @@ -136,7 +134,7 @@ public class DragPositioningCallbackUtility { repositionTaskBounds.top); } static void updateTaskBounds(Rect repositionTaskBounds, Rect taskBoundsAtDragStart, private static void updateTaskBounds(Rect repositionTaskBounds, Rect taskBoundsAtDragStart, PointF repositionStartPoint, float x, float y) { final float deltaX = x - repositionStartPoint.x; final float deltaY = y - repositionStartPoint.y; Loading @@ -144,6 +142,23 @@ public class DragPositioningCallbackUtility { repositionTaskBounds.offset((int) deltaX, (int) deltaY); } /** * Updates repositionTaskBounds to the final bounds of the task after the drag is finished. If * the bounds are outside of the stable bounds, they are shifted to place task at the top of the * stable bounds. */ static void onDragEnd(Rect repositionTaskBounds, Rect taskBoundsAtDragStart, Rect stableBounds, PointF repositionStartPoint, float x, float y) { updateTaskBounds(repositionTaskBounds, taskBoundsAtDragStart, repositionStartPoint, x, y); // If task is outside of stable bounds (in the status bar area), shift the task down. if (stableBounds.top > repositionTaskBounds.top) { final int yShift = stableBounds.top - repositionTaskBounds.top; repositionTaskBounds.offset(0, yShift); } } /** * Apply a bounds change to a task. * @param windowDecoration decor of task we are changing bounds for Loading Loading
libs/WindowManager/Shell/res/values/dimen.xml +4 −0 Original line number Diff line number Diff line Loading @@ -419,4 +419,8 @@ <dimen name="freeform_resize_handle">15dp</dimen> <dimen name="freeform_resize_corner">44dp</dimen> <!-- The height of the area at the top of the screen where a freeform task will transition to fullscreen if dragged until the top bound of the task is within the area. --> <dimen name="desktop_mode_transition_area_height">16dp</dimen> </resources>
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +10 −8 Original line number Diff line number Diff line Loading @@ -100,6 +100,10 @@ class DesktopTasksController( } } private val transitionAreaHeight get() = context.resources.getDimensionPixelSize( com.android.wm.shell.R.dimen.desktop_mode_transition_area_height) init { desktopMode = DesktopModeImpl() if (DesktopModeStatus.isProto2Enabled()) { Loading Loading @@ -700,13 +704,12 @@ class DesktopTasksController( y: Float ) { if (taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) { val statusBarHeight = getStatusBarHeight(taskInfo) if (y <= statusBarHeight && visualIndicator == null) { if (y <= transitionAreaHeight && visualIndicator == null) { visualIndicator = DesktopModeVisualIndicator(syncQueue, taskInfo, displayController, context, taskSurface, shellTaskOrganizer, rootTaskDisplayAreaOrganizer) visualIndicator?.createFullscreenIndicatorWithAnimatedBounds() } else if (y > statusBarHeight && visualIndicator != null) { } else if (y > transitionAreaHeight && visualIndicator != null) { releaseVisualIndicator() } } Loading @@ -726,8 +729,7 @@ class DesktopTasksController( y: Float, windowDecor: DesktopModeWindowDecoration ) { val statusBarHeight = getStatusBarHeight(taskInfo) if (y <= statusBarHeight && taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) { if (y <= transitionAreaHeight && taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) { windowDecor.incrementRelayoutBlock() moveToFullscreenWithAnimation(taskInfo, position) } Loading @@ -746,9 +748,9 @@ class DesktopTasksController( taskSurface: SurfaceControl, y: Float ) { // If the motion event is above the status bar, return since we do not need to show the // visual indicator at this point. if (y < getStatusBarHeight(taskInfo)) { // If the motion event is above the status bar and the visual indicator is not yet visible, // return since we do not need to show the visual indicator at this point. if (y < getStatusBarHeight(taskInfo) && visualIndicator == null) { return } if (visualIndicator == null) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +1 −1 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { final DragPositioningCallback dragPositioningCallback = new FluidResizeTaskPositioner(mTaskOrganizer, windowDecoration, mDisplayController, null /* disallowedAreaForEndBounds */); 0 /* disallowedAreaForEndBoundsHeight */); final CaptionTouchEventListener touchEventListener = new CaptionTouchEventListener(taskInfo, dragPositioningCallback); windowDecoration.setCaptionListeners(touchEventListener, touchEventListener); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +8 −15 Original line number Diff line number Diff line Loading @@ -845,7 +845,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { windowDecoration.createResizeVeil(); final DragPositioningCallback dragPositioningCallback = createDragPositioningCallback( windowDecoration, taskInfo); windowDecoration); final DesktopModeTouchEventListener touchEventListener = new DesktopModeTouchEventListener(taskInfo, dragPositioningCallback); Loading @@ -858,24 +858,17 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { incrementEventReceiverTasks(taskInfo.displayId); } private DragPositioningCallback createDragPositioningCallback( @NonNull DesktopModeWindowDecoration windowDecoration, @NonNull RunningTaskInfo taskInfo) { final int screenWidth = mDisplayController.getDisplayLayout(taskInfo.displayId).width(); final Rect disallowedAreaForEndBounds; if (DesktopModeStatus.isProto2Enabled()) { disallowedAreaForEndBounds = new Rect(0, 0, screenWidth, getStatusBarHeight(taskInfo.displayId)); } else { disallowedAreaForEndBounds = null; } @NonNull DesktopModeWindowDecoration windowDecoration) { final int transitionAreaHeight = mContext.getResources().getDimensionPixelSize( R.dimen.desktop_mode_transition_area_height); if (!DesktopModeStatus.isVeiledResizeEnabled()) { return new FluidResizeTaskPositioner(mTaskOrganizer, windowDecoration, mDisplayController, disallowedAreaForEndBounds, mDragStartListener, mTransactionFactory); mDisplayController, mDragStartListener, mTransactionFactory, transitionAreaHeight); } else { return new VeiledResizeTaskPositioner(mTaskOrganizer, windowDecoration, mDisplayController, disallowedAreaForEndBounds, mDragStartListener, mTransitions); mDisplayController, mDragStartListener, mTransitions, transitionAreaHeight); } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallbackUtility.java +18 −3 Original line number Diff line number Diff line Loading @@ -83,8 +83,6 @@ public class DragPositioningCallbackUtility { // Make sure the new resizing destination in any direction falls within the stable bounds. // If not, set the bounds back to the old location that was valid to avoid conflicts with // some regions such as the gesture area. displayController.getDisplayLayout(windowDecoration.mDisplay.getDisplayId()) .getStableBounds(stableBounds); if ((ctrlType & CTRL_TYPE_LEFT) != 0) { final int candidateLeft = repositionTaskBounds.left + (int) delta.x; repositionTaskBounds.left = (candidateLeft > stableBounds.left) Loading Loading @@ -136,7 +134,7 @@ public class DragPositioningCallbackUtility { repositionTaskBounds.top); } static void updateTaskBounds(Rect repositionTaskBounds, Rect taskBoundsAtDragStart, private static void updateTaskBounds(Rect repositionTaskBounds, Rect taskBoundsAtDragStart, PointF repositionStartPoint, float x, float y) { final float deltaX = x - repositionStartPoint.x; final float deltaY = y - repositionStartPoint.y; Loading @@ -144,6 +142,23 @@ public class DragPositioningCallbackUtility { repositionTaskBounds.offset((int) deltaX, (int) deltaY); } /** * Updates repositionTaskBounds to the final bounds of the task after the drag is finished. If * the bounds are outside of the stable bounds, they are shifted to place task at the top of the * stable bounds. */ static void onDragEnd(Rect repositionTaskBounds, Rect taskBoundsAtDragStart, Rect stableBounds, PointF repositionStartPoint, float x, float y) { updateTaskBounds(repositionTaskBounds, taskBoundsAtDragStart, repositionStartPoint, x, y); // If task is outside of stable bounds (in the status bar area), shift the task down. if (stableBounds.top > repositionTaskBounds.top) { final int yShift = stableBounds.top - repositionTaskBounds.top; repositionTaskBounds.offset(0, yShift); } } /** * Apply a bounds change to a task. * @param windowDecoration decor of task we are changing bounds for Loading