I noticed that some applications are whitelisted from doze-mode on samsung devices without having ever asked the user. I tested this on a galaxy s8, galaxy A5 2016, 2017 all running android 7.0 or 7.1. These apps are for instance Viber, WhatsApp, Messenger - they're what I have seen.
When I first noticed this on a samsung I was not 100% sure that I have not by chance given them that permission myself... So I have done a fresh test by hard resetting a Samsung A5 2016 and installing only Viber onto the fresh phone. After the install, I have not even logged into Viber (and it had not had a chance to ask me of any permissions at all), I immediately checked the Battery Optimisation whitelist and Viber was there.
So the first question is how - according to Android specs an app must ask the user to explicitly allow whitelisting (Am I wrong here)?
The second question - is this maybe possible on Samsung despite the spec.
The third question - maybe Samsung just knows some well known apps and whitelists them by default itself?
--EDIT The initial research on this was hindered by the fact that if you google "samsung doze-mode whitelist" maybe with "not asking the user" it still serves you many links to the official doze mode specs and media articles, but not Samsung related. But then I searched with "samsung smart manager whitelist" and found the following
- Question on SO (second answer gives a list of apps which are whitelisted) https://stackoverflow.com/questions/37205106/how-do-i-avoid-that-my-app-enters-optimization-on-samsung-devices
the list of apps in the second answer was of undisclosed source but I can confirm that I checked nearly 10 of them and they are whitelisted by default
Funny thing - the user asks a question and a part of the question is the same as mine - why Viber etc are whitelisted. The answer is carefully avoiding that part and only answers the other part - that he should ask the users consent or use Knox (also asking the user for permission)
So answers to my own questions
According to the spec the app must ask users consent to be whitelisted - yes.
not possible on Samsung for a simple app, either
Yes, Samsung has a whitelist of well-known apps in its Smartmanager
2 more pieces of info
A. Samsung is reluctant to talk about it(see above SEAP link) or maybe not everybody there is aware of the fact.
B. If you have an issue with Samsung doze-mode, do not google for "Samsung doze-mode", google for smth. like "Samsung smart manager doze-mode" (add "smart manager"), because it will yield more Samsung specific results (And Samsung part of battery optimizations is pretty specific).