Skip to content
Commit cab7d8e0 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Resolve Notification.Colors once, instead of lazily.

* Instead of resolving colors as-needed, resolve the entire palette potentially used by the notification at the start.
* Centralize color logic and palette storage into Notification.Colors for easier unit testing.
* Adds unit tests for the Notification.Colors, including validating color contrast ratios for various colors.
* Fix a bug with ColorContrastUtil where the luminosity for dark/light font cutoff was 0.5, which resulted in a max contrast ratio of 1.9 for some colors.  Now contrast ratios of 4.5:1 can be achieved for all colors.
* Removes a few of the color accessors in Notification.Builder which were infrequently used, and replaces them with direct use of Notification.Colors.
* Notification specific colors (primary, secondary, default) have only been used by colorized notifications for a few months.  Remove the dark mode overrides of these, ensuring that colorized notifications have the same exact appearance in light and dark themes.
* Replace the use of the "default" color with the "secondary text color"; this practically only affects the alerted bell icon, is more consistent, and reduces complexity.

Fixes: 187881776
Test: manual
Test: atest android.app.NotificationTest
Change-Id: Ib8840d04093094c324d8bdce5b2e84c93a94db8d
parent d49a4099
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment