Added a liveliness check box preference for Face Unlock.

This will be used to enable or disable liveliness detection.

Change-Id: I0be735724aed4cadbd5c37d895a7f80ad4f4ee09
This commit is contained in:
Danielle Millett
2012-03-19 18:05:26 -04:00
parent 439c551cf3
commit a87a25bdec
3 changed files with 24 additions and 0 deletions

View File

@@ -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 --> <!-- 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> <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 --> <!-- Security settings screen, setting option name to change screen timeout -->
<string name="lock_after_timeout">Automatically lock</string> <string name="lock_after_timeout">Automatically lock</string>

View File

@@ -30,6 +30,11 @@
android:key="biometric_weak_improve_matching" android:key="biometric_weak_improve_matching"
android:title="@string/biometric_weak_improve_matching_title"/> 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 <CheckBoxPreference
android:key="visiblepattern" android:key="visiblepattern"
android:title="@string/lockpattern_settings_enable_visible_pattern_title"/> android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>

View File

@@ -53,6 +53,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change"; private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change";
private static final String KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING = private static final String KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING =
"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_LOCK_ENABLED = "lockenabled";
private static final String KEY_VISIBLE_PATTERN = "visiblepattern"; private static final String KEY_VISIBLE_PATTERN = "visiblepattern";
private static final String KEY_TACTILE_FEEDBACK_ENABLED = "unlock_tactile_feedback"; private static final String KEY_TACTILE_FEEDBACK_ENABLED = "unlock_tactile_feedback";
@@ -74,6 +75,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
private LockPatternUtils mLockPatternUtils; private LockPatternUtils mLockPatternUtils;
private ListPreference mLockAfter; private ListPreference mLockAfter;
private CheckBoxPreference mBiometricWeakLiveliness;
private CheckBoxPreference mVisiblePattern; private CheckBoxPreference mVisiblePattern;
private CheckBoxPreference mTactileFeedback; private CheckBoxPreference mTactileFeedback;
@@ -155,6 +157,10 @@ public class SecuritySettings extends SettingsPreferenceFragment
updateLockAfterPreferenceSummary(); updateLockAfterPreferenceSummary();
} }
// biometric weak liveliness
mBiometricWeakLiveliness =
(CheckBoxPreference) root.findPreference(KEY_BIOMETRIC_WEAK_LIVELINESS);
// visible pattern // visible pattern
mVisiblePattern = (CheckBoxPreference) root.findPreference(KEY_VISIBLE_PATTERN); mVisiblePattern = (CheckBoxPreference) root.findPreference(KEY_VISIBLE_PATTERN);
@@ -322,6 +328,10 @@ public class SecuritySettings extends SettingsPreferenceFragment
createPreferenceHierarchy(); createPreferenceHierarchy();
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils(); final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
if (mBiometricWeakLiveliness != null) {
mBiometricWeakLiveliness.setChecked(
lockPatternUtils.isBiometricWeakLivelinessEnabled());
}
if (mVisiblePattern != null) { if (mVisiblePattern != null) {
mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled()); mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled());
} }
@@ -354,6 +364,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
CONFIRM_EXISTING_FOR_BIOMETRIC_IMPROVE_REQUEST, null, null)) { CONFIRM_EXISTING_FOR_BIOMETRIC_IMPROVE_REQUEST, null, null)) {
startBiometricWeakImprove(); // no password set, so no need to confirm 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)) { } else if (KEY_LOCK_ENABLED.equals(key)) {
lockPatternUtils.setLockPatternEnabled(isToggled(preference)); lockPatternUtils.setLockPatternEnabled(isToggled(preference));
} else if (KEY_VISIBLE_PATTERN.equals(key)) { } else if (KEY_VISIBLE_PATTERN.equals(key)) {