Commit b751b23a authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Fix SetDisplayProperties when in force tablet mode

When Chrome is in forced tablet mode (--force-tablet-mode=touch_view)
and display rotation is set through setDisplayProperties(),
ScreenOrientationController::GetCurrentOrientation() keeps returning
landscape-primary regardless of the rotation. It prevented some tests
from working as intended.

TEST=tast run eve-DUT arc.SoftInputMode
BUG=1032881

Change-Id: I2b40db9fea2af4a066a0fb8f4d37a870b87d603b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032693Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738398}
parent c98280fd
...@@ -229,9 +229,11 @@ ScreenOrientationController::ScreenOrientationController() ...@@ -229,9 +229,11 @@ ScreenOrientationController::ScreenOrientationController()
Shell::Get()->tablet_mode_controller()->AddObserver(this); Shell::Get()->tablet_mode_controller()->AddObserver(this);
SplitViewController::Get(Shell::GetPrimaryRootWindow())->AddObserver(this); SplitViewController::Get(Shell::GetPrimaryRootWindow())->AddObserver(this);
display::Screen::GetScreen()->AddObserver(this); display::Screen::GetScreen()->AddObserver(this);
Shell::Get()->window_tree_host_manager()->AddObserver(this);
} }
ScreenOrientationController::~ScreenOrientationController() { ScreenOrientationController::~ScreenOrientationController() {
Shell::Get()->window_tree_host_manager()->RemoveObserver(this);
display::Screen::GetScreen()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this);
SplitViewController::Get(Shell::GetPrimaryRootWindow())->RemoveObserver(this); SplitViewController::Get(Shell::GetPrimaryRootWindow())->RemoveObserver(this);
Shell::Get()->tablet_mode_controller()->RemoveObserver(this); Shell::Get()->tablet_mode_controller()->RemoveObserver(this);
...@@ -454,7 +456,6 @@ void ScreenOrientationController::OnTabletPhysicalStateChanged() { ...@@ -454,7 +456,6 @@ void ScreenOrientationController::OnTabletPhysicalStateChanged() {
if (IsAutoRotationAllowed()) { if (IsAutoRotationAllowed()) {
AccelerometerReader::GetInstance()->AddObserver(this); AccelerometerReader::GetInstance()->AddObserver(this);
shell->window_tree_host_manager()->AddObserver(this);
// Do not exit early, as the internal display can be determined after // Do not exit early, as the internal display can be determined after
// Maximize Mode has started. (chrome-os-partner:38796) Always start // Maximize Mode has started. (chrome-os-partner:38796) Always start
...@@ -472,7 +473,6 @@ void ScreenOrientationController::OnTabletPhysicalStateChanged() { ...@@ -472,7 +473,6 @@ void ScreenOrientationController::OnTabletPhysicalStateChanged() {
ApplyLockForTopMostWindowOnInternalDisplay(); ApplyLockForTopMostWindowOnInternalDisplay();
} else { } else {
AccelerometerReader::GetInstance()->RemoveObserver(this); AccelerometerReader::GetInstance()->RemoveObserver(this);
shell->window_tree_host_manager()->RemoveObserver(this);
if (!display::Display::HasInternalDisplay()) if (!display::Display::HasInternalDisplay())
return; return;
......
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