diff options
author | 2023-09-20 15:00:21 +0800 | |
---|---|---|
committer | 2023-09-25 16:03:05 +0800 | |
commit | df291c526410b3b2f50d87534f6896f8d3cae97d (patch) | |
tree | d9e34163a61acafb19628c776dfc43bb4867037c | |
parent | 1d9b476c764a31b26b8bebcdb65545562c9bef37 (diff) |
Ask remote transition handler to handle transiton in MixedHandler
When DefaultMixedHandler#handleRequest is going to handle a remote
transition, also ask remote transition handler to handle the remote
transition, so if the leftover handler cannot handle the transition,
the remote transition handler can have chance to handle it.
Bug: 301047305
Test: create a split screen pair, then launch app from notification,
verify remote transition handler can play the transition while split
cannot handle it.
Test: create a split screen pair with one of app is pip-able, then
launch app from notification, verify the app can enter pip, and the
remote transition handle can play the open transition animation.
Change-Id: I84a4b7c26c57498d17baca58811db19f00aa2714
-rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java index 986560bd6053..c45770280c85 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java @@ -113,6 +113,14 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler, 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); + } } } |