Added a liveliness check box preference for Face Unlock.
This will be used to enable or disable liveliness detection.
Change-Id: I0be735724aed4cadbd5c37d895a7f80ad4f4ee09
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 71564c5..5beeace 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -639,6 +639,13 @@
<!-- Security settings screen when using face unlock, setting option name to start an activity that allows the user to improve accuracy by adding additional enrollment faces -->
<string name="biometric_weak_improve_matching_title">Improve face matching</string>
+ <!-- On the security settings screen when using face unlock. This checkbox is used to toggle whether liveliness detection is required. If it is checked the user must blink during unlock to prove it's not a photo -->
+ <string name="biometric_weak_liveliness_title">Require eye blink</string>
+ <!-- On the security settings screen when using face unlock. The summary of the liveliness checkbox -->
+ <string name="biometric_weak_liveliness_summary" product="default">Prevent others from using a photo of you to unlock your phone</string>
+ <!-- On the security settings screen when using face unlock. The summary of the liveliness checkbox -->
+ <string name="biometric_weak_liveliness_summary" product="tablet">Prevent others from using a photo of you to unlock your tablet</string>
+
<!-- Security settings screen, setting option name to change screen timeout -->
<string name="lock_after_timeout">Automatically lock</string>
diff --git a/res/xml/security_settings_biometric_weak.xml b/res/xml/security_settings_biometric_weak.xml
index 080fbc9..4a41431 100644
--- a/res/xml/security_settings_biometric_weak.xml
+++ b/res/xml/security_settings_biometric_weak.xml
@@ -31,6 +31,11 @@
android:title="@string/biometric_weak_improve_matching_title"/>
<CheckBoxPreference
+ android:key="biometric_weak_liveliness"
+ android:title="@string/biometric_weak_liveliness_title"
+ android:summary="@string/biometric_weak_liveliness_summary"/>
+
+ <CheckBoxPreference
android:key="visiblepattern"
android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index adf8c37..df4baf6 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -53,6 +53,7 @@
private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change";
private static final String KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING =
"biometric_weak_improve_matching";
+ private static final String KEY_BIOMETRIC_WEAK_LIVELINESS = "biometric_weak_liveliness";
private static final String KEY_LOCK_ENABLED = "lockenabled";
private static final String KEY_VISIBLE_PATTERN = "visiblepattern";
private static final String KEY_TACTILE_FEEDBACK_ENABLED = "unlock_tactile_feedback";
@@ -74,6 +75,7 @@
private LockPatternUtils mLockPatternUtils;
private ListPreference mLockAfter;
+ private CheckBoxPreference mBiometricWeakLiveliness;
private CheckBoxPreference mVisiblePattern;
private CheckBoxPreference mTactileFeedback;
@@ -155,6 +157,10 @@
updateLockAfterPreferenceSummary();
}
+ // biometric weak liveliness
+ mBiometricWeakLiveliness =
+ (CheckBoxPreference) root.findPreference(KEY_BIOMETRIC_WEAK_LIVELINESS);
+
// visible pattern
mVisiblePattern = (CheckBoxPreference) root.findPreference(KEY_VISIBLE_PATTERN);
@@ -322,6 +328,10 @@
createPreferenceHierarchy();
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
+ if (mBiometricWeakLiveliness != null) {
+ mBiometricWeakLiveliness.setChecked(
+ lockPatternUtils.isBiometricWeakLivelinessEnabled());
+ }
if (mVisiblePattern != null) {
mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled());
}
@@ -354,6 +364,8 @@
CONFIRM_EXISTING_FOR_BIOMETRIC_IMPROVE_REQUEST, null, null)) {
startBiometricWeakImprove(); // no password set, so no need to confirm
}
+ } else if (KEY_BIOMETRIC_WEAK_LIVELINESS.equals(key)) {
+ lockPatternUtils.setBiometricWeakLivelinessEnabled(isToggled(preference));
} else if (KEY_LOCK_ENABLED.equals(key)) {
lockPatternUtils.setLockPatternEnabled(isToggled(preference));
} else if (KEY_VISIBLE_PATTERN.equals(key)) {