summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinControllerTest.kt12
-rw-r--r--libs/WindowManager/Shell/res/drawable/bubble_drop_target_background.xml18
-rw-r--r--libs/WindowManager/Shell/res/values/dimen.xml3
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java9
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinController.kt20
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/bubbles/BubbleBarUpdate.java15
6 files changed, 41 insertions, 36 deletions
diff --git a/libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinControllerTest.kt b/libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinControllerTest.kt
index 611013365e7d..076414132e27 100644
--- a/libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinControllerTest.kt
+++ b/libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinControllerTest.kt
@@ -31,7 +31,6 @@ import com.android.internal.protolog.common.ProtoLog
import com.android.wm.shell.R
import com.android.wm.shell.bubbles.BubblePositioner
import com.android.wm.shell.bubbles.DeviceConfig
-import com.android.wm.shell.bubbles.bar.BubbleExpandedViewPinController.Companion.DROP_TARGET_SCALE
import com.android.wm.shell.common.bubbles.BaseBubblePinController
import com.android.wm.shell.common.bubbles.BaseBubblePinController.Companion.DROP_TARGET_ALPHA_IN_DURATION
import com.android.wm.shell.common.bubbles.BaseBubblePinController.Companion.DROP_TARGET_ALPHA_OUT_DURATION
@@ -248,15 +247,8 @@ class BubbleExpandedViewPinControllerTest {
private val dropTargetView: View?
get() = container.findViewById(R.id.bubble_bar_drop_target)
- private fun getExpectedDropTargetBounds(onLeft: Boolean): Rect {
- val rect = Rect()
- positioner.getBubbleBarExpandedViewBounds(onLeft, false /* isOveflowExpanded */, rect)
- // Scale the rect to expected size, but keep the center point the same
- val centerX = rect.centerX()
- val centerY = rect.centerY()
- rect.scale(DROP_TARGET_SCALE)
- rect.offset(centerX - rect.centerX(), centerY - rect.centerY())
- return rect
+ private fun getExpectedDropTargetBounds(onLeft: Boolean): Rect = Rect().also {
+ positioner.getBubbleBarExpandedViewBounds(onLeft, false /* isOveflowExpanded */, it)
}
private fun runOnMainSync(runnable: Runnable) {
diff --git a/libs/WindowManager/Shell/res/drawable/bubble_drop_target_background.xml b/libs/WindowManager/Shell/res/drawable/bubble_drop_target_background.xml
index 9dcde3b54421..b928a0b20764 100644
--- a/libs/WindowManager/Shell/res/drawable/bubble_drop_target_background.xml
+++ b/libs/WindowManager/Shell/res/drawable/bubble_drop_target_background.xml
@@ -13,12 +13,14 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
- android:shape="rectangle">
- <corners android:radius="@dimen/bubble_bar_expanded_view_corner_radius" />
- <solid android:color="@color/bubble_drop_target_background_color" />
- <stroke
- android:width="1dp"
- android:color="?androidprv:attr/materialColorPrimaryContainer" />
-</shape>
+ android:inset="@dimen/bubble_bar_expanded_view_drop_target_padding">
+ <shape android:shape="rectangle">
+ <corners android:radius="@dimen/bubble_bar_expanded_view_drop_target_corner" />
+ <solid android:color="@color/bubble_drop_target_background_color" />
+ <stroke
+ android:width="1dp"
+ android:color="?androidprv:attr/materialColorPrimaryContainer" />
+ </shape>
+</inset>
diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml
index f532f96ccfc9..8d24c161e3e4 100644
--- a/libs/WindowManager/Shell/res/values/dimen.xml
+++ b/libs/WindowManager/Shell/res/values/dimen.xml
@@ -274,6 +274,9 @@
<dimen name="bubble_bar_expanded_view_corner_radius">16dp</dimen>
<!-- Corner radius for expanded view while it is being dragged -->
<dimen name="bubble_bar_expanded_view_corner_radius_dragged">28dp</dimen>
+ <!-- Corner radius for expanded view drop target -->
+ <dimen name="bubble_bar_expanded_view_drop_target_corner">28dp</dimen>
+ <dimen name="bubble_bar_expanded_view_drop_target_padding">24dp</dimen>
<!-- Width of the box around bottom center of the screen where drag only leads to dismiss -->
<dimen name="bubble_bar_dismiss_zone_width">192dp</dimen>
<!-- Height of the box around bottom center of the screen where drag only leads to dismiss -->
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
index 9d43070b2cbd..9e6c5fbf9f5e 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
@@ -1171,6 +1171,15 @@ public class BubbleController implements ConfigurationChangeListener,
*/
public void startBubbleDrag(String bubbleKey) {
onBubbleDrag(bubbleKey, true /* isBeingDragged */);
+ if (mBubbleStateListener != null) {
+ boolean overflow = BubbleOverflow.KEY.equals(bubbleKey);
+ Rect rect = new Rect();
+ mBubblePositioner.getBubbleBarExpandedViewBounds(mBubblePositioner.isBubbleBarOnLeft(),
+ overflow, rect);
+ BubbleBarUpdate update = new BubbleBarUpdate();
+ update.expandedViewDropTargetSize = new Point(rect.width(), rect.height());
+ mBubbleStateListener.onBubbleStateChange(update);
+ }
}
/**
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinController.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinController.kt
index 3b3974dc80ec..651bf022e07d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinController.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinController.kt
@@ -22,7 +22,6 @@ import android.graphics.Rect
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
-import androidx.annotation.VisibleForTesting
import androidx.core.view.updateLayoutParams
import com.android.wm.shell.R
import com.android.wm.shell.bubbles.BubblePositioner
@@ -79,7 +78,11 @@ class BubbleExpandedViewPinController(
override fun updateLocation(location: BubbleBarLocation) {
val view = dropTargetView ?: return
- getBounds(location.isOnLeft(view.isLayoutRtl), tempRect)
+ positioner.getBubbleBarExpandedViewBounds(
+ location.isOnLeft(view.isLayoutRtl),
+ false /* isOverflowExpanded */,
+ tempRect
+ )
view.updateLayoutParams<FrameLayout.LayoutParams> {
width = tempRect.width()
height = tempRect.height()
@@ -87,17 +90,4 @@ class BubbleExpandedViewPinController(
view.x = tempRect.left.toFloat()
view.y = tempRect.top.toFloat()
}
-
- private fun getBounds(onLeft: Boolean, out: Rect) {
- positioner.getBubbleBarExpandedViewBounds(onLeft, false /* isOverflowExpanded */, out)
- val centerX = out.centerX()
- val centerY = out.centerY()
- out.scale(DROP_TARGET_SCALE)
- // Move rect center back to the same position as before scale
- out.offset(centerX - out.centerX(), centerY - out.centerY())
- }
-
- companion object {
- @VisibleForTesting const val DROP_TARGET_SCALE = 0.9f
- }
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/bubbles/BubbleBarUpdate.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/bubbles/BubbleBarUpdate.java
index e5f6c370da84..6980c6f01e5d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/bubbles/BubbleBarUpdate.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/bubbles/BubbleBarUpdate.java
@@ -18,6 +18,7 @@ package com.android.wm.shell.common.bubbles;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.graphics.Point;
import android.os.Parcel;
import android.os.Parcelable;
@@ -49,6 +50,8 @@ public class BubbleBarUpdate implements Parcelable {
public String unsupressedBubbleKey;
@Nullable
public BubbleBarLocation bubbleBarLocation;
+ @Nullable
+ public Point expandedViewDropTargetSize;
// This is only populated if bubbles have been removed.
public List<RemovedBubble> removedBubbles = new ArrayList<>();
@@ -81,12 +84,14 @@ public class BubbleBarUpdate implements Parcelable {
suppressedBubbleKey = parcel.readString();
unsupressedBubbleKey = parcel.readString();
removedBubbles = parcel.readParcelableList(new ArrayList<>(),
- RemovedBubble.class.getClassLoader());
+ RemovedBubble.class.getClassLoader(), RemovedBubble.class);
parcel.readStringList(bubbleKeysInOrder);
currentBubbleList = parcel.readParcelableList(new ArrayList<>(),
- BubbleInfo.class.getClassLoader());
+ BubbleInfo.class.getClassLoader(), BubbleInfo.class);
bubbleBarLocation = parcel.readParcelable(BubbleBarLocation.class.getClassLoader(),
BubbleBarLocation.class);
+ expandedViewDropTargetSize = parcel.readParcelable(Point.class.getClassLoader(),
+ Point.class);
}
/**
@@ -105,6 +110,7 @@ public class BubbleBarUpdate implements Parcelable {
|| bubbleBarLocation != null;
}
+ @NonNull
@Override
public String toString() {
return "BubbleBarUpdate{"
@@ -121,6 +127,7 @@ public class BubbleBarUpdate implements Parcelable {
+ " bubbles=" + bubbleKeysInOrder
+ " currentBubbleList=" + currentBubbleList
+ " bubbleBarLocation=" + bubbleBarLocation
+ + " expandedViewDropTargetSize=" + expandedViewDropTargetSize
+ " }";
}
@@ -144,6 +151,7 @@ public class BubbleBarUpdate implements Parcelable {
parcel.writeStringList(bubbleKeysInOrder);
parcel.writeParcelableList(currentBubbleList, flags);
parcel.writeParcelable(bubbleBarLocation, flags);
+ parcel.writeParcelable(expandedViewDropTargetSize, flags);
}
/**
@@ -157,10 +165,11 @@ public class BubbleBarUpdate implements Parcelable {
@NonNull
public static final Creator<BubbleBarUpdate> CREATOR =
- new Creator<BubbleBarUpdate>() {
+ new Creator<>() {
public BubbleBarUpdate createFromParcel(Parcel source) {
return new BubbleBarUpdate(source);
}
+
public BubbleBarUpdate[] newArray(int size) {
return new BubbleBarUpdate[size];
}