Layer caption container surface behind corner input region.

Changes layering of caption to allow input in regions occupied by
caption view. This change combined with ag/23604820 will allow for mouse input in the gap left by rounded corners.

Bug: 286461778
Test: Manual; check mouse input near caption corners in both desktop
mode and legacy caption.

Change-Id: I49d5c105b52920a3b0aead04dbc87231e73bdfca
This commit is contained in:
mattsziklay
2023-06-09 10:27:30 -07:00
parent d2db7f2c01
commit c2d0acd78c
2 changed files with 6 additions and 5 deletions

View File

@@ -56,7 +56,6 @@ 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;
@@ -440,10 +439,7 @@ class DragResizeInputListener implements AutoCloseable {
}
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
if (distanceFromCenter < mTaskCornerRadius + mResizeHandleThickness
&& distanceFromCenter >= mTaskCornerRadius) {
return ctrlType;
}

View File

@@ -237,7 +237,12 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
final int captionHeight = loadDimensionPixelSize(resources, params.mCaptionHeightId);
final int captionWidth = taskBounds.width();
// We use mDecorationContainerSurface to define input window for task resizing; by layering
// it in front of mCaptionContainerSurface, we can allow it to handle input prior to
// caption view itself, treating corner inputs as resize events rather than repositioning.
startT.setWindowCrop(mCaptionContainerSurface, captionWidth, captionHeight)
.setLayer(mCaptionContainerSurface, -1)
.show(mCaptionContainerSurface);
if (ViewRootImpl.CAPTION_ON_SHELL) {