I have tried to find a way to disable the PatternLock screen temporarily. I don't want the lock to be disabled completely, but the user should not need to re-enter his pattern all the time.
My idea is to write a service which disables the pattern after some user activity and re-enables it after a while. (and even more)
There are apps on the market that do something like that (i.e. AutoLock or TogglePattern), so there must be a solution.
I know that I can prevent a lock completely by using:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
or
KeyguardLock.disableKeyguard()
But that is not what I'm after.
I saw the class com.android.internal.widget.LockPatternUtils
in the android sources which is used by the settings activity, but this class is not (at least as far as I know) accessible by a "normal" application.
Do you have any suggestions?
Have you tried looking at the code for com.android.internal.widget.LockPatternUtils
and doing what it does?
It has something like this:
public void setLockPatternEnabled(boolean enabled) {
setBoolean(android.provider.Settings.System.LOCK_PATTERN_ENABLED, enabled);
}
private void setBoolean(String systemSettingKey, boolean enabled) {
android.provider.Settings.System.putInt(
mContentResolver,
systemSettingKey,
enabled ? 1 : 0);
}
You might be able to do something similar in your code.