From 4acb22437c062bf3d49e5285719a2c6f014f2574 Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Tue, 11 May 2021 16:33:09 +0200 Subject: [PATCH] Scale splash screen icon by 1.2 instead of 1.3 Bug: 186847483 Test: Open an app Change-Id: I889df24a8a39bafa3c4c5eec6b14536a7cc804a2 --- .../shell/startingsurface/SplashscreenContentDrawer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java index fd6f0ad99e66d..1f098c200b3f6 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java @@ -66,7 +66,7 @@ public class SplashscreenContentDrawer { // For example, an icon with the foreground 108*108 opaque pixels and it's background // also 108*108 pixels, then do not enlarge this icon if only need to show foreground icon. private static final float ENLARGE_FOREGROUND_ICON_THRESHOLD = (72f * 72f) / (108f * 108f); - private static final float NO_BACKGROUND_SCALE = 1.3f; + private static final float NO_BACKGROUND_SCALE = 192f / 160; private final Context mContext; private final IconProvider mIconProvider; @@ -283,7 +283,8 @@ public class SplashscreenContentDrawer { } else { final float iconScale = (float) mIconSize / (float) mDefaultIconSize; final int densityDpi = mContext.getResources().getDisplayMetrics().densityDpi; - final int scaledIconDpi = (int) (0.5f + iconScale * densityDpi); + final int scaledIconDpi = + (int) (0.5f + iconScale * densityDpi * NO_BACKGROUND_SCALE); iconDrawable = mIconProvider.getIcon(mActivityInfo, scaledIconDpi); if (iconDrawable == null) { iconDrawable = mContext.getPackageManager().getDefaultActivityIcon(); @@ -356,7 +357,7 @@ public class SplashscreenContentDrawer { Slog.d(TAG, "makeSplashScreenContentView: choose fg icon"); } // Reference AdaptiveIcon description, outer is 108 and inner is 72, so we - // should enlarge the size 108/72 if we only draw adaptiveIcon's foreground. + // scale by 192/160 if we only draw adaptiveIcon's foreground. final float noBgScale = foreIconTester.nonTransparentRatio() < ENLARGE_FOREGROUND_ICON_THRESHOLD ? NO_BACKGROUND_SCALE : 1f;