Ensure feature flags are set prior to checking Activity Transition.
Bug 23764120
Window features are set in PhoneWindow.installDecor. The Activity
Transition feature is checked after onCreate. If the developer
hasn't accessed the decor View in onCreate, the Activity Transition
feature will not have been set prior to checking it. To correct
this, the decor View will be forced to be created prior to
checking the Activity Transition feature state.
Change-Id: I2c756b6736ae7f3a346f4f9bcef6936371ff03c5
diff --git a/core/java/android/app/ActivityTransitionState.java b/core/java/android/app/ActivityTransitionState.java
index 5c6fe46..38562da 100644
--- a/core/java/android/app/ActivityTransitionState.java
+++ b/core/java/android/app/ActivityTransitionState.java
@@ -150,7 +150,13 @@
}
public void setEnterActivityOptions(Activity activity, ActivityOptions options) {
- if (activity.getWindow().hasFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)
+ final Window window = activity.getWindow();
+ if (window == null) {
+ return;
+ }
+ // ensure Decor View has been created so that the window features are activated
+ window.getDecorView();
+ if (window.hasFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)
&& options != null && mEnterActivityOptions == null
&& mEnterTransitionCoordinator == null
&& options.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) {