Double pre-inflate counts if work profile is enabled

When work profile is enabled, we will show 2 all apps recycler views, thus we should double the pre-inflated BubbleTextView count to make sure scrolling both personal and work all apps is smooth.

Traces are attached in bug.

Fix: 287462835
Test: Grab perfetto traces and compare scrolling all apps on phone with work profile enabled vs disabled
Change-Id: Iaa68ddacad0abcca0f260dd7fa21c92d2feabb03
This commit is contained in:
Fengjiang Li committed 2023-10-05 14:53:30 -07:00
1 parent 2cce534cbb
commit 25eac1381f
4 files changed
+18 -5

No files matched your search

@@ -94,6 +94,10 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
}
protected void updatePoolSize() {
updatePoolSize(false);
}
void updatePoolSize(boolean hasWorkProfile) {
DeviceProfile grid = ActivityContext.lookupContext(getContext()).getDeviceProfile();
RecyclerView.RecycledViewPool pool = getRecycledViewPool();
int approxRows = (int) Math.ceil(grid.availableHeightPx / grid.allAppsIconSizePx);
@@ -109,6 +113,9 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
maxPoolSizeForAppIcons +=
PREINFLATE_ICONS_ROW_COUNT * grid.numShownAllAppsColumns + EXTRA_ICONS_COUNT;
}
if (hasWorkProfile) {
maxPoolSizeForAppIcons *= 2;
}
pool.setMaxRecycledViews(
AllAppsGridAdapter.VIEW_TYPE_ICON, maxPoolSizeForAppIcons);
}