Fix transition progress not applying to drawables

TaskLayerDrawable should reapply UI changes from the transition progress
when there is a new drawable. In addition, the transition should check
if the drawable in the front and back are the same (i.e. on
initialization when both are showing the empty drawable) so that it only
applies the front-drawable alpha.

Bug: 114136250
Test: Builds
Change-Id: I74836b5043da555358742ba0a3f46f170f590904
(cherry picked from commit 1531982d1ed7c03cc1ec4c0a6d6069ff747de5b5)
diff --git a/go/quickstep/src/com/android/quickstep/views/TaskLayerDrawable.java b/go/quickstep/src/com/android/quickstep/views/TaskLayerDrawable.java
index 3a23048..98b66b9 100644
--- a/go/quickstep/src/com/android/quickstep/views/TaskLayerDrawable.java
+++ b/go/quickstep/src/com/android/quickstep/views/TaskLayerDrawable.java
@@ -31,6 +31,7 @@
  */
 public final class TaskLayerDrawable extends LayerDrawable {
     private final Drawable mEmptyDrawable;
+    private float mProgress;
 
     public TaskLayerDrawable(Context context) {
         super(new Drawable[0]);
@@ -50,6 +51,7 @@
      */
     public void setCurrentDrawable(@NonNull Drawable drawable) {
         setDrawable(0, drawable);
+        applyTransitionProgress(mProgress);
     }
 
     /**
@@ -82,9 +84,18 @@
         if (progress > 1 || progress < 0) {
             throw new IllegalArgumentException("Transition progress should be between 0 and 1");
         }
+        mProgress = progress;
+        applyTransitionProgress(progress);
+    }
+
+    private void applyTransitionProgress(float progress) {
         int drawableAlpha = (int) (progress * 255);
         getDrawable(0).setAlpha(drawableAlpha);
-        getDrawable(1).setAlpha(255 - drawableAlpha);
+        if (getDrawable(0) != getDrawable(1)) {
+            // Only do this if it's a different drawable so that it fades out.
+            // Otherwise, we'd just be overwriting the front drawable's alpha.
+            getDrawable(1).setAlpha(255 - drawableAlpha);
+        }
         invalidateSelf();
     }
 }