Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force deep sleep on android phone for testing

Tags:

android

I'm trying to reproduce a bug in a third-party-developed app that seems to occur when my tablet is awakened from several hours of sleep. My understanding is the "power" button only turns off the screen, but does not activate true sleep until some period of time has passed. Is there a way to force deep sleep other than waiting a few hours?

Although my test device is a tablet, we are most interested in what happens on phones.

like image 226
Gregory Cosmo Haun Avatar asked Jul 16 '14 01:07

Gregory Cosmo Haun


People also ask

How do I put my phone in deep sleep mode?

go to Settings – Battery saver/Auto-sleep.

What is Android deep sleep mode?

Deep sleeping apps: Shows you all apps that will never run in the background. They'll only work when you open them. You can add apps to the list by tapping the + sign, selecting your desired app(s), and then tapping Add. To remove apps, tap More options (the three vertical dots), and then tap Remove apps.

Can you still use an app if you put it in deep sleep?

Deep sleep means the app is pretty much completely disabled. It won't even get updates from the Play Store unless you open it first then manually check. It's best used for apps that don't need to do ANYTHING in the background.


2 Answers

If you have the device unplugged from the computer and USB Debugging turned off clicking the power button will force it to sleep.

If you have it plugged in, turning off USB Debugging and disabling Background Data will also force it into sleep mode once you push the power button.

like image 173
Josh Avatar answered Oct 10 '22 00:10

Josh


You can use terminal:

adb shell dumpsys deviceidle -h
like image 33
Felix Avatar answered Oct 10 '22 01:10

Felix