Whenever I go to my homescreen or otherwise load another app the previous one closes. If I’m browsing Lemmy and I open a page linked on a post to read it, my app will have reset itself when I close the tab and I either have to give up or root around for the post.
This OS is borderline unusable in this state. It even evicts my homescreen app so there’s a 5-10 second lag when tapping the circle button.
Any tips? I have 8GB of RAM, which should be more than enough for a dozen apps.
You need to change battery optimization for the affected apps (well, the apps you don’t want hibernated instantly).
Some brands of phones have aggressive hibernation config for all apps by default (Samsung, Xiomi I think).
Lookup hibernation control for your brand of phone.
Also check out https://dontkillmyapp.com/
GrapheneOS. It keeps Termux and Molly (for MollySocket) open but nothing else.
Thanks for this thread. I just switched to GrapheneOS and noticed the same thing. It’s particularly annoying having my Lemmy feed reset so often.
I’m also using grapheneos, but I’ve never noticed anything like this.
To check I just went back to the very last app in the app switcher, which was ironfox, which was still open on the same page I left it during lunch today. (About 6 hours ago)
That’s interesting, and surprising. Graphene doesn’t do anything special with battery optimization, does it (I didn’t think it did)?
Have you asked on any Graphene chats (they use discord and telegram, right?).
I’ve used Greenify for 10+ years to manage hibernation, but it really only works well with root, and the Graphene folks aren’t down with root… So the only thing I can think to look at is how battery optimization is configured per app (and the “don’t keep activities” setting in Developer Options).
Edit: look in Developer Options for “Background Check”, here you can select which apps can run in the background.
I’m running a Pixel with Lineage and battery optimization works fine. Graphene starts with AOSP like Lineage does, surely they aren’t doing anything weird with battery optimizing?
Termux and Molly have battery optimizations disabled because they run critical services.
If you really need it not to be killed, you can always open split screen before opening the second app, or just open it in free-form mode. But this is more of a workaround than solution.
Your phone is trying to keep your battery alive. The lower the specs of the phone, then the more aggressive the OS is. I don’t know how it works in Graphene but this is why many UIs now have and advertise multiapp ux like floating windows, split screen, floating icon and desktop modes. I suggest to use your phone intended keep app alive tactic.
Your phone is trying to keep your battery alive. The lower the specs of the phone, then the more aggressive the OS is.
No, apps closing between switches is not a matter of battery, it’s a core feature of Android related to the management of RAM. Whenever the OS needs more available RAM, the OS will close a backgrounded app to make those resources available. This is why it happens more frequently on low-end devices - these generally ship with less RAM.
Some misguided vendors will limit background execution in incorrect ways in the name of saving battery, but the general thing with apps living in background is a story of RAM.
Interestingly enough, apps are supposed to be built to cope with being closed down due to lack of RAM and then be restored seamlessly, but this is an art that is uncommonly done correctly in the Android development space. The OS support is there, though.
The OS support is there, though.
That’s right. The art of correctly handling
savedInstanceState
is unfortunately not exactly well understood
I have a Pixel, I don’t have this problem, and I run it hard. Switch apps extensively, have ~250 user apps, rooted, numerous service apps (Foldersync, Syncthing, Resilio Sync, 2 versions of Telegram, Teleguard, 2 XMPP clients, VPN), etc, etc. The apps I want kept alive stay alive, the ones I don’t care about get hibernated when Android decides to.
OP is using Graphene, I’m using Lineage, both start from AOSP. There’s something overly aggressive in Graphene battery optimization config.
Which phone?
Have you been mucking around in the developer options?Have you tried backing up and doing a factory reset?
I had a similar issue, and it seems to have been resolved by setting things in the developer options back to default, then turning off developer options entirely. No idea why that matters, but it was the recommendation in the Grapheneos forum.
When did you last reboot your phone?
I have had memory leaks in android that slowly consumes ram until I have the same issue. A reboot clears it for a while.
Every day or two. Last one was probably 2 nights ago.
What’s your phone model?
Does that matter? It’s a pixel running Graphene.
Yes
If it’s a memory hog app and another memory hog app and you have a tonne of background services running and you have limited memory, the oom is gonna make sure there’s enough memory to run the app.
And if you have the private profile unlocked and a secondary user profile which you’ve allowed to run in the background…well, you just might run into some problems.
Then again, on graphene, app depending, it could be one of the security settings that is causing it to drop it’s cache and reload.
Or, it could be the app itself.
Battery optimization, permissions, a privacy toggle, who knows?
The only way to truly keep 2 open is to do split screen.
I am also on grapheneOS on a 9 with 12Gb ram.
And even with that, I know a browser or two that doesn’t handle switching very well.
But, because of the limited information, it’s difficult to know where to focus.
PS. Did you try reading the logs for the app when they reset to see what’s happening?
I have a theory: this OS doesn’t know how to swap correctly. It either loads the whole APK or kills the scope/whatever the android term is (for things that aren’t set to always run.)
I think this is because APKs are zipped files and thus the android developers decided that ZIP reads makes a ton of sequential cached file misses. So then it would have to been loaded from the storage. Back when android was made these were expensive, and slow.
So it always loads the whole renamed zip :3
No I haven’t read the logs. I’ll do that next time.
You can see your current live memory usage.
Settings -> Developer Options -> Running ServicesAh, yes, a feature only developers use: task manager
Nearly half of it is “system”
Wow. I have a Pixel with Lineage, 1.9 gig for system.
Whats Graphene doing using so much ram?
Fuck if I know. Let me restart.
Edit: 1.7 for system.
Do you have access to developer options?
If so make sure “don’t keep activites” isn’t checked. And also check background process limit.
Oh also don’t keep activities is turned off.
Background process limit is max signed 32 bit integer value because I need Termux to fucking work
Do you swipe away all the unwanted running apps?
No. The phone kills them anyway and AOSP multitasking is a piece of shit that is broken more than it works properly
Ya answered your own question
The phone is killing the ones you want because you aren’t swiping the ones you don’t want away
Not OP, but same happens to me, and I swipe out apps as soon as I’m done with them, so that’s not the problem. My phone literally can’t hold open example.com on Firefox, and Voyager app at the same time, and it has 8GB of RAM
Wouldn’t it kill the ones I’ve last opened longer ago first?
Yes, that person is incorrect.
I am not sure what the heuristic is. Probably ram consumption or battery usage, both of which is going to potentially select in-use apps first
I had this problem until I swiped away all the apps I wasn’t using
Alright thanks. I’ll test this and report back :3
Good luck