Commit 2cfa2e41 authored by Kazuki Takise's avatar Kazuki Takise Committed by Commit Bot

Don't update PIP bounds when always on top is set

CTS requires a PIP window to stay at the initial position that
Android calculates. However, Chrome sometimes adjusts the bounds
unexpectedly when always on top is set because setting always on
top triggers UpdatePipBounds, and depending on the density, the
initial bounds is adjusted by one pixel.

With this CL, PIP bounds update is defered while always on top is set.

Other possible ways to fix this issue are:
- Don't update PIP bounds for WM_EVENT_ADDED_TO_WORKSPACE.
- Ignore bounds change for PIP if it's one (or a few) pixel difference.

Note, changing bounds calculation logic on either Android or Chrome
side so there's no gap between the bounds calculated by them doesn't
work because because DP -> pixels is not a surjection and Chrome may
be unable to place the PIP window in the place Android wants (and
vice versa).

BUG=b:147396441
BUG=b:145881485
TEST=atest android.server.am.ActivityManagerPinnedStackTests
TEST=#testEnterPictureInPictureSavePosition

Change-Id: I60bfef4620459c0d3f604d3c1641864fc589c1a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1969090Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Kazuki Takise <takise@chromium.org>
Auto-Submit: Kazuki Takise <takise@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732708}
parent c3e7678c
...@@ -1092,10 +1092,25 @@ void ClientControlledShellSurface::OnPostWidgetCommit() { ...@@ -1092,10 +1092,25 @@ void ClientControlledShellSurface::OnPostWidgetCommit() {
if (expected_orientation_ == orientation_) if (expected_orientation_ == orientation_)
orientation_compositor_lock_.reset(); orientation_compositor_lock_.reset();
widget_->GetNativeWindow()->SetProperty(aura::client::kZOrderingKey,
pending_always_on_top_ ui::ZOrderLevel z_order_level = pending_always_on_top_
? ui::ZOrderLevel::kFloatingWindow ? ui::ZOrderLevel::kFloatingWindow
: ui::ZOrderLevel::kNormal); : ui::ZOrderLevel::kNormal;
ash::WindowState* window_state = GetWindowState();
if (window_state->IsPip()) {
// CTS requires a PIP window to stay at the initial position that Android
// calculates. UpdatePipBounds() is triggered by setting the window always
// on top, and depending on the density, it's adjusted by one pixel, which
// makes CTS fail.
// TODO(takise): Remove this workaround once ARC P is gone. See b/147847272
// for more detail.
base::AutoReset<bool> resetter(&ignore_bounds_change_request_, true);
widget_->GetNativeWindow()->SetProperty(aura::client::kZOrderingKey,
z_order_level);
} else {
widget_->GetNativeWindow()->SetProperty(aura::client::kZOrderingKey,
z_order_level);
}
} }
void ClientControlledShellSurface::OnSurfaceDestroying(Surface* surface) { void ClientControlledShellSurface::OnSurfaceDestroying(Surface* surface) {
......
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