Removing HW layers for task view transitions.

Change-Id: I00377e12d779519bd0fc102480d37382b3ac4ea6
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java b/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java
index 086fb58..2bf2ccb 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java
@@ -88,15 +88,6 @@
     }
 
     /**
-     * Cancels an animation.
-     */
-    public static void cancelAnimation(Animator animator) {
-        if (animator != null) {
-            animator.cancel();
-        }
-    }
-
-    /**
      * Cancels an animation ensuring that if it has listeners, onCancel and onEnd
      * are not called.
      */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 79e3bc7..b09504e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -205,6 +205,11 @@
     }
 
     @Override
+    public boolean hasOverlappingRendering() {
+        return false;
+    }
+
+    @Override
     public boolean onInterceptTouchEvent(MotionEvent ev) {
         if (ev.getAction() == MotionEvent.ACTION_DOWN) {
             mDownTouchPos.set((int) (ev.getX() * getScaleX()), (int) (ev.getY() * getScaleY()));
@@ -244,12 +249,11 @@
     void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform,
             TaskViewAnimation toAnimation, ValueAnimator.AnimatorUpdateListener updateCallback) {
         RecentsConfiguration config = Recents.getConfiguration();
-        Utilities.cancelAnimation(mTransformAnimation);
+        Utilities.cancelAnimationWithoutCallbacks(mTransformAnimation);
 
         // Compose the animations for the transform
         mTmpAnimators.clear();
-        boolean requiresHwLayers = toTransform.applyToTaskView(this, mTmpAnimators, toAnimation,
-                !config.fakeShadows);
+        toTransform.applyToTaskView(this, mTmpAnimators, toAnimation, !config.fakeShadows);
         if (toAnimation.isImmediate()) {
             setTaskProgress(toTransform.p);
             if (toAnimation.listener != null) {
@@ -266,22 +270,13 @@
 
             // Create the animator
             mTransformAnimation = toAnimation.createAnimator(mTmpAnimators);
-            if (requiresHwLayers) {
-                setLayerType(View.LAYER_TYPE_HARDWARE, null);
-                mTransformAnimation.addListener(new AnimatorListenerAdapter() {
-                    @Override
-                    public void onAnimationEnd(Animator animation) {
-                        setLayerType(View.LAYER_TYPE_NONE, null);
-                    }
-                });
-            }
             mTransformAnimation.start();
         }
     }
 
     /** Resets this view's properties */
     void resetViewProperties() {
-        Utilities.cancelAnimation(mTransformAnimation);
+        Utilities.cancelAnimationWithoutCallbacks(mTransformAnimation);
         setDim(0);
         setVisibility(View.VISIBLE);
         getViewBounds().reset();
@@ -297,7 +292,7 @@
      * Cancels any current transform animations.
      */
     public void cancelTransformAnimation() {
-        Utilities.cancelAnimation(mTransformAnimation);
+        Utilities.cancelAnimationWithoutCallbacks(mTransformAnimation);
     }
 
     /** Enables/disables handling touch on this task view. */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
index 284e0e2..538c248 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
@@ -125,15 +125,12 @@
 
     /**
      * Applies this transform to a view.
-     *
-     * @return whether hardware layers are required for this animation.
      */
-    public boolean applyToTaskView(TaskView v, ArrayList<Animator> animators,
+    public void applyToTaskView(TaskView v, ArrayList<Animator> animators,
             TaskViewAnimation taskAnimation, boolean allowShadows) {
         // Return early if not visible
-        boolean requiresHwLayers = false;
         if (!visible) {
-            return requiresHwLayers;
+            return;
         }
 
         if (taskAnimation.isImmediate()) {
@@ -163,7 +160,6 @@
             }
             if (hasAlphaChangedFrom(v.getAlpha())) {
                 animators.add(ObjectAnimator.ofFloat(v, View.ALPHA, v.getAlpha(), alpha));
-                requiresHwLayers = true;
             }
             if (hasRectChangedFrom(v)) {
                 animators.add(ObjectAnimator.ofPropertyValuesHolder(v,
@@ -173,7 +169,6 @@
                         PropertyValuesHolder.ofInt(BOTTOM, v.getBottom(), (int) rect.bottom)));
             }
         }
-        return requiresHwLayers;
     }
 
     /** Reset the transform on a view. */