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

Commit e06cbf59 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Send flag to disable gestures when split layout is animating

* Previously we were only sending the signal when starting/opening
split apps.
* Now sending it also for divider swap and switching between apps
in flex split and general divider flings

Test: Manual
Bug: 391894192
Flag: EXEMPT bugfix
Change-Id: Icb41f68e06b6c3ff4a5ff96047f4fa44ed8ff8c2
parent f8f213e1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -968,6 +968,12 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                )
        );
        mDividerFlingAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                mParentContainerCallbacks.onSplitLayoutAnimating(true /*animating*/);
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                if (flingFinishedCallback != null) {
@@ -976,11 +982,13 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                mInteractionJankMonitor.end(
                        CUJ_SPLIT_SCREEN_RESIZE);
                mDividerFlingAnimator = null;
                mParentContainerCallbacks.onSplitLayoutAnimating(false /*animating*/);
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                mDividerFlingAnimator = null;
                mParentContainerCallbacks.onSplitLayoutAnimating(false /*animating*/);
            }
        });
        mDividerFlingAnimator.start();
+2 −0
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ public final class SplitWindowManager extends WindowlessWindowManager {
        void onLeashReady(SurfaceControl leash);
        /** Inflates the given touch zone on the appropriate stage root. */
        void inflateOnStageRoot(OffscreenTouchZone touchZone);
        /** Called when any visual animations w/ split layout are happening. */
        void onSplitLayoutAnimating(boolean animating);
    }

    public SplitWindowManager(String windowName, Context context, Configuration config,
+1 −1
Original line number Diff line number Diff line
@@ -501,7 +501,7 @@ class SplitScreenTransitions {

            mPendingEnter.onConsumed(aborted);
            mPendingEnter = null;
            mStageCoordinator.notifySplitAnimationFinished();
            mStageCoordinator.notifySplitAnimationStatus(false /*animationRunning*/);
            ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTransitionConsumed for enter transition");
        } else if (isPendingDismiss(transition)) {
            mPendingDismiss.onConsumed(aborted);
+18 −9
Original line number Diff line number Diff line
@@ -374,6 +374,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                            rootTaskInfo.configuration, mSyncQueue,
                            touchZone.isTopLeft() ? topLeftLeash : bottomRightLeash);
                }

                @Override
                public void onSplitLayoutAnimating(boolean animating) {
                    notifySplitAnimationStatus(animating);
                }
            };

    protected StageCoordinator(Context context, int displayId, SyncTransactionQueue syncQueue,
@@ -1359,6 +1364,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        // layers anymore. populateTouchZones() is called in the end callback to inflate new touch
        // layers in the appropriate places.
        mSplitLayout.removeTouchZones();
        notifySplitAnimationStatus(true /*animationRunning*/);

        mSplitLayout.playSwapAnimation(t, topLeftStage, bottomRightStage,
                insets -> {
@@ -1380,6 +1386,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                        mSplitLayout.updateStateWithCurrentPosition();
                        updateSurfaceBounds(mSplitLayout, st, false /* applyResizingOffset */);
                        mSplitLayout.populateTouchZones();
                        notifySplitAnimationStatus(false /*animationRunning*/);

                        // updateSurfaceBounds(), above, officially puts the two apps in their new
                        // stages. Starting on the next frame, all calculations are made using the
@@ -3321,7 +3328,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,

                mMixedHandler.animatePendingEnterPipFromSplit(transition, info,
                        startTransaction, finishTransaction, finishCallback, keepSplitWithPip);
                notifySplitAnimationFinished();
                notifySplitAnimationStatus(false /*animationRunning*/);
                return true;
            }

@@ -3378,7 +3385,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                //                    the transition, or synchronize task-org callbacks.
            }
            // Use normal animations.
            notifySplitAnimationFinished();
            notifySplitAnimationStatus(false /*animationRunning*/);
            return false;
        } else if (mMixedHandler != null && TransitionUtil.hasDisplayChange(info)) {
            // A display-change has been un-expectedly inserted into the transition. Redirect
@@ -3392,7 +3399,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    mSplitLayout.update(startTransaction, true /* resetImePosition */);
                    startTransaction.apply();
                }
                notifySplitAnimationFinished();
                notifySplitAnimationStatus(false /*animationRunning*/);
                return true;
            }
        } else if (mSplitTransitions.isPendingPassThrough(transition)) {
@@ -3400,7 +3407,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    "startAnimation: passThrough transition=%d", info.getDebugId());
            mSplitTransitions.mPendingRemotePassthrough.mRemoteHandler.startAnimation(transition,
                    info, startTransaction, finishTransaction, finishCallback);
            notifySplitAnimationFinished();
            notifySplitAnimationStatus(false /*animationRunning*/);
            return true;
        }

@@ -3669,7 +3676,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        enterTransition.setFinishedCallback((callbackWct, callbackT) -> {
            if (!enterTransition.mResizeAnim) {
                // If resizing, we'll call notify at the end of the resizing animation (below)
                notifySplitAnimationFinished();
                notifySplitAnimationStatus(false /*animationRunning*/);
            }
            if (finalMainChild != null) {
                if (!mainNotContainOpenTask) {
@@ -3692,7 +3699,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            }
            if (enterTransition.mResizeAnim) {
                mShowDecorImmediately = true;
                mSplitLayout.flingDividerToCenter(this::notifySplitAnimationFinished);
                mSplitLayout.flingDividerToCenter(() -> {
                    notifySplitAnimationStatus(false /*animationRunning*/);
                });
            }
            callbackWct.setReparentLeafTaskIfRelaunch(mSplitMultiDisplayHelper
                    .getDisplayRootTaskInfo(DEFAULT_DISPLAY).token, false);
@@ -4211,15 +4220,15 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,

    private void handleUnsupportedSplitStart() {
        mSplitUnsupportedToast.show();
        notifySplitAnimationFinished();
        notifySplitAnimationStatus(false /*animationRunning*/);
    }

    void notifySplitAnimationFinished() {
    void notifySplitAnimationStatus(boolean animationRunning) {
        if (mSplitInvocationListener == null || mSplitInvocationListenerExecutor == null) {
            return;
        }
        mSplitInvocationListenerExecutor.execute(() ->
                mSplitInvocationListener.onSplitAnimationInvoked(false /*animationRunning*/));
                mSplitInvocationListener.onSplitAnimationInvoked(animationRunning));
    }

    /**