Don't want your android to sleep soon!!!


Hi friend,

I got another one interesting task in my project.  The task is by default the sleep time in Android ICS was 1 min, we want to set to 30 minutes as default.

If you check in Settings > display > sleep, it will display as 1 minute as default and there will not be any never option.

So now if we want to change the default sleep value while customizing the android, just follow the following steps…

Step 1: open the following xml file… android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml.

Step 2: change the default sleep time value in the line,
<"integer name="def_screen_off_timeout">60000<"/integer">… I changed it to 1800000 (30 minutes)…
Now, if you check in Settings > display > sleep, it will display as 30 minutes as default…

And if you don’t want timeout, set it to ‘-1’ …
Now, if you check in Settings > display > sleep, it won’t show any time out value… :)


ANOTHER METHOD: Editing the sleep time in the Settings source…

Step 1: open the file, android/packages/apps/Settings/src/com/android/settings/DisplaySettings.java

Step 2: Add the line, “Settings.System.putInt(getContentResolver(), SCREEN_OFF_TIMEOUT, -1);” before the line “ final long currentTimeout = Settings.System.getLong(resolver, SCREEN_OFF_TIMEOUT,               FALLBACK_SCREEN_TIMEOUT_VALUE);”

Now, if you check in Settings > display > sleep, it won’t show any time out value… :)

DO REBUILD THE ANDROID AFTER THE CHANGES!!! DON’T FORGET!!!

Task Completed :) :) :)

8 comments:

Anonymous said...

Very good article, thank you for the informations, but these methods work only if you open the settings/display screens. If you only boot the device with the newly programmed constants...the default value stays at 1 minute, until you open settings/display screens. I don't know how to make the default value take effect without going in settings/display. Would you have any suggestions?

Thank you for your help.

ALAGAPPAN said...

Hi,
If you use the First method by changing the variable def_screen_off_timeout in the android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml. It will take effect without going in settings/display.

Sorry for late response.

Anonymous said...

Thank you for your help, it worked perfectly!

ALAGAPPAN said...

Welcome :)

Anonymous said...

Thank you so much it is very use full link..

Anonymous said...


I have read your blog recently about how to default sleep time on android ICS to 30 minutes. I was confused about the first method. Samsung android phone have 10 minutes maximun sleep time, which is annoying of short time for one session. I have queation to ask you. I know how to root the android phone, do you think I need to root my phone before default the sleeping time? After I rooted, how to fimd the xml file:android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml. how to default sleep time value once I found the defaults.xml file. I hope you can show me more detail to finish the process.

ALAGAPPAN said...

No, Rooting the mobile will not help in this. If you could work on the android OS source code, you could find these xml & JAVA file. We can't just go to android shell and change these thing, we need to edit the source code, build and flash it to the device.

Vibhor Chaudhary said...

what is the value to make it 2 mins?

Newer Post Older Post Home

About Me

My photo
Hi everyone,myself Alagappan...electronic and communication engg. student... living in madurai... interested in everything... want to achieve something great in my lifetime...

Followers


Recent Comments