diff options
| author | 2021-11-17 16:05:10 -0800 | |
|---|---|---|
| committer | 2021-12-01 18:46:17 +0000 | |
| commit | 166f263128010f6a885efa17a5ebc3aa94d3b3d6 (patch) | |
| tree | fa726084b869ff9373d671e5c7814e3d8bf700a8 | |
| parent | dbf728782c2c197c8d12658f1b51699d7810660b (diff) | |
Ignore ui mode change caused by Morris overlay in PiP
When entering PiP from GMM with Morris overlay enabled, there will be a
display change callback caused by ui mode change that tend to shift the
PiP window. For PiP, such ui mode change from app is not quite relevant
and we can simply ignore in PipController.
Bug: 201589034
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/dmI3KCeKPAH118BRqnhgNO
Test: enter PiP from GMM with Morris overlay, see video
Merged-In: I2d72e166fb8de1e503415b5441c03f0685de9573
Change-Id: I2d72e166fb8de1e503415b5441c03f0685de9573
(cherry picked from commit 391f372726af62c6d9ba9b221508003c37e8ff8a)
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java | 13 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java index b7235a31af03..a568c28dacf1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java @@ -83,6 +83,19 @@ public class DisplayLayout { private boolean mHasStatusBar = false; private int mNavBarFrameHeight = 0; + /** + * Different from {@link #equals(Object)}, this method compares the basic geometry properties + * of two {@link DisplayLayout} objects including width, height, rotation, density and cutout. + * @return {@code true} if the given {@link DisplayLayout} is identical geometry wise. + */ + public boolean isSameGeometry(@NonNull DisplayLayout other) { + return mWidth == other.mWidth + && mHeight == other.mHeight + && mRotation == other.mRotation + && mDensityDpi == other.mDensityDpi + && Objects.equals(mCutout, other.mCutout); + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java index 63f1985aa86e..8967457802a7 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java @@ -76,7 +76,6 @@ import com.android.wm.shell.pip.PipTransitionController; import com.android.wm.shell.pip.PipUtils; import java.io.PrintWriter; -import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; @@ -441,7 +440,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb } private void onDisplayChanged(DisplayLayout layout, boolean saveRestoreSnapFraction) { - if (Objects.equals(layout, mPipBoundsState.getDisplayLayout())) { + if (mPipBoundsState.getDisplayLayout().isSameGeometry(layout)) { return; } Runnable updateDisplayLayout = () -> { |