Battery and heat improvement for apps and system
Introduce and describe the topic
While you can run most desktop apps on phosh it makes the device suffer heating and big battery consumption, it would be great if we found a way to make apps less resource consuming or a way for phosh to manage this in order to save power.
Why is this important?
Having a linux phone it's wonderful, but having 4hours of battery life it's a pity.
How would you like people to respond?
Badri Sunderarajan Mon 7 Oct 2024 3:48AM
What is the status of sleeping/suspend on various devices? Currently the option to "suspend" you phone from the menu is marked as experimental because it could lead you to miss calls and messages. I also heard there were some problems with waking up in the Librem 5 (though they may have been old reports).
My Poco F1 was suspending and waking up without a problem until yesterday when it would sometimes be unable to wake from suspend (maybe caused by a recent update?). On the other hand I realised that incoming calls weren't coming through when the device was in suspend.
This was because the system is only configured to wake up when the power button is pressed. The postmarketOS wiki describes a workaround to also wake up on when any modem event such as a call or SMS comes in, which fixed the problem for me and my phone is now able to wake up when a call or message comes in.
Unfortunately "modem event" also includes things like network changes, and we don't currently have a way to distinguish between different modem events. My place is at the edge of a mobile tower cell so the signal changes quite often, leading the phone to keep waking up "randomly" (and switching on the screen). It's better than not receiving calls, but at the expense of battery life.
Quoting from the same pmOS wiki page:
This would be acceptable if it were possible to do this without immediately turning on the display, and if the message isn't a call or SMS, automatically suspending again. For Phosh, I believe this requires support to be added to GNOME session daemon to wake up without turning on the display. Figuring out why the device woke up (maybe it was a power button press or USB cable insertion) requires keeping track of all the counts in /sys/class/wakeup/wakeup*/wakeup_count and then having a look up table for each wakeup (to know that e.g. wakeup /sys/devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:pon@800/c440000.spmi:pmic@0:pon@800:pwrkey/wakeup is associated with the power button)
If this is still the case, then this is a different optimisation that can be worked on even before (or in parallel with) Unified Push. It looks like some parts of this are device specific, but other parts are generic (eg. being able to wake up without turning on the display). There are similar issues with Internet packets (WiFi and mobile data) which also need to be worked on. (I couldn't find anyone already working on this, but I might have missed it).
However I'm not sure what the exact situation is with devices other than my Poco F1. People with other devices how does suspend (or lack of it) work for you?
Badri Sunderarajan Mon 7 Oct 2024 3:51AM
Given the number of times my phone is waking up and turning on the screen, I need to decide whether it is more efficient (in terms of battery) to run it this way or just not let it suspend at all (thereby keeping the screen switched off). I only realised all this yesterday so I'm yet to do detailed battery-related testing.
Pirate Praveen · Tue 3 Sep 2024 11:21AM
I think one way is, kill the app when idle and open it via push notifications. This is how android achieves good battery life. So having unified push support is a pre requisite for this.