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

Commit 4ddb740a authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

Calculate KCA Rect once PiP consistent

Display bounds are updated as we are entering
PiP in fixed rotation. This means if KCA updates come in
before PiP is in a consistent state, we can be left with
an incorrect offset during fixed-rotation enter PiP in btn nav.

Bug: 377372720
Flag: com.android.wm.shell.enable_pip2
Test: enter PiP in fixed-rotation in button-nav mode
Change-Id: Ie1494190dc6c88e1e9a394ea971d411852ce79eb
parent 70a45498
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -376,6 +376,7 @@ public class PipController implements ConfigurationChangeListener,
    private void setLauncherKeepClearAreaHeight(boolean visible, int height) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "setLauncherKeepClearAreaHeight: visible=%b, height=%d", visible, height);
        mPipTransitionState.setOnIdlePipTransitionStateRunnable(() -> {
            if (visible) {
                Rect rect = new Rect(
                        0, mPipDisplayLayoutState.getDisplayBounds().bottom - height,
@@ -388,6 +389,7 @@ public class PipController implements ConfigurationChangeListener,
                        PipBoundsState.NAMED_KCA_LAUNCHER_SHELF, null);
            }
            mPipTouchHandler.onShelfVisibilityChanged(visible, height);
        });
    }

    @Override
+8 −10
Original line number Diff line number Diff line
@@ -231,7 +231,6 @@ public class PipTouchHandler implements PipTransitionState.PipTransitionStateCha
                // KCA triggered movement to wait for other transitions (e.g. due to IME changes).
                return;
            }
            mPipTransitionState.setOnIdlePipTransitionStateRunnable(() -> {
            boolean hasUserInteracted = (mPipBoundsState.hasUserMovedPip()
                    || mPipBoundsState.hasUserResizedPip());
            int delta = mPipBoundsAlgorithm.getEntryDestinationBounds().top
@@ -241,7 +240,6 @@ public class PipTouchHandler implements PipTransitionState.PipTransitionStateCha
                // If the user hasn't interacted with PiP, we respect the keep clear areas
                mMotionHelper.animateToOffset(mPipBoundsState.getBounds(), delta);
            }
            });
        };

        if (PipUtils.isPip2ExperimentEnabled()) {