How to change default display timeout settings using adb command

Connect your Android device over adb to get adb shell and check the default screen timeout value already set,

$ adb shell settings get system screen_off_timeout
30000 

As you can see above for our android device the default screen timeout was set to 30 sec i.e. 30 * 1000 ms, now we can change this value to say 45 sec as,

$ adb shell settings put system screen_off_timeout 45000

The display information can be obtained using below command,

$ $ dumpsys power | grep Screen                                                                                                                                                                 
  mLastScreenBrightnessBoostTime=0 (3088734 ms ago)
  mScreenBrightnessBoostInProgress=false
  mSuspendWhenScreenOffDueToProximityConfig=false
  mDozeAfterScreenOff=true
  mMinimumScreenOffTimeoutConfig=10000
  mMaximumScreenDimDurationConfig=7000
  mMaximumScreenDimRatioConfig=0.20000005
  mScreenOffTimeoutSetting=45000
  mMaximumScreenOffTimeoutFromDeviceAdmin=900000 (enforced=true)
  mScreenBrightnessSetting=0
  mScreenBrightnessModeSetting=1
  mScreenBrightnessOverrideFromWindowManager=-1
  mDozeScreenStateOverrideFromDreamManager=1
  mDozeScreenBrightnessOverrideFromDreamManager=17
  mScreenBrightnessSettingMinimum=1
  mScreenBrightnessSettingMaximum=255
  mScreenBrightnessSettingDefault=102
Screen off timeout: 10000 ms
Screen dim duration: 2000 ms

As you can see above, if we change the “screen_off_timeout” to 45 sec, it changes as “mScreenOffTimeoutSetting=45000” as reported in dumpsys.

Reference –

<integer name="def_screen_off_timeout">60000</integer>

as seen in frameworks/base/packages/SettingsProvider/res/values/defaults.xml#21 from http://androidxref.com/9.0.0_r3/xref/frameworks/base/packages/SettingsProvider/res/values/defaults.xml#21

Leave a Comment