Merge "Add detailed exception for snappedIndex == -1 when dismissing tasks" into udc-dev am: dcbe9583fb am: 143e612bc4

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23535540

Change-Id: Ie51df96182b138aeda874960da8511eaefab1d15
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-06-21 12:29:19 +00:00
committed by Automerger Merge Worker

View File

@@ -3766,19 +3766,33 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
taskViewIdArray.removeValue(
finalNextFocusedTaskView.getTaskViewId());
}
if (snappedIndex < taskViewIdArray.size()) {
taskViewIdToSnapTo = taskViewIdArray.get(snappedIndex);
} else if (snappedIndex == taskViewIdArray.size()) {
// If the snapped task is the last item from the
// dismissed row,
// snap to the same column in the other grid row
IntArray inverseRowTaskViewIdArray =
isSnappedTaskInTopRow ? getBottomRowIdArray()
: getTopRowIdArray();
if (snappedIndex < inverseRowTaskViewIdArray.size()) {
taskViewIdToSnapTo = inverseRowTaskViewIdArray.get(
snappedIndex);
try {
if (snappedIndex < taskViewIdArray.size()) {
taskViewIdToSnapTo = taskViewIdArray.get(snappedIndex);
} else if (snappedIndex == taskViewIdArray.size()) {
// If the snapped task is the last item from the
// dismissed row,
// snap to the same column in the other grid row
IntArray inverseRowTaskViewIdArray =
isSnappedTaskInTopRow ? getBottomRowIdArray()
: getTopRowIdArray();
if (snappedIndex < inverseRowTaskViewIdArray.size()) {
taskViewIdToSnapTo = inverseRowTaskViewIdArray.get(
snappedIndex);
}
}
} catch (ArrayIndexOutOfBoundsException e) {
throw new IllegalStateException(
"b/269956477 invalid snappedIndex"
+ "\nsnappedTaskViewId: "
+ snappedTaskViewId
+ "\nfocusedTaskViewId: "
+ mFocusedTaskViewId
+ "\ntopRowIdArray: "
+ getTopRowIdArray().toConcatString()
+ "\nbottomRowIdArray: "
+ getBottomRowIdArray().toConcatString(),
e);
}
}
}