Prevent Taskbar all apps from showing multi instance options
This change makes it so that we don't show any multi instance options in
Taskbar all apps. This matches the behavior from regular All apps.
Fix: 382342931
Test: Long press an app icon in Taskbar all apps and ensure multi
instance options don't show up.
Flag: com.android.launcher3.enable_multi_instance_menu_taskbar
Change-Id: I5322df328ee5484168b96831f32c2023521704e6
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
index 2e0bae5..abf35a2 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
@@ -15,6 +15,7 @@
*/
package com.android.launcher3.taskbar;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS;
import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR;
import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition;
@@ -309,9 +310,7 @@
*/
SystemShortcut.Factory<BaseTaskbarContext> createNewWindowShortcutFactory() {
return (context, itemInfo, originalView) -> {
- ComponentKey key = itemInfo.getComponentKey();
- AppInfo app = getApp(key);
- if (app != null && app.supportsMultiInstance()) {
+ if (shouldShowMultiInstanceOptions(itemInfo)) {
return new NewWindowTaskbarShortcut<>(context, itemInfo, originalView);
}
return null;
@@ -325,9 +324,7 @@
*/
public SystemShortcut.Factory<BaseTaskbarContext> createManageWindowsShortcutFactory() {
return (context, itemInfo, originalView) -> {
- ComponentKey key = itemInfo.getComponentKey();
- AppInfo app = getApp(key);
- if (app != null && app.supportsMultiInstance()) {
+ if (shouldShowMultiInstanceOptions(itemInfo)) {
return new ManageWindowsTaskbarShortcut<>(context, itemInfo, originalView,
mControllers);
}
@@ -336,6 +333,16 @@
}
/**
+ * Determines whether to show multi-instance options for a given item.
+ */
+ private boolean shouldShowMultiInstanceOptions(ItemInfo itemInfo) {
+ ComponentKey key = itemInfo.getComponentKey();
+ AppInfo app = getApp(key);
+ return app != null && app.supportsMultiInstance()
+ && itemInfo.container != CONTAINER_ALL_APPS;
+ }
+
+ /**
* A single menu item ("Split left," "Split right," or "Split top") that executes a split
* from the taskbar, as if the user performed a drag and drop split.
* Includes an onClick method that initiates the actual split.