r/androiddev • u/jpetitto • Sep 21 '17
Android Color Resources Not Safe
https://twitter.com/mandybess/status/91055567847695155251
u/EddieRingle Sep 21 '17
There's a part of the CTS that checks to make sure the Holo and Material themes are unmodified. I would've hoped that there was a similar test to ensure public framework resources were left unmodified, as well.
10
Sep 27 '17
We naively hoped OEMs would not change android.R.color... A new test is getting added https://android-review.googlesource.com/#/c/platform/cts/+/494605/
3
u/EddieRingle Sep 27 '17
Awesome! What's done is done, but I'm glad to see improvements are being made.
20
u/cypressious Sep 21 '17
This! This is 100% on Google.
23
u/adamhighdef Sep 21 '17
No, it's on OEMs for changing them in the first place. Not every android phone is bundled with googles software
10
u/TheRealKidkudi Sep 21 '17
¿Por que no los dos? Yeah OEMs shouldn't be messing with it, but Google shouldn't let them do it either.
4
Sep 23 '17
It's impossible to enumerate all possible bad things that can be done. Google has the same problem with SELinux neverallow rules trying to rule out all kinds of bad policies. The only full solutions would be the OEMs acting responsibility or Google ending their Play licensing and treating Android like ChromeOS.
3
u/wannagotopopeyes Oct 04 '17
No, it's on Google for letting this kind of thing slip through the cracks. Compatibility Test Suite is a requirement for all OEM's shipping a device with Android - not sure how this sort of thing would slip through but Google won't let you make any Android hardware if you fail CTS
41
u/ene__im https://github.com/eneim Sep 21 '17
The worst part is when they change transparent to solid color. Had this issue before when working with some Japanese tablets.
12
u/fritti_tailchaser Sep 21 '17
I wonder what the rationale for doing that is.
17
u/fury-s12 Sep 21 '17
usually its just that samsung think they are right, always
11
u/xroni Sep 21 '17
Since Samsung is Korean they don't make Japanese tablets afaik, but yeah they think they can do whatever they want.
5
Sep 21 '17
It's because they can. They hold by far the largest market share, and a few fuckups here and there ain't gonna change that.
1
u/ene__im https://github.com/eneim Sep 21 '17
I was so angry and tired that I forgot to ask "WHY" ...
1
Sep 21 '17
Not supporting an alpha channel maybe? I have no idea, but saving a byte for every pixel seems nice for budget devices.
21
u/beejiu Sep 21 '17
On a web application I work on, I discovered one day that (white) text on (blue) buttons seemed quite difficult to read. Turns out my colleague thought it would be a good idea to change a variable called $cpurewhite to have a blueish hint.
13
26
u/can_i_have Sep 21 '17
I argued this case with a senior architect fuckin yearsss back in 2013. Going to find his contact info so that I can have the last laugh.
4
u/WestonP Sep 21 '17
Finally, clear justification for me being stubborn and defining my own colors! I've learned to be weary of trusting the system to be consistent.
1
u/K-K-K-KWEEEH Sep 21 '17
Could this happen in the Color class as well?
5
u/jpetitto Sep 21 '17
They are just compile time hex constants packaged with the SDK, so they should be safe. I hope.
1
3
Sep 21 '17
I'm going to guess that mapping the brightest colors to dimmer versions it lowers screen power usage and extends battery life.
2
u/Avamander Sep 21 '17 edited Oct 03 '24
Lollakad! Mina ja nuhk! Mina, kes istun jaoskonnas kogu ilma silma all! Mis nuhk niisuke on. Nuhid on nende eneste keskel, otse kõnelejate nina all, nende oma kaitsemüüri sees, seal on nad.
0
25
u/jpetitto Sep 21 '17
I suppose this extends to other resources too, like
android:string/ok.