Commit 8b4da353 authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

overview: Be sure to actually end overview when a display is added

The present CL addresses system instability after a display is added (or
you end mirror mode) while in tablet split view with empty overview.
OverviewSession::OnDisplayAdded calls OverviewController::EndOverview
which fails in case of tablet split view with empty overview. Thus,
overview stays active, but there is no overview grid for the added
display. Then you certainly can get a crash, because a lot of code
assumes that when overview is active, there is an overview grid for each
display. The present CL ensures that overview will actually end when a
display is added.

Test: All/SplitViewOverviewSessionTest.ExitAndReenterMirrorModeWithEmptyOverview/?
Change-Id: Ib9e359e2b231db0f531f7f1de4af9c5af0b2d408
Fixed: 1124481
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390964Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805437}
parent 1efe2842
...@@ -71,8 +71,10 @@ constexpr SkColor kNoItemsIndicatorTextColor = SK_ColorWHITE; ...@@ -71,8 +71,10 @@ constexpr SkColor kNoItemsIndicatorTextColor = SK_ColorWHITE;
constexpr int kKeyboardPressScrollingDp = 75; constexpr int kKeyboardPressScrollingDp = 75;
constexpr int kKeyboardHoldScrollingDp = 15; constexpr int kKeyboardHoldScrollingDp = 15;
void EndOverview() { // Tries to end overview. Returns true if overview is successfully ended, or
Shell::Get()->overview_controller()->EndOverview(); // just was not active in the first place.
bool EndOverview() {
return Shell::Get()->overview_controller()->EndOverview();
} }
} // namespace } // namespace
...@@ -924,6 +926,9 @@ bool OverviewSession::CanProcessEvent(OverviewItem* sender, ...@@ -924,6 +926,9 @@ bool OverviewSession::CanProcessEvent(OverviewItem* sender,
} }
void OverviewSession::OnDisplayAdded(const display::Display& display) { void OverviewSession::OnDisplayAdded(const display::Display& display) {
if (EndOverview())
return;
SplitViewController::Get(Shell::GetPrimaryRootWindow())->EndSplitView();
EndOverview(); EndOverview();
} }
......
...@@ -5992,6 +5992,18 @@ TEST_P(SplitViewOverviewSessionTest, ...@@ -5992,6 +5992,18 @@ TEST_P(SplitViewOverviewSessionTest,
EXPECT_EQ(minimized_window.get(), window_util::GetActiveWindow()); EXPECT_EQ(minimized_window.get(), window_util::GetActiveWindow());
} }
// Verify no crash (or DCHECK failure) if you exit and re-enter mirror mode
// while in tablet split view with empty overview.
TEST_P(SplitViewOverviewSessionTest,
ExitAndReenterMirrorModeWithEmptyOverview) {
UpdateDisplay("800x600,800x600");
std::unique_ptr<aura::Window> window = CreateTestWindow();
ToggleOverview();
split_view_controller()->SnapWindow(window.get(), SplitViewController::LEFT);
display_manager()->SetMirrorMode(display::MirrorMode::kOff, base::nullopt);
display_manager()->SetMirrorMode(display::MirrorMode::kNormal, base::nullopt);
}
// Test the split view and overview functionalities in clamshell mode. Split // Test the split view and overview functionalities in clamshell mode. Split
// view is only active when overview is active in clamshell mode. // view is only active when overview is active in clamshell mode.
class SplitViewOverviewSessionInClamshellTest class SplitViewOverviewSessionInClamshellTest
......
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