Open HanabishiRecca opened 2 years ago
Android automatically kills processes when a foreground app requires more memory. Micro-managing apps via "exit" button is not something Android was designed for. We won't add such a button.
As far as I know it's not possible to programmatically unload the WebView process. We could run the Push service in a separate process, so K-9 Mail's UI process can be more easily killed by the OS when it is not needed. However, this requires quite substantial architectural changes. I don't see us doing this anytime soon.
Android automatically kills processes when a foreground app requires more memory.
Unfortunately it only will be killed along with the push service.
We could run the Push service in a separate process, so K-9 Mail's UI process can be more easily killed by the OS when it is not needed.
Yes, I belive this is the issue. Other apps don't show such behavior, seems like their UI part and services are separated.
However, this requires quite substantial architectural changes. I don't see us doing this anytime soon.
Fair enough. The important thing is that devs are aware of the issue and maybe some day.
This is more relevant than ever because WebView recently has become really fat. We're talking about over 350MB of RAM consumption for displaying a text email.
@cketti I've been thinking about this issue and I think I've found a wonderful very simple workaround/solution.
Once K9Mail is sent to background you simply restart it. That's it. That will kill the web renderer while leaving the app running.
https://stackoverflow.com/questions/6609414/how-do-i-programmatically-restart-an-android-app
Checklist
App version
6.202
Where did you get the app from?
Google Play
Android version
Android 12 / LineageOS 19.1
Device model
No response
Steps to reproduce
Expected behavior
WebView process should exit when the app is closed.
Actual behavior
Starting as usual the service is fine.
When I open the app and view some mail, WebView process is started. But it never unloads after the app was closed, just keeps hanging along with the push service and wasting memory no matter what. Also there is no dedicated exit button in the app to properly close it.
I found two ways to kill it without stopping the service:
Force stop WebView app from its info page.
Or kill the process using some process viewer (requires root).
Only after that we return back to expected state.
My thoughts: Android obviously treats WebView process as part of the service and never kills it. Foreground services have high priority and never being unloaded even under low memory conditions. There should be some way to avoid such behavior or at least make an "exit" button in the app, which properly shuts down all its processes, but keeps the push service running.
Logs
No response