• General
  • Regression in GrapheneOS? Apps are aggressively killed by OS in the background

How many profiles do you have? The upper limit for the profiles that can be run in parallel has been increased couple of months ago, and I assumed that was taking up all the RAM.

    I have 4 profiles including the owner profile. But at most 3 profiles are running at one time including the owner profile.

    ryrona If the apps lose data due to being unloaded from memory, those apps are buggy and need to be fixed. Android apps are supposed to gracefully handle being unloaded at any time. They also need to handle their activities being respawned for configuration changes such as enabling dark mode or by default even rotating the screen. Switching profiles has always gracefully cleared out most apps from the previous profile to make room. It doesn't mean data is lost, and that would be a bug in the apps.

      Eudyptula

      In short, apps are being killed extremely aggressively. As far as I know, this issue does not exist on stock Android.

      That's wrong. There's no difference between how this works between GrapheneOS and the stock Pixel OS. There's no bug related to it in GrapheneOS. Your device is misconfigured. You have developer options enabled and likely made broken changes there and potentially with ADB. A factory reset should resolve your issues.

      Friends and family, which I convinced to get Pixel phones and install GrapheneOS on them, all have reacted to this as it's pretty hard not to notice. It really does affect usability.

      Did you configure their devices for them? What you're describing is not the normal behavior of GrapheneOS.

      Of course, allowing background usage and setting "unrestricted" in "App battery usage".

      You should not have anything set as Unrestricted unnecessary. It should only be given to apps which actually need it and know how to use it.

      I've tried to disable the things in the app info page that are GrapheneOS related. I initially thought that "Exploit protection compatibility mode" solved it. It seemed to do so, until it didn't.

      It has nothing to do with the exploit protections.

      Are there any known workarounds until (hopefully) it's fixed by the developers?

      You likely caused the issue with how you configured these devices. It's not up to us to fix it. Factory reset the device and use it with default settings without changing a bunch of things or using any developer options. Should work fine.

      GrapheneOSNewUser Switching users has always worked this way. It highly deprioritizes the background users and will unload their inactive apps to free memory for apps in the current user.

      Stephan-P That doesn't sound like what's being described in the original post. Unrestricted battery mode also won't help for apps which don't know how to use it.

      Serg It's supposed to work that way and has nothing to do with GrapheneOS specifically.

      ryrona If you have apps losing data when gracefully unloaded from memory, that needs to be reported to the app developers. Simply rotating the screen respawns app activities by default along with many other things. Apps are not supposed to just mark many configuration changes as handled by themselves while not ever actually implementing saving/restoring their state. Browsers are known to not handle this particularly well and that's not in any way unique to GrapheneOS. Other apps generally handle it just fine.

      If you open the Settings app, go to Apps, Vanadium, Battery Usage, is Allow background usage enabled?

      This isn't really relevant to this.

      Orange The maximum number of profiles which can be used at the same time is a very separate thing from Android unloading inactive apps to make room for other usage of the memory along with Chromium-based browsers setting up tabs to be separately unloaded in a similar way.

      GrapheneOS If the apps lose data due to being unloaded from memory, those apps are buggy and need to be fixed. Android apps are supposed to gracefully handle being unloaded at any time.

      What about incognito browser tabs, would they also be closed? As far as I know they're always kept only in RAM, so when RAM becomes short they're (as a last resort) killed.

      GrapheneOS I never had any issues with rotating the screen. But many apps lose any half-typed message that has not yet been sent or posted if unloaded. Many others lose their scroll position. Some even jump back to their home screen or default dashboard. Vanadium is one example of an app that is handling this especially poorly. But every single end-to-end encrypted chat app I have tried also cannot handle being unloaded without losing my half-typed message.

      I understand apps are supposed to be able to handle being unloaded gracefully, without losing any state, but the truth is that this seem to rarely be handled well. Many apps cannot be put in restricted battery usage because of this.

      1. Opened a website https://editpad.org (I dont even know how good editpad.org is by the way, just the first online text editor that showed up for me) in primary user in vanadium
      2. Typed some text into it.
      3. Switched to a secondary user which hadn't been unlocked yet
      4. Did some stuff there like open camera, check gallery, open browser
      5. Closed that session and switched back to primary user
      6. Well, the website did need to load again, but my progress there was saved
      7. Tried the same steps with https://editpad.org in incognito tabs
      8. When opening vanadium in primary user, it opened the incognito tabs with my progress saved

      All this on a pixel 6a.
      I am not sure what's going wrong here, perhaps tell us what kind of activity and for how long
      you're using secondary profile. Just light switching/using doesn't seem to produce these effects on a 6a.

      Very little configuration changes on my part. No developer options.

        Ok there is one thing though, I only had vanadium active on my primary user.

        • thmf replied to this.

          ayaen I used to have a similar issue and hope the post will help a bit. Last time I tested this was maybe a year ago or so. In my scenario profiles are used the other way around. It used to be like this:
          I open Vanadium in secondary profile, open my bank web site, try to login, then it sends you 2FA SMS (security, right?) which I used to receive in default GrapheneOS messaging app in owner profile. So I switch to the owner profile, check the 2FA code, switch back to the secondary profile, and Vanadium page gets reloaded, so no option to enter the code. Login again, sends new code, etc...
          The secondary profile was setup to run in background.
          I don't know if this is still true, since I don't use that bank and don't receive SMS messages anymore (by choice), so sadly can't test.
          Tried to swipe up Vanadium to put it in background in secondary user, tried to leave it active on screen while changing the profiles - no difference.
          The only thing I can't recall is if the tabs were regular ones or incognito.
          Hope this helps in any way.

          ayaen Opened a website https://editpad.org (I dont even know how good editpad.org is by the way, just the first online text editor that showed up for me) in primary user in vanadium

          You probably found one of the few internet sites that actually save your state themselves to their remote server. Any text you have typed into a regular HTML POST input-text field will not be preserved like that.

          The strange thing is: When using Private Space, no apps get killed at all. Everything works as expected.

          The moment I switch to any regular user profile, all Vanadium Tabs (regular or private ones) are gone. Always. Other apps seem to be uneffected and I can continue right where I left.

          Sometimes even my always-on VPN App has trouble. I receive a notification from the Owner Profile/VPN App. Usually when switching back to the Owner, everthing seems fine. But at least once I had to manually open/reconnect the VPN App because it was "killed" for whatever reason.

          Device: Pixel 9
          GrapheneOS 2025021100