launcher: check if task still exists before leaving it in focus

Fixes 191353942
Test: manually; check buganizer on how to reproduce

Change-Id: Ia75ff59b5a9ef5654747d445df4088a5b17f6a42
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index ca43193..c3dd13f 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1159,7 +1159,9 @@
             final TaskView taskView = (TaskView) getChildAt(pageIndex);
             taskView.bind(task, mOrientationState);
         }
-        if (mFocusedTaskId == -1 && getTaskViewCount() > 0) {
+
+        // If the list changed, maybe the focused task doesn't exist anymore
+        if (getFocusedTaskView() == null && getTaskViewCount() > 0) {
             mFocusedTaskId = getTaskViewAt(0).getTaskId();
         }
         updateTaskSize();