diff options
| author | Tony Huang <tonyychuang@google.com> | 2021-01-20 17:32:01 +0800 |
|---|---|---|
| committer | Tony Huang <tonyychuang@google.com> | 2021-02-22 13:43:52 +0800 |
| commit | 03c4d1e95c8af54c3f9668db0741c9511e72ff19 (patch) | |
| tree | b201d7b8f82b4ad166874a667e04cf10fbafa761 /core/java | |
| parent | ddfb6c46f2e8f943a204ae4cfa65309b4b26d19a (diff) | |
Make AppTransition animations sharable (2/n)
Handle basic animation in shell transition.
Bug: 175053726
Test: enable shell transition and check basic task open/close and
activity open/close
Change-Id: I7046f8314261aaf554bac7bfced21e405faf79ac
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/policy/TransitionAnimation.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/java/com/android/internal/policy/TransitionAnimation.java b/core/java/com/android/internal/policy/TransitionAnimation.java index 56b25b2060ea..93ba0372df08 100644 --- a/core/java/com/android/internal/policy/TransitionAnimation.java +++ b/core/java/com/android/internal/policy/TransitionAnimation.java @@ -180,6 +180,7 @@ public class TransitionAnimation { "android", com.android.internal.R.anim.cross_profile_apps_thumbnail_enter); } + /** Load animation by resource Id from specific LayoutParams. */ @Nullable private Animation loadAnimationRes(LayoutParams lp, int resId) { Context context = mContext; @@ -193,6 +194,7 @@ public class TransitionAnimation { return null; } + /** Load animation by resource Id from specific package. */ @Nullable private Animation loadAnimationRes(String packageName, int resId) { if (ResourceId.isValid(resId)) { @@ -204,6 +206,13 @@ public class TransitionAnimation { return null; } + /** Load animation by resource Id from android package. */ + @Nullable + public Animation loadDefaultAnimationRes(int resId) { + return loadAnimationRes("android", resId); + } + + /** Load animation by attribute Id from specific LayoutParams */ @Nullable public Animation loadAnimationAttr(LayoutParams lp, int animAttr, int transit) { int resId = Resources.ID_NULL; @@ -222,6 +231,25 @@ public class TransitionAnimation { return null; } + /** Load animation by attribute Id from android package. */ + @Nullable + public Animation loadDefaultAnimationAttr(int animAttr) { + int resId = Resources.ID_NULL; + Context context = mContext; + if (animAttr >= 0) { + AttributeCache.Entry ent = getCachedAnimations("android", + mDefaultWindowAnimationStyleResId); + if (ent != null) { + context = ent.context; + resId = ent.array.getResourceId(animAttr, 0); + } + } + if (ResourceId.isValid(resId)) { + return loadAnimationSafely(context, resId, mTag); + } + return null; + } + @Nullable private AttributeCache.Entry getCachedAnimations(LayoutParams lp) { if (mDebug) { |
