wallpaper: demo mode use CBX logic
When demo mode user logs in, call SetTimeOfDayWallpaper if the device is compatible with Time of Day Wallpaper. New behavior is behind flag: DemoModeWallpaperUpdate. Bug: 301304136 Test: ash_unittests --gtest_filter=*WallpaperController*DemoMode* Change-Id: I53d21f40250f2a9d7d54f26ff55c5b95f5a52bbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6368799 Reviewed-by: Jason Thai <jasontt@chromium.org> Reviewed-by: Xiaoqian Dai <xdai@chromium.org> Commit-Queue: Jeffrey Young <cowmoo@google.com> Cr-Commit-Position: refs/heads/main@{#1434504}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
71c7c6e35f
commit
f861980211
@ -4677,6 +4677,7 @@ test("ash_unittests") {
|
||||
"//chromeos/ash/components/dbus/shill",
|
||||
"//chromeos/ash/components/dbus/userdataauth",
|
||||
"//chromeos/ash/components/dbus/userdataauth:userdataauth_proto",
|
||||
"//chromeos/ash/components/demo_mode",
|
||||
"//chromeos/ash/components/editor_menu/public/cpp",
|
||||
"//chromeos/ash/components/emoji",
|
||||
"//chromeos/ash/components/emoji:resources_grit",
|
||||
@ -4686,6 +4687,7 @@ test("ash_unittests") {
|
||||
"//chromeos/ash/components/geolocation",
|
||||
"//chromeos/ash/components/growth:test_support",
|
||||
"//chromeos/ash/components/human_presence:human_presence",
|
||||
"//chromeos/ash/components/install_attributes:test_support",
|
||||
"//chromeos/ash/components/login/auth",
|
||||
"//chromeos/ash/components/login/auth:test_support",
|
||||
"//chromeos/ash/components/login/login_state",
|
||||
|
1
ash/DEPS
1
ash/DEPS
@ -93,6 +93,7 @@ include_rules = [
|
||||
"+chromeos/ash/components/feature_usage",
|
||||
"+chromeos/ash/components/geolocation",
|
||||
"+chromeos/ash/components/human_presence",
|
||||
"+chromeos/ash/components/install_attributes",
|
||||
"+chromeos/ash/components/local_search_service",
|
||||
"+chromeos/ash/components/login/auth",
|
||||
"+chromeos/ash/components/mojo_service_manager",
|
||||
|
@ -538,6 +538,11 @@ BASE_FEATURE(kDemoModeSignIn,
|
||||
"DemoModeSignIn",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Controls whether demo mode applies CBX wallpaper logic.
|
||||
BASE_FEATURE(kDemoModeWallpaperUpdate,
|
||||
"DemoModeWallpaperUpdate",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Toggle different display features based on user setting and power state
|
||||
BASE_FEATURE(kDisplayPerformanceMode,
|
||||
"DisplayPerformanceMode",
|
||||
@ -3458,6 +3463,10 @@ bool IsDemoModeSignInEnabled() {
|
||||
return base::FeatureList::IsEnabled(kDemoModeSignIn);
|
||||
}
|
||||
|
||||
bool IsDemoModeWallpaperUpdateEnabled() {
|
||||
return base::FeatureList::IsEnabled(kDemoModeWallpaperUpdate);
|
||||
}
|
||||
|
||||
bool IsDeskTemplateSyncEnabled() {
|
||||
return base::FeatureList::IsEnabled(kDeskTemplateSync);
|
||||
}
|
||||
|
@ -166,6 +166,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS)
|
||||
BASE_DECLARE_FEATURE(kDeferConciergeStartup);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS)
|
||||
BASE_DECLARE_FEATURE(kDemoModeSignIn);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS)
|
||||
BASE_DECLARE_FEATURE(kDemoModeWallpaperUpdate);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kDeskTemplateSync);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS)
|
||||
BASE_DECLARE_FEATURE(kDeviceActiveClient28DayActiveCheckMembership);
|
||||
@ -1075,6 +1077,7 @@ bool IsCryptauthAttestationSyncingEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDeepLinkingEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDemoModeAppLandscapeLockedEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDemoModeSignInEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDemoModeWallpaperUpdateEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDeskTemplateSyncEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDisplayPerformanceModeEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsInputDeviceSettingsSplitEnabled();
|
||||
|
@ -71,10 +71,12 @@
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/types/cxx23_to_underlying.h"
|
||||
#include "chromeos/ash/components/demo_mode/utils/demo_session_utils.h"
|
||||
#include "chromeos/ash/components/system/statistics_provider.h"
|
||||
#include "chromeos/constants/chromeos_features.h"
|
||||
#include "components/account_id/account_id.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/session_manager/session_manager_types.h"
|
||||
#include "services/data_decoder/public/cpp/data_decoder.h"
|
||||
#include "services/data_decoder/public/mojom/image_decoder.mojom-shared.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
@ -1679,10 +1681,13 @@ void WallpaperControllerImpl::OnActiveUserPrefServiceChanged(
|
||||
AccountId account_id = GetActiveAccountId();
|
||||
|
||||
WallpaperInfo local_info;
|
||||
bool has_local_info =
|
||||
const bool has_local_info =
|
||||
pref_manager_->GetLocalWallpaperInfo(account_id, &local_info);
|
||||
const bool is_oobe_or_demo =
|
||||
IsOobeState() || (demo_mode::IsDeviceInDemoMode() &&
|
||||
features::IsDemoModeWallpaperUpdateEnabled());
|
||||
bool should_set_time_of_day_wallpaper =
|
||||
IsOobeState() && has_local_info &&
|
||||
is_oobe_or_demo && has_local_info &&
|
||||
local_info.type == WallpaperType::kDefault &&
|
||||
features::IsTimeOfDayWallpaperEnabled();
|
||||
if (should_set_time_of_day_wallpaper) {
|
||||
|
@ -85,7 +85,9 @@
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/time/time_override.h"
|
||||
#include "chromeos/ash/components/demo_mode/utils/demo_session_utils.h"
|
||||
#include "chromeos/ash/components/geolocation/simple_geolocation_provider.h"
|
||||
#include "chromeos/ash/components/install_attributes/stub_install_attributes.h"
|
||||
#include "chromeos/ash/components/system/fake_statistics_provider.h"
|
||||
#include "chromeos/ash/components/system/statistics_provider.h"
|
||||
#include "chromeos/constants/chromeos_features.h"
|
||||
@ -553,6 +555,7 @@ void InitTimeOfDayFeatureList(
|
||||
enabled_features.push_back(features::kSeaPen);
|
||||
enabled_features.push_back(features::kFeatureManagementSeaPen);
|
||||
enabled_features.push_back(features::kSeaPenDemoMode);
|
||||
enabled_features.push_back(features::kDemoModeWallpaperUpdate);
|
||||
scoped_feature_list.InitWithFeatures(enabled_features, disabled_features);
|
||||
}
|
||||
|
||||
@ -956,6 +959,8 @@ class WallpaperControllerTestBase : public NoSessionAshTestBase {
|
||||
const AccountId kChildAccountId =
|
||||
AccountId::FromUserEmailGaiaId(kChildEmail, GaiaId("child_gaia_id"));
|
||||
|
||||
ScopedStubInstallAttributes scoped_stub_install_attributes_;
|
||||
|
||||
private:
|
||||
InProcessDataDecoder decoder_;
|
||||
base::Time mock_clock_origin_;
|
||||
@ -1774,7 +1779,7 @@ TEST_P(WallpaperControllerTest,
|
||||
client_.AddCollection(wallpaper_constants::kTimeOfDayWallpaperCollectionId,
|
||||
images);
|
||||
WallpaperInfo local_info = InfoWithType(WallpaperType::kDefault);
|
||||
pref_manager_->SetLocalWallpaperInfo(kAccountId1, local_info);
|
||||
ASSERT_TRUE(pref_manager_->SetLocalWallpaperInfo(kAccountId1, local_info));
|
||||
SetSessionState(SessionState::OOBE);
|
||||
// Log in and trigger `OnActiveUserPrefServiceChange`.
|
||||
SimulateUserLogin(kAccountId1);
|
||||
@ -1790,6 +1795,34 @@ TEST_P(WallpaperControllerTest,
|
||||
"Ash.Wallpaper.SetTimeOfDayAfterOobe.Default", true, 1);
|
||||
}
|
||||
|
||||
TEST_P(WallpaperControllerTest,
|
||||
ActiveUserPrefServiceChanged_DemoMode_SetTimeOfDayWallpaper) {
|
||||
if (!IsTimeOfDayEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
scoped_stub_install_attributes_.Get()->SetDemoMode();
|
||||
ASSERT_TRUE(demo_mode::IsDeviceInDemoMode());
|
||||
|
||||
auto images = TimeOfDayImageSet();
|
||||
client_.AddCollection(wallpaper_constants::kTimeOfDayWallpaperCollectionId,
|
||||
images);
|
||||
WallpaperInfo local_info = InfoWithType(WallpaperType::kDefault);
|
||||
ASSERT_TRUE(pref_manager_->SetLocalWallpaperInfo(kAccountId1, local_info));
|
||||
// Demo mode skips OOBE state.
|
||||
SetSessionState(SessionState::LOGIN_PRIMARY);
|
||||
SimulateUserLogin(kAccountId1);
|
||||
RunAllTasksUntilIdle();
|
||||
|
||||
WallpaperInfo actual_info;
|
||||
EXPECT_TRUE(pref_manager_->GetUserWallpaperInfo(kAccountId1, &actual_info));
|
||||
EXPECT_EQ(WallpaperType::kOnline, actual_info.type);
|
||||
EXPECT_EQ(wallpaper_constants::kTimeOfDayWallpaperCollectionId,
|
||||
actual_info.collection_id);
|
||||
EXPECT_EQ(wallpaper_constants::kDefaultTimeOfDayWallpaperUnitId,
|
||||
actual_info.unit_id.value_or(0));
|
||||
}
|
||||
|
||||
TEST_P(WallpaperControllerTest,
|
||||
ActiveUserPrefServiceChanged_SetTimeOfDayWallpaperAlternateUnitId) {
|
||||
if (!IsTimeOfDayEnabled()) {
|
||||
|
Reference in New Issue
Block a user