OSDN Git Service

Added a liveliness check box preference for Face Unlock.
authorDanielle Millett <dmillett@google.com>
Mon, 19 Mar 2012 22:05:26 +0000 (18:05 -0400)
committerDanielle Millett <dmillett@google.com>
Wed, 21 Mar 2012 17:32:56 +0000 (13:32 -0400)
This will be used to enable or disable liveliness detection.

Change-Id: I0be735724aed4cadbd5c37d895a7f80ad4f4ee09

res/values/strings.xml
res/xml/security_settings_biometric_weak.xml
src/com/android/settings/SecuritySettings.java

index 71564c5..5beeace 100644 (file)
 
     <!-- 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>
index 080fbc9..4a41431 100644 (file)
             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"/>
 
index adf8c37..df4baf6 100644 (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_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 @@ public class SecuritySettings extends SettingsPreferenceFragment
     private LockPatternUtils mLockPatternUtils;
     private ListPreference mLockAfter;
 
+    private CheckBoxPreference mBiometricWeakLiveliness;
     private CheckBoxPreference mVisiblePattern;
     private CheckBoxPreference mTactileFeedback;
 
@@ -155,6 +157,10 @@ public class SecuritySettings extends SettingsPreferenceFragment
             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 @@ public class SecuritySettings extends SettingsPreferenceFragment
         createPreferenceHierarchy();
 
         final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
+        if (mBiometricWeakLiveliness != null) {
+            mBiometricWeakLiveliness.setChecked(
+                    lockPatternUtils.isBiometricWeakLivelinessEnabled());
+        }
         if (mVisiblePattern != null) {
             mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled());
         }
@@ -354,6 +364,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
                     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)) {