DO NOT MERGE ANYWHERE:Fix NPE during Activity transition using wrong Activity.

Bug 30786309

If the Activity used in makeSceneTransitionAnimation isn't
the same one used in the startActivity call, a NullPointerException
could be thrown.

Change-Id: Id21c54fcf99b353feab62f7fc160997ed06e7d23
(cherry picked from commit 3289bfa289f560d60611dddef9441c9614fd883a)
(cherry picked from commit a3edbf6a5d4698570f2b5610390b5c70251f52d7)
diff --git a/core/java/android/app/ActivityTransitionState.java b/core/java/android/app/ActivityTransitionState.java
index 2219238..aef1d0c 100644
--- a/core/java/android/app/ActivityTransitionState.java
+++ b/core/java/android/app/ActivityTransitionState.java
@@ -337,11 +337,12 @@
     }
 
     public void startExitOutTransition(Activity activity, Bundle options) {
-        if (!activity.getWindow().hasFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)) {
+        mEnterTransitionCoordinator = null;
+        if (!activity.getWindow().hasFeature(Window.FEATURE_ACTIVITY_TRANSITIONS) ||
+                mExitTransitionCoordinators == null) {
             return;
         }
         ActivityOptions activityOptions = new ActivityOptions(options);
-        mEnterTransitionCoordinator = null;
         if (activityOptions.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) {
             int key = activityOptions.getExitCoordinatorKey();
             int index = mExitTransitionCoordinators.indexOfKey(key);