summaryrefslogtreecommitdiffstats
path: root/core/java/com/android/internal/widget/LockPatternUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/com/android/internal/widget/LockPatternUtils.java')
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java83
1 files changed, 60 insertions, 23 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 668b029..cbd1317 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -101,8 +101,9 @@ public class LockPatternUtils {
private final static String LOCKOUT_PERMANENT_KEY = "lockscreen.lockedoutpermanently";
private final static String LOCKOUT_ATTEMPT_DEADLINE = "lockscreen.lockoutattemptdeadline";
private final static String PATTERN_EVER_CHOSEN_KEY = "lockscreen.patterneverchosen";
- public final static String PASSWORD_TYPE_KEY = "lockscreen.password_type";
private final static String LOCK_PASSWORD_SALT_KEY = "lockscreen.password_salt";
+ private final static String LOCK_FINGER_ENABLED = "lockscreen.lockfingerenabled";
+ public final static String PASSWORD_TYPE_KEY = "lockscreen.password_type";
private final Context mContext;
private final ContentResolver mContentResolver;
@@ -251,6 +252,14 @@ public class LockPatternUtils {
}
/**
+ * Check to see if the user has stored a finger.
+ * @return Whether a saved finger exists.
+ */
+ public boolean savedFingerExists() {
+ return true;
+ }
+
+ /**
* Return true if the user has ever chosen a pattern. This is true even if the pattern is
* currently cleared.
*
@@ -287,6 +296,11 @@ public class LockPatternUtils {
activePasswordQuality = DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC;
}
break;
+ case DevicePolicyManager.PASSWORD_QUALITY_FINGER:
+ if (isLockFingerEnabled()) {
+ activePasswordQuality = DevicePolicyManager.PASSWORD_QUALITY_FINGER;
+ }
+ break;
}
return activePasswordQuality;
}
@@ -560,6 +574,15 @@ public class LockPatternUtils {
}
/**
+ * @return Whether the lock finger is enabled.
+ */
+ public boolean isLockFingerEnabled() {
+ return getBoolean(LOCK_FINGER_ENABLED)
+ && getLong(PASSWORD_TYPE_KEY, 0)
+ == DevicePolicyManager.PASSWORD_QUALITY_FINGER;
+ }
+
+ /**
* Set whether the lock pattern is enabled.
*/
public void setLockPatternEnabled(boolean enabled) {
@@ -567,6 +590,18 @@ public class LockPatternUtils {
}
/**
+ * Set whether the lock finger is enabled.
+ */
+ public void setLockFingerEnabled(boolean enabled) {
+ setBoolean(LOCK_FINGER_ENABLED, enabled);
+ if (enabled) {
+ setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_FINGER);
+ } else {
+ setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
+ }
+ }
+
+ /**
* @return Whether the visible pattern is enabled.
*/
public boolean isVisiblePatternEnabled() {
@@ -593,59 +628,59 @@ public class LockPatternUtils {
public void setTactileFeedbackEnabled(boolean enabled) {
setBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, enabled);
}
-
+
public void setVisibleDotsEnabled(boolean enabled) {
- setBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, enabled);
+ setBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, enabled);
}
-
+
public boolean isVisibleDotsEnabled() {
return getBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, true);
}
-
+
public void setShowErrorPath(boolean enabled) {
- setBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, enabled);
+ setBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, enabled);
}
-
+
public boolean isShowErrorPath() {
return getBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, true);
}
-
+
public void setShowCustomMsg(boolean enabled) {
setBoolean(Settings.Secure.LOCK_SHOW_CUSTOM_MSG, enabled);
}
-
+
public boolean isShowCustomMsg() {
return getBoolean(Settings.Secure.LOCK_SHOW_CUSTOM_MSG, false);
}
-
+
public void setCustomMsg(String msg) {
setString(Settings.Secure.LOCK_CUSTOM_MSG, msg);
}
-
+
public String getCustomMsg() {
return getString(Settings.Secure.LOCK_CUSTOM_MSG);
}
-
+
public int getIncorrectDelay() {
return getInt(Settings.Secure.LOCK_INCORRECT_DELAY, 2000);
}
-
+
public void setIncorrectDelay(int delay) {
setInt(Settings.Secure.LOCK_INCORRECT_DELAY, delay);
}
-
+
public void setShowUnlockMsg(boolean enabled) {
setBoolean(Settings.Secure.SHOW_UNLOCK_TEXT, enabled);
}
-
+
public boolean isShowUnlockMsg() {
return getBoolean(Settings.Secure.SHOW_UNLOCK_TEXT, true);
}
-
+
public void setShowUnlockErrMsg(boolean enabled) {
setBoolean(Settings.Secure.SHOW_UNLOCK_ERR_TEXT, enabled);
}
-
+
public boolean isShowUnlockErrMsg() {
return getBoolean(Settings.Secure.SHOW_UNLOCK_ERR_TEXT, true);
}
@@ -852,7 +887,7 @@ public class LockPatternUtils {
return 1 ==
android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey, 0);
}
-
+
private boolean getBoolean(String systemSettingKey, boolean defaultValue) {
return 1 ==
android.provider.Settings.Secure.getInt(
@@ -872,7 +907,7 @@ public class LockPatternUtils {
private void setLong(String secureSettingKey, long value) {
android.provider.Settings.Secure.putLong(mContentResolver, secureSettingKey, value);
}
-
+
private int getInt(String systemSettingKey, int def) {
return android.provider.Settings.Secure.getInt(mContentResolver, systemSettingKey, def);
}
@@ -880,16 +915,16 @@ public class LockPatternUtils {
private void setInt(String systemSettingKey, int value) {
android.provider.Settings.Secure.putInt(mContentResolver, systemSettingKey, value);
}
-
+
private String getString(String systemSettingKey) {
String s = android.provider.Settings.Secure.getString(mContentResolver, systemSettingKey);
-
+
if (s == null)
return "";
-
+
return s;
}
-
+
private void setString(String systemSettingKey, String value) {
android.provider.Settings.Secure.putString(mContentResolver, systemSettingKey, value);
}
@@ -897,10 +932,12 @@ public class LockPatternUtils {
public boolean isSecure() {
long mode = getKeyguardStoredPasswordQuality();
final boolean isPattern = mode == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
+ final boolean isFinger = mode == DevicePolicyManager.PASSWORD_QUALITY_FINGER;
final boolean isPassword = mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC;
final boolean secure = isPattern && isLockPatternEnabled() && savedPatternExists()
+ || isFinger && isLockFingerEnabled() && savedFingerExists()
|| isPassword && savedPasswordExists();
return secure;
}