summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Liran Binyamin <liranb@google.com> 2024-10-07 16:55:02 -0400
committer Liran Binyamin <liranb@google.com> 2024-10-07 16:57:08 -0400
commit5e04f0960d5d0d498f277355eca907c9606eade9 (patch)
treef084e449731ded1ca7c3abfd20c2c0458129db2d
parentd8c3328d4d9c5b3ffa95b0e9d45494bee07b8423 (diff)
Store the flyout in BubbleBarBubble
Extracts the flyout message from the bundle and stores it in BubbleBarBubble. Flag: com.android.wm.shell.enable_bubble_bar Bug: 277815200 Test: builds successfully -- code is not wired up yet Change-Id: I5e810290991b4ee638f43add4d6a6514edb167af
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt6
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleCreator.java23
-rw-r--r--quickstep/testing/com/android/launcher3/taskbar/bubbles/testing/FakeBubbleViewFactory.kt11
-rw-r--r--quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewTest.kt11
-rw-r--r--quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt11
5 files changed, 56 insertions, 6 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt
index 7a32ef152a..680ffca0a0 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 @@ package com.android.launcher3.taskbar.bubbles
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 @@ data class BubbleBarBubble(
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 340a120e33..c5efe2fca3 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_DYNAMIC;
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.R;
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 @@ public class BubbleCreator {
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 @@ public class BubbleCreator {
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 473d8ef559..2f1f0b5f6f 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 @@ object FakeBubbleViewFactory {
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 2caff01057..4ae887718b 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 @@ class BubbleViewTest {
)
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 39131659be..7eee4de9ba 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 @@ class BubbleBarViewAnimatorTest {
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)
}