Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6d81a53 authored by Mady Mellor's avatar Mady Mellor
Browse files

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
parent 2ae29b62
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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>()
+1 −1
Original line number Diff line number Diff line
@@ -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);
    }