From dcf9b9d70085c5b28ea4f67258beecdbf9bc4beb Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Fri, 16 Feb 2024 16:08:09 -0800 Subject: Expanded view handle should be the size of the dots Handle was using the width of the expanded view. Which meant the entire width was clickable and draggable. Reduce the size of the handle to the dots and some padding aronud it. Bug: 283991264 Test: manual, tap on area close to the edge of bubble expanded view Change-Id: Ib36e024ba1cd9dbd0ed31ce1c294f0ad9cf77359 --- .../Shell/res/layout/bubble_bar_expanded_view.xml | 5 +++-- libs/WindowManager/Shell/res/values/dimen.xml | 2 ++ .../android/wm/shell/bubbles/bar/BubbleBarExpandedView.java | 11 +++-------- .../com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java | 1 + 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'libs') diff --git a/libs/WindowManager/Shell/res/layout/bubble_bar_expanded_view.xml b/libs/WindowManager/Shell/res/layout/bubble_bar_expanded_view.xml index e04ab817215c..34f03c2f226b 100644 --- a/libs/WindowManager/Shell/res/layout/bubble_bar_expanded_view.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_bar_expanded_view.xml @@ -23,7 +23,8 @@ + android:layout_height="@dimen/bubble_bar_expanded_view_caption_height" + android:layout_width="@dimen/bubble_bar_expanded_view_caption_width" + android:layout_gravity="top|center_horizontal" /> diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index f73775becac9..3b0eb49158cb 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -244,6 +244,8 @@ 24dp 32dp + + 128dp 4dp diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarExpandedView.java index eddd43f263d9..271fb9abce6a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarExpandedView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarExpandedView.java @@ -143,6 +143,8 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), mCurrentCornerRadius); } }); + // Set a touch sink to ensure that clicks on the caption area do not propagate to the parent + setOnTouchListener((v, event) -> true); } @Override @@ -245,12 +247,8 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); - int height = MeasureSpec.getSize(heightMeasureSpec); - int menuViewHeight = Math.min(mCaptionHeight, height); - measureChild(mHandleView, widthMeasureSpec, MeasureSpec.makeMeasureSpec(menuViewHeight, - MeasureSpec.getMode(heightMeasureSpec))); - if (mTaskView != null) { + int height = MeasureSpec.getSize(heightMeasureSpec); measureChild(mTaskView, widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.getMode(heightMeasureSpec))); } @@ -259,14 +257,11 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); - final int captionBottom = t + mCaptionHeight; if (mTaskView != null) { mTaskView.layout(l, t, r, t + mTaskView.getMeasuredHeight()); mTaskView.setCaptionInsets(Insets.of(0, mCaptionHeight, 0, 0)); } - // Handle draws on top of task view in the caption area. - mHandleView.layout(l, t, r, captionBottom); } @Override diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java index 62f2726ad9bd..78a41f759d96 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java @@ -231,6 +231,7 @@ public class BubbleBarLayerView extends FrameLayout // Touch delegate for the menu BubbleBarHandleView view = mExpandedView.getHandleView(); view.getBoundsOnScreen(mHandleTouchBounds); + // Move top value up to ensure touch target is large enough mHandleTouchBounds.top -= mPositioner.getBubblePaddingTop(); mHandleTouchDelegate = new TouchDelegate(mHandleTouchBounds, mExpandedView.getHandleView()); -- cgit v1.2.3-59-g8ed1b