android: manipulate screen lock settings via adb?
I eventually figured it out:
adb -s $SERIAL shell rm -f /data/system/locksettings.db*
This will remove any lockscreen, setting it to "None" in the system settings.
André Fernandes
Updated on June 26, 2022Comments
-
André Fernandes about 2 years
I'm in the process of setting up an automated testing environment which uses android emulators to test apps. This is a headless setup where the emulators are run under Xvfb, so manual interaction is not possible.
I need a programatic way to change (via adb or telnet) the screen lock settings on the emulator to never lock (equivalent to manually changing settings in the "screen lock" menu to "None"), particularly the emulator must be in the unlocked state right after startup.
Snapshots won't do because they must be taken after the change has been done, and reusing snapshots from other AVDs is not desireable because this setup must accommodate new android releases.
In other words, setup of a new AVD must be completely unattended.
I'm wondering if something like this would work, but I haven't been able to figure out how to get into the "Screen lock" sub-menu:
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.SecuritySettings
Either way, is there a better way to achieve this?
-
Saik almost 6 yearsDid not work on Android 5.1.1 Deleted all the locksettings.db files but the files are back in that folder when I restart the phone and lockscreen is not gone.
-
Greşanu Emanuel - Vasile almost 6 yearsAfter you delete the DB files, had you also cleared data for all packages before rebooting the phone?
-
Izzy almost 6 yearsYou will also need to remove the
*.key
files located in the same directory, @Saik -
T3rm1 over 5 yearsI assume you need a rooted device for this, right?
-
xarantolus over 4 yearsWARNING: Don't do this if your device is encrypted; while it will still boot it won't be able to decrypt anymore