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
@@ -17,6 +17,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.popup.SystemShortcut.PIN_UNPIN_ITEM;
import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition;
import android.content.Intent;
@@ -195,6 +196,9 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
// append split options to APP_INFO shortcut if not in Desktop Windowing mode, the order
// here will reflect in the popup
ArrayList<SystemShortcut.Factory> shortcuts = new ArrayList<>();
if (Flags.enablePinningAppWithContextMenu()) {
shortcuts.add(PIN_UNPIN_ITEM);
}
shortcuts.add(APP_INFO);
if (!mControllers.taskbarDesktopModeController.getAreDesktopTasksVisible()) {
shortcuts.addAll(mControllers.uiController.getSplitMenuOptions().toList());