• GeneralSolved
  • How to completely prevent device from entering Deep sleep mode?

Is there an adb command, or a very minimal app to prevent a Graphene OS-running device from entering Deep sleep mode? I need that for testing purposes.

As alternative to Coffee you can also try KeepScreenOn which has settings that might add to your testing (restore timeout when on low battery or screen is locked, maximum screen timeout setting).

Thanks guys, but I specifically don't want the screen to be turned on, because I need to take battery measurements and it would therefore interfere with the results I'm hoping to get.

    [deleted] You mean
    dumpsys deviceidle disable
    Didn't work for me, I am still seeing device entering Deep sleep mode regardless. Just to make it clear, I use AccuBattery to see the stats about modes: it would show something like "in deep sleep for..." and "total", both counting hours. I know it's reliable because I have one app that specifically disables deep sleep, and it clearly shows in AccuBattery stats, but I need to have that app off for testing, yet also disable Deep sleep.

    So something that could keep a wake lock but do nothing else.

      865be553dc4f5b2b maybe download Termux from F-Droid, and once you get a running terminal, there will be a notification from Termux on your lockscreen, with a button on the notification to "acquire Wakelock".

      If an app has a persistent Wakelock, then the CPU shouldn't enter deep sleep mode. Set it to unrestricted battery mode as well, (though I'm sure it has foreground permission) and that should do the trick!

        Tryptamine Yes! Thank you! I've actually had Termux installed all this time but never bothered to look into its notifications. "Acquire wakelock" did exactly what I needed without consuming additional CPU cycles, perfect for my tests.

          865be553dc4f5b2b

          Very glad it worked. Happy to have helped as well, and good luck with your project!

          If you are up for it and care to share, you have me intrigued as to why you need a persistently awake device to take measurements from. I'm always interested in things like this...

            Tryptamine Sure, it's not confidential.
            Well, first I'm having trouble preventing Termux from interfering with power consumption. Some of the time I get pretty high measurements like 100mAh, yet other times I get expected measurements like 30mAh. Both with wakelock enabled (both measured on a non-Graphene OS device). Still investigating why that might be. Maybe it does consume CPU cycles after all, in some way.

            Regarding why I need this, I was going to post another thread about it after I collect enough information, but briefly it's because Graphene OS seems to consume way more power than necessary when it's out of Deep sleep/Doze. On other Android (13) devices there is no difference, I get approximately 30mAh when the device is idle (screen off) regardless of whether the device is in Deep sleep or not (as seen in Battery Guru and Accubattery stats). I haven't measured that on regular Android 14 devices.

            On Graphene OS, however, there is a huge difference and something seems to activate whenever the device is out of Deep sleep. I'm trying to understand what that something is, but haven't had much progress so far. Android is kind of a black box in that regard so I try poking around, disabling apps, wifi, cellular radios, see if I can reliably get to the level of consumption seen in regular Android devices. Haven't found the culprit yet and the idle consumption is still higher.

            As for why that bothers me at all, it's because I need to run SimpleX app with constant notifications, a mode when SimpleX is constanly connected to its servers. That prevents Deep sleep and consequentially on Graphene OS causes way more power consumption that I regard reasonable. SimpleX is definitely not the culprit here as I have already measured power consumption with it running constantly on other devices, and the difference between it running like that and not running at all is at best +5mAh. On Graphene OS the difference is approximately 70mAh and 33mAh respectively, which is more than 50%. Comparatively on other devices (which are Ulefone Power Armor 18T Ultra and Sony Xperia 10 II) I see approximately 28mAh and presence or absence of Deep sleep doesn't change that at all (5mAh at best).

            It's been mentioned on reddit some time ago with regards to Signal power consumption when idle, so it looks like pretty much the same issue. No solution or reason was given as nobody wanted to dig deeper.

            https://www.reddit.com/r/signal/comments/urv3e8/signal_is_killing_my_battery_on_grapheneos_its/
            https://www.reddit.com/r/GrapheneOS/comments/11pamo0/signal_battery_drain_when_notification_enabled/

            If you have a non-Graphene OS Android 14 device you could help by measuring your battery drain with SimpleX set to "Always on" and "Periodically" in its notification settings and no other apps having wakelocks or running in the background and posting your results here. I suspect it might be an upstream bug-feature rather than Graphene OS-specific.