Disable Saving App Pairs for Private Space Apps
This change disables saving App Pair from recents
into launcher workspace when any of the app in pair
belongs to Private Space.
Private Space are still allowed in Split Mode
Bug: 322892793
Test: Manual on device
Flag: ACONFIG com.android.launcher3.private_space_restrict_accessibility_drag TRUNKFOOD
Change-Id: I204b721ce3a2bf4ebfd7419c25d72a77fd8174ac
diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
index c1b3a16..36bdad4 100644
--- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
@@ -45,6 +45,7 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import com.android.launcher3.model.WellbeingModel;
+import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.popup.SystemShortcut.AppInfo;
import com.android.launcher3.util.InstantAppResolver;
@@ -61,6 +62,7 @@
import com.android.systemui.shared.recents.view.RecentsTransition;
import com.android.systemui.shared.system.ActivityManagerWrapper;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
@@ -319,13 +321,18 @@
recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView));
boolean shouldShowActionsButtonInstead =
isLargeTileFocusedTask && isInExpectedScrollPosition;
+ boolean hasUnpinnableApp = Arrays.stream(taskView.getTaskIdAttributeContainers())
+ .anyMatch(att -> att != null && att.getItemInfo() != null
+ && ((att.getItemInfo().runtimeStatusFlags
+ & ItemInfoWithIcon.FLAG_NOT_PINNABLE) != 0));
// No "save app pair" menu item if:
// - app pairs feature is not enabled
// - the task in question is a single task
+ // - at least one app in app pair is unpinnable
// - the Overview Actions Button should be visible
if (!FeatureFlags.enableAppPairs() || !taskView.containsMultipleTasks()
- || shouldShowActionsButtonInstead) {
+ || hasUnpinnableApp || shouldShowActionsButtonInstead) {
return null;
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 085c502..9b48082 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -29,6 +29,7 @@
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP;
+import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_NOT_PINNABLE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
@@ -83,6 +84,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.launcher3.pm.UserCache;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.testing.TestLogging;
@@ -501,6 +503,11 @@
if (getRecentsView() != null) {
stubInfo.screenId = getRecentsView().indexOfChild(this);
}
+ if (Flags.privateSpaceRestrictAccessibilityDrag()) {
+ if (UserCache.getInstance(getContext()).getUserInfo(componentKey.user).isPrivate()) {
+ stubInfo.runtimeStatusFlags |= FLAG_NOT_PINNABLE;
+ }
+ }
return stubInfo;
}