Prevent Save App Pair from showing up on 3p launcher

This CL adds a check so that app pairs can't be saved on 3p launchers. This affects the Overview icon dropdown menu and the Overview Actions Bar.

Fixes: 326155701
Flag: ACONFIG com.android.wm.shell.enable_app_pairs TRUNKFOOD
Test: Manual, option does not show up when Nova Launcher is set as default home app, and shows up again for Pixel Launcher.
Change-Id: I60d6fd3b3eb39921edafb12faace743d16de270f
This commit is contained in:
Jeremy Sim
2024-03-06 17:59:30 -08:00
parent 60101ae7fc
commit 2b2d8cc90b
4 changed files with 27 additions and 2 deletions
@@ -328,11 +328,15 @@ public interface TaskShortcutFactory {
// No "save app pair" menu item if:
// - app pairs feature is not enabled
// - we are in 3p launcher
// - 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()
|| hasUnpinnableApp || shouldShowActionsButtonInstead) {
if (!FeatureFlags.enableAppPairs()
|| !recentsView.supportsAppPairs()
|| !taskView.containsMultipleTasks()
|| hasUnpinnableApp
|| shouldShowActionsButtonInstead) {
return null;
}
@@ -302,4 +302,10 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
protected boolean canLaunchFullscreenTask() {
return !mActivity.isInState(OVERVIEW_SPLIT_SELECT);
}
/** Returns if app pairs are supported in this launcher. */
@Override
public boolean supportsAppPairs() {
return false;
}
}
@@ -106,6 +106,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
public @interface AppPairButtonHiddenFlags { }
public static final int FLAG_SINGLE_TASK_HIDE_APP_PAIR = 1 << 0;
public static final int FLAG_SMALL_SCREEN_HIDE_APP_PAIR = 1 << 1;
public static final int FLAG_3P_LAUNCHER_HIDE_APP_PAIR = 1 << 2;
private MultiValueAlpha mMultiValueAlpha;
@@ -254,6 +255,13 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
updateAppPairButtonHiddenFlags(FLAG_SMALL_SCREEN_HIDE_APP_PAIR, isSmallScreen);
}
/**
* Updates flags to hide and show actions buttons for 1p/3p launchers.
*/
public void updateFor3pLauncher(boolean is3pLauncher) {
updateAppPairButtonHiddenFlags(FLAG_3P_LAUNCHER_HIDE_APP_PAIR, is3pLauncher);
}
/**
* Updates the proper flags to indicate whether the "Screenshot" button should be hidden.
*
@@ -4022,6 +4022,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mActionsView.updateForGroupedTask(isCurrentSplit);
// Update flags to see if actions bar should show buttons for tablets or phones.
mActionsView.updateForSmallScreen(!mActivity.getDeviceProfile().isTablet);
// Update flags for 1p/3p launchers
mActionsView.updateFor3pLauncher(!supportsAppPairs());
if (isDesktopModeSupported()) {
boolean isCurrentDesktop = getCurrentPageTaskView() instanceof DesktopTaskView;
@@ -4029,6 +4031,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
}
}
/** Returns if app pairs are supported in this launcher. Overridden in subclasses. */
public boolean supportsAppPairs() {
return true;
}
/**
* Returns all the tasks in the top row, without the focused task
*/