launcher: use same icon size for all apps drawer in foldables
For foldables, no matter the grid size, we use 60dp for icons sizes.
This also fix a bug where the icon size was always the minimum between
default and all apps, which means that for foldables it would always be
default.
Bug: 202708085
Test: visual, using HSV and Window
Change-Id: I315718a8ba7a0aaed2204ad12e6b184dda2be48e
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index d844b87..2ebedf7 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -286,7 +286,11 @@
mExtraAttrs = closestProfile.extraAttrs;
iconSize = displayOption.iconSizes;
- iconBitmapSize = ResourceUtils.pxFromDp(iconSize[INDEX_DEFAULT], metrics);
+ float maxIconSize = iconSize[0];
+ for (int i = 1; i < iconSize.length; i++) {
+ maxIconSize = Math.max(maxIconSize, iconSize[i]);
+ }
+ iconBitmapSize = ResourceUtils.pxFromDp(maxIconSize, metrics);
fillResIconDpi = getLauncherIconDensity(iconBitmapSize);
iconTextSize = displayOption.textSizes;
@@ -555,13 +559,10 @@
}
out.multiply(1.0f / weights);
- // Since the bitmaps are persisted, ensure that the default bitmap size is same as
+ // Since the bitmaps are persisted, ensure that all bitmap sizes are not larger than
// predefined size to avoid cache invalidation
- out.iconSizes[INDEX_DEFAULT] =
- closestPoint.iconSizes[INDEX_DEFAULT];
- for (int i = INDEX_DEFAULT + 1; i < COUNT_SIZES; i++) {
- out.iconSizes[i] = Math.min(out.iconSizes[i],
- out.iconSizes[INDEX_DEFAULT]);
+ for (int i = INDEX_DEFAULT; i < COUNT_SIZES; i++) {
+ out.iconSizes[i] = Math.min(out.iconSizes[i], closestPoint.iconSizes[i]);
}
return out;