Commit 25063a81 authored by Michael Giuffrida's avatar Michael Giuffrida Committed by Commit Bot

Hide Play Store in Demo Mode behind a flag

Hides Play Store in Demo Mode by default, because it doesn't show the
right view yet.

To test Play Store in Demo Mode after this CL, use the flag:
  --show-play-in-demo-mode

Bug: 885370
Change-Id: I7119a208742caf3fd2884ac73176a9bbc19a2bde
Reviewed-on: https://chromium-review.googlesource.com/c/1277841Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600120}
parent 27871aa8
......@@ -708,9 +708,15 @@ ArcSupervisionTransition GetSupervisionTransition(const Profile* profile) {
}
bool IsPlayStoreAvailable() {
return (!IsRobotOrOfflineDemoAccountMode() ||
chromeos::DemoSession::IsDeviceInDemoMode()) &&
!ShouldArcAlwaysStartWithNoPlayStore();
if (ShouldArcAlwaysStartWithNoPlayStore())
return false;
if (!IsRobotOrOfflineDemoAccountMode())
return true;
// Demo Mode is the only public session scenario that can launch Play.
return chromeos::DemoSession::IsDeviceInDemoMode() &&
chromeos::switches::ShouldShowPlayStoreInDemoMode();
}
} // namespace arc
......@@ -856,6 +856,18 @@ TEST_F(ChromeArcUtilTest, ArcStartModeDefaultPublicSession) {
TEST_F(ChromeArcUtilTest, ArcStartModeDefaultDemoMode) {
auto* command_line = base::CommandLine::ForCurrentProcess();
command_line->InitFromArgv({"", "--arc-availability=installed"});
chromeos::DemoSession::SetDemoConfigForTesting(
chromeos::DemoSession::DemoModeConfig::kOnline);
ScopedLogIn login(GetFakeUserManager(),
AccountId::FromUserEmail("public_user@gmail.com"),
user_manager::USER_TYPE_PUBLIC_ACCOUNT);
EXPECT_FALSE(IsPlayStoreAvailable());
}
TEST_F(ChromeArcUtilTest, ArcStartModeDefaultDemoModeWithPlayStore) {
auto* command_line = base::CommandLine::ForCurrentProcess();
command_line->InitFromArgv(
{"", "--arc-availability=installed", "--show-play-in-demo-mode"});
chromeos::DemoSession::SetDemoConfigForTesting(
chromeos::DemoSession::DemoModeConfig::kOnline);
ScopedLogIn login(GetFakeUserManager(),
......
......@@ -29,6 +29,7 @@
#include "chrome/browser/ui/app_list/arc/arc_package_syncable_service.h"
#include "chrome/browser/ui/app_list/arc/arc_pai_starter.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/chromeos_switches.h"
#include "components/arc/arc_prefs.h"
#include "components/arc/arc_service_manager.h"
#include "components/arc/arc_util.h"
......@@ -1030,7 +1031,8 @@ void ArcAppListPrefs::AddAppAndShortcut(const std::string& name,
// TODO(khmel): Use show_in_launcher flag to hide the Play Store app.
if (app_id == arc::kPlayStoreAppId &&
arc::IsRobotOrOfflineDemoAccountMode() &&
!chromeos::DemoSession::IsDeviceInDemoMode()) {
!(chromeos::DemoSession::IsDeviceInDemoMode() &&
chromeos::switches::ShouldShowPlayStoreInDemoMode())) {
return;
}
......
......@@ -549,6 +549,9 @@ const char kFilesAppDisableMyFilesNavigation[] = "disable-my-files-navigation";
// This makes it easier to test layout logic.
const char kShowLoginDevOverlay[] = "show-login-dev-overlay";
// Show Play Store in Demo Mode.
const char kShowPlayInDemoMode[] = "show-play-in-demo-mode";
// Indicates that a stub implementation of CrosSettings that stores settings in
// memory without signing should be used, treating current user as the owner.
// This also modifies OwnerSettingsServiceChromeOS::HandlesSetting such that no
......@@ -713,5 +716,9 @@ bool IsInstantTetheringBackgroundAdvertisingSupported() {
kInstantTetheringBackgroundAdvertisementSupport);
}
bool ShouldShowPlayStoreInDemoMode() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(kShowPlayInDemoMode);
}
} // namespace switches
} // namespace chromeos
......@@ -153,6 +153,7 @@ CHROMEOS_EXPORT extern const char kShelfHoverPreviews[];
CHROMEOS_EXPORT extern const char kShowAndroidFilesInFilesApp[];
CHROMEOS_EXPORT extern const char kFilesAppDisableMyFilesNavigation[];
CHROMEOS_EXPORT extern const char kShowLoginDevOverlay[];
CHROMEOS_EXPORT extern const char kShowPlayInDemoMode[];
CHROMEOS_EXPORT extern const char kStubCrosSettings[];
CHROMEOS_EXPORT extern const char kTestEncryptionMigrationUI[];
CHROMEOS_EXPORT extern const char kTetherStub[];
......@@ -223,6 +224,10 @@ CHROMEOS_EXPORT bool ShouldShowShelfHoverPreviews();
// background advertisement model
CHROMEOS_EXPORT bool IsInstantTetheringBackgroundAdvertisingSupported();
// Returns true if Play Store should be available in Demo Mode.
// TODO(michaelpg): Remove after M71 branch to re-enable Play Store by default.
CHROMEOS_EXPORT bool ShouldShowPlayStoreInDemoMode();
} // namespace switches
} // namespace chromeos
......
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