New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 904354 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 29
Cc:
Components:
EstimatedDays: ----
NextAction: 2018-12-04
OS: Android
Pri: 1
Type: Feature

Blocking:
issue 862041



Sign in to add a comment

Support MASKABLE icons for Add To Home Screen

Project Member Reported by peconn@chromium.org, Nov 12

Issue description

Add support for Web App Manifest Icons with purpose="maskable"[1] to the Add to Homescreen flow.

On Android O, if a maskable icon is present, we should add that to homescreen as an adaptable icon[2].




[1] https://w3c.github.io/manifest/#purpose-member
[2] https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmap(android.graphics.Bitmap)
 
Cc: dominickn@chromium.org mgiuca@chromium.org
Hi Peter,

I've created a live demo of a PWA with a maskable icon here:
https://killer-marmot.appspot.com/web/

This page provides a guide on what the icon should look like when interpreted according to the spec:
https://killer-marmot.appspot.com/web/maskable.html

In particular, the system should not crop away more than the yellow circle (i.e. the marmot face should be fully visible). I believe Android will crop too much by default, so the image will have to be padded with 15% on all sides, to get it to the right size.

Ping me or dominickn@ for any help with this, since the exact size calculations are kinda tricky. (See this post for details: https://github.com/w3c/manifest/issues/555#issuecomment-404097653)
Project Member

Comment 2 by bugdroid1@chromium.org, Nov 15

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/68c7419528a629e44025abbea3b17a761bc7f6e6

commit 68c7419528a629e44025abbea3b17a761bc7f6e6
Author: Peter E Conn <peconn@chromium.org>
Date: Thu Nov 15 18:57:07 2018

👹 Read MASKABLE purpose from Web App Manifests.

Web App Manifest icons can have the MASKABLE purpose specifying they
were designed with all of their important content sufficiently far from
the edges to allow the User Agent to apply a mask [1].

This CL just adds code to read in that purpose, which will be used in
upcoming CLs.

[1] https://w3c.github.io/manifest/#purpose-member

Bug:  904354 
Change-Id: Ib62eb7af9226d14199d0d74615cb5bbf2666abda
Reviewed-on: https://chromium-review.googlesource.com/c/1329792
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608448}
[modify] https://crrev.com/68c7419528a629e44025abbea3b17a761bc7f6e6/content/browser/background_fetch/background_fetch.proto
[modify] https://crrev.com/68c7419528a629e44025abbea3b17a761bc7f6e6/content/browser/background_fetch/storage/create_metadata_task.cc
[modify] https://crrev.com/68c7419528a629e44025abbea3b17a761bc7f6e6/content/renderer/manifest/manifest_parser.cc
[modify] https://crrev.com/68c7419528a629e44025abbea3b17a761bc7f6e6/content/renderer/manifest/manifest_parser_unittest.cc
[modify] https://crrev.com/68c7419528a629e44025abbea3b17a761bc7f6e6/third_party/blink/public/common/manifest/manifest.h
[modify] https://crrev.com/68c7419528a629e44025abbea3b17a761bc7f6e6/third_party/blink/public/common/manifest/manifest_mojom_traits.h
[modify] https://crrev.com/68c7419528a629e44025abbea3b17a761bc7f6e6/third_party/blink/public/mojom/manifest/manifest.mojom
[modify] https://crrev.com/68c7419528a629e44025abbea3b17a761bc7f6e6/third_party/blink/renderer/modules/manifest/image_resource_type_converters.cc

Project Member

Comment 3 by bugdroid1@chromium.org, Nov 16

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6

commit 0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6
Author: Peter E Conn <peconn@chromium.org>
Date: Fri Nov 16 14:04:29 2018

👹 Prefer maskable icons in InstallableManager when supported.

Web App Manifests allow icons to be specified with the "maskable"
purpose [1]. These icons are designed with enough space on the sides
to allow the user agent to mask them (eg, cut the icon into a circle).

On devices that support this, attempt to load a maskable icon.

[1] https://w3c.github.io/manifest/#purpose-member

Bug:  904354 
Change-Id: I08c404d7b956e678b37f995e9ae0d3f13a5a49fe
Reviewed-on: https://chromium-review.googlesource.com/c/1333778
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Matt Giuca <mgiuca@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608758}
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/android/webapps/add_to_homescreen_data_fetcher_unittest.cc
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/extensions/bookmark_app_helper_unittest.cc
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/installable/fake_installable_manager.cc
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/installable/installable_data.cc
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/installable/installable_data.h
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/installable/installable_manager.cc
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/installable/installable_manager.h
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/installable/installable_manager_browsertest.cc
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/installable/installable_params.h
[modify] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/browser/web_applications/extensions/bookmark_app_installation_task_unittest.cc
[add] https://crrev.com/0c3be6d9ae31c0937fd5368a2e1f7363a7d09db6/chrome/test/data/banners/manifest_maskable.json

Images to go with discussion on https://chromium-review.googlesource.com/c/chromium/src/+/1341998.


2018-11-20_09-45-17-Dialog.png
73.0 KB View Download
2018-11-20_09-45-25-Adding.png
97.7 KB View Download
Video to go with patcheset 3 of CL.
2018-11-26_15-31-24-Icons.mp4
11.0 MB View Download
The video only seems to show the adding of the "Any" icon.
#6: the maskable icon is added from 25 seconds in (at least, that's what I saw)
#7 oh yeah... maybe I stopped the video early when I watched it. zzz
Project Member

Comment 9 by bugdroid1@chromium.org, Nov 29

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ff026011c94e2dff9da130f898e5ec5c32f2ccfc

commit ff026011c94e2dff9da130f898e5ec5c32f2ccfc
Author: Peter E Conn <peconn@chromium.org>
Date: Thu Nov 29 16:05:01 2018

👹 Add adaptable homescreen shortcuts for maskable icons.

The Add to Homescreen feature will now consider "maskable" icons from
the web app manifest [1]. If a maskable icon is present and we are on
an Android O+ device, turn that "maskable" icon into an Android Adaptive
icon [2].

The icon is scaled to ensure that the safe zone is preserved [3].

[1]: https://w3c.github.io/manifest/#purpose-member
[2]: https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
[3]: https://github.com/w3c/manifest/issues/555#issuecomment-404097653

Bug:  904354 
Change-Id: Iedfe61ace0fda4ca7f3ed3da6a5d07f2bff81443
Reviewed-on: https://chromium-review.googlesource.com/c/1341998
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: Matt Giuca <mgiuca@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612218}
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenManager.java
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/browser/android/shortcut_helper.cc
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/browser/android/shortcut_helper.h
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/browser/android/webapk/webapk_install_service.cc
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/browser/android/webapps/add_to_homescreen_manager.cc
[modify] https://crrev.com/ff026011c94e2dff9da130f898e5ec5c32f2ccfc/chrome/browser/banners/app_banner_ui_delegate_android.cc

Status: Fixed (was: Started)
Project Member

Comment 11 by bugdroid1@chromium.org, Nov 30

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/aa1f1cca8021e014b171aaacb6125e5c1cfe3115

commit aa1f1cca8021e014b171aaacb6125e5c1cfe3115
Author: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Date: Fri Nov 30 02:00:38 2018

Revert "👹 Add adaptable homescreen shortcuts for maskable icons."

This reverts commit ff026011c94e2dff9da130f898e5ec5c32f2ccfc.

Reason for revert: AddToHomescreen tests failing on Android CFI

https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Android%20CFI/3851

JNI ERROR (app bug): expected jboolean (0/1) but got value of 255 as argument 2 to void org.chromium.chrome.browser.webapps.AddToHomescreenManager.onIconAvailable(android.graphics.Bitmap, boolean)

Original change's description:
> 👹 Add adaptable homescreen shortcuts for maskable icons.
> 
> The Add to Homescreen feature will now consider "maskable" icons from
> the web app manifest [1]. If a maskable icon is present and we are on
> an Android O+ device, turn that "maskable" icon into an Android Adaptive
> icon [2].
> 
> The icon is scaled to ensure that the safe zone is preserved [3].
> 
> [1]: https://w3c.github.io/manifest/#purpose-member
> [2]: https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
> [3]: https://github.com/w3c/manifest/issues/555#issuecomment-404097653
> 
> Bug:  904354 
> Change-Id: Iedfe61ace0fda4ca7f3ed3da6a5d07f2bff81443
> Reviewed-on: https://chromium-review.googlesource.com/c/1341998
> Commit-Queue: Peter Conn <peconn@chromium.org>
> Reviewed-by: Matt Giuca <mgiuca@chromium.org>
> Reviewed-by: Peter Beverloo <peter@chromium.org>
> Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
> Reviewed-by: Dominick Ng <dominickn@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#612218}

TBR=yfriedman@chromium.org,peter@chromium.org,mgiuca@chromium.org,peconn@chromium.org,dominickn@chromium.org

Change-Id: I2cccbcbd5fc01f68e1004516b470465db1e663ac
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  904354 
Reviewed-on: https://chromium-review.googlesource.com/c/1356166
Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612513}
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenManager.java
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/browser/android/shortcut_helper.cc
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/browser/android/shortcut_helper.h
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/browser/android/webapk/webapk_install_service.cc
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/browser/android/webapps/add_to_homescreen_manager.cc
[modify] https://crrev.com/aa1f1cca8021e014b171aaacb6125e5c1cfe3115/chrome/browser/banners/app_banner_ui_delegate_android.cc

Project Member

Comment 12 by bugdroid1@chromium.org, Dec 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b955ae4aa818025234a33de98f38b0ee36ba508f

commit b955ae4aa818025234a33de98f38b0ee36ba508f
Author: Peter E Conn <peconn@chromium.org>
Date: Mon Dec 03 13:02:09 2018

Reland "👹 Add adaptable homescreen shortcuts for maskable icons."

This reverts commit aa1f1cca8021e014b171aaacb6125e5c1cfe3115.

Relanded CL:
  https://chromium-review.googlesource.com/c/chromium/src/+/1341998

Changes from original:
  Initialize has_maskable_primary_icon_

Bug:  904354 
Change-Id: I10cbd7bcfea94ea4a1b20236b4e619be9ce415e7

TBR: mgiuca@chromium.org, peter@chromium.org, yfriedman@chromium.org, dominickn@chromium.org
Change-Id: I10cbd7bcfea94ea4a1b20236b4e619be9ce415e7
Reviewed-on: https://chromium-review.googlesource.com/c/1358062
Reviewed-by: Peter Conn <peconn@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613062}
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenManager.java
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/browser/android/shortcut_helper.cc
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/browser/android/shortcut_helper.h
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/browser/android/webapk/webapk_install_service.cc
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/browser/android/webapps/add_to_homescreen_manager.cc
[modify] https://crrev.com/b955ae4aa818025234a33de98f38b0ee36ba508f/chrome/browser/banners/app_banner_ui_delegate_android.cc

Labels: Merge-Request-72
Project Member

Comment 14 by sheriffbot@chromium.org, Dec 3

Labels: -Merge-Request-72 Merge-Review-72 Hotlist-Merge-Review
This bug requires manual review: Reverts referenced in bugdroid comments after merge request.
Please contact the milestone owner if you have questions.
Owners: govind@(Android), kariahda@(iOS), djmm@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
NextAction: 2018-12-04
Is M72 merge request is for CL listed at #12? If yes, cl is not in canary yet, pls update bug with canary result tomorrow. Thank you.
The NextAction date has arrived: 2018-12-04
How is the change looking in latest canary?
The change looks good :-)
Labels: -Merge-Review-72 Merge-Approved-72
Approving merge to M72 branch 3626 based on comment #18. Please merge ASAP. Thank you.
Project Member

Comment 20 by bugdroid1@chromium.org, Dec 5

Labels: -merge-approved-72 merge-merged-3626
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4fbc86df539efbb8552291b4aacd78c237a1ab9c

commit 4fbc86df539efbb8552291b4aacd78c237a1ab9c
Author: Peter E Conn <peconn@chromium.org>
Date: Wed Dec 05 16:26:27 2018

Reland "👹 Add adaptable homescreen shortcuts for maskable icons."

This reverts commit aa1f1cca8021e014b171aaacb6125e5c1cfe3115.

Relanded CL:
  https://chromium-review.googlesource.com/c/chromium/src/+/1341998

Changes from original:
  Initialize has_maskable_primary_icon_

Bug:  904354 
Change-Id: I10cbd7bcfea94ea4a1b20236b4e619be9ce415e7

TBR: mgiuca@chromium.org, peter@chromium.org, yfriedman@chromium.org, dominickn@chromium.org
Change-Id: I10cbd7bcfea94ea4a1b20236b4e619be9ce415e7
Reviewed-on: https://chromium-review.googlesource.com/c/1358062
Reviewed-by: Peter Conn <peconn@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#613062}(cherry picked from commit b955ae4aa818025234a33de98f38b0ee36ba508f)
Reviewed-on: https://chromium-review.googlesource.com/c/1363285
Cr-Commit-Position: refs/branch-heads/3626@{#79}
Cr-Branched-From: d897fb137fbaaa9355c0c93124cc048824eb1e65-refs/heads/master@{#612437}
[modify] https://crrev.com/4fbc86df539efbb8552291b4aacd78c237a1ab9c/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc

I just installed killer marmot and I get this image[1] instead of the maskable icon[2]. Is this a bug in killer marmot or the implementation of the feature? This is on Chrome Canary 73.0.3630.0

[1] https://killer-marmot.appspot.com/web/marmot.png
[2] https://killer-marmot.appspot.com/web/maskable.png
The maskable icon is shown on the dialog when installing the app, but when the app actually gets installed I see the non-maskable icon.
WebAPKs don't yet support maskable icons. This CL just passes the maskable icon up to the WebAPK server but we still need the server to bake in the maskable icon correctly.

If you turn WebAPKs off, you'll get the maskable icon correctly. :)
Labels: Merge-Merged-72-3626
The following revision refers to this bug: 
https://chromium.googlesource.com/chromium/src.git/+/4fbc86df539efbb8552291b4aacd78c237a1ab9c

Commit: 4fbc86df539efbb8552291b4aacd78c237a1ab9c
Author: peconn@chromium.org
Commiter: peconn@chromium.org
Date: 2018-12-05 16:26:27 +0000 UTC

Reland "👹 Add adaptable homescreen shortcuts for maskable icons."

This reverts commit aa1f1cca8021e014b171aaacb6125e5c1cfe3115.

Relanded CL:
  https://chromium-review.googlesource.com/c/chromium/src/+/1341998

Changes from original:
  Initialize has_maskable_primary_icon_

Bug:  904354 
Change-Id: I10cbd7bcfea94ea4a1b20236b4e619be9ce415e7

TBR: mgiuca@chromium.org, peter@chromium.org, yfriedman@chromium.org, dominickn@chromium.org
Change-Id: I10cbd7bcfea94ea4a1b20236b4e619be9ce415e7
Reviewed-on: https://chromium-review.googlesource.com/c/1358062
Reviewed-by: Peter Conn <peconn@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#613062}(cherry picked from commit b955ae4aa818025234a33de98f38b0ee36ba508f)
Reviewed-on: https://chromium-review.googlesource.com/c/1363285
Cr-Commit-Position: refs/branch-heads/3626@{#79}
Cr-Branched-From: d897fb137fbaaa9355c0c93124cc048824eb1e65-refs/heads/master@{#612437}

Sign in to add a comment