Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fad6eccb authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

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

parents ef056c36 c2e83fdc
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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
+6 −3
Original line number Diff line number Diff line
@@ -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();