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.

  • Onomatopoeia@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    23
    arrow-down
    1
    ·
    3 days ago

    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/

    • Kairos@lemmy.todayOP
      link
      fedilink
      English
      arrow-up
      5
      ·
      3 days ago

      GrapheneOS. It keeps Termux and Molly (for MollySocket) open but nothing else.

      • grue@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        ·
        3 days ago

        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.

        • Ghoelian@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          2 days ago

          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)

      • Onomatopoeia@lemmy.cafe
        link
        fedilink
        English
        arrow-up
        3
        ·
        edit-2
        2 days 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?

        • Kairos@lemmy.todayOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 days ago

          Termux and Molly have battery optimizations disabled because they run critical services.

  • wasu@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 days ago

    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.

  • dustyData@lemmy.world
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    1
    ·
    3 days ago

    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.

    • GissaMittJobb@lemmy.ml
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 days ago

      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.

    • Onomatopoeia@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 days ago

      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.

  • frongt@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 days ago

    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.

  • slazer2au@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    3 days ago

    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.

          • masterofn001@lemmy.ca
            link
            fedilink
            English
            arrow-up
            4
            ·
            2 days ago

            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?

            • Kairos@lemmy.todayOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              19 hours ago

              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

  • thejoker954@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 days ago

    Do you have access to developer options?

    If so make sure “don’t keep activites” isn’t checked. And also check background process limit.

    • Kairos@lemmy.todayOP
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      1
      ·
      3 days ago

      No. The phone kills them anyway and AOSP multitasking is a piece of shit that is broken more than it works properly

      • ryannathans@aussie.zone
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        5
        ·
        3 days ago

        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

        • Die Martin Die@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          5
          ·
          edit-2
          3 days ago

          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