pin-shortcut: Add pin shortcut to the context menu

This cl adds the pin shortcut option to the context menu, where
it works on Home launcher, hotseat, and pinned apps on the
taskbar.
Currently the option is a no-op.

Bug: 375648361
Test: Manual. Recording uploaded to buganizer
Flag: com.android.launcher3.enable_pinning_app_with_context_menu
Change-Id: I5d1284a6e909fd75f14e81c3ae713da3cdc01ce3
This commit is contained in:
Wen-Chien Wang
2024-12-10 00:24:51 +00:00
parent 0f0394c597
commit 2badfc7ebc
4 changed files with 36 additions and 0 deletions
@@ -48,6 +48,7 @@ import static com.android.launcher3.popup.SystemShortcut.APP_INFO;
import static com.android.launcher3.popup.SystemShortcut.BUBBLE_SHORTCUT;
import static com.android.launcher3.popup.SystemShortcut.DONT_SUGGEST_APP;
import static com.android.launcher3.popup.SystemShortcut.INSTALL;
import static com.android.launcher3.popup.SystemShortcut.PIN_UNPIN_ITEM;
import static com.android.launcher3.popup.SystemShortcut.PRIVATE_PROFILE_INSTALL;
import static com.android.launcher3.popup.SystemShortcut.UNINSTALL_APP;
import static com.android.launcher3.popup.SystemShortcut.WIDGETS;
@@ -457,6 +458,10 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
// Order matters as it affects order of appearance in popup container
List<SystemShortcut.Factory> shortcuts = new ArrayList(Arrays.asList(
APP_INFO, WellbeingModel.SHORTCUT_FACTORY, mHotseatPredictionController));
if (Flags.enablePinningAppWithContextMenu()) {
shortcuts.add(0, PIN_UNPIN_ITEM);
}
shortcuts.addAll(getSplitShortcuts());
shortcuts.add(WIDGETS);
shortcuts.add(INSTALL);