Merge "Store the flyout in BubbleBarBubble" into main
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt
index 7a32ef1..680ffca 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt
@@ -17,10 +17,11 @@
import android.graphics.Bitmap
import android.graphics.Path
+import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutMessage
import com.android.wm.shell.shared.bubbles.BubbleInfo
/** An entity in the bubble bar. */
-sealed class BubbleBarItem(open var key: String, open var view: BubbleView)
+sealed class BubbleBarItem(open val key: String, open var view: BubbleView)
/** Contains state info about a bubble in the bubble bar as well as presentation information. */
data class BubbleBarBubble(
@@ -30,7 +31,8 @@
var icon: Bitmap,
var dotColor: Int,
var dotPath: Path,
- var appName: String
+ var appName: String,
+ var flyoutMessage: BubbleBarFlyoutMessage?,
) : BubbleBarItem(info.key, view)
/** Represents the overflow bubble in the bubble bar. */
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleCreator.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleCreator.java
index 340a120..c5efe2f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleCreator.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleCreator.java
@@ -22,6 +22,7 @@
import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LAUNCHER;
import static com.android.launcher3.icons.FastBitmapDrawable.WHITE_SCRIM_ALPHA;
+import static com.android.wm.shell.shared.bubbles.FlyoutDrawableLoader.loadFlyoutDrawable;
import android.annotation.Nullable;
import android.content.Context;
@@ -49,7 +50,9 @@
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.launcher3.shortcuts.ShortcutRequest;
+import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutMessage;
import com.android.wm.shell.shared.bubbles.BubbleInfo;
+import com.android.wm.shell.shared.bubbles.ParcelableFlyoutMessage;
/**
* Loads the necessary info to populate / present a bubble (name, icon, shortcut).
@@ -157,13 +160,16 @@
dotColor = ColorUtils.blendARGB(badgeBitmapInfo.color,
Color.WHITE, WHITE_SCRIM_ALPHA / 255f);
+ final BubbleBarFlyoutMessage flyoutMessage =
+ getFlyoutMessage(info.getParcelableFlyoutMessage());
+
if (existingBubble == null) {
LayoutInflater inflater = LayoutInflater.from(context);
BubbleView bubbleView = (BubbleView) inflater.inflate(
R.layout.bubblebar_item_view, barView, false /* attachToRoot */);
BubbleBarBubble bubble = new BubbleBarBubble(info, bubbleView,
- badgeBitmap, bubbleBitmap, dotColor, dotPath, appName);
+ badgeBitmap, bubbleBitmap, dotColor, dotPath, appName, flyoutMessage);
bubbleView.setBubble(bubble);
return bubble;
} else {
@@ -174,10 +180,25 @@
existingBubble.setDotColor(dotColor);
existingBubble.setDotPath(dotPath);
existingBubble.setAppName(appName);
+ existingBubble.setFlyoutMessage(flyoutMessage);
return existingBubble;
}
}
+ @Nullable
+ private BubbleBarFlyoutMessage getFlyoutMessage(
+ @Nullable ParcelableFlyoutMessage parcelableFlyoutMessage) {
+ if (parcelableFlyoutMessage == null) {
+ return null;
+ }
+ String title = parcelableFlyoutMessage.getTitle();
+ String message = parcelableFlyoutMessage.getMessage();
+ return new BubbleBarFlyoutMessage(
+ loadFlyoutDrawable(parcelableFlyoutMessage.getIcon(), mContext),
+ title == null ? "" : title,
+ message == null ? "" : message);
+ }
+
/**
* Creates the overflow view shown in the bubble bar.
*
diff --git a/quickstep/testing/com/android/launcher3/taskbar/bubbles/testing/FakeBubbleViewFactory.kt b/quickstep/testing/com/android/launcher3/taskbar/bubbles/testing/FakeBubbleViewFactory.kt
index 473d8ef..2f1f0b5 100644
--- a/quickstep/testing/com/android/launcher3/taskbar/bubbles/testing/FakeBubbleViewFactory.kt
+++ b/quickstep/testing/com/android/launcher3/taskbar/bubbles/testing/FakeBubbleViewFactory.kt
@@ -73,7 +73,16 @@
context.resources.getString(com.android.internal.R.string.config_icon_mask)
)
val bubble =
- BubbleBarBubble(bubbleInfo, bubbleView, badge, icon, dotColor, dotPath, "test app")
+ BubbleBarBubble(
+ bubbleInfo,
+ bubbleView,
+ badge,
+ icon,
+ dotColor,
+ dotPath,
+ "test app",
+ null,
+ )
bubbleView.setBubble(bubble)
return bubbleView
}
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewTest.kt
index 2caff01..4ae8877 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewTest.kt
@@ -80,7 +80,16 @@
)
bubbleView = inflater.inflate(R.layout.bubblebar_item_view, null, false) as BubbleView
bubble =
- BubbleBarBubble(bubbleInfo, bubbleView, bitmap, bitmap, Color.WHITE, Path(), "")
+ BubbleBarBubble(
+ bubbleInfo,
+ bubbleView,
+ bitmap,
+ bitmap,
+ Color.WHITE,
+ Path(),
+ "",
+ null,
+ )
bubbleView.setBubble(bubble)
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
index 3913165..7eee4de 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
@@ -886,7 +886,16 @@
bubbleView =
inflater.inflate(R.layout.bubblebar_item_view, bubbleBarView, false) as BubbleView
bubble =
- BubbleBarBubble(bubbleInfo, bubbleView, bitmap, bitmap, Color.WHITE, Path(), "")
+ BubbleBarBubble(
+ bubbleInfo,
+ bubbleView,
+ bitmap,
+ bitmap,
+ Color.WHITE,
+ Path(),
+ "",
+ null,
+ )
bubbleView.setBubble(bubble)
bubbleBarView.addView(bubbleView)
}