diff options
| author | Issei Suzuki <issei@google.com> | 2022-04-12 17:41:20 +0200 |
|---|---|---|
| committer | Issei Suzuki <issei@google.com> | 2022-05-04 09:58:49 +0000 |
| commit | 40395751a92a1405d8678cd363cd99750784fff9 (patch) | |
| tree | a177a73267d6a561a34ba2deb050ebdbfc91d6bd /core/java | |
| parent | b5054e3547f4fc64fba08428b30cd0e71073003d (diff) | |
Disable overriding task animation through windowAnimationStyle attribute.
Bug: 211624533
Test: atest ActivityTransitionTests
Change-Id: Ia6844ab4397a54dc510f34f06edc4d8a188db1fc
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/policy/TransitionAnimation.java | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/core/java/com/android/internal/policy/TransitionAnimation.java b/core/java/com/android/internal/policy/TransitionAnimation.java index fd8534d45b2b..7fd3a3866a3a 100644 --- a/core/java/com/android/internal/policy/TransitionAnimation.java +++ b/core/java/com/android/internal/policy/TransitionAnimation.java @@ -25,6 +25,7 @@ import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; import static android.view.WindowManager.TRANSIT_OLD_NONE; import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE; import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_UNSET; import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_CLOSE; import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN; import static android.view.WindowManager.TRANSIT_OPEN; @@ -261,11 +262,17 @@ public class TransitionAnimation { } return null; } - - /** Load animation by attribute Id from a specific AnimationStyle resource. */ + /** + * Load animation by attribute Id from a specific AnimationStyle resource. + * + * @param translucent {@code true} if we're sure that the animation is applied on a translucent + * window container, {@code false} otherwise. + * @param transit {@link TransitionOldType} for the app transition of this animation, or + * {@link TransitionOldType#TRANSIT_OLD_UNSET} if app transition type is unknown. + */ @Nullable - public Animation loadAnimationAttr(String packageName, int animStyleResId, int animAttr, - boolean translucent) { + private Animation loadAnimationAttr(String packageName, int animStyleResId, int animAttr, + boolean translucent, @TransitionOldType int transit) { if (animStyleResId == 0) { return null; } @@ -281,6 +288,8 @@ public class TransitionAnimation { } if (translucent) { resId = updateToTranslucentAnimIfNeeded(resId); + } else if (transit != TRANSIT_OLD_UNSET) { + resId = updateToTranslucentAnimIfNeeded(resId, transit); } if (ResourceId.isValid(resId)) { return loadAnimationSafely(context, resId, mTag); @@ -288,6 +297,15 @@ public class TransitionAnimation { return null; } + + /** Load animation by attribute Id from a specific AnimationStyle resource. */ + @Nullable + public Animation loadAnimationAttr(String packageName, int animStyleResId, int animAttr, + boolean translucent) { + return loadAnimationAttr(packageName, animStyleResId, animAttr, translucent, + TRANSIT_OLD_UNSET); + } + /** Load animation by attribute Id from android package. */ @Nullable public Animation loadDefaultAnimationAttr(int animAttr, boolean translucent) { @@ -295,6 +313,13 @@ public class TransitionAnimation { translucent); } + /** Load animation by attribute Id from android package. */ + @Nullable + public Animation loadDefaultAnimationAttr(int animAttr, @TransitionOldType int transit) { + return loadAnimationAttr(DEFAULT_PACKAGE, mDefaultWindowAnimationStyleResId, animAttr, + false /* translucent */, transit); + } + @Nullable private AttributeCache.Entry getCachedAnimations(LayoutParams lp) { if (mDebug) { |
