Conversation

Replying to and
Apps aren't allowed to keep the device awake or trigger waking it up whenever they want though, so it can't apply to every usage of stuff like TCP keepalive. It's also really best if every single app needing push notifications isn't trusted to do it right themselves.
1
Replying to and
Well now we're getting into the domain of Android policy (and why it's idiotic). Mobile OS should just force-suspend any app that consumes more than X% of cpu while in background, letting them use standard APIs like TCP keepalive but suffer consequences if they do it wrong.
1
Replying to and
Waking up the device frequently is a bigger battery drain than doing it very infrequently but using a lot of CPU. It gets to sleep for long periods of 30+ minutes at a time on a reliable network. It always tries to get back to sleep very fast but apps will stop that.
2
Most apps will ruin battery life if given the opportunity. Simply something like an email app that wants to poll every minute and is too lazy to come up with a push system for email since it's not part of the baseline email standards and they don't want to run a push server, etc.
1
And it's basically every app that will do it, so if the user has 50 apps they've got 50 things keeping the device awake with wake locks or constantly waking it up, with the intervals not lining up well. OS has to be heavily involved in scheduling / alarms / timers to work well.
1
Replying to and
That's already essentially how everything works. An app can be actively doing things and the device is still going to go to sleep and the app will keep doing whatever it was doing as soon as the device wakes up again. Wake locks are needed to force it from going to sleep.
1
It does measure how much battery usage apps are causing based on CPU time, wake locks, scheduled jobs, etc. but being able to identify those after a while to some extent isn't really a substitute for providing efficient ways of doing things and coercing app devs to use them.
1
iOS is similar to modern Android if you completely remove the option of foreground services and battery optimization exceptions. It's why it has had such good battery life all along while Android had to keep making things stricter and stricter until it got to the state now.