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
This commit is contained in:
minch
2024-12-12 18:26:50 +00:00
committed by Min Chen
parent 179403d37d
commit 8cf0df7f96
@@ -6186,10 +6186,12 @@ public abstract class RecentsView<
}
}
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)