-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Description
This is not really a bug, but rather an "improvement request".
When Termux runs using the Wake Lock, the performance greatly slows down because of "Doze" (explained in details here: https://developer.android.com/training/monitoring-device-state/doze-standby.html)
If a user leaves a device unplugged and stationary for a period of time, with the screen off, the device enters Doze mode. In Doze mode, the system attempts to conserve battery by restricting apps' access to network and CPU-intensive services. It also prevents apps from accessing the network and defers their jobs, syncs, and standard alarms.
Periodically, the system exits Doze for a brief time to let apps complete their deferred activities. During this maintenance window, the system runs all pending syncs, jobs, and alarms, and lets apps access the network.
As soon as the user wakes the device by moving it, turning on the screen, or connecting a charger, the system exits Doze and all apps return to normal activity
This means if you're connected with SSH on Termux, it will suddenly get really laggy (until you wake it up again), even worse if you use Termux as a web server.
See the conversation here: https://gitter.im/termux/termux?at=57a2253c836d2d0211610052
@fornwall said: "I'm just trying if disabling battery optimizaton for termux helps the wake-lock not working problem" and "I have disabled battery optimization earlier today and have not noticed any slowdowns yet. I will continue to test this."
The whitelist described here might be a solution: https://developer.android.com/training/monitoring-device-state/doze-standby.html#whitelisting-cases
Since I'm looking forward to this, here's an issue to know if it eventually does work :)