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

Commit d3d9ba02 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Send flag to disable gestures when split layout is animating" into main

parents b5aff7b0 e06cbf59
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -979,6 +979,12 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                )
                )
        );
        );
        mDividerFlingAnimator.addListener(new AnimatorListenerAdapter() {
        mDividerFlingAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                mParentContainerCallbacks.onSplitLayoutAnimating(true /*animating*/);
            }

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


            @Override
            @Override
            public void onAnimationCancel(Animator animation) {
            public void onAnimationCancel(Animator animation) {
                mDividerFlingAnimator = null;
                mDividerFlingAnimator = null;
                mParentContainerCallbacks.onSplitLayoutAnimating(false /*animating*/);
            }
            }
        });
        });
        mDividerFlingAnimator.start();
        mDividerFlingAnimator.start();
+2 −0
Original line number Original line Diff line number Diff line
@@ -69,6 +69,8 @@ public final class SplitWindowManager extends WindowlessWindowManager {
        void onLeashReady(SurfaceControl leash);
        void onLeashReady(SurfaceControl leash);
        /** Inflates the given touch zone on the appropriate stage root. */
        /** Inflates the given touch zone on the appropriate stage root. */
        void inflateOnStageRoot(OffscreenTouchZone touchZone);
        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,
    public SplitWindowManager(String windowName, Context context, Configuration config,
+1 −1
Original line number Original line Diff line number Diff line
@@ -501,7 +501,7 @@ class SplitScreenTransitions {


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

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


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


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


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


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


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


@@ -3755,7 +3762,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        enterTransition.setFinishedCallback((callbackWct, callbackT) -> {
        enterTransition.setFinishedCallback((callbackWct, callbackT) -> {
            if (!enterTransition.mResizeAnim) {
            if (!enterTransition.mResizeAnim) {
                // If resizing, we'll call notify at the end of the resizing animation (below)
                // If resizing, we'll call notify at the end of the resizing animation (below)
                notifySplitAnimationFinished();
                notifySplitAnimationStatus(false /*animationRunning*/);
            }
            }
            if (finalMainChild != null) {
            if (finalMainChild != null) {
                if (!mainNotContainOpenTask) {
                if (!mainNotContainOpenTask) {
@@ -3778,7 +3785,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            }
            }
            if (enterTransition.mResizeAnim) {
            if (enterTransition.mResizeAnim) {
                mShowDecorImmediately = true;
                mShowDecorImmediately = true;
                mSplitLayout.flingDividerToCenter(this::notifySplitAnimationFinished);
                mSplitLayout.flingDividerToCenter(() -> {
                    notifySplitAnimationStatus(false /*animationRunning*/);
                });
            }
            }
            int displayId = SplitMultiDisplayHelper.getTransitionDisplayId(info);
            int displayId = SplitMultiDisplayHelper.getTransitionDisplayId(info);
            callbackWct.setReparentLeafTaskIfRelaunch(mSplitMultiDisplayHelper
            callbackWct.setReparentLeafTaskIfRelaunch(mSplitMultiDisplayHelper
@@ -4304,15 +4313,15 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,


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


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


    /**
    /**