Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/JetpackTaskFragmentOrganizer.java +11 −15 Original line number Diff line number Diff line Loading @@ -398,7 +398,6 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { new TaskFragmentAnimationParams.Builder(); final int animationBackgroundColor = getAnimationBackgroundColor(splitAttributes); builder.setAnimationBackgroundColor(animationBackgroundColor); if (Flags.activityEmbeddingAnimationCustomizationFlag()) { final int openAnimationResId = splitAttributes.getAnimationParams().getOpenAnimationResId(); builder.setOpenAnimationResId(openAnimationResId); Loading @@ -408,17 +407,14 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { final int changeAnimationResId = splitAttributes.getAnimationParams().getChangeAnimationResId(); builder.setChangeAnimationResId(changeAnimationResId); } return builder.build(); } @ColorInt private static int getAnimationBackgroundColor(@NonNull SplitAttributes splitAttributes) { int animationBackgroundColor = DEFAULT_ANIMATION_BACKGROUND_COLOR; AnimationBackground animationBackground = splitAttributes.getAnimationBackground(); if (Flags.activityEmbeddingAnimationCustomizationFlag()) { animationBackground = splitAttributes.getAnimationParams().getAnimationBackground(); } final AnimationBackground animationBackground = splitAttributes.getAnimationParams().getAnimationBackground(); if (animationBackground instanceof AnimationBackground.ColorBackground colorBackground) { animationBackgroundColor = colorBackground.getColor(); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/activityembedding/ActivityEmbeddingAnimationRunner.java +7 −17 Original line number Diff line number Diff line Loading @@ -268,11 +268,8 @@ class ActivityEmbeddingAnimationRunner { final Animation animation = animationProvider.get(info, change, openingWholeScreenBounds); if (shouldUseJumpCutForAnimation(animation)) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { return new ArrayList<>(); } continue; } final ActivityEmbeddingAnimationAdapter adapter = createOpenCloseAnimationAdapter( info, change, animation, openingWholeScreenBounds); if (isOpening) { Loading @@ -296,11 +293,8 @@ class ActivityEmbeddingAnimationRunner { final Animation animation = animationProvider.get(info, change, closingWholeScreenBounds); if (shouldUseJumpCutForAnimation(animation)) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { return new ArrayList<>(); } continue; } final ActivityEmbeddingAnimationAdapter adapter = createOpenCloseAnimationAdapter( info, change, animation, closingWholeScreenBounds); if (!isOpening) { Loading Loading @@ -455,13 +449,11 @@ class ActivityEmbeddingAnimationRunner { final Animation[] animations = mAnimationSpec.createChangeBoundsChangeAnimations(info, change, parentBounds); // Jump cut if either animation has zero for duration. if (Flags.activityEmbeddingAnimationCustomizationFlag()) { for (Animation animation : animations) { if (shouldUseJumpCutForAnimation(animation)) { return new ArrayList<>(); } } } // Keep track as we might need to add background color for the animation. // Although there may be multiple change animation, record one of them is sufficient // because the background color will be added to the root leash for the whole animation. Loading Loading @@ -516,11 +508,9 @@ class ActivityEmbeddingAnimationRunner { mAnimationSpec.createChangeBoundsOpenAnimation(info, change, parentBounds); shouldShowBackgroundColor = false; } if (Flags.activityEmbeddingAnimationCustomizationFlag()) { if (shouldUseJumpCutForAnimation(animation)) { return new ArrayList<>(); } } adapters.add(new ActivityEmbeddingAnimationAdapter(animation, change, TransitionUtil.getRootFor(change, info))); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/activityembedding/ActivityEmbeddingAnimationSpec.java +15 −25 Original line number Diff line number Diff line Loading @@ -96,12 +96,10 @@ class ActivityEmbeddingAnimationSpec { @NonNull Animation createChangeBoundsOpenAnimation(@NonNull TransitionInfo info, @NonNull TransitionInfo.Change change, @NonNull Rect parentBounds) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { final Animation customAnimation = loadCustomAnimation(info, change, TRANSIT_CHANGE); if (customAnimation != null) { return customAnimation; } } // Use end bounds for opening. final Rect bounds = change.getEndAbsBounds(); final int startLeft; Loading Loading @@ -130,12 +128,10 @@ class ActivityEmbeddingAnimationSpec { @NonNull Animation createChangeBoundsCloseAnimation(@NonNull TransitionInfo info, @NonNull TransitionInfo.Change change, @NonNull Rect parentBounds) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { final Animation customAnimation = loadCustomAnimation(info, change, TRANSIT_CHANGE); if (customAnimation != null) { return customAnimation; } } // Use start bounds for closing. final Rect bounds = change.getStartAbsBounds(); final int endTop; Loading Loading @@ -168,7 +164,6 @@ class ActivityEmbeddingAnimationSpec { @NonNull Animation[] createChangeBoundsChangeAnimations(@NonNull TransitionInfo info, @NonNull TransitionInfo.Change change, @NonNull Rect parentBounds) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { // TODO(b/293658614): Support more complicated animations that may need more than a noop // animation as the start leash. final Animation noopAnimation = createNoopAnimation(change); Loading @@ -176,7 +171,6 @@ class ActivityEmbeddingAnimationSpec { if (customAnimation != null) { return new Animation[]{noopAnimation, customAnimation}; } } // Both start bounds and end bounds are in screen coordinates. We will post translate // to the local coordinates in ActivityEmbeddingAnimationAdapter#onAnimationUpdate final Rect startBounds = change.getStartAbsBounds(); Loading Loading @@ -320,13 +314,9 @@ class ActivityEmbeddingAnimationSpec { } final Animation anim; if (Flags.activityEmbeddingAnimationCustomizationFlag()) { // TODO(b/293658614): Consider allowing custom animations from non-default packages. // Enforce limiting to animations from the default "android" package for now. anim = mTransitionAnimation.loadDefaultAnimationRes(resId); } else { anim = mTransitionAnimation.loadAnimationRes(options.getPackageName(), resId); } if (anim != null) { return anim; } Loading Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/JetpackTaskFragmentOrganizer.java +11 −15 Original line number Diff line number Diff line Loading @@ -398,7 +398,6 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { new TaskFragmentAnimationParams.Builder(); final int animationBackgroundColor = getAnimationBackgroundColor(splitAttributes); builder.setAnimationBackgroundColor(animationBackgroundColor); if (Flags.activityEmbeddingAnimationCustomizationFlag()) { final int openAnimationResId = splitAttributes.getAnimationParams().getOpenAnimationResId(); builder.setOpenAnimationResId(openAnimationResId); Loading @@ -408,17 +407,14 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { final int changeAnimationResId = splitAttributes.getAnimationParams().getChangeAnimationResId(); builder.setChangeAnimationResId(changeAnimationResId); } return builder.build(); } @ColorInt private static int getAnimationBackgroundColor(@NonNull SplitAttributes splitAttributes) { int animationBackgroundColor = DEFAULT_ANIMATION_BACKGROUND_COLOR; AnimationBackground animationBackground = splitAttributes.getAnimationBackground(); if (Flags.activityEmbeddingAnimationCustomizationFlag()) { animationBackground = splitAttributes.getAnimationParams().getAnimationBackground(); } final AnimationBackground animationBackground = splitAttributes.getAnimationParams().getAnimationBackground(); if (animationBackground instanceof AnimationBackground.ColorBackground colorBackground) { animationBackgroundColor = colorBackground.getColor(); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/activityembedding/ActivityEmbeddingAnimationRunner.java +7 −17 Original line number Diff line number Diff line Loading @@ -268,11 +268,8 @@ class ActivityEmbeddingAnimationRunner { final Animation animation = animationProvider.get(info, change, openingWholeScreenBounds); if (shouldUseJumpCutForAnimation(animation)) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { return new ArrayList<>(); } continue; } final ActivityEmbeddingAnimationAdapter adapter = createOpenCloseAnimationAdapter( info, change, animation, openingWholeScreenBounds); if (isOpening) { Loading @@ -296,11 +293,8 @@ class ActivityEmbeddingAnimationRunner { final Animation animation = animationProvider.get(info, change, closingWholeScreenBounds); if (shouldUseJumpCutForAnimation(animation)) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { return new ArrayList<>(); } continue; } final ActivityEmbeddingAnimationAdapter adapter = createOpenCloseAnimationAdapter( info, change, animation, closingWholeScreenBounds); if (!isOpening) { Loading Loading @@ -455,13 +449,11 @@ class ActivityEmbeddingAnimationRunner { final Animation[] animations = mAnimationSpec.createChangeBoundsChangeAnimations(info, change, parentBounds); // Jump cut if either animation has zero for duration. if (Flags.activityEmbeddingAnimationCustomizationFlag()) { for (Animation animation : animations) { if (shouldUseJumpCutForAnimation(animation)) { return new ArrayList<>(); } } } // Keep track as we might need to add background color for the animation. // Although there may be multiple change animation, record one of them is sufficient // because the background color will be added to the root leash for the whole animation. Loading Loading @@ -516,11 +508,9 @@ class ActivityEmbeddingAnimationRunner { mAnimationSpec.createChangeBoundsOpenAnimation(info, change, parentBounds); shouldShowBackgroundColor = false; } if (Flags.activityEmbeddingAnimationCustomizationFlag()) { if (shouldUseJumpCutForAnimation(animation)) { return new ArrayList<>(); } } adapters.add(new ActivityEmbeddingAnimationAdapter(animation, change, TransitionUtil.getRootFor(change, info))); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/activityembedding/ActivityEmbeddingAnimationSpec.java +15 −25 Original line number Diff line number Diff line Loading @@ -96,12 +96,10 @@ class ActivityEmbeddingAnimationSpec { @NonNull Animation createChangeBoundsOpenAnimation(@NonNull TransitionInfo info, @NonNull TransitionInfo.Change change, @NonNull Rect parentBounds) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { final Animation customAnimation = loadCustomAnimation(info, change, TRANSIT_CHANGE); if (customAnimation != null) { return customAnimation; } } // Use end bounds for opening. final Rect bounds = change.getEndAbsBounds(); final int startLeft; Loading Loading @@ -130,12 +128,10 @@ class ActivityEmbeddingAnimationSpec { @NonNull Animation createChangeBoundsCloseAnimation(@NonNull TransitionInfo info, @NonNull TransitionInfo.Change change, @NonNull Rect parentBounds) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { final Animation customAnimation = loadCustomAnimation(info, change, TRANSIT_CHANGE); if (customAnimation != null) { return customAnimation; } } // Use start bounds for closing. final Rect bounds = change.getStartAbsBounds(); final int endTop; Loading Loading @@ -168,7 +164,6 @@ class ActivityEmbeddingAnimationSpec { @NonNull Animation[] createChangeBoundsChangeAnimations(@NonNull TransitionInfo info, @NonNull TransitionInfo.Change change, @NonNull Rect parentBounds) { if (Flags.activityEmbeddingAnimationCustomizationFlag()) { // TODO(b/293658614): Support more complicated animations that may need more than a noop // animation as the start leash. final Animation noopAnimation = createNoopAnimation(change); Loading @@ -176,7 +171,6 @@ class ActivityEmbeddingAnimationSpec { if (customAnimation != null) { return new Animation[]{noopAnimation, customAnimation}; } } // Both start bounds and end bounds are in screen coordinates. We will post translate // to the local coordinates in ActivityEmbeddingAnimationAdapter#onAnimationUpdate final Rect startBounds = change.getStartAbsBounds(); Loading Loading @@ -320,13 +314,9 @@ class ActivityEmbeddingAnimationSpec { } final Animation anim; if (Flags.activityEmbeddingAnimationCustomizationFlag()) { // TODO(b/293658614): Consider allowing custom animations from non-default packages. // Enforce limiting to animations from the default "android" package for now. anim = mTransitionAnimation.loadDefaultAnimationRes(resId); } else { anim = mTransitionAnimation.loadAnimationRes(options.getPackageName(), resId); } if (anim != null) { return anim; } Loading