In preparation for daily driving #MobileLinux I've been thinking a lot about what must be done for reliable and power-efficient push notifications.

Spoiler alert: while UnifiedPush may be a relevant service for some apps, it's not where platform dev focus should be. We want a future full of p2p apps that reject permanently-addressable "servers" entirely, after all! And centralization is not where the bulk of the power-saving magic is anyway. The "magic" is in the fact that the SoC can be in deep sleep and the modem will still wake it up with an interrupt when data arrives on an open connection. It should be fine to have apps' own service processes listen for notifications!

My rough sketch of a to-do list would be:

  • making sure wakeups don't turn the display on xD
  • research into what's needed to set up filtering on the modem for which sockets can wake the SoC up (but initially, fine to just rely on "nothing else has open sockets anyway, only the background services waiting for pushes" maybe?)
  • easy API for establishing the push connection specifically over mobile data if available (since only modem supports wakeup well rn)
  • support for robust background services: unlike what the Background portal offers now, let #Flatpak apps install systemd-user services, which would have metadata connecting them to the .desktop entry, making them introspectable and accountable via settings GUIs (not via control center popups! they shouldn't show up as "annoying left-over in-process thing possibly eating battery"! they're a different thing, expected to run permanently!)
  • actually getting apps to separate push notification listeners into background services

#postmarketOS #linuxmobile #freedesktop

@valpackett in my case fp5/pmos roughly uses two times more energy compare to the stock android. I'd like to learn and know for sure where the energy goes. powersupply is great app, but show only total current energy consumption. would be nice to get deeper into details. Please share thoughts how to know more.
thanks!

@Oleksii that's kinda basically impossible :) :) :) there isn't really any granular energy measurement in the hardware, heck all the hw shares power rails in ways that would make per-rail measurement not-so-useful.

fun fact, even what macOS reports as power usage by apps is kind of a guesstimate based on resource usage and factory measurement of how that vaguely translates into energy.

@valpackett thank you for sharing. Just for analogy. if we are talking about basic server use case without gpu, only cpu, ram and storage. In this case vast majority uses CPU i guess. of course linux mobile is way more complicated case, but at least its my thoughts.

@valpackett have no idea what is happening under the hood, but in case of kubernetes you have some control over cpu i guess its effect total energy consumption of server quite a lot.

ohh another use case. Im using watt app on stock android its very helpful when i need to save battery.