Redraw live tile in updatePageOffsets()

Also finish recents controller in RecentsView#reset() if it hasn't
been already.

Test: in 2 button mode, swipe up from overview when a live tile is
running, ensure it moves offscreen with its TaskView; after swiping
from overview to home, tap nav bar to ensure controller was finished
Test2: in 0 button mode, open Maps, start directions, swipe up to
home and ensure PiP starts

Fixes: 185588376
Change-Id: I03c18b14b4f55f1f09ce3bc442de23c94aa170bf
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index d39c58b..5761dfb 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1516,7 +1516,14 @@
         mTaskListChangeId = -1;
         mFocusedTaskId = -1;
 
-        mRecentsAnimationController = null;
+        if (mRecentsAnimationController != null) {
+            if (LIVE_TILE.get() && mEnableDrawingLiveTile) {
+                // We are still drawing the live tile, finish it now to clean up.
+                finishRecentsAnimation(true /* toRecents */, null);
+            } else {
+                mRecentsAnimationController = null;
+            }
+        }
         mLiveTileParams.setTargetSet(null);
         mLiveTileTaskViewSimulator.setDrawsBelowRecents(true);
 
@@ -2621,6 +2628,10 @@
                     ? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty()
                     : mOrientationHandler.getPrimaryViewTranslate();
             translationProperty.set(child, totalTranslation);
+            if (LIVE_TILE.get() && mEnableDrawingLiveTile && i == getRunningTaskIndex()) {
+                mLiveTileTaskViewSimulator.taskPrimaryTranslation.value = totalTranslation;
+                redrawLiveTile();
+            }
         }
         updateCurveProperties();
     }