Do not rely on `getTaskViewCount` to iterate TaskViews
Using `getChildCount` to iterate TaskViews instead of
`getTaskViewCount` when indices are used. As it is not safe to assume
the TaskView starts from index 0.
Flag: EXEMPT as no functionality changes
Bug: 379942019
Test: Manual
Change-Id: I599b5117f0848e429ebf83fc4b85451e52b4bcab
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 6021b71..ffded36 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -6186,10 +6186,12 @@
}
}
- final int taskCount = getTaskViewCount();
int lastTaskScroll = getLastTaskScroll(clearAllScroll, clearAllWidth);
- for (int i = 0; i < taskCount; i++) {
- TaskView taskView = requireTaskViewAt(i);
+ for (int i = 0; i < getChildCount(); i++) {
+ TaskView taskView = getTaskViewAt(i);
+ if (taskView == null) {
+ continue;
+ }
float scrollDiff = taskView.getScrollAdjustment(showAsGrid);
int pageScroll = newPageScrolls[i] + Math.round(scrollDiff);
if ((mIsRtl && pageScroll < lastTaskScroll)