diff --git a/core/java/com/android/internal/policy/TransitionAnimation.java b/core/java/com/android/internal/policy/TransitionAnimation.java index ece6f2f3571be..37c96e71a0a8d 100644 --- a/core/java/com/android/internal/policy/TransitionAnimation.java +++ b/core/java/com/android/internal/policy/TransitionAnimation.java @@ -98,6 +98,10 @@ public class TransitionAnimation { private static final String DEFAULT_PACKAGE = "android"; + // TODO (b/215515255): remove once we full migrate to shell transitions + private static final boolean SHELL_TRANSITIONS_ENABLED = + SystemProperties.getBoolean("persist.debug.shell_transit", false); + private final Context mContext; private final String mTag; @@ -252,6 +256,9 @@ public class TransitionAnimation { resId = ent.array.getResourceId(animAttr, 0); } } + if (!SHELL_TRANSITIONS_ENABLED) { + resId = updateToLegacyIfNeeded(resId); + } resId = updateToTranslucentAnimIfNeeded(resId, transit); if (ResourceId.isValid(resId)) { return loadAnimationSafely(context, resId, mTag); @@ -259,6 +266,24 @@ public class TransitionAnimation { return null; } + /** + * Replace animations that are not compatible with the legacy transition system with ones that + * are compatible with it. + * TODO (b/215515255): remove once we full migrate to shell transitions + */ + private int updateToLegacyIfNeeded(int anim) { + if (anim == R.anim.activity_open_enter) { + return R.anim.activity_open_enter_legacy; + } else if (anim == R.anim.activity_open_exit) { + return R.anim.activity_open_exit_legacy; + } else if (anim == R.anim.activity_close_enter) { + return R.anim.activity_close_enter_legacy; + } else if (anim == R.anim.activity_close_exit) { + return R.anim.activity_close_exit_legacy; + } + return anim; + } + /** Load animation by attribute Id from a specific AnimationStyle resource. */ @Nullable public Animation loadAnimationAttr(String packageName, int animStyleResId, int animAttr, diff --git a/core/res/res/anim/activity_close_enter.xml b/core/res/res/anim/activity_close_enter.xml index 9fa7c5498ea6c..0fefb5113dfcf 100644 --- a/core/res/res/anim/activity_close_enter.xml +++ b/core/res/res/anim/activity_close_enter.xml @@ -19,16 +19,37 @@ - + + + android:startOffset="0" + android:duration="450" /> + + \ No newline at end of file diff --git a/core/res/res/anim/activity_close_enter_legacy.xml b/core/res/res/anim/activity_close_enter_legacy.xml new file mode 100644 index 0000000000000..9fa7c5498ea6c --- /dev/null +++ b/core/res/res/anim/activity_close_enter_legacy.xml @@ -0,0 +1,34 @@ + + + + + + \ No newline at end of file diff --git a/core/res/res/anim/activity_close_exit.xml b/core/res/res/anim/activity_close_exit.xml index 1599ae8cb19fc..f807c26dda200 100644 --- a/core/res/res/anim/activity_close_exit.xml +++ b/core/res/res/anim/activity_close_exit.xml @@ -18,27 +18,38 @@ --> + android:shareInterpolator="false"> + - + + + android:startOffset="0" + android:duration="450" /> + + diff --git a/core/res/res/anim/activity_close_exit_legacy.xml b/core/res/res/anim/activity_close_exit_legacy.xml new file mode 100644 index 0000000000000..1599ae8cb19fc --- /dev/null +++ b/core/res/res/anim/activity_close_exit_legacy.xml @@ -0,0 +1,44 @@ + + + + + + + diff --git a/core/res/res/anim/activity_open_enter.xml b/core/res/res/anim/activity_open_enter.xml index 38d3e8ed06ce9..1674dab3040a3 100644 --- a/core/res/res/anim/activity_open_enter.xml +++ b/core/res/res/anim/activity_open_enter.xml @@ -18,6 +18,7 @@ + - + + + android:duration="450" /> + + diff --git a/core/res/res/anim/activity_open_enter_legacy.xml b/core/res/res/anim/activity_open_enter_legacy.xml new file mode 100644 index 0000000000000..38d3e8ed06ce9 --- /dev/null +++ b/core/res/res/anim/activity_open_enter_legacy.xml @@ -0,0 +1,42 @@ + + + + + + diff --git a/core/res/res/anim/activity_open_exit.xml b/core/res/res/anim/activity_open_exit.xml index 3865d2149f42f..372f2c8e09f66 100644 --- a/core/res/res/anim/activity_open_exit.xml +++ b/core/res/res/anim/activity_open_exit.xml @@ -19,27 +19,36 @@ - + android:interpolator="@interpolator/standard_accelerate" + android:startOffset="0" + android:duration="450" /> - + android:startOffset="0" + android:duration="450" /> + + \ No newline at end of file diff --git a/core/res/res/anim/activity_open_exit_legacy.xml b/core/res/res/anim/activity_open_exit_legacy.xml new file mode 100644 index 0000000000000..3865d2149f42f --- /dev/null +++ b/core/res/res/anim/activity_open_exit_legacy.xml @@ -0,0 +1,45 @@ + + + + + + + + + \ No newline at end of file diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 84c5bc9b0bbc2..d5ef7c49e2a64 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1697,7 +1697,13 @@ + + + + + +