diff --git a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java index a833ccf9c4..b33fd38606 100644 --- a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java @@ -18,6 +18,7 @@ package com.android.launcher3.taskbar; import android.content.Context; import android.content.Intent; import android.content.pm.ShortcutInfo; +import android.os.UserHandle; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; @@ -60,9 +61,9 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements } @Override - public void showAppBubble(Intent intent) { + public void showAppBubble(Intent intent, UserHandle user) { if (intent == null || intent.getPackage() == null) return; - SystemUiProxy.INSTANCE.get(this).showAppBubble(intent); + SystemUiProxy.INSTANCE.get(this).showAppBubble(intent, user); } /** Callback invoked when a drag is initiated within this context. */ diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index f86030d049..58ebc506ef 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -84,6 +84,7 @@ import android.os.Bundle; import android.os.IRemoteCallback; import android.os.SystemProperties; import android.os.Trace; +import android.os.UserHandle; import android.util.AttributeSet; import android.view.Display; import android.view.HapticFeedbackConstants; @@ -1431,9 +1432,9 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, } @Override - public void showAppBubble(Intent intent) { + public void showAppBubble(Intent intent, UserHandle user) { if (intent == null || intent.getPackage() == null) return; - SystemUiProxy.INSTANCE.get(this).showAppBubble(intent); + SystemUiProxy.INSTANCE.get(this).showAppBubble(intent, user); } /** Sets the location of the bubble bar */ diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.kt b/quickstep/src/com/android/quickstep/SystemUiProxy.kt index c1a92ede11..f679fec02a 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.kt +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.kt @@ -663,8 +663,10 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context: * * @param intent the intent used to create the bubble. */ - fun showAppBubble(intent: Intent?) = - executeWithErrorLog({ "Failed call showAppBubble" }) { bubbles?.showAppBubble(intent) } + fun showAppBubble(intent: Intent?, user: UserHandle) = + executeWithErrorLog({ "Failed call showAppBubble" }) { + bubbles?.showAppBubble(intent, user) + } /** Tells SysUI to show the expanded view. */ fun showExpandedView() = diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index 329d9df4f1..7e08c6ec20 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -431,7 +431,7 @@ public abstract class SystemShortcut extends ItemInfo && !(itemInfo instanceof WorkspaceItemInfo)) { return null; } - return new BubbleShortcut(activity, itemInfo, originalView); + return new BubbleShortcut<>(activity, itemInfo, originalView); }; public interface BubbleActivityStarter { @@ -439,7 +439,7 @@ public abstract class SystemShortcut extends ItemInfo void showShortcutBubble(ShortcutInfo info); /** Tell SysUI to show the provided intent in a bubble. */ - void showAppBubble(Intent intent); + void showAppBubble(Intent intent, UserHandle user); } public static class BubbleShortcut extends SystemShortcut { @@ -476,7 +476,7 @@ public abstract class SystemShortcut extends ItemInfo if (intent.getPackage() == null) { intent.setPackage(mItemInfo.getTargetPackage()); } - mStarter.showAppBubble(intent); + mStarter.showAppBubble(intent, mItemInfo.user); } else { Log.w(TAG, "unable to bubble, no intent: " + mItemInfo); } diff --git a/tests/tapl/com/android/launcher3/tapl/AppIconMenu.java b/tests/tapl/com/android/launcher3/tapl/AppIconMenu.java index bbcc6a85ba..033cfb0664 100644 --- a/tests/tapl/com/android/launcher3/tapl/AppIconMenu.java +++ b/tests/tapl/com/android/launcher3/tapl/AppIconMenu.java @@ -63,5 +63,12 @@ public abstract class AppIconMenu { return new SplitScreenMenuItem(mLauncher, menuItem); } + /** Returns the Bubble menu item. */ + public BubbleMenuItem getBubbleMenuItem() { + final UiObject2 menuItem = mLauncher.waitForObjectInContainer(mDeepShortcutsContainer, + AppIcon.getMenuItemSelector("Bubble", mLauncher)); + return new BubbleMenuItem(mLauncher, menuItem); + } + protected abstract AppIconMenuItem createMenuItem(UiObject2 menuItem); } diff --git a/tests/tapl/com/android/launcher3/tapl/BubbleMenuItem.kt b/tests/tapl/com/android/launcher3/tapl/BubbleMenuItem.kt new file mode 100644 index 0000000000..77391f1ef7 --- /dev/null +++ b/tests/tapl/com/android/launcher3/tapl/BubbleMenuItem.kt @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.tapl + +import androidx.test.uiautomator.UiObject2 + +/** + * A class representing the Bubble menu item in the app long-press menu, which moves the app into a + * bubble. + */ +class BubbleMenuItem( + private val launcher: LauncherInstrumentation, + private val uiObject: UiObject2, +) { + + fun click() { + launcher.addContextLayer("want to create bubble from app long-press menu").use { + LauncherInstrumentation.log( + "clicking on bubble menu item ${uiObject.visibleCenter} in ${ + launcher.getVisibleBounds( + uiObject + ) + }" + ) + launcher.clickLauncherObject(uiObject) + } + } +}