Skip to content

Commit

Permalink
overview: Remove wallpaper blur controller
Browse files Browse the repository at this point in the history
It's no longer needed with Jelly enabled.

Bug: b/306399190
Bug: b/308012047
Test: existing tests
Change-Id: Ic263093c06aee74283654592afb106ff0b0ca9c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4981725
Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216432}
  • Loading branch information
Sammie Quon authored and Chromium LUCI CQ committed Oct 27, 2023
1 parent ab85893 commit ba4d32d
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 640 deletions.
3 changes: 0 additions & 3 deletions ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2570,8 +2570,6 @@ component("ash") {
"wm/overview/overview_types.h",
"wm/overview/overview_utils.cc",
"wm/overview/overview_utils.h",
"wm/overview/overview_wallpaper_controller.cc",
"wm/overview/overview_wallpaper_controller.h",
"wm/overview/overview_window_drag_controller.cc",
"wm/overview/overview_window_drag_controller.h",
"wm/overview/scoped_float_container_stacker.cc",
Expand Down Expand Up @@ -3767,7 +3765,6 @@ test("ash_unittests") {
"wm/overview/overview_session_unittest.cc",
"wm/overview/overview_test_base.cc",
"wm/overview/overview_test_base.h",
"wm/overview/overview_wallpaper_controller_unittest.cc",
"wm/overview/overview_window_drag_controller_unittest.cc",
"wm/overview/overview_window_drag_histogram_unittests.cc",
"wm/overview/scoped_overview_transform_window_unittest.cc",
Expand Down
4 changes: 2 additions & 2 deletions ash/drag_drop/tab_drag_drop_windows_hider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
#include <vector>

#include "ash/app_list/app_list_controller_impl.h"
#include "ash/public/cpp/style/color_provider.h"
#include "ash/public/cpp/window_backdrop.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/root_window_controller.h"
#include "ash/scoped_animation_disabler.h"
#include "ash/shell.h"
#include "ash/wallpaper/views/wallpaper_view.h"
#include "ash/wallpaper/views/wallpaper_widget_controller.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/overview_controller.h"
Expand Down Expand Up @@ -53,7 +53,7 @@ TabDragDropWindowsHider::TabDragDropWindowsHider(aura::Window* source_window)
// Blurs the wallpaper background.
RootWindowController::ForWindow(root_window_)
->wallpaper_widget_controller()
->SetWallpaperBlur(wallpaper_constants::kOverviewBlur);
->SetWallpaperBlur(ColorProvider::kBackgroundBlurSigma);

// `root_window_` might became nullptr during drag&drop. See b/276736023 for
// details.
Expand Down
21 changes: 0 additions & 21 deletions ash/shelf/drag_window_from_shelf_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "chromeos/constants/chromeos_features.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/hit_test.h"
#include "ui/compositor/layer.h"
Expand Down Expand Up @@ -476,15 +475,6 @@ void DragWindowFromShelfController::OnDragStarted(
// Hide the home launcher until it's eligible to show it.
Shell::Get()->app_list_controller()->OnWindowDragStarted();

// Use the same dim and blur as in overview during dragging. If the feature
// `kJellyroll` is enabled, there's no wallpaper blur in overview mode, thus
// we don't need to set it here neither.
if (!chromeos::features::IsJellyrollEnabled()) {
RootWindowController::ForWindow(window_->GetRootWindow())
->wallpaper_widget_controller()
->SetWallpaperBlur(wallpaper_constants::kOverviewBlur);
}

// If the dragged window is one of the snapped window in splitview, it needs
// to be detached from splitview before start dragging.
SplitViewController* split_view_controller =
Expand Down Expand Up @@ -537,17 +527,6 @@ void DragWindowFromShelfController::OnDragEnded(
// ends.
Shell::Get()->app_list_controller()->OnWindowDragEnded(/*animate=*/true);

// Clear the wallpaper dim and blur if not in overview after drag ends.
// If in overview, the dim and blur will be cleared after overview ends.
// If the feature `kJellyroll` is enabled, no need to clear the wallpaper
// dim and blur since the background is set to clear in overview mode.
if (!chromeos::features::IsJellyrollEnabled() &&
!overview_controller->InOverviewSession()) {
RootWindowController::ForWindow(window_->GetRootWindow())
->wallpaper_widget_controller()
->SetWallpaperBlur(wallpaper_constants::kClear);
}

DCHECK(window_drag_result_.has_value());
switch (*window_drag_result_) {
case ShelfWindowDragResult::kGoToHomeScreen:
Expand Down
28 changes: 0 additions & 28 deletions ash/shelf/drag_window_from_shelf_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#include "ash/shelf/window_scale_animation.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wallpaper/views/wallpaper_view.h"
#include "ash/wallpaper/views/wallpaper_widget_controller.h"
#include "ash/wallpaper/wallpaper_constants.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_drop_target.h"
Expand Down Expand Up @@ -596,31 +593,6 @@ TEST_F(DragWindowFromShelfControllerTest, DragOrFlingInSplitView) {
ExitOverview();
}

// Test wallpaper should be blurred as in overview, even though overview might
// not open during dragging.
TEST_F(DragWindowFromShelfControllerTest, WallpaperBlurDuringDragging) {
UpdateDisplay("500x400");
const gfx::Rect shelf_bounds = GetShelfBounds();
auto window = CreateTestWindow();

StartDrag(window.get(), shelf_bounds.CenterPoint());
Drag(gfx::Point(0, 200), 0.f,
DragWindowFromShelfController::kShowOverviewThreshold + 1);
OverviewController* overview_controller = OverviewController::Get();
EXPECT_FALSE(overview_controller->InOverviewSession());
auto* wallpaper_view =
RootWindowController::ForWindow(window->GetRootWindow())
->wallpaper_widget_controller()
->wallpaper_view();
EXPECT_EQ(wallpaper_view->blur_sigma(),
chromeos::features::IsJellyrollEnabled()
? wallpaper_constants::kClear
: wallpaper_constants::kOverviewBlur);

EndDrag(shelf_bounds.CenterPoint(), /*velocity_y=*/absl::nullopt);
EXPECT_EQ(wallpaper_view->blur_sigma(), wallpaper_constants::kClear);
}

// Test overview is hidden during dragging and shown when drag slows down or
// stops.
TEST_F(DragWindowFromShelfControllerTest, HideOverviewDuringDragging) {
Expand Down
8 changes: 4 additions & 4 deletions ash/wallpaper/wallpaper_blur_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace ash {

// Handles blur state for wallpaper. ChromeOS Wallpaper may be blurred on
// login/lock screen, and in window overview mode.
// lock/login screen.
class ASH_EXPORT WallpaperBlurManager {
public:
WallpaperBlurManager();
Expand All @@ -34,9 +34,9 @@ class ASH_EXPORT WallpaperBlurManager {

// When user presses the physical lock button on device, a quick blur
// animation shows as the device is locking. This animation may show over
// other forms of blur like overview mode wallpaper blur. If the user lets go
// of the lock button before the device is locked, the animation rolls back
// and should restore the prior blur state.
// other forms of blur. If the user lets go of the lock button before the
// device is locked, the animation rolls back and should restore the prior
// blur state.
void RestoreWallpaperBlurForLockState(float blur,
WallpaperType wallpaper_type);

Expand Down
2 changes: 0 additions & 2 deletions ash/wallpaper/wallpaper_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace wallpaper_constants {

// Blur sigma used for normal wallpaper.
constexpr float kClear = 0.f;
// Blur sigma used in overview mode.
constexpr float kOverviewBlur = ColorProvider::kBackgroundBlurSigma;
// Blur sigma in lock/login screen.
constexpr float kLockLoginBlur = 30.0f;
// Blur sigma used in oobe.
Expand Down
10 changes: 2 additions & 8 deletions ash/wm/lock_state_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -934,10 +934,7 @@ TEST_P(LockStateControllerAnimationTest, CancelShouldResetWallpaperBlur) {

// Enter Overview and verify wallpaper properties.
EnterOverview();
EXPECT_EQ(chromeos::features::IsJellyrollEnabled()
? wallpaper_constants::kClear
: wallpaper_constants::kOverviewBlur,
wallpaper_view->blur_sigma());
EXPECT_EQ(wallpaper_constants::kClear, wallpaper_view->blur_sigma());

// Start lock animation and verify wallpaper properties.
PressLockButton();
Expand All @@ -952,10 +949,7 @@ TEST_P(LockStateControllerAnimationTest, CancelShouldResetWallpaperBlur) {
ExpectUnlockedState("4");

// Verify wallpaper blur are restored to overview's.
EXPECT_EQ(chromeos::features::IsJellyrollEnabled()
? wallpaper_constants::kClear
: wallpaper_constants::kOverviewBlur,
wallpaper_view->blur_sigma());
EXPECT_EQ(wallpaper_constants::kClear, wallpaper_view->blur_sigma());
}

INSTANTIATE_TEST_SUITE_P(LockStateControllerAnimation,
Expand Down
44 changes: 2 additions & 42 deletions ash/wm/overview/overview_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "ash/wm/overview/overview_item.h"
#include "ash/wm/overview/overview_session.h"
#include "ash/wm/overview/overview_utils.h"
#include "ash/wm/overview/overview_wallpaper_controller.h"
#include "ash/wm/raster_scale/raster_scale_controller.h"
#include "ash/wm/screen_pinning_controller.h"
#include "ash/wm/snap_group/snap_group_controller.h"
Expand Down Expand Up @@ -103,22 +102,13 @@ OverviewEnterExitType MaybeOverrideEnterExitTypeForHomeScreen(
OverviewController::OverviewController()
: occlusion_pause_duration_for_end_(kOcclusionPauseDurationForEnd),
delayed_animation_task_delay_(kTransition) {
// If the feature `kJellyroll` is enabled, there's no wallpaper blur in
// overview mode, thus we don't need to create `OverviewWallpaperController`
// which takes care the the wallpaper blur for overview mode.
if (!chromeos::features::IsJellyrollEnabled()) {
overview_wallpaper_controller_ =
std::make_unique<OverviewWallpaperController>();
}

Shell::Get()->activation_client()->AddObserver(this);
CHECK_EQ(g_instance, nullptr);
g_instance = this;
}

OverviewController::~OverviewController() {
Shell::Get()->activation_client()->RemoveObserver(this);
overview_wallpaper_controller_.reset();

// Destroy widgets that may be still animating if shell shuts down soon after
// exiting overview mode.
Expand Down Expand Up @@ -269,10 +259,6 @@ void OverviewController::RemoveAndDestroyExitAnimationObserver(
base::EraseIf(delayed_animations_,
base::MatchesUniquePtr(animation_observer));

// If something has been removed and its the last observer, unblur the
// wallpaper and let observers know. This function may be called while still
// in overview (ie. splitview restores one window but leaves overview active)
// so check that |overview_session_| is null before notifying.
if (!overview_session_ && !previous_empty && delayed_animations_.empty())
OnEndingAnimationComplete(/*canceled=*/false);
}
Expand Down Expand Up @@ -499,16 +485,6 @@ void OverviewController::ToggleOverview(OverviewEnterExitType type) {

overview_session_->UpdateFrameThrottling();

// When fading in from home, start animating blur immediately (if animation
// is required) - with this transition the item widgets are positioned in
// the overview immediately, so delaying blur start until start animations
// finish looks janky. If the feature `kJellyroll` is enabled, no need to
// set the wallpaper blur.
if (!chromeos::features::IsJellyrollEnabled()) {
overview_wallpaper_controller_->Blur(
/*animate=*/new_type == OverviewEnterExitType::kFadeInEnter);
}

// For app dragging, there are no start animations so add a delay to delay
// animations observing when the start animation ends, such as the shelf,
// shadow and rounded corners.
Expand Down Expand Up @@ -577,19 +553,10 @@ bool OverviewController::CanEndOverview(OverviewEnterExitType type) {
}

void OverviewController::OnStartingAnimationComplete(bool canceled) {
DCHECK(overview_session_);

// For kFadeInEnter, wallpaper blur is initiated on transition start,
// so it doesn't have to be requested again on starting animation end.
if (!chromeos::features::IsJellyrollEnabled() && !canceled &&
overview_session_->enter_exit_overview_type() !=
OverviewEnterExitType::kFadeInEnter) {
overview_wallpaper_controller_->Blur(/*animate=*/true);
}
CHECK(overview_session_);

// Observers should not do anything which may cause overview to quit
// explicitly (i.e. ToggleOverview()) or implicity (i.e. activation change).
DCHECK(overview_session_);
overview_session_->OnStartingAnimationComplete(canceled,
should_focus_overview_);
for (auto& observer : observers_) {
Expand All @@ -604,15 +571,8 @@ void OverviewController::OnStartingAnimationComplete(bool canceled) {
void OverviewController::OnEndingAnimationComplete(bool canceled) {
for (auto& observer : observers_)
observer.OnOverviewModeEndingAnimationComplete(canceled);
UnpauseOcclusionTracker(occlusion_pause_duration_for_end_);

// Unblur when animation is completed (or right away if there was no
// delayed animation) unless it's canceled, in which case, we should keep
// the blur. No need to unblur the wallpaper if the feature `kJellyroll` is
// enabled, since it's not blurred on overview started.
if (!canceled && !chromeos::features::IsJellyrollEnabled()) {
overview_wallpaper_controller_->Unblur();
}
UnpauseOcclusionTracker(occlusion_pause_duration_for_end_);

// Resume the activation frame state.
if (!canceled) {
Expand Down
7 changes: 1 addition & 6 deletions ash/wm/overview/overview_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
namespace ash {

class OverviewSession;
class OverviewWallpaperController;

// Manages a overview session which displays an overview of all windows and
// allows selecting a window to activate it.
class ASH_EXPORT OverviewController : public OverviewDelegate,
public ::wm::ActivationChangeObserver {
public wm::ActivationChangeObserver {
public:
OverviewController();

Expand Down Expand Up @@ -178,10 +177,6 @@ class ASH_EXPORT OverviewController : public OverviewDelegate,

base::TimeDelta occlusion_pause_duration_for_end_;

// Handles blurring and dimming of the wallpaper when entering or exiting
// overview mode. Animates the blurring and dimming if necessary.
std::unique_ptr<OverviewWallpaperController> overview_wallpaper_controller_;

base::CancelableOnceClosure reset_pauser_task_;

// App dragging enters overview right away. This task is used to delay the
Expand Down

0 comments on commit ba4d32d

Please sign in to comment.