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/+/2501965 Reviewed-by: Malay Keshav <malaykeshav@chromium.org> Commit-Queue: Mitsuru Oshima <oshima@chromium.org> Cr-Commit-Position: refs/heads/master@{#821519}
This commit is contained in:

committed by
Commit Bot

parent
361bbfe18f
commit
68aa60f67d
@ -13,6 +13,7 @@
|
||||
#include "ash/shelf/shelf.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/wallpaper/wallpaper_controller_impl.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/time/time.h"
|
||||
#include "chromeos/system/devicemode.h"
|
||||
@ -140,7 +141,9 @@ void DisplayConfigurationController::SetDisplayRotation(
|
||||
display::Display::Rotation rotation,
|
||||
display::Display::RotationSource source,
|
||||
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)
|
||||
return;
|
||||
if (display_animator_) {
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "ash/rotator/screen_rotation_animator.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "ash/wallpaper/wallpaper_controller_impl.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/macros.h"
|
||||
#include "ui/display/manager/display_manager.h"
|
||||
@ -28,6 +29,13 @@ class DisplayConfigurationControllerSmoothRotationTest : public AshTestBase {
|
||||
DisplayConfigurationControllerSmoothRotationTest() = 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:
|
||||
DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationControllerSmoothRotationTest);
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ash/system/status_area_widget_test_helper.h"
|
||||
#include "ash/test/ash_test_base.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 "base/bind.h"
|
||||
#include "base/callback_forward.h"
|
||||
@ -173,6 +174,9 @@ class ScreenRotationAnimatorSlowAnimationTest : public AshTestBase {
|
||||
|
||||
void ScreenRotationAnimatorSlowAnimationTest::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();
|
||||
animator_ = std::make_unique<ScreenRotationAnimator>(
|
||||
@ -235,6 +239,9 @@ void ScreenRotationAnimatorSmoothAnimationTest::QuitWaitForCopyCallback() {
|
||||
|
||||
void ScreenRotationAnimatorSmoothAnimationTest::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();
|
||||
run_loop_ = std::make_unique<base::RunLoop>();
|
||||
|
@ -179,6 +179,9 @@ class ASH_EXPORT WallpaperControllerImpl
|
||||
// lock/login screen. See https://crbug.com/775591.
|
||||
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
|
||||
// user is not ephemeral. Returns false if it fails (which happens if local
|
||||
// state is not available).
|
||||
@ -322,6 +325,8 @@ class ASH_EXPORT WallpaperControllerImpl
|
||||
// Proxy to private ReloadWallpaper().
|
||||
void ReloadWallpaperForTesting(bool clear_cache);
|
||||
|
||||
void set_bypass_decode_for_testing() { bypass_decode_for_testing_ = true; }
|
||||
|
||||
private:
|
||||
FRIEND_TEST_ALL_PREFIXES(WallpaperControllerTest, BasicReparenting);
|
||||
FRIEND_TEST_ALL_PREFIXES(WallpaperControllerTest,
|
||||
|
@ -523,7 +523,7 @@ class WallpaperControllerTest : public AshTestBase {
|
||||
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; }
|
||||
|
||||
|
Reference in New Issue
Block a user