Only apply the task's pending transaction if it is detached

This fixes a flicker introduced by 88fbccf which may incorrectly apply
the display content's pending transaction instead of the task's.

Test: go/wm-smoke
Test: app to recents, see no flicker
Change-Id: If0a0431b2ea170ea833c1445599f0fdb9431dabf
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 128c259..40315f9 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -996,7 +996,7 @@
                         .setWindowCrop(taskSurface, mFinishBounds.width(), mFinishBounds.height())
                         .apply();
                 mFinishBounds.setEmpty();
-            } else {
+            } else if (!mTask.isAttached()) {
                 // Apply the task's pending transaction in case it is detached and its transaction
                 // is not reachable.
                 mTask.getPendingTransaction().apply();