auto suspend or shutdown after innactivity

Showing results for 
Search instead for 
Did you mean: 

auto suspend or shutdown after innactivity

Contributor V


We're using Android 9 from NXP for our I.mx8 boards.  It has some customization for some of our custom hardware but mostly the UI and Android is all stock.  I've read some posts about auto suspend but that seems to be disabled.  I'm not sure where to enable it.   As installed, it stays on and doesn't even dim the screen.  (That may be because our screen doesn't yet support dimming but it will in a future hardware revision.)

We have a device where battery power must last as long as possible.  I want to enable the lowest possible power consumption when not in use.  Suspend to disk would be probably OK but even shutting down entirely would be good.

All the values in frameworks/base/core/res/res/values/config.xml seem to suggest auto suspend is there (activity timeouts, min, max intervals, screen dimming values etc), but the system doesn't actually ever attempt to suspend.  So I think it's disabled or not activated somewhere else.

Thanks for input!

Tags (2)
2 Replies

Senior Contributor II

Hi  Dennis Muhlestein,

To auto suspend, there is one "Stay awake" option in Settings->System->Developer options field in Android GUI. This might be enabled in your case. So, that's why your screen is not suspended. You need to disable this "Stay awake" option. To get Developer Option, you first need to tap 7 times on Build number field in Settings->About Table Option. By doing this you will get the Developer option

You can also disable this "Stay awake" opting using the below-mentioned command in the console.

  • settings put global stay_on_while_plugged_in 0

And to resume the screen, use the below-mentioned command in the console.

  • input keyevent 26 && input keyevent 82

Hope this will help you.




Note: If this post answers your question, please click the Correct Answer button. Thank you!

Contributor V

Thank you for your reply.

Yes, I know about developer settings and stay awake while plugged in.  This is not our problem however.  Even if I set those settings to false so the screen will sleep, the system still does not sleep.  With the screen off, I can still log into adb and see the system awake.  If I press the power button, the screen comes back on and I can still use the system.  I understand this is the default behavior.

What I am asking is how to cause the system to power down after the sleep timeout.  If the screen goes to sleep, I want the system to shut off.  Eventually I would like to add a prompt to show the user the system is going to power down soon.

0 Kudos