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

Yes, i can reproduce thing with unloading active tabs when switching between profiles. But i don't remember how it was in previous GrapheneOS versions (for example with Android 14). It would be interesting what GrapheneOS developers would say (is it a bug or normal behaviour).

Tested with Pixel 8.

    I've noticed the same thing, not just from Vanadium but with different apps. This needs to be addressed by the devs.

      It's not clear that people in this thread are talking about the same issue. The OP never mentioned profiles. ryrona's post is the first post with clear steps to reproduce.

      Eudyptula It's driving me crazy that I now can't be sure whether an app will be killed off if I go into a different app for a few moments before returning.

      You didn't mention profiles. Does it only occur when switching between profiles?

      0289380427 I've noticed the same thing, not just from Vanadium but with different apps. This needs to be addressed by the devs.

      What have you noticed exactly? Are you in a position to provide steps to reproduce (which apps are affected, what do you do when the issue occurs)?

      ryrona However, when switching to a secondary user profile that is not running, and having to enter your primary credentials to access it, it does seem all apps are unloaded in all other profiles, leading to loss of unsaved data.

      That has always been the case for me as far as I remember, since I started using GrapheneOS on a 6a about two years ago. Although it's annoying, I've always attributed that to a lack of available system memory, and the OS "unloading" apps to free up resources. But I don't really know.

      To be clear, I'm talking about switching from Owner -> secondary profile -> Owner. Not sure if we're referring to the same thing.

      Upstate1618 My incognito Vanadium tabs are killed as soon as I lock the screen.

      I've never had this issue. I can't reproduce it on GrapheneOS 2025021100.

        ryrona
        I run Vanadium in the main profile. incognito tabs are killed immediately after screen locked. This does not happen 100%. I don't use regular tabs so I can't say.
        P8P 2025021100. I have only 2 profiles: main profile and private space.

          fid02 That has always been the case for me as far as I remember, since I started using GrapheneOS on a 6a about two years ago. Although it's annoying, I've always attributed that to a lack of available system memory, and the OS "unloading" apps to free up resources. But I don't really know.

          Ah, okay. I never noticed it before. Still, it shouldn't happen. There shouldn't be more system resources needed at first start of a profile as opposed to the profile being actively running, and it does lead to data loss, any unsaved changes are lost.

          To be clear, I'm talking about switching from Owner -> secondary profile -> Owner. Not sure if we're referring to the same thing.

          Yes, we are.

          Upstate1618 I run Vanadium in the main profile. incognito tabs are killed immediately after screen locked. This does not happen 100%. I don't use regular tabs so I can't say.

          Okay, so then probably it is the Vanadium web browser that gets unloaded, and it would affect non-incognito tabs for you as well. That is the most likely.

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

            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.