From 00947ee4cf8fc1b06605bb6c7235056a6c7a279c Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Tue, 31 Jan 2023 15:15:17 -0800 Subject: [PATCH] Remove dragging from/to status bar from proto 1 Removing option to switch windowing modes by dragging from/to status bar from prototype 1. Only way to toggle windowing modes is the quick settings toggle. Bug: 266711813 Test: atest DesktopModeWindowDecorViewModelTests Test: manual, try to drag a window to status bar when desktop mode is on Test: manual, turn off desktop mode, check that window handle is not shown in status bar Change-Id: Ia2d4c6f82c9edf2824e263743d1152ea45902ff6 --- .../DesktopModeWindowDecorViewModel.java | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java index 606cf28548029..db6cbdc5176d3 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java @@ -301,18 +301,11 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { mDragPositioningCallback.onDragPositioningEnd( e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)); if (e.getRawY(dragPointerIdx) <= statusBarHeight) { - if (DesktopModeStatus.isProto2Enabled()) { - if (taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) { - // Switch a single task to fullscreen - mDesktopTasksController.ifPresent( - c -> c.moveToFullscreen(taskInfo)); - } - } else if (DesktopModeStatus.isProto1Enabled()) { - if (DesktopModeStatus.isActive(mContext)) { - // Turn off desktop mode - mDesktopModeController.ifPresent( - c -> c.setDesktopModeActive(false)); - } + if (DesktopModeStatus.isProto2Enabled() + && taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) { + // Switch a single task to fullscreen + mDesktopTasksController.ifPresent( + c -> c.moveToFullscreen(taskInfo)); } } break; @@ -402,10 +395,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { || focusedDecor.mTaskInfo.getWindowingMode() != WINDOWING_MODE_FREEFORM) { handleCaptionThroughStatusBar(ev); } - } else if (DesktopModeStatus.isProto1Enabled()) { - if (!DesktopModeStatus.isActive(mContext)) { - handleCaptionThroughStatusBar(ev); - } } handleEventOutsideFocusedCaption(ev); // Prevent status bar from reacting to a caption drag. @@ -451,9 +440,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { // In proto2 any full screen task can be dragged to freeform dragFromStatusBarAllowed = focusedDecor.mTaskInfo.getWindowingMode() == WINDOWING_MODE_FULLSCREEN; - } else if (DesktopModeStatus.isProto1Enabled()) { - // In proto1 task can be dragged to freeform when not in desktop mode - dragFromStatusBarAllowed = !DesktopModeStatus.isActive(mContext); } if (dragFromStatusBarAllowed && focusedDecor.checkTouchEventInHandle(ev)) { @@ -524,7 +510,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { private boolean shouldShowWindowDecor(RunningTaskInfo taskInfo) { if (taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) return true; - return DesktopModeStatus.isAnyEnabled() + return DesktopModeStatus.isProto2Enabled() && taskInfo.getActivityType() == ACTIVITY_TYPE_STANDARD && mDisplayController.getDisplayContext(taskInfo.displayId) .getResources().getConfiguration().smallestScreenWidthDp >= 600;