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

Commit 7f0f2c78 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

Update PipBoundsState when KCA height is set

Update PipBoundsState's NAMED_KCA_LAUNCHER_SHELF
keep clear unrestricted area, when Launcher sets
the KCA height due to shelf being visible/invisible.

Also, make sure IME visibility updates take KCA
into account if PiP hasn't been interacted with.

Bug: 356508169
Flag: com.android.wm.shell.enable_pip2_implementation
Test: swipe up to PiP, open IME, close IME
Test: swipe up to PiP, open another app, open IME, close IME
Change-Id: I3efdbf941e251334d11d7aa6e2043fa45f01f33b
parent 7fdad1e5
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -332,6 +332,22 @@ public class PipController implements ConfigurationChangeListener,
        mPipRecentsAnimationListener.onPipAnimationStarted();
    }

    private void setLauncherKeepClearAreaHeight(boolean visible, int height) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "setLauncherKeepClearAreaHeight: visible=%b, height=%d", visible, height);
        if (visible) {
            Rect rect = new Rect(
                    0, mPipDisplayLayoutState.getDisplayBounds().bottom - height,
                    mPipDisplayLayoutState.getDisplayBounds().right,
                    mPipDisplayLayoutState.getDisplayBounds().bottom);
            mPipBoundsState.setNamedUnrestrictedKeepClearArea(
                    PipBoundsState.NAMED_KCA_LAUNCHER_SHELF, rect);
        } else {
            mPipBoundsState.setNamedUnrestrictedKeepClearArea(
                    PipBoundsState.NAMED_KCA_LAUNCHER_SHELF, null);
        }
    }

    @Override
    public void onPipTransitionStateChanged(@PipTransitionState.TransitionState int oldState,
            @PipTransitionState.TransitionState int newState, @Nullable Bundle extra) {
@@ -507,7 +523,10 @@ public class PipController implements ConfigurationChangeListener,
        public void setShelfHeight(boolean visible, int height) {}

        @Override
        public void setLauncherKeepClearAreaHeight(boolean visible, int height) {}
        public void setLauncherKeepClearAreaHeight(boolean visible, int height) {
            executeRemoteCallWithTaskPermission(mController, "setLauncherKeepClearAreaHeight",
                    (controller) -> controller.setLauncherKeepClearAreaHeight(visible, height));
        }

        @Override
        public void setLauncherAppIconSize(int iconSizePx) {}
+6 −1
Original line number Diff line number Diff line
@@ -356,9 +356,14 @@ public class PipTouchHandler implements PipTransitionState.PipTransitionStateCha
        mPipTransitionState.setOnIdlePipTransitionStateRunnable(() -> {
            int delta = mPipBoundsState.getMovementBounds().bottom
                    - mPipBoundsState.getBounds().top;

            boolean hasUserInteracted = (mPipBoundsState.hasUserMovedPip()
                    || mPipBoundsState.hasUserResizedPip());

            if (!imeVisible && !hasUserInteracted) {
                delta = mPipBoundsAlgorithm.getEntryDestinationBounds().top
                        - mPipBoundsState.getBounds().top;
            }

            if ((imeVisible && delta < 0) || (!imeVisible && !hasUserInteracted)) {
                // The policy is to ignore an IME disappearing if user has interacted with PiP.
                // Otherwise, only offset due to an appearing IME if PiP occludes it.