Jacob Stevens Jacob Stevens - 3 months ago 26
Android Question

Set screenlock setting interactively

I want to set the screenlock mode to None in KitKat so I can run CTS.

I'm using the DragonBoard APQ8074 for development from Intrinsyc, and they just released their BSP for Android KitKat 4.4.2. Trouble is, it's unstable and the Security menu in Settings crashes. So I can't use

adb shell
to
input keyevents 19, 20, 21, 22, 23
to navigate.

adb shell settings
command seems like it should work for this, but it's not. I tried these commands against 4.2, 4.3 and 4.4, and they seem to assign the values, but they don't visually result in any changes.

shell@msm8974:/ $ settings get system lockscreen_disabled
null
shell@msm8974:/ $ settings put system lockscreen_disabled true
shell@msm8974:/ $ settings get system lockscreen_disabled
true

shell@msm8974:/ $ settings get system screen_brightness
102
shell@msm8974:/ $ settings put system screen_brightness 255
shell@msm8974:/ $ settings get system screen_brightness
255


Now I dunno if lockscreen_disabled is what I want, here, but Settings.java doesn't seem to provide a call to any sort of
unlock_mode
, so I dunno what else to do. I don't want to write an app to do this, I just want to set screen lock mode to
None
so I can run CTS. If I need to modify source, then make & flash a new image, I'm willing to do that, but I don't know what to modify. Thanks for any guidance.

Answer

Got it figured out.

1. Update settings.db using adb shell

shell@msm8974:/ $ su
shell@msm8974:/ # sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite3> update secure set value=1 where name='lockscreen.disabled';
sqlite3> .quit

2. Move or delete locksettings files

shell@msm8974:/ # mkdir /data/system/lock
shell@msm8974:/ # mv /data/system/locksettings* lock

adb reboot and good to go.