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

This commit is contained in:
Hongwei Wang
2023-01-19 21:38:22 +00:00
committed by Android (Google) Code Review
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();