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) { ...@@ -708,9 +708,15 @@ ArcSupervisionTransition GetSupervisionTransition(const Profile* profile) {
} }
bool IsPlayStoreAvailable() { bool IsPlayStoreAvailable() {
return (!IsRobotOrOfflineDemoAccountMode() || if (ShouldArcAlwaysStartWithNoPlayStore())
chromeos::DemoSession::IsDeviceInDemoMode()) && return false;
!ShouldArcAlwaysStartWithNoPlayStore();
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 } // namespace arc
...@@ -856,6 +856,18 @@ TEST_F(ChromeArcUtilTest, ArcStartModeDefaultPublicSession) { ...@@ -856,6 +856,18 @@ TEST_F(ChromeArcUtilTest, ArcStartModeDefaultPublicSession) {
TEST_F(ChromeArcUtilTest, ArcStartModeDefaultDemoMode) { TEST_F(ChromeArcUtilTest, ArcStartModeDefaultDemoMode) {
auto* command_line = base::CommandLine::ForCurrentProcess(); auto* command_line = base::CommandLine::ForCurrentProcess();
command_line->InitFromArgv({"", "--arc-availability=installed"}); 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::SetDemoConfigForTesting(
chromeos::DemoSession::DemoModeConfig::kOnline); chromeos::DemoSession::DemoModeConfig::kOnline);
ScopedLogIn login(GetFakeUserManager(), ScopedLogIn login(GetFakeUserManager(),
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "chrome/browser/ui/app_list/arc/arc_package_syncable_service.h" #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/browser/ui/app_list/arc/arc_pai_starter.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chromeos/chromeos_switches.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
#include "components/arc/arc_service_manager.h" #include "components/arc/arc_service_manager.h"
#include "components/arc/arc_util.h" #include "components/arc/arc_util.h"
...@@ -1030,7 +1031,8 @@ void ArcAppListPrefs::AddAppAndShortcut(const std::string& name, ...@@ -1030,7 +1031,8 @@ void ArcAppListPrefs::AddAppAndShortcut(const std::string& name,
// TODO(khmel): Use show_in_launcher flag to hide the Play Store app. // TODO(khmel): Use show_in_launcher flag to hide the Play Store app.
if (app_id == arc::kPlayStoreAppId && if (app_id == arc::kPlayStoreAppId &&
arc::IsRobotOrOfflineDemoAccountMode() && arc::IsRobotOrOfflineDemoAccountMode() &&
!chromeos::DemoSession::IsDeviceInDemoMode()) { !(chromeos::DemoSession::IsDeviceInDemoMode() &&
chromeos::switches::ShouldShowPlayStoreInDemoMode())) {
return; return;
} }
......
...@@ -549,6 +549,9 @@ const char kFilesAppDisableMyFilesNavigation[] = "disable-my-files-navigation"; ...@@ -549,6 +549,9 @@ const char kFilesAppDisableMyFilesNavigation[] = "disable-my-files-navigation";
// This makes it easier to test layout logic. // This makes it easier to test layout logic.
const char kShowLoginDevOverlay[] = "show-login-dev-overlay"; 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 // Indicates that a stub implementation of CrosSettings that stores settings in
// memory without signing should be used, treating current user as the owner. // memory without signing should be used, treating current user as the owner.
// This also modifies OwnerSettingsServiceChromeOS::HandlesSetting such that no // This also modifies OwnerSettingsServiceChromeOS::HandlesSetting such that no
...@@ -713,5 +716,9 @@ bool IsInstantTetheringBackgroundAdvertisingSupported() { ...@@ -713,5 +716,9 @@ bool IsInstantTetheringBackgroundAdvertisingSupported() {
kInstantTetheringBackgroundAdvertisementSupport); kInstantTetheringBackgroundAdvertisementSupport);
} }
bool ShouldShowPlayStoreInDemoMode() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(kShowPlayInDemoMode);
}
} // namespace switches } // namespace switches
} // namespace chromeos } // namespace chromeos
...@@ -153,6 +153,7 @@ CHROMEOS_EXPORT extern const char kShelfHoverPreviews[]; ...@@ -153,6 +153,7 @@ CHROMEOS_EXPORT extern const char kShelfHoverPreviews[];
CHROMEOS_EXPORT extern const char kShowAndroidFilesInFilesApp[]; CHROMEOS_EXPORT extern const char kShowAndroidFilesInFilesApp[];
CHROMEOS_EXPORT extern const char kFilesAppDisableMyFilesNavigation[]; CHROMEOS_EXPORT extern const char kFilesAppDisableMyFilesNavigation[];
CHROMEOS_EXPORT extern const char kShowLoginDevOverlay[]; CHROMEOS_EXPORT extern const char kShowLoginDevOverlay[];
CHROMEOS_EXPORT extern const char kShowPlayInDemoMode[];
CHROMEOS_EXPORT extern const char kStubCrosSettings[]; CHROMEOS_EXPORT extern const char kStubCrosSettings[];
CHROMEOS_EXPORT extern const char kTestEncryptionMigrationUI[]; CHROMEOS_EXPORT extern const char kTestEncryptionMigrationUI[];
CHROMEOS_EXPORT extern const char kTetherStub[]; CHROMEOS_EXPORT extern const char kTetherStub[];
...@@ -223,6 +224,10 @@ CHROMEOS_EXPORT bool ShouldShowShelfHoverPreviews(); ...@@ -223,6 +224,10 @@ CHROMEOS_EXPORT bool ShouldShowShelfHoverPreviews();
// background advertisement model // background advertisement model
CHROMEOS_EXPORT bool IsInstantTetheringBackgroundAdvertisingSupported(); 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 switches
} // namespace chromeos } // 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