Merge "Pass the user id for intent app bubbles" into main

This commit is contained in:
Liran Binyamin authored and Android (Google) Code Review committed 2025-01-17 12:29:50 -08:00
commit e96bd71f50
6 files changed
+62 -9

No files matched your search

@@ -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. */
@@ -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 */
@@ -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() =
@@ -431,7 +431,7 @@ public abstract class SystemShortcut<T extends ActivityContext> 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<T extends ActivityContext> 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<T extends ActivityContext> extends SystemShortcut<T> {
@@ -476,7 +476,7 @@ public abstract class SystemShortcut<T extends ActivityContext> 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);
}
@@ -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);
}
@@ -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)
}
}
}