diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-12-02 00:02:32 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-12-02 00:02:32 +0000 |
commit | acc288377442012fe94d8003bec0bb99912f920a (patch) | |
tree | 457d999550d6f7e1c21e30e494da664807fc271a | |
parent | ebdb6f123c0cd22886a43d04e585fdb706e12aa9 (diff) | |
parent | efb099367349a687d36b0514744ac01bbd85006b (diff) | |
download | base-android-12.0.0_r26.tar.gz |
Merge cherrypicks of [16372369] into sc-qpr1-release.android-12.0.0_r26
Change-Id: I5cd1c506674a91ff9d0da784ae5cde57cfb2ef0a
-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 = () -> { |