Search code examples
androidconfigurationadb

Programmatically change "Instant lock on power button" setting


I'm pretty new to Android world so maybe I'm lacking some base concept. I'm writing a script (that will issued throught ADB shell) to update phone settings, typically here is a sample of what I want to achieve

su
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
update secure set value='Unlocking device message' where name='lock_screen_owner_info';

I want now to change the "Power button instantly lock" to be enable with my script (I've been searching in different sqlite databse but was unable to find anything relevant)

Question :

How to enable (or disable) the "Power button instantly lock" feature with a script ?


Solution

  • it's impossible to overwrite hardware button. But you can create onLockListener. See http://chandan-tech.blogspot.com/2010/10/handling-screen-lock-unlock-in-android.html