From c22b39a31904f42c40677d2fd0ae2cf2b5516351 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Wed, 6 Mar 2024 17:59:30 -0800 Subject: [PATCH] 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 (cherry picked from commit 2b2d8cc90b5989a8dca58a364579fd7157cce587) Merged-In: I60d6fd3b3eb39921edafb12faace743d16de270f --- .../src/com/android/quickstep/TaskShortcutFactory.java | 5 ++++- .../android/quickstep/fallback/FallbackRecentsView.java | 6 ++++++ .../com/android/quickstep/views/OverviewActionsView.java | 8 ++++++++ .../src/com/android/quickstep/views/RecentsView.java | 7 +++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java index c1b3a16c57..54bbd73e1a 100644 --- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java @@ -322,9 +322,12 @@ 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 // - the Overview Actions Button should be visible - if (!FeatureFlags.enableAppPairs() || !taskView.containsMultipleTasks() + if (!FeatureFlags.enableAppPairs() + || !recentsView.supportsAppPairs() + || !taskView.containsMultipleTasks() || shouldShowActionsButtonInstead) { return null; } diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index 0ee50a46b2..32d8be988c 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -302,4 +302,10 @@ public class FallbackRecentsView extends RecentsView 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 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. * diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 6699147136..1a0dc3dfd6 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -4022,6 +4022,8 @@ public abstract class RecentsView