[automerger] Fix incorrect reporting of launch failure am: 83f58f2d2c

Change-Id: I3befdb5851c1244d46ace72c73eb3281a306b6b5
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 4263654..160acb5 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1160,15 +1160,18 @@
             onTaskLaunched(result);
             tv.setVisibility(VISIBLE);
             getOverlay().remove(drawable);
-            if (!result) {
-                tv.notifyTaskLaunchFailed(TAG);
-            }
         };
 
         mPendingAnimation = new PendingAnimation(anim);
         mPendingAnimation.addEndListener((onEndListener) -> {
             if (onEndListener.isSuccess) {
-                tv.launchTask(false, onTaskLaunchFinish, getHandler());
+                Consumer<Boolean> onLaunchResult = (result) -> {
+                    onTaskLaunchFinish.accept(result);
+                    if (!result) {
+                        tv.notifyTaskLaunchFailed(TAG);
+                    }
+                };
+                tv.launchTask(false, onLaunchResult, getHandler());
                 Task task = tv.getTask();
                 if (task != null) {
                     mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(