Disable Powerbutton instantly Locking Device via Script

Disable Powerbutton instantly Locking Device via Script


maybe you can help me out here even though i am almost sure its a limitation of mobicontrol / device at this point.

i want to set the timeout before the display gets locked to 30 minutes and the powerbutton should only turn of the screen.

on an android+ device i found the following with watchsettings so far:


Lock Screen After Timeout:

Custom log (URI:content://settings/secure SETTING:lock_screen_lock_after_timeout VALUE:1800000)


For the powerbutton option i sadly got no result.


Using the following script on an aedo device got me no result:

writesecuresetting -sec lock_screen_lock_after_timeout 1800000


I then tried to find something with adblogs on the aedo device and found the following settings triggered:




i tried multiple combinations of the settings with writesecuresetting i.e.:

writesecuresetting -sec lock_after_timeout 1800000
writesecuresetting -sec power_button_instantly_locks false

writesecuresetting -sec lock_screen_lock_after_timeout 1800000
writesecuresetting -sec lock_screen_power_button_instantly_locks false

None of them worked.

Any Ideas would be appreciated.


Kind Regards John

2 Answers

Order By:   Standard | Newest | Votes
Raymond Chan | posted this 27 August 2020

The writesecuresetting script command is not supported in AE platform, and is only supported for a very very small number of OEM specific Android+ device agents.  Don't waste time on that any more.


For AE platform, some settings parameters may become dynamically configurable via EMM software via the OEMConfig framework.  Check the corresponding OEMCOnfig app from the device vendor in Managed Google Play Store. For each individual device brand, what parameters are supported  depends on the firmware it designs and communication/configuration allowed via its own OEMConfig complaint app.


  • 1
  • 0
John Doe | posted this 19 August 2020

I am guessing this means the command is not supported because whatever you type in as "Setting" it always shows as permission denied:


08-19 15:24:38.604 E/soti    (12541): script-executor|E|DO|[LegacyScriptExecutor][executeScriptCommand] Failed to exec script command: writesecuresetting [-sec, lock_screen_lock_after_timeout, 1800000]|java.lang.SecurityException: Permission denial: Device owners cannot update lock_screen_lock_after_timeout
08-19 15:24:38.604 E/soti    (12541):     at android.os.Parcel.createException(Parcel.java:1950)
08-19 15:24:38.604 E/soti    (12541):     at android.os.Parcel.readException(Parcel.java:1918)
08-19 15:24:38.604 E/soti    (12541):     at android.os.Parcel.readException(Parcel.java:1868)
08-19 15:24:38.604 E/soti    (12541):     at android.app.admin.IDevicePolicyManager$Stub$Proxy.setSecureSetting(IDevicePolicyManager.java:7859)
08-19 15:24:38.604 E/soti    (12541):     at android.app.admin.DevicePolicyManager.setSecureSetting(DevicePolicyManager.java:7377)
08-19 15:24:38.604 E/soti    (12541):     at net.soti.mobicontrol.settingscontrol.AfwSecureSettingsManager.writeSecureSetting(SourceFile:45)
08-19 15:24:38.604 E/soti    (12541):     at net.soti.mobicontrol.script.a.br$a$1.execute(SourceFile:55)
08-19 15:24:38.604 E/soti    (12541):     at net.soti.mobicontrol.script.a.br.execute(SourceFile:47)
08-19 15:24:38.604 E/soti    (12541):     at net.soti.mobicontrol.script.af.a(SourceFile:163)
08-19 15:24:38.604 E/soti    (12541):     at net.soti.mobicontrol.script.af.a(SourceFile:116)
08-19 15:24:38.604 E/soti    (12541):     at net.soti.mobicontrol.script.af.a(SourceFile:61)
08-19 15:24:38.604 E/soti    (12541):     at net.soti.mobicontrol.script.af.lambda$iP_JBWcmOIYD_qiTUOSnkue6jEg(Unknown Source:0)
08-19 15:24:38.604 E/soti    (12541):     at net.soti.mobicontrol.script.-$$Lambda$af$iP_JBWcmOIYD_qiTUOSnkue6jEg.run(Unknown Source:8)
08-19 15:24:38.604 E/soti    (12541):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
08-19 15:24:38.604 E/soti    (12541):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
08-19 15:24:38.604 E/soti    (12541):     at java.lang.Thread.run(Thread.java:764)
08-19 15:24:38.604 E/soti    (12541): Caused by: android.os.RemoteException: Remote stack trace:
08-19 15:24:38.604 E/soti    (12541):     at com.android.server.devicepolicy.DevicePolicyManagerService.setSecureSetting(DevicePolicyManagerService.java:10039)
08-19 15:24:38.604 E/soti    (12541):     at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:2510)
08-19 15:24:38.604 E/soti    (12541):     at android.os.Binder.execTransact(Binder.java:731)



Kind Regards John

  • 0
  • 0

Give us your feedback
Give us your feedback