Merge "Update handler callback to support clean-up aborted transitions" into tm-qpr-dev
This commit is contained in:
@@ -315,7 +315,7 @@ public class PipTransition extends PipTransitionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTransitionMerged(@NonNull IBinder transition) {
|
public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted) {
|
||||||
if (transition != mExitTransition) {
|
if (transition != mExitTransition) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -328,7 +328,7 @@ public class PipTransition extends PipTransitionController {
|
|||||||
}
|
}
|
||||||
// Unset exitTransition AFTER cancel so that finishResize knows we are merging.
|
// Unset exitTransition AFTER cancel so that finishResize knows we are merging.
|
||||||
mExitTransition = null;
|
mExitTransition = null;
|
||||||
if (!cancelled) return;
|
if (!cancelled || aborted) return;
|
||||||
final ActivityManager.RunningTaskInfo taskInfo = mPipOrganizer.getTaskInfo();
|
final ActivityManager.RunningTaskInfo taskInfo = mPipOrganizer.getTaskInfo();
|
||||||
if (taskInfo != null) {
|
if (taskInfo != null) {
|
||||||
startExpandAnimation(taskInfo, mPipOrganizer.getSurfaceControl(),
|
startExpandAnimation(taskInfo, mPipOrganizer.getSurfaceControl(),
|
||||||
|
|||||||
@@ -246,7 +246,9 @@ class SplitScreenTransitions {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onTransitionMerged(@NonNull IBinder transition) {
|
void onTransitionConsumed(@NonNull IBinder transition, boolean aborted) {
|
||||||
|
if (aborted) return;
|
||||||
|
|
||||||
// Once a pending enter transition got merged, make sure to append the reset of finishing
|
// Once a pending enter transition got merged, make sure to append the reset of finishing
|
||||||
// operations to the finish transition.
|
// operations to the finish transition.
|
||||||
if (transition == mPendingEnter) {
|
if (transition == mPendingEnter) {
|
||||||
|
|||||||
@@ -1574,8 +1574,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTransitionMerged(@NonNull IBinder transition) {
|
public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted) {
|
||||||
mSplitTransitions.onTransitionMerged(transition);
|
mSplitTransitions.onTransitionConsumed(transition, aborted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTransitionMerged(@NonNull IBinder transition) {
|
public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted) {
|
||||||
MixedTransition mixed = null;
|
MixedTransition mixed = null;
|
||||||
for (int i = mActiveTransitions.size() - 1; i >= 0; --i) {
|
for (int i = mActiveTransitions.size() - 1; i >= 0; --i) {
|
||||||
if (mActiveTransitions.get(i).mTransition != transition) continue;
|
if (mActiveTransitions.get(i).mTransition != transition) continue;
|
||||||
@@ -283,7 +283,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
|
|||||||
}
|
}
|
||||||
if (mixed == null) return;
|
if (mixed == null) return;
|
||||||
if (mixed.mType == MixedTransition.TYPE_ENTER_PIP_FROM_SPLIT) {
|
if (mixed.mType == MixedTransition.TYPE_ENTER_PIP_FROM_SPLIT) {
|
||||||
mPipHandler.onTransitionMerged(transition);
|
mPipHandler.onTransitionConsumed(transition, aborted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTransitionMerged(@NonNull IBinder transition) {
|
public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted) {
|
||||||
mRequestedRemotes.remove(transition);
|
mRequestedRemotes.remove(transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -516,15 +516,20 @@ public class Transitions implements RemoteCallable<Transitions> {
|
|||||||
active.mMerged = true;
|
active.mMerged = true;
|
||||||
active.mAborted = abort;
|
active.mAborted = abort;
|
||||||
if (active.mHandler != null) {
|
if (active.mHandler != null) {
|
||||||
active.mHandler.onTransitionMerged(active.mToken);
|
active.mHandler.onTransitionConsumed(active.mToken, abort);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mActiveTransitions.get(activeIdx).mAborted = abort;
|
final ActiveTransition active = mActiveTransitions.get(activeIdx);
|
||||||
|
active.mAborted = abort;
|
||||||
|
if (active.mAborted && active.mHandler != null) {
|
||||||
|
// Notifies to clean-up the aborted transition.
|
||||||
|
active.mHandler.onTransitionConsumed(transition, true /* aborted */);
|
||||||
|
}
|
||||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
|
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
|
||||||
"Transition animation finished (abort=%b), notifying core %s", abort, transition);
|
"Transition animation finished (abort=%b), notifying core %s", abort, transition);
|
||||||
// Merge all relevant transactions together
|
// Merge all relevant transactions together
|
||||||
SurfaceControl.Transaction fullFinish = mActiveTransitions.get(activeIdx).mFinishT;
|
SurfaceControl.Transaction fullFinish = active.mFinishT;
|
||||||
for (int iA = activeIdx + 1; iA < mActiveTransitions.size(); ++iA) {
|
for (int iA = activeIdx + 1; iA < mActiveTransitions.size(); ++iA) {
|
||||||
final ActiveTransition toMerge = mActiveTransitions.get(iA);
|
final ActiveTransition toMerge = mActiveTransitions.get(iA);
|
||||||
if (!toMerge.mMerged) break;
|
if (!toMerge.mMerged) break;
|
||||||
@@ -553,6 +558,10 @@ public class Transitions implements RemoteCallable<Transitions> {
|
|||||||
while (mActiveTransitions.size() > activeIdx
|
while (mActiveTransitions.size() > activeIdx
|
||||||
&& mActiveTransitions.get(activeIdx).mAborted) {
|
&& mActiveTransitions.get(activeIdx).mAborted) {
|
||||||
ActiveTransition aborted = mActiveTransitions.remove(activeIdx);
|
ActiveTransition aborted = mActiveTransitions.remove(activeIdx);
|
||||||
|
// Notifies to clean-up the aborted transition.
|
||||||
|
if (aborted.mHandler != null) {
|
||||||
|
aborted.mHandler.onTransitionConsumed(transition, true /* aborted */);
|
||||||
|
}
|
||||||
mOrganizer.finishTransition(aborted.mToken, null /* wct */, null /* wctCB */);
|
mOrganizer.finishTransition(aborted.mToken, null /* wct */, null /* wctCB */);
|
||||||
}
|
}
|
||||||
if (mActiveTransitions.size() <= activeIdx) {
|
if (mActiveTransitions.size() <= activeIdx) {
|
||||||
@@ -735,9 +744,10 @@ public class Transitions implements RemoteCallable<Transitions> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a transition which was already "claimed" by this handler has been merged
|
* Called when a transition which was already "claimed" by this handler has been merged
|
||||||
* into another animation. Gives this handler a chance to clean-up any expectations.
|
* into another animation or has been aborted. Gives this handler a chance to clean-up any
|
||||||
|
* expectations.
|
||||||
*/
|
*/
|
||||||
default void onTransitionMerged(@NonNull IBinder transition) { }
|
default void onTransitionConsumed(@NonNull IBinder transition, boolean aborted) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets transition animation scale settings value to handler.
|
* Sets transition animation scale settings value to handler.
|
||||||
|
|||||||
Reference in New Issue
Block a user