Merge "pin-shortcut: Add pin shortcut to the context menu" into main

This commit is contained in:
Wen-chien Wang
2024-12-13 17:00:42 -08:00
committed by Android (Google) Code Review
4 changed files with 36 additions and 0 deletions

View File

@@ -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());

View File

@@ -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);