From 61867f4b3ce4560688b97894cd594c98f78b66a2 Mon Sep 17 00:00:00 2001 From: Annie Lin Date: Wed, 21 May 2025 10:06:47 -0700 Subject: [PATCH] Restrict launcher bubble shortcut option. To respect current multi-window mode policies for non-resizeable activities, we should hide this option on small screens. The bubble option will continue to show on large screens (unfolded Foldables and Tablets) but not on small screens (folded Foldables and Phones) for non-resizeable apps. Bug: 411558731 Test: Manual - Enable the flag and try to bubble a shortcut via the longpress menu on launcher --> Does not show bubble option for non-resizeable apps on small screen but shows otherwise. Flag: com.android.wm.shell.enable_create_any_bubble Change-Id: I2546b1002c92e309b8f7f439480e2c87eaf951c4 --- src/com/android/launcher3/popup/SystemShortcut.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index 2c5b510b0f..82b6747da7 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -426,6 +426,16 @@ public abstract class SystemShortcut extends ItemInfo && !(itemInfo instanceof WorkspaceItemInfo)) { return null; } + if (itemInfo instanceof WorkspaceItemInfo) { + // Don't show bubble shortcut option for non-resizeable apps on small screens. + // TODO(b/411558731): isPhone just checks for smallest width < 600dp, so it + // basically is a check for small screens including Foldables when folded. + // However, the name is a bit misleading, so considering renaming. + WorkspaceItemInfo wsItemInfo = (WorkspaceItemInfo) itemInfo; + if (wsItemInfo.isNonResizeable() && activity.getDeviceProfile().isPhone) { + return null; + } + } return new BubbleShortcut<>(activity, itemInfo, originalView); };