Merge "Fix duplicate display update upon nav mode change" into tm-qpr-dev am: fad6eccb13

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21026687

Change-Id: Ib437389ff680dc415351a895d5d29a4facf5fb0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hongwei Wang
2023-01-19 22:05:33 +00:00
committed by Automerger Merge Worker
2 changed files with 8 additions and 7 deletions

View File

@@ -96,8 +96,7 @@ public class DisplayLayout {
/**
* Different from {@link #equals(Object)}, this method compares the basic geometry properties
* of two {@link DisplayLayout} objects including width, height, rotation, density, cutout and
* insets.
* of two {@link DisplayLayout} objects including width, height, rotation, density, cutout.
* @return {@code true} if the given {@link DisplayLayout} is identical geometry wise.
*/
public boolean isSameGeometry(@NonNull DisplayLayout other) {
@@ -105,8 +104,7 @@ public class DisplayLayout {
&& mHeight == other.mHeight
&& mRotation == other.mRotation
&& mDensityDpi == other.mDensityDpi
&& Objects.equals(mCutout, other.mCutout)
&& Objects.equals(mStableInsets, other.mStableInsets);
&& Objects.equals(mCutout, other.mCutout);
}
@Override

View File

@@ -616,7 +616,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
return;
}
int oldMaxMovementBound = mPipBoundsState.getMovementBounds().bottom;
onDisplayChanged(
onDisplayChangedUncheck(
mDisplayController.getDisplayLayout(mPipBoundsState.getDisplayId()),
false /* saveRestoreSnapFraction */);
int newMaxMovementBound = mPipBoundsState.getMovementBounds().bottom;
@@ -702,9 +702,12 @@ public class PipController implements PipTransitionController.PipTransitionCallb
}
private void onDisplayChanged(DisplayLayout layout, boolean saveRestoreSnapFraction) {
if (mPipBoundsState.getDisplayLayout().isSameGeometry(layout)) {
return;
if (!mPipBoundsState.getDisplayLayout().isSameGeometry(layout)) {
onDisplayChangedUncheck(layout, saveRestoreSnapFraction);
}
}
private void onDisplayChangedUncheck(DisplayLayout layout, boolean saveRestoreSnapFraction) {
Runnable updateDisplayLayout = () -> {
final boolean fromRotation = Transitions.ENABLE_SHELL_TRANSITIONS
&& mPipBoundsState.getDisplayLayout().rotation() != layout.rotation();