Support icons larger than 48dp on the splash screen |
||||||
Issue descriptionUsers want this: See Issue 818433
,
Mar 7 2018
,
Mar 7 2018
> This should ideally not make the APK any bigger because a .zip archive should compress really well duplicate files Unfortunately, IIUC, zip archives compress each file individually, so I don't think they would detect or optimize for multiple identical files.
,
Mar 7 2018
,
Jun 28 2018
This requires some investigation before we know what are options are here
,
Jul 3
Just attempted the suggestion of creating separate splash_screen_icon.png files and using those. Unfortunately, it looks like the APK increases from 130.7 kB to 219.3 kB. This is probably not the best solution given the size cost. Especially if we are just reusing existing files. I will start investigating other avenues to see if there are alternatives.
,
Jul 3
A promising alternative seems to be ApiCompatibilityUtils#getDrawableForDensity which allows us to fetch the explicit density of drawable regardless of aliasing. This will avoid binary size increase while still achieving the desired effect. It is a bit more code to write/maintain regarding screen density but it looks straightforward to implement. Do we want to significantly increase the size of xxhdpi and xxxhdpi splash screens as well? We don't have assets for that in the WebAPK at present.
,
Jul 3
Oh I thought we do have xxhdpi & xxxhdpi under the mipmap folders (cause that's what's used for homescreens)
,
Jul 4
yfriedman@ To clarity, we have xxhdpi and xxxhdpi homescreen/app_icons but those are already used on the splashscreen. As I understand it, the meaning of this bug is that lower dpi devices should use higher dpi images for the splash screen so they are larger. For example; xhdpi phones use the xxxhdpi app_icon.png for the splash image. Since there are no assets larger than xxxhdpi, the xxhdpi only scales slightly and the xxxhdpi splash screen cannot scale up further.
,
Jul 4
Right, thanks. It's a shame if this doesn't really benefit higher quality devices too but of course we also don't want to bloat the apk's too much. I honestly forget how we map the web app manifest icon / sizes to android densities. Worth a look to see if we filter it only at a certain size but have the ability to go higher?
,
Jul 19
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/10d564ab13c187637aa30ddb8e7b8b5441331e7e commit 10d564ab13c187637aa30ddb8e7b8b5441331e7e Author: Calder Kitagawa <ckitagawa@chromium.org> Date: Thu Jul 19 13:32:25 2018 [WebAPK] Proposed splash_icon resource rearrangement Rearrange the WebAPK resources such that a higher density app_icon_<density>.png can be used as the splash_icon.xml and add app_icon.xml to not break anything as a result of moving and renaming the app_icon.png files. Also adds a splashId to the AndroidManifest.xml for use in Chrome such that the WebAPK can update the splash screen image rather than using the primaryIcon for the splash screen. Modifies Chrome code to support decoding XML aliases to images. TBR=dominickn@chromium.org Bug: 819755 Change-Id: Id42c2e898a5996dfba46ad6608cc1d3103300521 Reviewed-on: https://chromium-review.googlesource.com/1128256 Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Reviewed-by: Dominick Ng <dominickn@chromium.org> Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org> Reviewed-by: Xi Han <hanxi@chromium.org> Cr-Commit-Position: refs/heads/master@{#576471} [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/AndroidManifest.xml [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/bound_manifest_config.json [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/http_manifest_config.json [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/javatest_manifest_config.json [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/maps_go_manifest_config.json [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/drawable-hdpi/splash_icon.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/drawable-mdpi/splash_icon.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/drawable-xhdpi/splash_icon.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/drawable-xxhdpi/splash_icon.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/drawable-xxxhdpi/splash_icon.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-hdpi/app_icon.xml [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-hdpi/ic_launcher.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-mdpi/app_icon.xml [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-mdpi/ic_launcher.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-xhdpi/app_icon.xml [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-xhdpi/ic_launcher.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-xxhdpi/app_icon.xml [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-xxhdpi/ic_launcher.xml [add] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-xxxhdpi/app_icon.xml [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap-xxxhdpi/ic_launcher.xml [rename] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap/app_icon_hdpi.png [rename] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap/app_icon_mdpi.png [rename] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap/app_icon_xhdpi.png [rename] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap/app_icon_xxhdpi.png [rename] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/res/mipmap/app_icon_xxxhdpi.png [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/shell_apk_version.gni [modify] https://crrev.com/10d564ab13c187637aa30ddb8e7b8b5441331e7e/chrome/android/webapk/shell_apk/unbound_manifest_config.json
,
Jul 23
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/743d97bb444ef5c4dbb7611615bce587757afe5b commit 743d97bb444ef5c4dbb7611615bce587757afe5b Author: Calder Kitagawa <ckitagawa@chromium.org> Date: Mon Jul 23 20:49:42 2018 [WebAPKs] Larger Splash Icon: Remainder of client side changes This constitutes the remainder of the changes required for the client to show a larger splash screen icon. The server still needs a few more changes before the larger icons can be shipped but this gets the client to a point where the larger icons can be used. Updates will occur automatically when the new Shell APK version is pushed. Otherwise apps will continue to use the small icons. Because larger splash icons are just app icons, all that is needed to trigger an update is changing the icons in the WebappManifest to update the splash screen icons. Tested on mdpi, hdpi, xhdpi, and xxhdpi devices running L, N, O, P. There is a known issue on P Beta builds where xxhdpi devices don't use the large layout due to Bitmap#getWidth() and Bitmap#getHeight() returning incorrect values for aliased resources. However, this is not something we can solve in Chrome and requires Android changes. See b/111687946 Bug: 819755 Change-Id: I033dba20b766f875b6fc3d7515f24636aa5b0d4a Reviewed-on: https://chromium-review.googlesource.com/1142475 Reviewed-by: Dominick Ng <dominickn@chromium.org> Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org> Reviewed-by: Xi Han <hanxi@chromium.org> Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Cr-Commit-Position: refs/heads/master@{#577248} [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateDataFetcher.java [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateDataFetcherTest.java [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkInfoTest.java [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java [modify] https://crrev.com/743d97bb444ef5c4dbb7611615bce587757afe5b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkMetaDataKeys.java
,
Jul 23
Client side changes are finished. I will mark this bug as fixed when the internal server side changes are complete. Note: This will not be available until at least M70 after a new shell_apk push.
,
Jul 24
P Bugfix: On Android P there was a graphic issue where xxhdpi devices used the small splash screen layout resulting in a clipped image. This was a result of an internal change where Bitmaps are no longer scaled by the device except at render time to reduce RAM usage. As a result the previously working Bitmap#getWidth() and Bitmap#getHeight() returned the unscaled values yet the image was rendered scaled resulting in the layout selection logic being faulty. To correct for this we need to use Bitmap#getScaledWidth(DisplayMetrics) and Bitmap#getScaledHeight(DisplayMetrics) which returns the image size post scaling on Android O and earlier this results in no change but on Android P it fixes the issue. See the attached screenshots for the before and after results.
,
Jul 25
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/59e3c75c060833b5b566ef6c209bc75e79bc04c5 commit 59e3c75c060833b5b566ef6c209bc75e79bc04c5 Author: Calder Kitagawa <ckitagawa@chromium.org> Date: Wed Jul 25 18:32:11 2018 [Webapps] Fix splash screen scaling on Android P When loading splash_icon.xml on Android P, scaling doesn't occur until after the image is drawn. As a result, if we try to show a lower DPI image such as the mdpi icon, the Bitmap#getWidth/Bitmap#getHeight values will only return the original image size on Android P. What we actually want is the scaled image size. To do so we use Bitmap#getScaledWidth/Bitmap#getScaledHeight which return the scaled image size in pixels. This wasn't a problem on O and earlier since this scaling occurred when the bitmap was loaded into memory (prior to rendering). Bug: 819755 Change-Id: I86ad9466d653d4d8501a8c672925b2ba86819d8d Reviewed-on: https://chromium-review.googlesource.com/1148815 Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org> Reviewed-by: Xi Han <hanxi@chromium.org> Reviewed-by: Dominick Ng <dominickn@chromium.org> Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Cr-Commit-Position: refs/heads/master@{#577987} [modify] https://crrev.com/59e3c75c060833b5b566ef6c209bc75e79bc04c5/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java
,
Aug 8
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/842f0969f52cfd7efb472e23c230087e26b30919 commit 842f0969f52cfd7efb472e23c230087e26b30919 Author: Calder Kitagawa <ckitagawa@chromium.org> Date: Wed Aug 08 13:46:53 2018 [WebAPK] Improve splash icon logic. pkotwicz@ pointed out that res/mipmap is actually an alias for res/mipmap-mdpi. This resulted in all icons being way too large and appear with some fidelity issues. In testing I believed these larger icons to be correct but in reality they should have been smaller. To fix this we could move the icons into the mipmap-nodpi folder. However, this prevents them from scaling even when aliased. i.e. if on an xxhdpi device all we have is an mdpi icon the following scenario occurs; drawable-*dpi/ has no valid splash_icon.xml so we fall back to the mipmap-*dpi/app_icon.xml here we find that only the mdpi icon is available. One would think this then scales up to an appropriate size on drawable-xxhdpi but instead Android refuses to scale it as it is in the mipmap-nodpi as the double lookup does not change the fact it is nodpi. pkotwicz@ then suggested we use Scale XML resources, these solve the problem but require the minting server to manually compute the scaling at mint time. Instead I propose the following solution: - Restore the state for app_icon.png files prior to CL https://chromium-review.googlesource.com/1128256 - Introduce a single splash_icon.xml in drawable-xxxhpdi. This will reference mipmap/app_icon and essentially be identical to the current behavior of just using the app_icon (this is just a placeholder). - Add a boolean to the metadata of the AndroidManifest.xml indicating whether we were able to package larger images on the server. (This is so xxhpdi can use these images rather than only using the slightly larger xxxhdpi icon). - Use ApiCompatibilityUtils#getDrawableForDensity(). This gives us the image for a specific density or scales the nearest available one if there isn't one available. This allows us to control which size of image we show. We can then impose the following lookup scheme based on the current device density. Tested on xhdpi, hdpi and xxhdpi running N, O, P | Current Density | App Icon Density for Splash Icon | | mdpi | xhdpi | | hdpi | xxhdpi | | xhdpi | xxxhdpi | | xxhdpi | xxxhdpi or larger if provided | | xxxhdpi | xxxhdpi or larger if provided | Bug: 819755 Change-Id: I40fe68375782b29d082193aae0ab1c1af0ae49f2 Reviewed-on: https://chromium-review.googlesource.com/1150297 Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Reviewed-by: Dominick Ng <dominickn@chromium.org> Reviewed-by: Xi Han <hanxi@chromium.org> Cr-Commit-Position: refs/heads/master@{#581549} [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkMetaDataKeys.java [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/AndroidManifest.xml [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/bound_manifest_config.json [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/http_manifest_config.json [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/javatest_manifest_config.json [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/maps_go_manifest_config.json [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/drawable-hdpi/splash_icon.xml [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/drawable-mdpi/splash_icon.xml [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/drawable-xhdpi/splash_icon.xml [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/drawable-xxhdpi/splash_icon.xml [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/drawable-xxxhdpi/splash_icon.xml [rename] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-hdpi/app_icon.png [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/mipmap-hdpi/app_icon.xml [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-hdpi/ic_launcher.xml [rename] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-mdpi/app_icon.png [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/mipmap-mdpi/app_icon.xml [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-mdpi/ic_launcher.xml [rename] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-xhdpi/app_icon.png [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/mipmap-xhdpi/app_icon.xml [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-xhdpi/ic_launcher.xml [rename] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-xxhdpi/app_icon.png [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/mipmap-xxhdpi/app_icon.xml [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-xxhdpi/ic_launcher.xml [rename] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-xxxhdpi/app_icon.png [delete] https://crrev.com/143a0622f29e0d5179efa5ce9c2a14eec5f72ff7/chrome/android/webapk/shell_apk/res/mipmap-xxxhdpi/app_icon.xml [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/res/mipmap-xxxhdpi/ic_launcher.xml [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/shell_apk_version.gni [modify] https://crrev.com/842f0969f52cfd7efb472e23c230087e26b30919/chrome/android/webapk/shell_apk/unbound_manifest_config.json
,
Aug 8
Should probably be verified in canary. We might want TE support to test on an array of devices. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by pkotw...@chromium.org
, Mar 7 2018