New issue
Advanced search Search tips

Issue 767579 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: ----

Blocked on:
issue 769683



Sign in to add a comment

Web Push Notifications: Custom badge's color doesn't change in apps with "android:windowLightStatusBar" enabled

Reported by conta...@rockodev.com, Sep 21 2017

Issue description

Device name: OnePlus 3T

From "Settings > About Chrome"
Application version: Chrome 60.0.3112.116
Operating system: Android 7.1.1; ONEPLUS A3000 Build/NMF26F

URLs (if applicable):
https://tests.peter.sh/notification-generator/
https://twitter.com/ (Twitter Lite Notifications)

Steps to reproduce:
(1) Open https://tests.peter.sh/notification-generator/ in Chrome and enable push notifications.
(2) In "Visual settings" > "Badge" select "Custom".
(3) Paste one of the following urls:
https://www.unocero.com/static/img/icons/notifications/ic_notification.1.png
https://abs-0.twimg.com/responsive-web/serviceworker/logo.9d0ec6feeefcbe03.png
https://tests.peter.sh/resources/icons/11.png
(4) Hit "Display the notification" button.
(5) Open the Twitter app (native) and toggle on/off the "Night Mode" located in the drawer menu (bottom left).
(6) Repeat all the steps but using different urls in step 3.

Expected result:
The notification badge's color should change to contrast with the color of the status bar (light/dark).

Actual result:
The notification badge's color is preserved white with some image urls. The only badge that changes is https://tests.peter.sh/resources/icons/11.png
 
screenshot-1.png
47.2 KB View Download
screenshot-2.png
53.6 KB View Download
Components: Blink>PushAPI

Comment 2 by peter@chromium.org, Sep 22 2017

Components: -Blink>PushAPI UI>Notifications
Owner: awdf@chromium.org
Status: Assigned (was: Unconfirmed)
This might be an Android issue, maybe even specific to the OnePlus 3T. We use the new Icon[1] class so that we can supply a Bitmap as opposed to a resource. It's possible that marks aren't being handled very well on those, in which case this will likely be a WontFix (unless we decide to blacklist the 3T for badges).

Anita, would you mind checking whether this is 3T specific?

[1] https://developer.android.com/reference/android/graphics/drawable/Icon.html

Comment 3 by awdf@chromium.org, Oct 4 2017

I'm confused by the repro steps.

 Why would we expect badges of notifications from tests.peter.sh to be displayed differently after toggling 'Night mode' in the native twitter app?

(I'm assuming 'Night Mode' in the native twitter app only changes UI within the native twitter app, it's not an OS-level Android feature right?)

Comment 4 by awdf@chromium.org, Oct 4 2017

Ok Peter drew my attention to the screenshots and I now understand.

In summary, it seems when the Android status bar at the top switches between a light and dark background color, most badges flip from dark to light, and vice versa, but some web notification badges do not.

I'll try to repro on my device..

Comment 5 by awdf@chromium.org, Oct 4 2017

Followed the steps in the description and cannot reproduce on Android O. 

(Although it's odd, when I tried on a Nexus 5 on O the custom badges didn't work at all - filed  Issue 771611  for this)..

Comment 6 by awdf@chromium.org, Oct 4 2017

*5x sorry

Comment 7 Deleted

I made more tests in Chrome stable channel:

Device: Xperia Z3 D6603
Application version: Chrome 61.0.3163.98
Operating system: Android 6.0.1; D6603 Build/23.5.A.1.291
Result: Everything works as expected.

Device: Nexus 9
Application version: Chrome 61.0.3163.98
Operating system: Android 7.1.1; Nexus 9 Build/N9F27H
Result: Everything works as expected.

Device: Nexus 5 (With LineageOS 14.1 Nightly)
Application version: Chrome 61.0.3163.98
Operating system: Android 7.1.2; Nexus 5 Build/NJH47F
Result: Everything works as expected.

Device: OnePlus 3T
Application version: Chrome 61.0.3163.98
Operating system: Android 7.1.1; ONEPLUS A3000 Build/NMF26F
Result: Same issue reported in this thread.

Device: Samsung Galaxy S8
Application version: Chrome 61.0.3163.98
Operating system: Android 7.0.0; SM-G950F Build/NRD90M
Result: Same issue reported in this thread. But, in this case, the icon also looks white in the notifications panel.

The following screenshots are from the Samsung Galaxy S8
sgs8-screenshot1.png
226 KB View Download
sgs8-screenshot2.png
23.4 KB View Download
3 more tests:

Device: Samsung Galaxy S8 Plus
Application version: Chrome 61.0.3163.98
Operating system: Android 7.0.0; SM-G955F Build/NRD90M
Result: Same issues as Samsung Galaxy S8.

Device: Nexus 6P
Application version: Chrome 61.0.3163.98
Operating system: Android 8.0.0; Nexus 6P Build/OPR6.170623.019
Result: Everything works as expected.

Device: Motorola Moto X Play
Application version: Chrome 61.0.3163.98
Operating system: Android 6.0.1; XT1563 Build/MPDS24.107-52-5
Result: Everything works as expected.


Maybe is an Android bug with some manufacturers...

Is posible fix this replacing Icon[1] with IconCompat[2] and using a workaround in the Android support library[3]?

[1] https://developer.android.com/reference/android/graphics/drawable/Icon.html
[2] https://developer.android.com/reference/android/support/v4/graphics/drawable/IconCompat.html
[3] https://developer.android.com/topic/libraries/support-library/index.html

Comment 10 by awdf@chromium.org, Oct 6 2017

Thanks for the extensive testing. It certainly looks device-specific.

IconCompat is a good idea, so long as there's not a good reason we're not using this already (from Peter's comment in #2 it sounds like there might be, related to using bitmaps instead of resources).

I will take a look at this properly later today and update this thread with whether the IconCompat solution is feasible.

Comment 11 by awdf@chromium.org, Oct 6 2017

Labels: -Pri-3 Pri-2

Comment 12 by awdf@chromium.org, Oct 6 2017

Status: Started (was: Assigned)

Comment 13 by awdf@chromium.org, Oct 6 2017

Blockedon: 769683
Status: Assigned (was: Started)
Hmm looks like the IconCompat class suggested in comment #9 was only added in v 26.0.0 of the Android support library, and currently Chrome is still on 25.0.1 [1]

However there is currently work in progress to update to v26.1.0 [2]

Marking this issue as blocked on that work. I will revisit this when it's done.

[1] https://cs.chromium.org/chromium/src/build/secondary/third_party/android_tools/support/BUILD.gn?l=12
[2] https://bugs.chromium.org/p/chromium/issues/detail?id=769683
Thank you

Comment 15 by awdf@chromium.org, Oct 11 2017

Status: ExternalDependency (was: Assigned)

Comment 16 by awdf@chromium.org, Jan 9 2018

Status: Available (was: ExternalDependency)
Status: Assigned (was: Available)
Owner: peter@chromium.org

Sign in to add a comment