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

Commit fd011456 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Ask remote transition handler to handle transiton in MixedHandler" into udc-qpr-dev

parents 19ae03e5 df291c52
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -112,6 +112,14 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
        Transitions.TransitionHandler mLeftoversHandler = null;
        WindowContainerTransaction mFinishWCT = null;

        /**
         * Whether the transition has request for remote transition while mLeftoversHandler
         * isn't remote transition handler.
         * If true and the mLeftoversHandler can handle the transition, need to notify remote
         * transition handler to consume the transition.
         */
        boolean mHasRequestToRemote;

        /**
         * Mixed transitions are made up of multiple "parts". This keeps track of how many
         * parts are currently animating.
@@ -204,6 +212,10 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
                    MixedTransition.TYPE_OPTIONS_REMOTE_AND_PIP_CHANGE, transition);
            mixed.mLeftoversHandler = handler.first;
            mActiveTransitions.add(mixed);
            if (mixed.mLeftoversHandler != mPlayer.getRemoteTransitionHandler()) {
                mixed.mHasRequestToRemote = true;
                mPlayer.getRemoteTransitionHandler().handleRequest(transition, request);
            }
            return handler.second;
        } else if (mSplitHandler.isSplitScreenVisible()
                && isOpeningType(request.getType())
@@ -331,8 +343,17 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
        } else if (mixed.mType == MixedTransition.TYPE_DISPLAY_AND_SPLIT_CHANGE) {
            return false;
        } else if (mixed.mType == MixedTransition.TYPE_OPTIONS_REMOTE_AND_PIP_CHANGE) {
            return animateOpenIntentWithRemoteAndPip(mixed, info, startTransaction,
                    finishTransaction, finishCallback);
            final boolean handledToPip = animateOpenIntentWithRemoteAndPip(mixed, info,
                    startTransaction, finishTransaction, finishCallback);
            // Consume the transition on remote handler if the leftover handler already handle this
            // transition. And if it cannot, the transition will be handled by remote handler, so
            // don't consume here.
            // Need to check leftOverHandler as it may change in #animateOpenIntentWithRemoteAndPip
            if (handledToPip && mixed.mHasRequestToRemote
                    && mixed.mLeftoversHandler != mPlayer.getRemoteTransitionHandler()) {
                mPlayer.getRemoteTransitionHandler().onTransitionConsumed(transition, false, null);
            }
            return handledToPip;
        } else if (mixed.mType == MixedTransition.TYPE_RECENTS_DURING_SPLIT) {
            for (int i = info.getChanges().size() - 1; i >= 0; --i) {
                final TransitionInfo.Change change = info.getChanges().get(i);
@@ -804,5 +825,8 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
        } else if (mixed.mType == MixedTransition.TYPE_UNFOLD) {
            mUnfoldHandler.onTransitionConsumed(transition, aborted, finishT);
        }
        if (mixed.mHasRequestToRemote) {
            mPlayer.getRemoteTransitionHandler().onTransitionConsumed(transition, aborted, finishT);
        }
    }
}