Skip to content

Commit

Permalink
snap-groups: Add observers fo FasterSplitScreenSetup
Browse files Browse the repository at this point in the history
Fixed: b/307838944
Change-Id: Ie3c042d50d17a6e589bedf9f71d269d1b10c4c59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4986375
Commit-Queue: Sophie Wen <sophiewen@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216543}
  • Loading branch information
Sophie Wen authored and Chromium LUCI CQ committed Oct 28, 2023
1 parent adbdba5 commit 57113bf
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
14 changes: 10 additions & 4 deletions ash/wm/overview/overview_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2309,10 +2309,9 @@ void OverviewGrid::OnSplitViewStateChanged(
}

if (window_util::IsFasterSplitScreenOrSnapGroupArm1Enabled()) {
// When an activated is auto snapped, it will send a state change and try to
// end overview here. Ignore split view state when `kFasterSplitScreenSetup`
// or `kSnapGroup` arm1 is enabled.
RefreshGridBounds(/*animate=*/false);
// When an activated window is auto snapped, it will send a state change and
// try to end overview here. Ignore split view state when
// `kFasterSplitScreenSetup` or `kSnapGroup` arm1 is enabled.
return;
}

Expand Down Expand Up @@ -2346,6 +2345,13 @@ void OverviewGrid::OnSplitViewStateChanged(
}

void OverviewGrid::OnSplitViewDividerPositionChanged() {
if (window_util::IsFasterSplitScreenOrSnapGroupArm1Enabled()) {
// If `IsFasterSplitScreenOrSnapGroupArm1Enabled` is true,
// `SplitViewOverviewSession` will manually update the bounds so we don't
// need to update here.
return;
}

SetBoundsAndUpdatePositions(
GetGridBoundsInScreen(root_window_,
/*window_dragging_state=*/absl::nullopt,
Expand Down
11 changes: 8 additions & 3 deletions ash/wm/snap_group/snap_group_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,11 @@ SplitViewOverviewSession* VerifySplitViewOverviewSession(aura::Window* window) {
EXPECT_TRUE(expected_grid_bounds.Contains(GetOverviewGridBounds()));
// Hotseat may be on the bottom of the work area.
EXPECT_TRUE(work_area_bounds().Contains(expected_grid_bounds));
EXPECT_TRUE(
GetOverviewGridForRoot(window->GetRootWindow())->no_windows_widget());

if (!Shell::Get()->IsInTabletMode()) {
EXPECT_TRUE(
GetOverviewGridForRoot(window->GetRootWindow())->no_windows_widget());
}

return split_view_overview_session;
}
Expand Down Expand Up @@ -635,8 +638,10 @@ TEST_F(FasterSplitScreenTest,

// Tests the histograms for the split view overview session exit points are
// recorded correctly in tablet mode.
// SplitViewOverviewSession should not support tablet mode.
// TODO(sophiewen): Re-enable or delete this.
TEST_F(FasterSplitScreenTest,
SplitViewOverviewSessionExitPointTabletHistograms) {
DISABLED_SplitViewOverviewSessionExitPointTabletHistograms) {
UpdateDisplay("800x600");
SwitchToTabletMode();
EXPECT_TRUE(Shell::Get()->IsInTabletMode());
Expand Down
3 changes: 0 additions & 3 deletions ash/wm/splitview/split_view_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1357,9 +1357,6 @@ bool SplitViewController::BoundsChangeIsFromVKAndAllowed(
}

void SplitViewController::AddObserver(SplitViewObserver* observer) {
if (window_util::IsFasterSplitScreenOrSnapGroupArm1Enabled()) {
return;
}
observers_.AddObserver(observer);
}

Expand Down
6 changes: 5 additions & 1 deletion ash/wm/window_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,11 @@ void WindowState::OnWMEvent(const WMEvent* event) {
if (snap_event && IsSnapped()) {
const WindowSnapActionSource snap_action_source =
snap_event->snap_action_source();
if (features::IsFasterSplitScreenSetupEnabled()) {
if (features::IsFasterSplitScreenSetupEnabled() &&
!Shell::Get()->IsInTabletMode()) {
// SplitViewController will start the partial overview session, no need
// for SplitViewOverviewSession.
// TODO(sophiewen): See if checking tablet mode is necessary.
window_util::MaybeStartSplitViewOverview(window_, snap_action_source);
return;
}
Expand Down
4 changes: 4 additions & 0 deletions ash/wm/window_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,10 @@ bool ShouldRoundThumbnailWindow(views::View* backdrop_view,
}

bool IsFasterSplitScreenOrSnapGroupArm1Enabled() {
if (Shell::Get()->IsInTabletMode()) {
// FasterSplitScreen is not supported in tablet mode.
return false;
}
if (features::IsFasterSplitScreenSetupEnabled()) {
return true;
}
Expand Down

0 comments on commit 57113bf

Please sign in to comment.