Loading libs/WindowManager/Shell/res/values/dimen.xml +1 −1 Original line number Diff line number Diff line Loading @@ -416,7 +416,7 @@ <!-- The radius of the caption menu shadow. --> <dimen name="desktop_mode_handle_menu_shadow_radius">2dp</dimen> <dimen name="freeform_resize_handle">30dp</dimen> <dimen name="freeform_resize_handle">15dp</dimen> <dimen name="freeform_resize_corner">44dp</dimen> </resources> libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL mHandler, mChoreographer, mDisplay.getDisplayId(), 0 /* taskCornerRadius */, mDecorationContainerSurface, mDragPositioningCallback); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +1 −0 Original line number Diff line number Diff line Loading @@ -235,6 +235,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin mHandler, mChoreographer, mDisplay.getDisplayId(), mRelayoutParams.mCornerRadius, mDecorationContainerSurface, mDragPositioningCallback); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java +57 −6 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ import com.android.internal.view.BaseIWindow; */ class DragResizeInputListener implements AutoCloseable { private static final String TAG = "DragResizeInputListener"; private static final float TOP_CORNER_PADDING = 1.5f; private final IWindowSession mWindowSession = WindowManagerGlobal.getWindowSession(); private final Handler mHandler; private final Choreographer mChoreographer; Loading @@ -74,6 +74,7 @@ class DragResizeInputListener implements AutoCloseable { private int mTaskHeight; private int mResizeHandleThickness; private int mCornerSize; private int mTaskCornerRadius; private Rect mLeftTopCornerBounds; private Rect mRightTopCornerBounds; Loading @@ -88,12 +89,14 @@ class DragResizeInputListener implements AutoCloseable { Handler handler, Choreographer choreographer, int displayId, int taskCornerRadius, SurfaceControl decorationSurface, DragPositioningCallback callback) { mInputManager = context.getSystemService(InputManager.class); mHandler = handler; mChoreographer = choreographer; mDisplayId = displayId; mTaskCornerRadius = taskCornerRadius; mDecorationSurface = decorationSurface; // Use a fake window as the backing surface is a container layer and we don't want to create // a buffer layer for it so we can't use ViewRootImpl. Loading Loading @@ -384,20 +387,68 @@ class DragResizeInputListener implements AutoCloseable { @DragPositioningCallback.CtrlType private int calculateResizeHandlesCtrlType(float x, float y) { int ctrlType = 0; if (x < 0) { // mTaskCornerRadius is only used in comparing with corner regions. Comparisons with // sides will use the bounds specified in setGeometry and not go into task bounds. if (x < mTaskCornerRadius) { ctrlType |= CTRL_TYPE_LEFT; } if (x > mTaskWidth) { if (x > mTaskWidth - mTaskCornerRadius) { ctrlType |= CTRL_TYPE_RIGHT; } if (y < 0) { if (y < mTaskCornerRadius) { ctrlType |= CTRL_TYPE_TOP; } if (y > mTaskHeight) { if (y > mTaskHeight - mTaskCornerRadius) { ctrlType |= CTRL_TYPE_BOTTOM; } return checkDistanceFromCenter(ctrlType, x, y); } // If corner input is not within appropriate distance of corner radius, do not use it. // If input is not on a corner or is within valid distance, return ctrlType. @DragPositioningCallback.CtrlType private int checkDistanceFromCenter(@DragPositioningCallback.CtrlType int ctrlType, float x, float y) { int centerX; int centerY; // Determine center of rounded corner circle; this is simply the corner if radius is 0. switch (ctrlType) { case CTRL_TYPE_LEFT | CTRL_TYPE_TOP: { centerX = mTaskCornerRadius; centerY = mTaskCornerRadius; break; } case CTRL_TYPE_LEFT | CTRL_TYPE_BOTTOM: { centerX = mTaskCornerRadius; centerY = mTaskHeight - mTaskCornerRadius; break; } case CTRL_TYPE_RIGHT | CTRL_TYPE_TOP: { centerX = mTaskWidth - mTaskCornerRadius; centerY = mTaskCornerRadius; break; } case CTRL_TYPE_RIGHT | CTRL_TYPE_BOTTOM: { centerX = mTaskWidth - mTaskCornerRadius; centerY = mTaskHeight - mTaskCornerRadius; break; } default: { return ctrlType; } } double distanceFromCenter = Math.hypot(x - centerX, y - centerY); // TODO(b/286461778): Remove this when input in top corner gap no longer goes to header float cornerPadding = (ctrlType & CTRL_TYPE_TOP) != 0 ? TOP_CORNER_PADDING : 1; if (distanceFromCenter < mTaskCornerRadius + mResizeHandleThickness * cornerPadding && distanceFromCenter >= mTaskCornerRadius) { return ctrlType; } return 0; } @DragPositioningCallback.CtrlType private int calculateCornersCtrlType(float x, float y) { Loading Loading
libs/WindowManager/Shell/res/values/dimen.xml +1 −1 Original line number Diff line number Diff line Loading @@ -416,7 +416,7 @@ <!-- The radius of the caption menu shadow. --> <dimen name="desktop_mode_handle_menu_shadow_radius">2dp</dimen> <dimen name="freeform_resize_handle">30dp</dimen> <dimen name="freeform_resize_handle">15dp</dimen> <dimen name="freeform_resize_corner">44dp</dimen> </resources>
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL mHandler, mChoreographer, mDisplay.getDisplayId(), 0 /* taskCornerRadius */, mDecorationContainerSurface, mDragPositioningCallback); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +1 −0 Original line number Diff line number Diff line Loading @@ -235,6 +235,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin mHandler, mChoreographer, mDisplay.getDisplayId(), mRelayoutParams.mCornerRadius, mDecorationContainerSurface, mDragPositioningCallback); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java +57 −6 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ import com.android.internal.view.BaseIWindow; */ class DragResizeInputListener implements AutoCloseable { private static final String TAG = "DragResizeInputListener"; private static final float TOP_CORNER_PADDING = 1.5f; private final IWindowSession mWindowSession = WindowManagerGlobal.getWindowSession(); private final Handler mHandler; private final Choreographer mChoreographer; Loading @@ -74,6 +74,7 @@ class DragResizeInputListener implements AutoCloseable { private int mTaskHeight; private int mResizeHandleThickness; private int mCornerSize; private int mTaskCornerRadius; private Rect mLeftTopCornerBounds; private Rect mRightTopCornerBounds; Loading @@ -88,12 +89,14 @@ class DragResizeInputListener implements AutoCloseable { Handler handler, Choreographer choreographer, int displayId, int taskCornerRadius, SurfaceControl decorationSurface, DragPositioningCallback callback) { mInputManager = context.getSystemService(InputManager.class); mHandler = handler; mChoreographer = choreographer; mDisplayId = displayId; mTaskCornerRadius = taskCornerRadius; mDecorationSurface = decorationSurface; // Use a fake window as the backing surface is a container layer and we don't want to create // a buffer layer for it so we can't use ViewRootImpl. Loading Loading @@ -384,20 +387,68 @@ class DragResizeInputListener implements AutoCloseable { @DragPositioningCallback.CtrlType private int calculateResizeHandlesCtrlType(float x, float y) { int ctrlType = 0; if (x < 0) { // mTaskCornerRadius is only used in comparing with corner regions. Comparisons with // sides will use the bounds specified in setGeometry and not go into task bounds. if (x < mTaskCornerRadius) { ctrlType |= CTRL_TYPE_LEFT; } if (x > mTaskWidth) { if (x > mTaskWidth - mTaskCornerRadius) { ctrlType |= CTRL_TYPE_RIGHT; } if (y < 0) { if (y < mTaskCornerRadius) { ctrlType |= CTRL_TYPE_TOP; } if (y > mTaskHeight) { if (y > mTaskHeight - mTaskCornerRadius) { ctrlType |= CTRL_TYPE_BOTTOM; } return checkDistanceFromCenter(ctrlType, x, y); } // If corner input is not within appropriate distance of corner radius, do not use it. // If input is not on a corner or is within valid distance, return ctrlType. @DragPositioningCallback.CtrlType private int checkDistanceFromCenter(@DragPositioningCallback.CtrlType int ctrlType, float x, float y) { int centerX; int centerY; // Determine center of rounded corner circle; this is simply the corner if radius is 0. switch (ctrlType) { case CTRL_TYPE_LEFT | CTRL_TYPE_TOP: { centerX = mTaskCornerRadius; centerY = mTaskCornerRadius; break; } case CTRL_TYPE_LEFT | CTRL_TYPE_BOTTOM: { centerX = mTaskCornerRadius; centerY = mTaskHeight - mTaskCornerRadius; break; } case CTRL_TYPE_RIGHT | CTRL_TYPE_TOP: { centerX = mTaskWidth - mTaskCornerRadius; centerY = mTaskCornerRadius; break; } case CTRL_TYPE_RIGHT | CTRL_TYPE_BOTTOM: { centerX = mTaskWidth - mTaskCornerRadius; centerY = mTaskHeight - mTaskCornerRadius; break; } default: { return ctrlType; } } double distanceFromCenter = Math.hypot(x - centerX, y - centerY); // TODO(b/286461778): Remove this when input in top corner gap no longer goes to header float cornerPadding = (ctrlType & CTRL_TYPE_TOP) != 0 ? TOP_CORNER_PADDING : 1; if (distanceFromCenter < mTaskCornerRadius + mResizeHandleThickness * cornerPadding && distanceFromCenter >= mTaskCornerRadius) { return ctrlType; } return 0; } @DragPositioningCallback.CtrlType private int calculateCornersCtrlType(float x, float y) { Loading