shortcuts: Add flag to only display the new shortcuts app

 - When the "kOnlyShowNewShortcutsApp" is enabled, the old
   app will be hidden from the launcher and existing entry
   points for the old app will now launch the new shortcuts
   app.

Bug: b:216049298
Test: unit_tests
Change-Id: I6d92e84f465c79fed52c1143bac5adabf7716c50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4189501
Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org>
Commit-Queue: Michael Checo <michaelcheco@google.com>
Cr-Commit-Position: refs/heads/main@{#1096539}
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc
index f0e103e..a8ed86f 100644
--- a/ash/constants/ash_features.cc
+++ b/ash/constants/ash_features.cc
@@ -1515,6 +1515,10 @@
              "OobeRemoveShutdownButton",
              base::FEATURE_ENABLED_BY_DEFAULT);
 
+BASE_FEATURE(kOnlyShowNewShortcutsApp,
+             "OnlyShowNewShortcutsApp",
+             base::FEATURE_DISABLED_BY_DEFAULT);
+
 // Enables or disables the feedback tool new UX on ChromeOS.
 // This tool under development will be rolled out via Finch.
 // Enabling this flag will use the new feedback tool instead of the current
@@ -3249,6 +3253,10 @@
   return base::FeatureList::IsEnabled(kGuestOsFileTasksUseAppService);
 }
 
+bool ShouldOnlyShowNewShortcutApp() {
+  return base::FeatureList::IsEnabled(kOnlyShowNewShortcutsApp);
+}
+
 bool ShouldShowPlayStoreInDemoMode() {
   return base::FeatureList::IsEnabled(kShowPlayInDemoMode);
 }
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h
index 569a888..8be375a7 100644
--- a/ash/constants/ash_features.h
+++ b/ash/constants/ash_features.h
@@ -430,6 +430,7 @@
 COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kOnDeviceGrammarCheck);
 COMPONENT_EXPORT(ASH_CONSTANTS)
 BASE_DECLARE_FEATURE(kOnDeviceSpeechRecognition);
+COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kOnlyShowNewShortcutsApp);
 COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kOsFeedback);
 COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kOobeChoobe);
 COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kOobeConsolidatedConsent);
@@ -899,6 +900,7 @@
 bool ShouldArcFileTasksUseAppService();
 COMPONENT_EXPORT(ASH_CONSTANTS)
 bool ShouldGuestOsFileTasksUseAppService();
+COMPONENT_EXPORT(ASH_CONSTANTS) bool ShouldOnlyShowNewShortcutApp();
 // TODO(michaelpg): Remove after M71 branch to re-enable Play Store by default.
 COMPONENT_EXPORT(ASH_CONSTANTS) bool ShouldShowPlayStoreInDemoMode();
 COMPONENT_EXPORT(ASH_CONSTANTS) bool ShouldUseV1DeviceSync();
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 68b6385..4e93441 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -6692,6 +6692,11 @@
      flag_descriptions::kEnableViewPpdDescription, kOsCrOS,
      FEATURE_VALUE_TYPE(ash::features::kEnableViewPpd)},
 
+    {"enable-only-show-new-shortcut-app",
+     flag_descriptions::kOnlyShowNewShortcutsAppName,
+     flag_descriptions::kOnlyShowNewShortcutsAppDescription, kOsCrOS,
+     FEATURE_VALUE_TYPE(ash::features::kOnlyShowNewShortcutsApp)},
+
 #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
 
     {"enable-fenced-frames", flag_descriptions::kEnableFencedFramesName,
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 202727a7..7097a936 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -2781,6 +2781,11 @@
     "expiry_milestone": 114
   },
   {
+    "name": "enable-only-show-new-shortcut-app",
+    "owners": [ "jimmyxgong", "michaelcheco", "cros-peripherals@google.com" ],
+    "expiry_milestone": 120
+  },
+  {
     "name": "enable-oop-print-drivers",
     "owners": [ "awscreen", "thestig" ],
     "expiry_milestone": 112
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 4ed168a..b1520c0 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -2230,6 +2230,12 @@
     "Configures the maximum number of autocomplete matches displayed in the "
     "Omnibox UI dynamically based on the number of URL matches.";
 
+const char kOnlyShowNewShortcutsAppName[] =
+    "Only show the new Shortcut Viewer app";
+const char kOnlyShowNewShortcutsAppDescription[] =
+    "If enabled, the existing Shortcut Viewer app will be hidden and only the "
+    "new Shortcut Customization app will be discoverable.";
+
 const char kOptimizationGuideDebugLogsName[] =
     "Enable optimization guide debug logs";
 const char kOptimizationGuideDebugLogsDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 36bbac0..62275a8 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -1254,6 +1254,9 @@
 extern const char kOmniboxDynamicMaxAutocompleteName[];
 extern const char kOmniboxDynamicMaxAutocompleteDescription[];
 
+extern const char kOnlyShowNewShortcutsAppName[];
+extern const char kOnlyShowNewShortcutsAppDescription[];
+
 extern const char kOptimizationGuideDebugLogsName[];
 extern const char kOptimizationGuideDebugLogsDescription[];
 
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 937b293..eb7588d 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -59381,6 +59381,7 @@
   <int value="-1032884201" label="HeavyAdPrivacyMitigations:enabled"/>
   <int value="-1032265414" label="AutocompleteExtendedSuggestions:disabled"/>
   <int value="-1031350684" label="PdfIsolation:disabled"/>
+  <int value="-1030683709" label="OnlyShowNewShortcutsApp:disabled"/>
   <int value="-1030530357" label="PwaInstallUseBottomSheet:disabled"/>
   <int value="-1030513821" label="DetectedSourceLanguageOption:disabled"/>
   <int value="-1029920490" label="IdleTimeSpellChecking:enabled"/>
@@ -64267,6 +64268,7 @@
   <int value="1809940714" label="SpeculativeLaunchServiceWorker:disabled"/>
   <int value="1810258949" label="DisplayLocking:enabled"/>
   <int value="1810311887" label="WebAssemblyThreads:enabled"/>
+  <int value="1810693550" label="OnlyShowNewShortcutsApp:enabled"/>
   <int value="1811266774" label="WebUITabStripNewTabButtonInTabStrip:disabled"/>
   <int value="1811744551" label="InterestFeedV2Hearts:enabled"/>
   <int value="1812368073" label="enable-new-app-list-mixer"/>