Prevent focusing next task if focused task part of split select

* Also ensure that in tablet portrait we shift
thumbnails to prevent overlap with the placeholder
view. I'm guessing the time that was written maybe
the grid was taking up a smaller space?

Fixes: 199898622
Test: Go into split selection with focused task,
next task doesn't take focus. Grid shifts down
to not overlap with placeholder view.

Change-Id: I4ed37b1d28287685ad01885331dffd764c7ddfc9
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index e25a8bc..eda035c 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -2721,7 +2721,7 @@
         if (showAsGrid) {
             dismissedTaskWidth = dismissedTaskView.getLayoutParams().width + mPageSpacing;
             isFocusedTaskDismissed = dismissedTaskViewId == mFocusedTaskViewId;
-            if (isFocusedTaskDismissed) {
+            if (isFocusedTaskDismissed && !isSplitSelectionActive()) {
                 nextFocusedTaskFromTop =
                         mTopRowIdSet.size() > 0 && mTopRowIdSet.size() >= (taskCount - 1) / 2f;
                 // Pick the next focused task from the preferred row.
@@ -2904,7 +2904,8 @@
             } else if (child instanceof TaskView) {
                 TaskView taskView = (TaskView) child;
                 if (isFocusedTaskDismissed) {
-                    if (!isSameGridRow(taskView, nextFocusedTaskView)) {
+                    if (nextFocusedTaskView != null &&
+                            !isSameGridRow(taskView, nextFocusedTaskView)) {
                         continue;
                     }
                 } else {
@@ -2941,7 +2942,7 @@
                             clampToProgress(LINEAR, 0f, ANIMATION_DISMISS_PROGRESS_MIDPOINT));
                 } else {
                     float primaryTranslation =
-                            isFocusedTaskDismissed ? nextFocusedTaskWidth : dismissedTaskWidth;
+                            nextFocusedTaskView != null ? nextFocusedTaskWidth : dismissedTaskWidth;
                     anim.setFloat(taskView, taskView.getPrimaryDismissTranslationProperty(),
                             mIsRtl ? primaryTranslation : -primaryTranslation,
                             clampToProgress(LINEAR, animationStartProgress,
@@ -3251,7 +3252,7 @@
             // Never enough space on phones
             return true;
         } else if (!mActivity.getDeviceProfile().isLandscape) {
-            return false;
+            return true;
         }
 
         Rect splitBounds = new Rect();