Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7b86b22 authored by Himanshu Gupta's avatar Himanshu Gupta
Browse files

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
parent d87f02f6
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import com.android.launcher3.R;
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.AppTransitionAnimationSpecsFutur
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 @@ public interface TaskShortcutFactory {
                    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;
            }

+7 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static com.android.launcher3.LauncherState.BACKGROUND_APP;
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.R;
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 @@ public class TaskView extends FrameLayout implements Reusable {
        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;
    }