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

Commit 85d3998a authored by Winson Chung's avatar Winson Chung
Browse files

Prevent PiP movement while the resize animation is running.

- This was causing numerous artifacts when the user starts touching while
  transitioning into PiP where the move rects clobber the animating rect.

Bug: 35764922
Test: Try touching the PiP while it is entering or exiting PiP
Change-Id: I5a72b5bea694b01aab401d2bb78a493688a9c655
parent c20082bd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -522,6 +522,7 @@ interface IActivityManager {
    void startLocalVoiceInteraction(in IBinder token, in Bundle options);
    void stopLocalVoiceInteraction(in IBinder token);
    boolean supportsLocalVoiceInteraction();
    void notifyPinnedStackAnimationStarted();
    void notifyPinnedStackAnimationEnded();
    void removeStack(int stackId);
    void makePackageIdle(String packageName, int userId);
+5 −0
Original line number Diff line number Diff line
@@ -37,6 +37,11 @@ oneway interface ITaskStackListener {
     */
    void onPinnedActivityRestartAttempt(String launchedFromPackage);

    /**
     * Called whenever the pinned stack is starting animating a resize.
     */
    void onPinnedStackAnimationStarted();

    /**
     * Called whenever the pinned stack is done animating a resize.
     */
+4 −0
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub {
    public void onPinnedActivityRestartAttempt(String launchedFromPackage) throws RemoteException {
    }

    @Override
    public void onPinnedStackAnimationStarted() throws RemoteException {
    }

    @Override
    public void onPinnedStackAnimationEnded() throws RemoteException {
    }
+8 −1
Original line number Diff line number Diff line
@@ -70,9 +70,16 @@ public class PipManager implements BasePipManager {
            mMediaController.onActivityPinned();
        }

        @Override
        public void onPinnedStackAnimationStarted() {
            // Disable touches while the animation is running
            mTouchHandler.setTouchEnabled(false);
        }

        @Override
        public void onPinnedStackAnimationEnded() {
            // TODO(winsonc): Disable touch interaction with the PiP until the animation ends
            // Re-enable touches after the animation completes
            mTouchHandler.setTouchEnabled(true);
        }

        @Override
+17 −0
Original line number Diff line number Diff line
@@ -181,6 +181,10 @@ public class PipTouchHandler {
        registerInputConsumer();
    }

    public void setTouchEnabled(boolean enabled) {
        mTouchState.setAllowTouches(enabled);
    }

    public void onActivityPinned() {
        // Reset some states once we are pinned
        if (mIsTappingThrough) {
@@ -294,6 +298,7 @@ public class PipTouchHandler {
                // Fall through to clean up
            }
            case MotionEvent.ACTION_CANCEL: {
                mTouchState.reset();
                break;
            }
        }
@@ -418,6 +423,10 @@ public class PipTouchHandler {

        @Override
        public void onDown(PipTouchState touchState) {
            if (!touchState.isUserInteracting()) {
                return;
            }

            if (ENABLE_DRAG_TO_DISMISS) {
                mDismissViewController.createDismissTarget();
                mHandler.postDelayed(mShowDismissAffordance, SHOW_DISMISS_AFFORDANCE_DELAY);
@@ -426,6 +435,10 @@ public class PipTouchHandler {

        @Override
        boolean onMove(PipTouchState touchState) {
            if (!touchState.isUserInteracting()) {
                return false;
            }

            if (touchState.startedDragging()) {
                mSavedSnapFraction = -1f;
            }
@@ -458,6 +471,10 @@ public class PipTouchHandler {

        @Override
        public boolean onUp(PipTouchState touchState) {
            if (!touchState.isUserInteracting()) {
                return false;
            }

            try {
                if (ENABLE_DRAG_TO_DISMISS) {
                    mHandler.removeCallbacks(mShowDismissAffordance);
Loading