Merge "Pass elevation to enable shadow in shared elements." into lmp-dev
diff --git a/core/java/android/app/ActivityTransitionCoordinator.java b/core/java/android/app/ActivityTransitionCoordinator.java
index 039bad0..f7c0d23 100644
--- a/core/java/android/app/ActivityTransitionCoordinator.java
+++ b/core/java/android/app/ActivityTransitionCoordinator.java
@@ -128,6 +128,7 @@
     protected static final String KEY_SNAPSHOT = "shared_element:bitmap";
     protected static final String KEY_SCALE_TYPE = "shared_element:scaleType";
     protected static final String KEY_IMAGE_MATRIX = "shared_element:imageMatrix";
+    protected static final String KEY_ELEVATION = "shared_element:elevation";
 
     protected static final ImageView.ScaleType[] SCALE_TYPE_VALUES = ImageView.ScaleType.values();
 
@@ -393,6 +394,8 @@
 
         float z = sharedElementBundle.getFloat(KEY_TRANSLATION_Z);
         view.setTranslationZ(z);
+        float elevation = sharedElementBundle.getFloat(KEY_ELEVATION);
+        view.setElevation(elevation);
 
         float left = sharedElementBundle.getFloat(KEY_SCREEN_LEFT);
         float top = sharedElementBundle.getFloat(KEY_SCREEN_TOP);
@@ -499,6 +502,8 @@
         state.mBottom = view.getBottom();
         state.mMeasuredWidth = view.getMeasuredWidth();
         state.mMeasuredHeight = view.getMeasuredHeight();
+        state.mTranslationZ = view.getTranslationZ();
+        state.mElevation = view.getElevation();
         if (!(view instanceof ImageView)) {
             return state;
         }
@@ -557,7 +562,9 @@
                   imageView.setImageMatrix(state.mMatrix);
                 }
             }
-           int widthSpec = View.MeasureSpec.makeMeasureSpec(state.mMeasuredWidth,
+            view.setElevation(state.mElevation);
+            view.setTranslationZ(state.mTranslationZ);
+            int widthSpec = View.MeasureSpec.makeMeasureSpec(state.mMeasuredWidth,
                     View.MeasureSpec.EXACTLY);
             int heightSpec = View.MeasureSpec.makeMeasureSpec(state.mMeasuredHeight,
                     View.MeasureSpec.EXACTLY);
@@ -622,6 +629,7 @@
         sharedElementBundle.putFloat(KEY_SCREEN_TOP, tempBounds.top);
         sharedElementBundle.putFloat(KEY_SCREEN_BOTTOM, tempBounds.bottom);
         sharedElementBundle.putFloat(KEY_TRANSLATION_Z, view.getTranslationZ());
+        sharedElementBundle.putFloat(KEY_ELEVATION, view.getElevation());
 
         Parcelable bitmap = mListener.captureSharedElementSnapshot(view, tempMatrix, tempBounds);
         if (bitmap != null) {
@@ -801,5 +809,7 @@
         int mMeasuredHeight;
         ImageView.ScaleType mScaleType;
         Matrix mMatrix;
+        float mTranslationZ;
+        float mElevation;
     }
 }