Commit 1182ec4c authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

tablet: Fix behavior after docked mode in user-enforced tablet mode.

When you enter docked mode while tablet mode is forced via
chrome://flags#force-tablet-mode, that setting to force tablet mode
shall still be respected, whereas the current behavior is to enter
clamshell mode and then stay in clamshell mode even if the lid is
flipped to tablet position.

Test: TabletModeControllerForceTabletModeTest.DockInForcedTabletMode
Bug: 929373
Change-Id: I3d0c2ec937f424b02c53ee1d2ab9019271f7f1d0
Reviewed-on: https://chromium-review.googlesource.com/c/1457466Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629831}
parent ed1a9f93
...@@ -294,6 +294,9 @@ void TabletModeController::OnShellInitialized() { ...@@ -294,6 +294,9 @@ void TabletModeController::OnShellInitialized() {
} }
void TabletModeController::OnDisplayConfigurationChanged() { void TabletModeController::OnDisplayConfigurationChanged() {
if (!AllowUiModeChange())
return;
if (!HasActiveInternalDisplay()) { if (!HasActiveInternalDisplay()) {
AttemptLeaveTabletMode(); AttemptLeaveTabletMode();
} else if (tablet_mode_switch_is_on_ && !IsTabletModeWindowManagerEnabled()) { } else if (tablet_mode_switch_is_on_ && !IsTabletModeWindowManagerEnabled()) {
......
...@@ -1080,6 +1080,29 @@ TEST_F(TabletModeControllerForceTabletModeTest, ForceTabletModeTest) { ...@@ -1080,6 +1080,29 @@ TEST_F(TabletModeControllerForceTabletModeTest, ForceTabletModeTest) {
EXPECT_TRUE(AreEventsBlocked()); EXPECT_TRUE(AreEventsBlocked());
} }
TEST_F(TabletModeControllerForceTabletModeTest, DockInForcedTabletMode) {
UpdateDisplay("800x600, 800x600");
const int64_t internal_display_id =
display::test::DisplayManagerTestApi(display_manager())
.SetFirstDisplayAsInternalDisplay();
// Deactivate internal display to simulate Docked Mode.
std::vector<display::ManagedDisplayInfo> all_displays;
all_displays.push_back(display_manager()->GetDisplayInfo(
display_manager()->GetDisplayAt(0).id()));
std::vector<display::ManagedDisplayInfo> secondary_only;
display::ManagedDisplayInfo secondary_display =
display_manager()->GetDisplayInfo(
display_manager()->GetDisplayAt(1).id());
all_displays.push_back(secondary_display);
secondary_only.push_back(secondary_display);
display_manager()->OnNativeDisplaysChanged(secondary_only);
ASSERT_FALSE(display_manager()->IsActiveDisplayId(internal_display_id));
// Still expect tablet mode.
EXPECT_TRUE(IsTabletModeStarted());
}
class TabletModeControllerForceClamshellModeTest class TabletModeControllerForceClamshellModeTest
: public TabletModeControllerTest { : public TabletModeControllerTest {
public: public:
......
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