Added possibility to use canned animation for icons

Icons now move in a canned animation from the shelf position
to the icon.

Test: adb shell setprop debug.icon_opening_animations true && adb shell killall com.android.systemui
Bug: 32437839
Change-Id: I82b6de37ac7a179aeb5d16bd663d566c2f338b1a
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 661cc3c..e4654e6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -193,7 +193,7 @@
     private View mChildAfterViewWhenDismissed;
     private View mGroupParentWhenDismissed;
     private boolean mRefocusOnDismiss;
-    private float mIconTransformationAmount;
+    private float mContentTransformationAmount;
     private boolean mIconsVisible = true;
     private boolean mAboveShelf;
     private boolean mIsLastChild;
@@ -837,23 +837,29 @@
     /**
      * Set how much this notification is transformed into an icon.
      *
-     * @param iconTransformationAmount A value from 0 to 1 indicating how much we are transformed
-     *                                 to an icon
+     * @param contentTransformationAmount A value from 0 to 1 indicating how much we are transformed
+     *                                 to the content away
      * @param isLastChild is this the last child in the list. If true, then the transformation is
      *                    different since it's content fades out.
      */
-    public void setIconTransformationAmount(float iconTransformationAmount, boolean isLastChild) {
+    public void setContentTransformationAmount(float contentTransformationAmount,
+            boolean isLastChild) {
         boolean changeTransformation = isLastChild != mIsLastChild;
-        changeTransformation |= mIconTransformationAmount != iconTransformationAmount;
+        changeTransformation |= mContentTransformationAmount != contentTransformationAmount;
         mIsLastChild = isLastChild;
-        mIconTransformationAmount = iconTransformationAmount;
+        mContentTransformationAmount = contentTransformationAmount;
         if (changeTransformation) {
             updateContentTransformation();
-            boolean iconsVisible = mIconTransformationAmount == 0.0f;
-            if (iconsVisible != mIconsVisible) {
-                mIconsVisible = iconsVisible;
-                updateIconVisibilities();
-            }
+        }
+    }
+
+    /**
+     * Set the icons to be visible of this notification.
+     */
+    public void setIconsVisible(boolean iconsVisible) {
+        if (iconsVisible != mIconsVisible) {
+            mIconsVisible = iconsVisible;
+            updateIconVisibilities();
         }
     }
 
@@ -864,9 +870,9 @@
 
     private void updateContentTransformation() {
         float contentAlpha;
-        float translationY = - mIconTransformationAmount * mIconTransformContentShift;
+        float translationY = -mContentTransformationAmount * mIconTransformContentShift;
         if (mIsLastChild) {
-            contentAlpha = 1.0f - mIconTransformationAmount;
+            contentAlpha = 1.0f - mContentTransformationAmount;
             contentAlpha = Math.min(contentAlpha / 0.5f, 1.0f);
             contentAlpha = Interpolators.ALPHA_OUT.getInterpolation(contentAlpha);
             translationY *= 0.4f;
@@ -1871,8 +1877,8 @@
         }
 
         @Override
-        protected void onYTranslationAnimationFinished() {
-            super.onYTranslationAnimationFinished();
+        protected void onYTranslationAnimationFinished(View view) {
+            super.onYTranslationAnimationFinished(view);
             if (mHeadsupDisappearRunning) {
                 setHeadsUpAnimatingAway(false);
             }