Commit 1c50cf81 authored by Dominick Ng's avatar Dominick Ng Committed by Chromium LUCI CQ

Allow ARC apps which are hidden in the launcher to be pinned to the shelf.

Apps that are hidden in the launcher, but still able to be launched
should be able to be shown in the shelf. One example of this is the
four Android apps explicitly hidden from the launcher: Android
Settings, Android Files, Android Contacts, and Android Clock. If the
user manages to launch one of these (e.g. through Chrome OS
settings or via Play Store), they should be pinnable on the Shelf.
Currently, this doesn't work as the ARC publisher prevents apps which
are hidden from the launcher from being shown in the shelf. Practically,
this manifests as an inability to persist the pin state for these four
apps. That is, the apps can be pinned, but logging out and logging back
in loses the pin state.

This CL addresses the bug by always allowing ARC apps to be shown in the
shelf, independent of whether they are present in the launcher. This
should only affect the four apps listed as they were the only four
Android apps where the show_in_shelf value was false. A test is added to
verify the behaviour - the test fails before this CL.

BUG=1124865

Change-Id: Ie4ac89a929396e7ee4a40efd9386d4af00b532db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2623610
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarNancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842865}
parent 21296da9
......@@ -1436,8 +1436,11 @@ apps::mojom::AppPtr ArcApps::Convert(ArcAppListPrefs* prefs,
auto show = ShouldShow(app_info) ? apps::mojom::OptionalBool::kTrue
: apps::mojom::OptionalBool::kFalse;
// All published ARC apps are launchable. All launchable apps should be
// permitted to be shown on the shelf, and have their pins on the shelf
// persisted.
app->show_in_shelf = apps::mojom::OptionalBool::kTrue;
app->show_in_launcher = show;
app->show_in_shelf = show;
app->show_in_search = show;
app->show_in_management = show;
......
......@@ -169,6 +169,17 @@ constexpr char kCrxAppPrefix[] = "_crx_";
// pin model with default apps that can affect some tests.
constexpr char kDummyAppId[] = "dummyappid_dummyappid_dummyappid";
std::vector<arc::mojom::AppInfoPtr> GetArcSettingsAppInfo() {
std::vector<arc::mojom::AppInfoPtr> apps;
arc::mojom::AppInfoPtr app(arc::mojom::AppInfo::New());
app->name = "settings";
app->package_name = "com.android.settings";
app->activity = "com.android.settings.Settings";
app->sticky = true;
apps.push_back(std::move(app));
return apps;
}
// Test implementation of AppIconLoader.
class TestAppIconLoaderImpl : public AppIconLoader {
public:
......@@ -827,6 +838,8 @@ class ChromeLauncherControllerTest : public BrowserWithTestWindowTest {
result += "Play Store";
} else if (app == crostini::kCrostiniTerminalSystemAppId) {
result += "Terminal";
} else if (app == arc::kSettingsAppId) {
result += "Android Settings";
} else {
bool arc_app_found = false;
for (const auto& arc_app : arc_test_.fake_apps()) {
......@@ -1525,6 +1538,24 @@ TEST_F(ChromeLauncherControllerExtendedShelfTest, NoUpgradeFromNonDefault) {
EXPECT_EQ("Chrome, Files, Gmail, Doc, Play Store", GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerWithArcTest,
ArcAppsHiddenFromLaunchCanBePinned) {
InitLauncherController();
// Register Android Settings.
arc::mojom::AppHost* app_host = arc_test_.arc_app_list_prefs();
app_host->OnAppListRefreshed(GetArcSettingsAppInfo());
app_service_test().WaitForAppService();
// Pin Android settings.
launcher_controller_->PinAppWithID(arc::kSettingsAppId);
EXPECT_EQ("Chrome, Android Settings", GetPinnedAppStatus());
// The pin should remain after syncing prefs. Play Store should now appear.
StartPrefSyncService(syncer::SyncDataList());
EXPECT_EQ("Chrome, Play Store, Android Settings", GetPinnedAppStatus());
}
TEST_F(ChromeLauncherControllerWithArcTest, ArcAppPinCrossPlatformWorkflow) {
// Work on ARC disabled platform first.
const std::string arc_app_id1 =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment