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

Commit b1afc90b authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Empty motion bounds when PiP bounds changed

When PipTouchHandler#movePip is triggered, the motion bounds will be set
and never gets reset. The littering motion bounds therefore blocks any
double-tap resize.

Fix this by empty the motion bounds whenever the resize transition is
finished.

Cleanup also the pip1 references in pip2 PipTouchHandler

Flag: com.android.wm.shell.enable_pip2
Bug: 404338655
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/c4UUsVjSRd2t7XMPLwIe90
Test: Drag and pinch-resize PiP, see Video
Change-Id: I92854665eefd5d4c05cc6a055cf11ec52df7a5a3
parent 62041833
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -787,6 +787,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
            case PipTransitionState.CHANGED_PIP_BOUNDS:
                // Check whether changed bounds imply we need to update stash state too.
                stashEndActionIfNeeded();
                settlePipBoundsAfterPhysicsAnimation(false /* animatingAfter */);
                break;
        }
    }
+0 −19
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.PIP_ST
import static com.android.wm.shell.common.pip.PipBoundsState.STASH_TYPE_LEFT;
import static com.android.wm.shell.common.pip.PipBoundsState.STASH_TYPE_NONE;
import static com.android.wm.shell.common.pip.PipBoundsState.STASH_TYPE_RIGHT;
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_TO_PIP;
import static com.android.wm.shell.pip2.phone.PhonePipMenuController.MENU_STATE_FULL;
import static com.android.wm.shell.pip2.phone.PhonePipMenuController.MENU_STATE_NONE;
import static com.android.wm.shell.pip2.phone.PipMenuView.ANIM_TYPE_NONE;
@@ -67,8 +66,6 @@ import com.android.wm.shell.common.pip.PipPerfHintController;
import com.android.wm.shell.common.pip.PipUiEventLogger;
import com.android.wm.shell.common.pip.PipUtils;
import com.android.wm.shell.common.pip.SizeSpecSource;
import com.android.wm.shell.pip.PipAnimationController;
import com.android.wm.shell.pip.PipTransitionController;
import com.android.wm.shell.sysui.ShellCommandHandler;
import com.android.wm.shell.sysui.ShellInit;

@@ -303,11 +300,6 @@ public class PipTouchHandler implements PipTransitionState.PipTransitionStateCha
                });
    }

    public PipTransitionController getTransitionHandler() {
        // return mPipTaskOrganizer.getTransitionController();
        return null;
    }

    private void reloadResources() {
        final Resources res = mContext.getResources();
        mBottomOffsetBufferPx = res.getDimensionPixelSize(R.dimen.pip_bottom_offset_buffer);
@@ -358,17 +350,6 @@ public class PipTouchHandler implements PipTransitionState.PipTransitionStateCha
        mPipBoundsState.setHasUserResizedPip(false);
    }

    void onPinnedStackAnimationEnded(
            @PipAnimationController.TransitionDirection int direction) {
        // Always synchronize the motion helper bounds once PiP animations finish
        mMotionHelper.synchronizePinnedStackBounds();
        updateMovementBounds();
        if (direction == TRANSITION_DIRECTION_TO_PIP) {
            // Set the initial bounds as the user resize bounds.
            mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
        }
    }

    void onConfigurationChanged() {
        mPipResizeGestureHandler.onConfigurationChanged();
        mMotionHelper.synchronizePinnedStackBounds();