I have the requirement to disable the lock screen and set the lock screen type to "None". My device is rooted (can run with SU permission) + can run as a system application with system permissions (under /system/app).
I have tried a few things to no avail.
Try 1
This seems to be deprecated and not working.
KeyguardManager manager = (KeyguardManager) this.getSystemService(KEYGUARD_SERVICE);
KeyguardLock lock = manager.newKeyguardLock("abc");
lock.disableKeyguard();
Try 2
This didn't work either.
/data/data/com.android.providers.settings/databases/settings.db
Execute the following SQL.
INSERT OR REPLACE INTO system (name, value) VALUES ('lockscreen.disabled', '1');
INSERT OR REPLACE INTO secure (name, value) VALUES ('lockscreen.disabled', '1');
Try 3
Rebooted the machine but still no luck.
android.provider.Settings.Secure.putLong(mContentResolver, Settings.Secure.LOCK_PATTERN_ENABLED, false);`
android.provider.Settings.Secure.putLong(mContentResolver, "lockscreen.password_type", DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);`
android.provider.Settings.Secure.putLong(mContentResolver, "lockscreen.password_type_alternate", DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
android.provider.Settings.Secure.putLong(mContentResolver, "lockscreen.disabled", true);
Is there anything else that I can try?
Please note that I do not want to disable the keyguard only when application is running.
You can try this:
adb shell sqlite3 /data/system/locksettings.db "UPDATE locksettings SET value = '1' WHERE name = 'lockscreen.disabled'"
adb shell sqlite3 /data/system/locksettings.db "UPDATE locksettings SET value = '0' WHERE name = 'lockscreen.password_type'"
adb shell sqlite3 /data/system/locksettings.db "UPDATE locksettings SET value = '0' WHERE name = 'lockscreen.password_type_alternate'"
It works on my rooted Nexus 4.