summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mady Mellor <madym@google.com> 2025-02-24 12:00:35 -0800
committer Mady Mellor <madym@google.com> 2025-02-24 12:02:33 -0800
commita6d81a531dd1755d5aaa9b431ed9915a5d30c260 (patch)
tree7a861fa4af22db43dd3abdfbcf423d6f206549c1
parent2ae29b62c80fd4323a13f456fc5b3a948e76b5a7 (diff)
Fix NPE when dragging an app to bubble from taskbar
I shouldn't have removed the use of component utils to look up the package name. I've added that back and modified the test to work with it. Flag: com.android.wm.shell.enable_bubble_anything Test: atest WMShellRobolectricTests:BubbleTaskViewListenerTest Test: manual - open an app, bring taskbar up, drag an app from taskbar to the bubble drop zone => observe that it works Bug: 398847805 Change-Id: I4eff1faf4c49fd21538b0e77472416c83a04c765
-rw-r--r--libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskViewListenerTest.kt2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java2
2 files changed, 3 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskViewListenerTest.kt b/libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskViewListenerTest.kt
index 3aefcd5ec6c0..9087da34d259 100644
--- a/libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskViewListenerTest.kt
+++ b/libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskViewListenerTest.kt
@@ -552,7 +552,9 @@ class BubbleTaskViewListenerTest {
private fun createAppBubble(usePendingIntent: Boolean = false): Bubble {
val target = Intent(context, TestActivity::class.java)
+ val component = ComponentName(context, TestActivity::class.java)
target.setPackage(context.packageName)
+ target.setComponent(component)
if (usePendingIntent) {
// Robolectric doesn't seem to play nice with PendingIntents, have to mock it.
val pendingIntent = mock<PendingIntent>()
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java
index 313d151aeab7..d9489287ff42 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java
@@ -364,7 +364,7 @@ public class Bubble implements BubbleViewProvider {
@ShellMainThread Executor mainExecutor, @ShellBackgroundThread Executor bgExecutor) {
return new Bubble(intent,
user,
- /* key= */ getAppBubbleKeyForApp(intent.getIntent().getPackage(), user),
+ /* key= */ getAppBubbleKeyForApp(ComponentUtils.getPackageName(intent), user),
mainExecutor, bgExecutor);
}