Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +17 −3 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ import com.android.wm.shell.sysui.ShellSharedConstants import com.android.wm.shell.transition.OneShotRemoteHandler import com.android.wm.shell.transition.Transitions import com.android.wm.shell.util.KtProtoLog import com.android.wm.shell.windowdecor.DragPositioningCallbackUtility import com.android.wm.shell.windowdecor.MoveToDesktopAnimator import com.android.wm.shell.windowdecor.OnTaskResizeAnimationListener import java.io.PrintWriter Loading Loading @@ -960,7 +961,8 @@ class DesktopTasksController( } /** * Perform checks required on drag end. Move to fullscreen if drag ends in status bar area. * Perform checks required on drag end. If indicator indicates a windowing mode change, perform * that change. Otherwise, ensure bounds are up to date. * * @param taskInfo the task being dragged. * @param position position of surface when drag ends. Loading @@ -971,7 +973,8 @@ class DesktopTasksController( taskInfo: RunningTaskInfo, position: Point, inputCoordinate: PointF, taskBounds: Rect taskBounds: Rect, validDragArea: Rect ) { if (taskInfo.configuration.windowConfiguration.windowingMode != WINDOWING_MODE_FREEFORM) { return Loading @@ -994,10 +997,21 @@ class DesktopTasksController( releaseVisualIndicator() snapToHalfScreen(taskInfo, SnapPosition.RIGHT) } DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR, DesktopModeVisualIndicator.IndicatorType.NO_INDICATOR -> { // If task bounds are outside valid drag area, snap them inward and perform a // transaction to set bounds. if (DragPositioningCallbackUtility.snapTaskBoundsIfNecessary( taskBounds, validDragArea)) { val wct = WindowContainerTransaction() wct.setBounds(taskInfo.token, taskBounds) transitions.startTransition(TRANSIT_CHANGE, wct, null) } releaseVisualIndicator() } DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR -> { throw IllegalArgumentException("Should not be receiving TO_DESKTOP_INDICATOR for " + "a freeform task.") } } // A freeform drag-move ended, remove the indicator immediately. releaseVisualIndicator() Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +11 −2 Original line number Diff line number Diff line Loading @@ -19,9 +19,11 @@ package com.android.wm.shell.windowdecor; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowManager.TRANSIT_CHANGE; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; import android.graphics.Rect; import android.os.Handler; import android.util.SparseArray; import android.view.Choreographer; Loading Loading @@ -186,7 +188,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { final FluidResizeTaskPositioner taskPositioner = new FluidResizeTaskPositioner(mTaskOrganizer, mTransitions, windowDecoration, mDisplayController, 0 /* disallowedAreaForEndBoundsHeight */); mDisplayController); final CaptionTouchEventListener touchEventListener = new CaptionTouchEventListener(taskInfo, taskPositioner); windowDecoration.setCaptionListeners(touchEventListener, touchEventListener); Loading Loading @@ -286,8 +288,15 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { mDragPointerId = e.getPointerId(0); } final int dragPointerIdx = e.findPointerIndex(mDragPointerId); mDragPositioningCallback.onDragPositioningEnd( final Rect newTaskBounds = mDragPositioningCallback.onDragPositioningEnd( e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)); DragPositioningCallbackUtility.snapTaskBoundsIfNecessary(newTaskBounds, mWindowDecorByTaskId.get(mTaskId).calculateValidDragArea()); if (newTaskBounds != taskInfo.configuration.windowConfiguration.getBounds()) { final WindowContainerTransaction wct = new WindowContainerTransaction(); wct.setBounds(taskInfo.token, newTaskBounds); mTransitions.startTransition(TRANSIT_CHANGE, wct, null); } final boolean wasDragging = mIsDragging; mIsDragging = false; return wasDragging; Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.wm.shell.windowdecor; import android.annotation.NonNull; import android.app.ActivityManager.RunningTaskInfo; import android.app.WindowConfiguration; import android.app.WindowConfiguration.WindowingMode; Loading Loading @@ -87,6 +88,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL } @Override @NonNull Rect calculateValidDragArea() { final int leftButtonsWidth = loadDimensionPixelSize(mContext.getResources(), R.dimen.caption_left_buttons_width); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +3 −5 Original line number Diff line number Diff line Loading @@ -639,7 +639,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)); mDesktopTasksController.onDragPositioningEnd(taskInfo, position, new PointF(e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)), newTaskBounds); newTaskBounds, decoration.calculateValidDragArea()); if (touchingButton && !mHasLongClicked) { // We need the input event to not be consumed here to end the ripple // effect on the touched button. We will reset drag state in the ensuing Loading Loading @@ -1086,18 +1086,16 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { windowDecoration.createResizeVeil(); final DragPositioningCallback dragPositioningCallback; final int transitionAreaHeight = mContext.getResources().getDimensionPixelSize( R.dimen.desktop_mode_fullscreen_from_desktop_height); if (!DesktopModeStatus.isVeiledResizeEnabled()) { dragPositioningCallback = new FluidResizeTaskPositioner( mTaskOrganizer, mTransitions, windowDecoration, mDisplayController, mDragStartListener, mTransactionFactory, transitionAreaHeight); mDragStartListener, mTransactionFactory); windowDecoration.setTaskDragResizer( (FluidResizeTaskPositioner) dragPositioningCallback); } else { dragPositioningCallback = new VeiledResizeTaskPositioner( mTaskOrganizer, windowDecoration, mDisplayController, mDragStartListener, mTransitions, transitionAreaHeight); mDragStartListener, mTransitions); windowDecoration.setTaskDragResizer( (VeiledResizeTaskPositioner) dragPositioningCallback); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.app.WindowConfiguration.windowingModeToString; import static com.android.launcher3.icons.BaseIconFactory.MODE_DEFAULT; import android.annotation.NonNull; import android.app.ActivityManager; import android.app.WindowConfiguration.WindowingMode; import android.content.Context; Loading Loading @@ -499,6 +500,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * Determine valid drag area for this task based on elements in the app chip. */ @Override @NonNull Rect calculateValidDragArea() { final int appTextWidth = ((DesktopModeAppControlsWindowDecorationViewHolder) mWindowDecorViewHolder).getAppNameTextWidth(); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +17 −3 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ import com.android.wm.shell.sysui.ShellSharedConstants import com.android.wm.shell.transition.OneShotRemoteHandler import com.android.wm.shell.transition.Transitions import com.android.wm.shell.util.KtProtoLog import com.android.wm.shell.windowdecor.DragPositioningCallbackUtility import com.android.wm.shell.windowdecor.MoveToDesktopAnimator import com.android.wm.shell.windowdecor.OnTaskResizeAnimationListener import java.io.PrintWriter Loading Loading @@ -960,7 +961,8 @@ class DesktopTasksController( } /** * Perform checks required on drag end. Move to fullscreen if drag ends in status bar area. * Perform checks required on drag end. If indicator indicates a windowing mode change, perform * that change. Otherwise, ensure bounds are up to date. * * @param taskInfo the task being dragged. * @param position position of surface when drag ends. Loading @@ -971,7 +973,8 @@ class DesktopTasksController( taskInfo: RunningTaskInfo, position: Point, inputCoordinate: PointF, taskBounds: Rect taskBounds: Rect, validDragArea: Rect ) { if (taskInfo.configuration.windowConfiguration.windowingMode != WINDOWING_MODE_FREEFORM) { return Loading @@ -994,10 +997,21 @@ class DesktopTasksController( releaseVisualIndicator() snapToHalfScreen(taskInfo, SnapPosition.RIGHT) } DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR, DesktopModeVisualIndicator.IndicatorType.NO_INDICATOR -> { // If task bounds are outside valid drag area, snap them inward and perform a // transaction to set bounds. if (DragPositioningCallbackUtility.snapTaskBoundsIfNecessary( taskBounds, validDragArea)) { val wct = WindowContainerTransaction() wct.setBounds(taskInfo.token, taskBounds) transitions.startTransition(TRANSIT_CHANGE, wct, null) } releaseVisualIndicator() } DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR -> { throw IllegalArgumentException("Should not be receiving TO_DESKTOP_INDICATOR for " + "a freeform task.") } } // A freeform drag-move ended, remove the indicator immediately. releaseVisualIndicator() Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +11 −2 Original line number Diff line number Diff line Loading @@ -19,9 +19,11 @@ package com.android.wm.shell.windowdecor; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowManager.TRANSIT_CHANGE; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; import android.graphics.Rect; import android.os.Handler; import android.util.SparseArray; import android.view.Choreographer; Loading Loading @@ -186,7 +188,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { final FluidResizeTaskPositioner taskPositioner = new FluidResizeTaskPositioner(mTaskOrganizer, mTransitions, windowDecoration, mDisplayController, 0 /* disallowedAreaForEndBoundsHeight */); mDisplayController); final CaptionTouchEventListener touchEventListener = new CaptionTouchEventListener(taskInfo, taskPositioner); windowDecoration.setCaptionListeners(touchEventListener, touchEventListener); Loading Loading @@ -286,8 +288,15 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { mDragPointerId = e.getPointerId(0); } final int dragPointerIdx = e.findPointerIndex(mDragPointerId); mDragPositioningCallback.onDragPositioningEnd( final Rect newTaskBounds = mDragPositioningCallback.onDragPositioningEnd( e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)); DragPositioningCallbackUtility.snapTaskBoundsIfNecessary(newTaskBounds, mWindowDecorByTaskId.get(mTaskId).calculateValidDragArea()); if (newTaskBounds != taskInfo.configuration.windowConfiguration.getBounds()) { final WindowContainerTransaction wct = new WindowContainerTransaction(); wct.setBounds(taskInfo.token, newTaskBounds); mTransitions.startTransition(TRANSIT_CHANGE, wct, null); } final boolean wasDragging = mIsDragging; mIsDragging = false; return wasDragging; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.wm.shell.windowdecor; import android.annotation.NonNull; import android.app.ActivityManager.RunningTaskInfo; import android.app.WindowConfiguration; import android.app.WindowConfiguration.WindowingMode; Loading Loading @@ -87,6 +88,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL } @Override @NonNull Rect calculateValidDragArea() { final int leftButtonsWidth = loadDimensionPixelSize(mContext.getResources(), R.dimen.caption_left_buttons_width); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +3 −5 Original line number Diff line number Diff line Loading @@ -639,7 +639,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)); mDesktopTasksController.onDragPositioningEnd(taskInfo, position, new PointF(e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)), newTaskBounds); newTaskBounds, decoration.calculateValidDragArea()); if (touchingButton && !mHasLongClicked) { // We need the input event to not be consumed here to end the ripple // effect on the touched button. We will reset drag state in the ensuing Loading Loading @@ -1086,18 +1086,16 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { windowDecoration.createResizeVeil(); final DragPositioningCallback dragPositioningCallback; final int transitionAreaHeight = mContext.getResources().getDimensionPixelSize( R.dimen.desktop_mode_fullscreen_from_desktop_height); if (!DesktopModeStatus.isVeiledResizeEnabled()) { dragPositioningCallback = new FluidResizeTaskPositioner( mTaskOrganizer, mTransitions, windowDecoration, mDisplayController, mDragStartListener, mTransactionFactory, transitionAreaHeight); mDragStartListener, mTransactionFactory); windowDecoration.setTaskDragResizer( (FluidResizeTaskPositioner) dragPositioningCallback); } else { dragPositioningCallback = new VeiledResizeTaskPositioner( mTaskOrganizer, windowDecoration, mDisplayController, mDragStartListener, mTransitions, transitionAreaHeight); mDragStartListener, mTransitions); windowDecoration.setTaskDragResizer( (VeiledResizeTaskPositioner) dragPositioningCallback); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.app.WindowConfiguration.windowingModeToString; import static com.android.launcher3.icons.BaseIconFactory.MODE_DEFAULT; import android.annotation.NonNull; import android.app.ActivityManager; import android.app.WindowConfiguration.WindowingMode; import android.content.Context; Loading Loading @@ -499,6 +500,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * Determine valid drag area for this task based on elements in the app chip. */ @Override @NonNull Rect calculateValidDragArea() { final int appTextWidth = ((DesktopModeAppControlsWindowDecorationViewHolder) mWindowDecorViewHolder).getAppNameTextWidth(); Loading