I’m wondering how the Librem 5 (or more precisely how KDEMobile/Phosh/etc.) are going to manage locking a device while preserving background functionalities (like receiving msgs) as well as apps life cycle ?
As I see it, now that Flatpak is using Portal through D-Bus, we start to see a cleaner API emerge which basically consists to interact only through D-Bus to access resources. This also allows sand-boxing & a permission system.
-> This is the parallel with Android’s Binder IPC & permission system.
However I see two missing pieces left to have a mobile OS :
- A “modern” app life cycle management. On Android we have a well defined App LifeCycle which can be in multiple states. This is very important for resources saving. Without this kind of lifecycle, battery is going to go down extremely fast.
Android can safely kill any app at any time because it knows the app can restore its state (which is kind of confusing on Android for some users, there is no notion of app “running” or not, because if it is killed it will restore its state and the user cannot notice it).
If an app needs to run in background (music player, downloads, etc…) there are very specific background process / media APIs that allows it. This is because as an app can be killed at any moment, we cannot rely on the app to handle background tasks. This policy results in a well controlled and efficient management of apps and resources.
So I was wondering which kind of solution could there be for KDE/Phosh/etc. here ? Killing an app when not in focus cannot work (you couldn’t listen to music or download a file) and apps are not made to restore their state. Living all apps open might kill the battery / take all the RAM. To me it seems very problematic…
Something that can be done is telling the Wayland Compositor to not send the “update UI” signal for non-focused apps. This save some unnecessary UI redraws but the app is still running and taking CPU/RAM potentially.
- The second very problematic aspect is Sleep / Lock vs Background services. When you lock the phone, it must still be able to receive messages, check updates, receive calls, etc… But just turning off the screen and not going to sleep would drain the battery in a few hours. By going to S3 Sleep without waking up mechanism, then you can’t receive a call or msgs.
Android implemented the controversial wakelocks : https://lwn.net/Articles/318611/
And has different well defined APIs that will leverage them and be able to wakeup on events or to regularly check updates for receive msg on a server, etc…
Currently there is nothing on linux distros that solve this. So I was wondering how Purism is approaching the problem ? Is there a conversation with Kernel Dev & Flatpak/FreeDesktop.org to come to an agreement on how to expose an API that allows this ? Also I guess this is related to the “Connected Standby” or S0ix of some processors.
So I would be curious if you know links to any recent discussion on the topic by Purism, Flatpak or Kernel devs ? Or if you know if they have any idea on how they plan to solve those two issues ?