Commit 52eead94 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Always animate unblur when exiting overview.

Test: manual
Bug: 833443
Change-Id: Iaf64e0c4edea2ae444d6d55a6103f922c5f33ffb
Reviewed-on: https://chromium-review.googlesource.com/1132476
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574950}
parent c5543eb5
...@@ -661,13 +661,6 @@ bool WindowSelector::ShouldAnimateWallpaper(aura::Window* root_window) { ...@@ -661,13 +661,6 @@ bool WindowSelector::ShouldAnimateWallpaper(aura::Window* root_window) {
if (!grid) if (!grid)
return false; return false;
// It is possible we leave overview mode to enter split view mode with both
// windows snapped. Do not animate the wallpaper in this case.
if (Shell::Get()->split_view_controller()->state() ==
SplitViewController::BOTH_SNAPPED) {
return false;
}
// If one of the windows covers the workspace, we do not need to animate. // If one of the windows covers the workspace, we do not need to animate.
for (const auto& selector_item : grid->window_list()) { for (const auto& selector_item : grid->window_list()) {
if (CanCoverAvailableWorkspace(selector_item->GetWindow())) if (CanCoverAvailableWorkspace(selector_item->GetWindow()))
......
...@@ -32,6 +32,10 @@ namespace ash { ...@@ -32,6 +32,10 @@ namespace ash {
namespace { namespace {
// Do not blur or unblur the wallpaper when entering or exiting overview mode
// when this is true.
bool g_disable_wallpaper_blur_for_tests = false;
// Amount of blur to apply on the wallpaper when we enter or exit overview mode. // Amount of blur to apply on the wallpaper when we enter or exit overview mode.
constexpr double kWallpaperBlurSigma = 10.f; constexpr double kWallpaperBlurSigma = 10.f;
constexpr double kWallpaperClearBlurSigma = 0.f; constexpr double kWallpaperClearBlurSigma = 0.f;
...@@ -71,7 +75,8 @@ bool ShouldExcludeWindowFromOverview(const aura::Window* window) { ...@@ -71,7 +75,8 @@ bool ShouldExcludeWindowFromOverview(const aura::Window* window) {
} }
bool IsBlurEnabled() { bool IsBlurEnabled() {
return Shell::Get()->wallpaper_controller()->IsBlurEnabled(); return !g_disable_wallpaper_blur_for_tests &&
Shell::Get()->wallpaper_controller()->IsBlurEnabled();
} }
} // namespace } // namespace
...@@ -157,8 +162,9 @@ class WindowSelectorController::OverviewBlurController ...@@ -157,8 +162,9 @@ class WindowSelectorController::OverviewBlurController
// |roots_to_animate_| accordingly. Applys blur or unblur immediately if // |roots_to_animate_| accordingly. Applys blur or unblur immediately if
// the wallpaper does not need blur animation. // the wallpaper does not need blur animation.
void OnBlurChange() { void OnBlurChange() {
bool should_blur = state_ == WallpaperAnimationState::kAddingBlur; const bool should_blur = state_ == WallpaperAnimationState::kAddingBlur;
double value = should_blur ? kWallpaperBlurSigma : kWallpaperClearBlurSigma; const double value =
should_blur ? kWallpaperBlurSigma : kWallpaperClearBlurSigma;
for (aura::Window* root : roots_to_animate_) for (aura::Window* root : roots_to_animate_)
root->RemoveObserver(this); root->RemoveObserver(this);
roots_to_animate_.clear(); roots_to_animate_.clear();
...@@ -166,17 +172,18 @@ class WindowSelectorController::OverviewBlurController ...@@ -166,17 +172,18 @@ class WindowSelectorController::OverviewBlurController
WindowSelector* window_selector = WindowSelector* window_selector =
Shell::Get()->window_selector_controller()->window_selector(); Shell::Get()->window_selector_controller()->window_selector();
DCHECK(window_selector); DCHECK(window_selector);
for (aura::Window* root : Shell::Get()->GetAllRootWindows()) { for (aura::Window* root : Shell::Get()->GetAllRootWindows()) {
if (!window_selector->ShouldAnimateWallpaper(root)) { if (!should_blur || window_selector->ShouldAnimateWallpaper(root)) {
animation_.Reset(should_blur ? 1.0 : 0.0);
ApplyBlur(root, value);
} else {
root->AddObserver(this); root->AddObserver(this);
roots_to_animate_.push_back(root); roots_to_animate_.push_back(root);
} else {
animation_.Reset(should_blur ? 1.0 : 0.0);
ApplyBlur(root, value);
} }
} }
// Run the animation if one of the roots needs to be aniamted. // Run the animation if one of the roots needs to be animated.
if (roots_to_animate_.empty()) { if (roots_to_animate_.empty()) {
state_ = WallpaperAnimationState::kNormal; state_ = WallpaperAnimationState::kNormal;
} else if (should_blur) { } else if (should_blur) {
...@@ -438,6 +445,11 @@ void WindowSelectorController::RemoveAndDestroyAnimationObserver( ...@@ -438,6 +445,11 @@ void WindowSelectorController::RemoveAndDestroyAnimationObserver(
delayed_animations_.end()); delayed_animations_.end());
} }
// static
void WindowSelectorController::SetDoNotChangeWallpaperBlurForTests() {
g_disable_wallpaper_blur_for_tests = true;
}
void WindowSelectorController::OnSelectionStarted() { void WindowSelectorController::OnSelectionStarted() {
if (!last_selection_time_.is_null()) { if (!last_selection_time_.is_null()) {
UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse",
......
...@@ -73,6 +73,9 @@ class ASH_EXPORT WindowSelectorController : public WindowSelectorDelegate { ...@@ -73,6 +73,9 @@ class ASH_EXPORT WindowSelectorController : public WindowSelectorDelegate {
class OverviewBlurController; class OverviewBlurController;
friend class WindowSelectorTest; friend class WindowSelectorTest;
// There is no need to blur or unblur the wallpaper for tests.
static void SetDoNotChangeWallpaperBlurForTests();
// Dispatched when window selection begins. // Dispatched when window selection begins.
void OnSelectionStarted(); void OnSelectionStarted();
......
...@@ -133,6 +133,7 @@ class WindowSelectorTest : public AshTestBase { ...@@ -133,6 +133,7 @@ class WindowSelectorTest : public AshTestBase {
GetPrimaryShelf()->GetShelfViewForTesting()); GetPrimaryShelf()->GetShelfViewForTesting());
shelf_view_test_api_->SetAnimationDuration(1); shelf_view_test_api_->SetAnimationDuration(1);
ScopedTransformOverviewWindow::SetImmediateCloseForTests(); ScopedTransformOverviewWindow::SetImmediateCloseForTests();
WindowSelectorController::SetDoNotChangeWallpaperBlurForTests();
} }
aura::Window* CreateWindow(const gfx::Rect& bounds) { aura::Window* CreateWindow(const gfx::Rect& bounds) {
......
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