[Android Notification Channels] Ensure origin channels are initialized

Desktop / Chromium - Anita Woodruff [chromium.org] - 15 June 2017 11:06 EDT

- This change ensures individual site channels ('per-origin' channels) are initialized at the point a web notification is posted to them.

- Note these 'per-origin' channels are still behind the 'SiteNotificationChannels' flag - web notifications are still posted to the generic 'Sites' channel unless this flag is enabled.

- Previously, if permission was granted while the flag was disabled, and then the flag was enabled and the site posted a notification, this notification would fail to post, since per-origin channels were only created on permission grant. Now, it should succeed.

- Note that even when the flag is removed, this change will still be necessary for users upgrading with existing notification permissions.

- Eventually we should only initialize these per-origin channels from native, so all per-origin channel initialization goes through the same path, but this is a quick fix for now.

Bug: 700377 Change-Id: I78321eb8eb2b651e2e25eeb74645a7e62b49cb36 Reviewed-on: https://chromium-review.googlesource.com/536953

a7e9481 [Android Notification Channels] Ensure origin channels are initialized
.../channels/ChannelsInitializer.java | 5 ++++-
.../channels/SiteChannelsManager.java | 2 +-
.../channels/ChannelsInitializerTest.java | 26 ++++++++++++++++++++--
3 files changed, 29 insertions(+), 4 deletions(-)

Upstream: git.chromium.org

  • Share