Merge "Make sure the mixedtransition record is removed" into udc-dev

This commit is contained in:
Evan Rosky
2023-03-04 07:47:24 +00:00
committed by Android (Google) Code Review

View File

@@ -78,7 +78,6 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
int mAnimType = 0; int mAnimType = 0;
final IBinder mTransition; final IBinder mTransition;
Transitions.TransitionFinishCallback mFinishCallback = null;
Transitions.TransitionHandler mLeftoversHandler = null; Transitions.TransitionHandler mLeftoversHandler = null;
WindowContainerTransaction mFinishWCT = null; WindowContainerTransaction mFinishWCT = null;
@@ -241,20 +240,25 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
} }
if (pipChange == null) { if (pipChange == null) {
if (mixed.mLeftoversHandler != null) { if (mixed.mLeftoversHandler != null) {
return mixed.mLeftoversHandler.startAnimation(mixed.mTransition, info, if (mixed.mLeftoversHandler.startAnimation(mixed.mTransition,
startTransaction, finishTransaction, finishCallback); info, startTransaction, finishTransaction, (wct, wctCB) -> {
mActiveTransitions.remove(mixed);
finishCallback.onTransitionFinished(wct, wctCB);
})) {
return true;
}
} }
mActiveTransitions.remove(mixed);
return false; return false;
} }
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Splitting PIP into a separate" ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Splitting PIP into a separate"
+ " animation because remote-animation likely doesn't support it"); + " animation because remote-animation likely doesn't support it");
mixed.mFinishCallback = finishCallback;
Transitions.TransitionFinishCallback finishCB = (wct, wctCB) -> { Transitions.TransitionFinishCallback finishCB = (wct, wctCB) -> {
--mixed.mInFlightSubAnimations; --mixed.mInFlightSubAnimations;
mixed.joinFinishArgs(wct, wctCB); mixed.joinFinishArgs(wct, wctCB);
if (mixed.mInFlightSubAnimations > 0) return; if (mixed.mInFlightSubAnimations > 0) return;
mActiveTransitions.remove(mixed); mActiveTransitions.remove(mixed);
mixed.mFinishCallback.onTransitionFinished(mixed.mFinishWCT, wctCB); finishCallback.onTransitionFinished(mixed.mFinishWCT, wctCB);
}; };
// Split the transition into 2 parts: the pip part and the rest. // Split the transition into 2 parts: the pip part and the rest.
mixed.mInFlightSubAnimations = 2; mixed.mInFlightSubAnimations = 2;
@@ -304,10 +308,10 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
} }
if (pipChange == null) { if (pipChange == null) {
// um, something probably went wrong. // um, something probably went wrong.
mActiveTransitions.remove(mixed);
return false; return false;
} }
final boolean isGoingHome = homeIsOpening; final boolean isGoingHome = homeIsOpening;
mixed.mFinishCallback = finishCallback;
Transitions.TransitionFinishCallback finishCB = (wct, wctCB) -> { Transitions.TransitionFinishCallback finishCB = (wct, wctCB) -> {
--mixed.mInFlightSubAnimations; --mixed.mInFlightSubAnimations;
mixed.joinFinishArgs(wct, wctCB); mixed.joinFinishArgs(wct, wctCB);
@@ -316,7 +320,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
if (isGoingHome) { if (isGoingHome) {
mSplitHandler.onTransitionAnimationComplete(); mSplitHandler.onTransitionAnimationComplete();
} }
mixed.mFinishCallback.onTransitionFinished(mixed.mFinishWCT, wctCB); finishCallback.onTransitionFinished(mixed.mFinishWCT, wctCB);
}; };
if (isGoingHome) { if (isGoingHome) {
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Animation is actually mixed " ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Animation is actually mixed "
@@ -408,7 +412,6 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
unlinkMissingParents(everythingElse); unlinkMissingParents(everythingElse);
final MixedTransition mixed = new MixedTransition( final MixedTransition mixed = new MixedTransition(
MixedTransition.TYPE_DISPLAY_AND_SPLIT_CHANGE, transition); MixedTransition.TYPE_DISPLAY_AND_SPLIT_CHANGE, transition);
mixed.mFinishCallback = finishCallback;
mActiveTransitions.add(mixed); mActiveTransitions.add(mixed);
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Animation is a mix of display change " ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Animation is a mix of display change "
+ "and split change."); + "and split change.");
@@ -420,7 +423,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
mixed.joinFinishArgs(wct, wctCB); mixed.joinFinishArgs(wct, wctCB);
if (mixed.mInFlightSubAnimations > 0) return; if (mixed.mInFlightSubAnimations > 0) return;
mActiveTransitions.remove(mixed); mActiveTransitions.remove(mixed);
mixed.mFinishCallback.onTransitionFinished(mixed.mFinishWCT, null /* wctCB */); finishCallback.onTransitionFinished(mixed.mFinishWCT, null /* wctCB */);
}; };
// Dispatch the display change. This will most-likely be taken by the default handler. // Dispatch the display change. This will most-likely be taken by the default handler.