Commit 68aa60f6 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Don't apply rotation animation if the wallpaper isn't ready during

startup

Bug: b/168173947
Test: manually tested. See bug for repro step.
Change-Id: Ia90d8373a88ee2230444e069d93000d07aa9f5d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2501965Reviewed-by: default avatarMalay Keshav <malaykeshav@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821519}
parent 361bbfe1
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "ash/shelf/shelf.h" #include "ash/shelf/shelf.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/wallpaper/wallpaper_controller_impl.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chromeos/system/devicemode.h" #include "chromeos/system/devicemode.h"
...@@ -140,7 +141,9 @@ void DisplayConfigurationController::SetDisplayRotation( ...@@ -140,7 +141,9 @@ void DisplayConfigurationController::SetDisplayRotation(
display::Display::Rotation rotation, display::Display::Rotation rotation,
display::Display::RotationSource source, display::Display::RotationSource source,
DisplayConfigurationController::RotationAnimation mode) { DisplayConfigurationController::RotationAnimation mode) {
if (display_manager_->IsDisplayIdValid(display_id)) { // No need to apply animation if the wallpaper isn't set yet during startup.
if (display_manager_->IsDisplayIdValid(display_id) &&
Shell::Get()->wallpaper_controller()->is_wallpaper_set()) {
if (GetTargetRotation(display_id) == rotation) if (GetTargetRotation(display_id) == rotation)
return; return;
if (display_animator_) { if (display_animator_) {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ash/rotator/screen_rotation_animator.h" #include "ash/rotator/screen_rotation_animator.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/wallpaper/wallpaper_controller_impl.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/macros.h" #include "base/macros.h"
#include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_manager.h"
...@@ -28,6 +29,13 @@ class DisplayConfigurationControllerSmoothRotationTest : public AshTestBase { ...@@ -28,6 +29,13 @@ class DisplayConfigurationControllerSmoothRotationTest : public AshTestBase {
DisplayConfigurationControllerSmoothRotationTest() = default; DisplayConfigurationControllerSmoothRotationTest() = default;
~DisplayConfigurationControllerSmoothRotationTest() override = default; ~DisplayConfigurationControllerSmoothRotationTest() override = default;
void SetUp() override {
AshTestBase::SetUp();
// ScreenRotionAnimator skips animation if the wallpaper isn't ready.
Shell::Get()->wallpaper_controller()->set_bypass_decode_for_testing();
Shell::Get()->wallpaper_controller()->ShowDefaultWallpaperForTesting();
}
private: private:
DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationControllerSmoothRotationTest); DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationControllerSmoothRotationTest);
}; };
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "ash/system/status_area_widget_test_helper.h" #include "ash/system/status_area_widget_test_helper.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/test/ash_test_helper.h" #include "ash/test/ash_test_helper.h"
#include "ash/wallpaper/wallpaper_controller_impl.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/callback_forward.h" #include "base/callback_forward.h"
...@@ -173,6 +174,9 @@ class ScreenRotationAnimatorSlowAnimationTest : public AshTestBase { ...@@ -173,6 +174,9 @@ class ScreenRotationAnimatorSlowAnimationTest : public AshTestBase {
void ScreenRotationAnimatorSlowAnimationTest::SetUp() { void ScreenRotationAnimatorSlowAnimationTest::SetUp() {
AshTestBase::SetUp(); AshTestBase::SetUp();
// ScreenRotionAnimator skips animation if the wallpaper isn't ready.
Shell::Get()->wallpaper_controller()->set_bypass_decode_for_testing();
Shell::Get()->wallpaper_controller()->ShowDefaultWallpaperForTesting();
display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); display_ = display::Screen::GetScreen()->GetPrimaryDisplay();
animator_ = std::make_unique<ScreenRotationAnimator>( animator_ = std::make_unique<ScreenRotationAnimator>(
...@@ -235,6 +239,9 @@ void ScreenRotationAnimatorSmoothAnimationTest::QuitWaitForCopyCallback() { ...@@ -235,6 +239,9 @@ void ScreenRotationAnimatorSmoothAnimationTest::QuitWaitForCopyCallback() {
void ScreenRotationAnimatorSmoothAnimationTest::SetUp() { void ScreenRotationAnimatorSmoothAnimationTest::SetUp() {
AshTestBase::SetUp(); AshTestBase::SetUp();
// ScreenRotionAnimator skips animation if the wallpaper isn't ready.
Shell::Get()->wallpaper_controller()->set_bypass_decode_for_testing();
Shell::Get()->wallpaper_controller()->ShowDefaultWallpaperForTesting();
display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); display_ = display::Screen::GetScreen()->GetPrimaryDisplay();
run_loop_ = std::make_unique<base::RunLoop>(); run_loop_ = std::make_unique<base::RunLoop>();
......
...@@ -179,6 +179,9 @@ class ASH_EXPORT WallpaperControllerImpl ...@@ -179,6 +179,9 @@ class ASH_EXPORT WallpaperControllerImpl
// lock/login screen. See https://crbug.com/775591. // lock/login screen. See https://crbug.com/775591.
bool IsBlurAllowedForLockState() const; bool IsBlurAllowedForLockState() const;
// True if the wallpaper is set.
bool is_wallpaper_set() const { return !!current_wallpaper_.get(); }
// Sets wallpaper info for |account_id| and saves it to local state if the // Sets wallpaper info for |account_id| and saves it to local state if the
// user is not ephemeral. Returns false if it fails (which happens if local // user is not ephemeral. Returns false if it fails (which happens if local
// state is not available). // state is not available).
...@@ -322,6 +325,8 @@ class ASH_EXPORT WallpaperControllerImpl ...@@ -322,6 +325,8 @@ class ASH_EXPORT WallpaperControllerImpl
// Proxy to private ReloadWallpaper(). // Proxy to private ReloadWallpaper().
void ReloadWallpaperForTesting(bool clear_cache); void ReloadWallpaperForTesting(bool clear_cache);
void set_bypass_decode_for_testing() { bypass_decode_for_testing_ = true; }
private: private:
FRIEND_TEST_ALL_PREFIXES(WallpaperControllerTest, BasicReparenting); FRIEND_TEST_ALL_PREFIXES(WallpaperControllerTest, BasicReparenting);
FRIEND_TEST_ALL_PREFIXES(WallpaperControllerTest, FRIEND_TEST_ALL_PREFIXES(WallpaperControllerTest,
......
...@@ -523,7 +523,7 @@ class WallpaperControllerTest : public AshTestBase { ...@@ -523,7 +523,7 @@ class WallpaperControllerTest : public AshTestBase {
return controller_->decode_requests_for_testing_; return controller_->decode_requests_for_testing_;
} }
void SetBypassDecode() { controller_->bypass_decode_for_testing_ = true; } void SetBypassDecode() { controller_->set_bypass_decode_for_testing(); }
void ClearWallpaperCount() { controller_->wallpaper_count_for_testing_ = 0; } void ClearWallpaperCount() { controller_->wallpaper_count_for_testing_ = 0; }
......
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