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

View File

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