Android: manage lock screen settings with adb?

I am going to create an automated test environment that uses Android emulators to test applications. This is a headless setup where emulators are run under Xvfb, so manual interaction is not possible.

I need a programmatic way to change (via adb or telnet) the screen lock settings on the emulator to never lock (equivalent to manually changing the settings in the Screen Lock menu to No), especially the emulator should be in an unlocked state right after launch.

Snapshots will not be taken because they have to be taken after the change has been made and reusing snapshots from other AVDs is not desirable because this setting needs to be consistent with new Android releases.

In other words, the setting for the new AVD should be completely disabled.

I'm wondering if something like this would work, but I couldn't figure out how to get to the Screen Lock submenu:

adb shell am start -a android.intent.action.MAIN -n com.android.settings/.SecuritySettings

      

Is there any better way to achieve this anyway?

+3


source to share


1 answer


Eventually I figured out:

adb -s $SERIAL shell rm -f /data/system/locksettings.db*

      



This will remove any lock screen by setting it to "No" in system preferences.

+2


source







All Articles