Merge "Let default transition handler animate customized animation" into udc-dev am: bfd848999e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23563396

Change-Id: I1b74e7130ff8527ba47c8273f28a4950c6414aa6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Riddle Hsu
2023-06-06 16:35:52 +00:00
committed by Automerger Merge Worker
2 changed files with 19 additions and 2 deletions

View File

@@ -20,6 +20,8 @@ import static android.app.ActivityOptions.ANIM_SCENE_TRANSITION;
import static android.window.TransitionInfo.FLAG_FILLS_TASK; import static android.window.TransitionInfo.FLAG_FILLS_TASK;
import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;
import static com.android.wm.shell.transition.DefaultTransitionHandler.isSupportedOverrideAnimation;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
import android.content.Context; import android.content.Context;
@@ -113,8 +115,11 @@ public class ActivityEmbeddingController implements Transitions.TransitionHandle
return false; return false;
} }
final TransitionInfo.AnimationOptions options = info.getAnimationOptions(); final TransitionInfo.AnimationOptions options = info.getAnimationOptions();
if (options != null && options.getType() == ANIM_SCENE_TRANSITION) { if (options != null
// Scene-transition will be handled by app side. // Scene-transition will be handled by app side.
&& (options.getType() == ANIM_SCENE_TRANSITION
// Use default transition handler to animate override animation.
|| isSupportedOverrideAnimation(options))) {
return false; return false;
} }

View File

@@ -873,6 +873,18 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
} }
} }
/**
* Returns {@code true} if the default transition handler can run the override animation.
* @see #loadAnimation(TransitionInfo, TransitionInfo.Change, int, boolean)
*/
public static boolean isSupportedOverrideAnimation(
@NonNull TransitionInfo.AnimationOptions options) {
final int animType = options.getType();
return animType == ANIM_CUSTOM || animType == ANIM_SCALE_UP
|| animType == ANIM_THUMBNAIL_SCALE_UP || animType == ANIM_THUMBNAIL_SCALE_DOWN
|| animType == ANIM_CLIP_REVEAL || animType == ANIM_OPEN_CROSS_PROFILE_APPS;
}
private static void applyTransformation(long time, SurfaceControl.Transaction t, private static void applyTransformation(long time, SurfaceControl.Transaction t,
SurfaceControl leash, Animation anim, Transformation transformation, float[] matrix, SurfaceControl leash, Animation anim, Transformation transformation, float[] matrix,
Point position, float cornerRadius, @Nullable Rect immutableClipRect) { Point position, float cornerRadius, @Nullable Rect immutableClipRect) {