Adding info explaining facelock's backup lock

This changes the security picker when selecting a backup lock for facelock
such that it says back up lock and gives a brief description of why it's needed.
This is currently a temporary way to display the info and will need to be changed
for the final release.

Change-Id: I6373f97caec088482d36c65bd210c79238c623cf
This commit is contained in:
Danielle Millett
2011-09-16 15:41:30 -04:00
parent 96dc241cea
commit 5bae8739ea
3 changed files with 25 additions and 2 deletions

View File

@@ -756,6 +756,9 @@
<!-- Title for security picker to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] --> <!-- Title for security picker to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
<string name="lock_settings_picker_title">Screen lock</string> <string name="lock_settings_picker_title">Screen lock</string>
<!-- Title for security picker when choosing a facelock's backup unlock method: Pattern/PIN [CHAR LIMIT=22] -->
<string name="backup_lock_settings_picker_title">Choose backup lock</string>
<!-- Main Security lock settings --><skip /> <!-- Main Security lock settings --><skip />
<!-- Title for PreferenceScreen to launch picker for security method when there is none [CHAR LIMIT=22] --> <!-- Title for PreferenceScreen to launch picker for security method when there is none [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_launch_picker_title">Screen lock</string> <string name="unlock_set_unlock_launch_picker_title">Screen lock</string>
@@ -769,6 +772,9 @@
<!-- Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password [CHAR LIMIT=45] --> <!-- Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_launch_picker_enable_summary">Choose a method to lock the screen</string> <string name="unlock_set_unlock_launch_picker_enable_summary">Choose a method to lock the screen</string>
<!-- Info explaining the backup lock which is used for facelock -->
<string name="unlock_backup_info_summary">When conditions for FaceLock aren\'t ideal, how do you want to unlock?</string>
<!-- Title for preference that disables unlock security [CHAR LIMIT=22] --> <!-- Title for preference that disables unlock security [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_off_title">None</string> <string name="unlock_set_unlock_off_title">None</string>
<!-- Summary for preference that disables unlock security [CHAR LIMIT=45] --> <!-- Summary for preference that disables unlock security [CHAR LIMIT=45] -->

View File

@@ -20,6 +20,13 @@
android:key="security_picker_category" android:key="security_picker_category"
android:title="@string/lock_settings_picker_title"> android:title="@string/lock_settings_picker_title">
<!-- TODO: find a better way to display this backup info -->
<PreferenceScreen
android:key="unlock_backup_info"
android:summary="@string/unlock_backup_info_summary"
android:selectable="false"
android:persistent="false"/>
<PreferenceScreen <PreferenceScreen
android:key="unlock_set_off" android:key="unlock_set_off"
android:title="@string/unlock_set_unlock_off_title" android:title="@string/unlock_set_unlock_off_title"

View File

@@ -43,6 +43,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
public static class ChooseLockGenericFragment extends SettingsPreferenceFragment { public static class ChooseLockGenericFragment extends SettingsPreferenceFragment {
private static final int MIN_PASSWORD_LENGTH = 4; private static final int MIN_PASSWORD_LENGTH = 4;
private static final String KEY_UNLOCK_BACKUP_INFO = "unlock_backup_info";
private static final String KEY_UNLOCK_SET_OFF = "unlock_set_off"; private static final String KEY_UNLOCK_SET_OFF = "unlock_set_off";
private static final String KEY_UNLOCK_SET_NONE = "unlock_set_none"; private static final String KEY_UNLOCK_SET_NONE = "unlock_set_none";
private static final String KEY_UNLOCK_SET_BIOMETRIC_WEAK = "unlock_set_biometric_weak"; private static final String KEY_UNLOCK_SET_BIOMETRIC_WEAK = "unlock_set_biometric_weak";
@@ -212,13 +213,21 @@ public class ChooseLockGeneric extends PreferenceActivity {
.getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false); .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
final boolean weakBiometricAvailable = isBiometricSensorAvailable( final boolean weakBiometricAvailable = isBiometricSensorAvailable(
DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK); DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK);
if (onlyShowFallback) {
picker.setTitle(R.string.backup_lock_settings_picker_title);
} else {
picker.setTitle(R.string.lock_settings_picker_title);
}
for (int i = preferenceCount-1; i >= 0; --i) { for (int i = preferenceCount-1; i >= 0; --i) {
Preference pref = cat.getPreference(i); Preference pref = cat.getPreference(i);
if (pref instanceof PreferenceScreen) { if (pref instanceof PreferenceScreen) {
final String key = ((PreferenceScreen) pref).getKey(); final String key = ((PreferenceScreen) pref).getKey();
boolean enabled = true; boolean enabled = true;
boolean visible = true; boolean visible = true;
if (KEY_UNLOCK_SET_OFF.equals(key)) { if (KEY_UNLOCK_BACKUP_INFO.equals(key)) {
enabled = true;
visible = onlyShowFallback;
} else if (KEY_UNLOCK_SET_OFF.equals(key)) {
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED; enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
} else if (KEY_UNLOCK_SET_NONE.equals(key)) { } else if (KEY_UNLOCK_SET_NONE.equals(key)) {
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED; enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
@@ -250,7 +259,8 @@ public class ChooseLockGeneric extends PreferenceActivity {
* @return true if allowed * @return true if allowed
*/ */
private boolean allowedForFallback(String key) { private boolean allowedForFallback(String key) {
return KEY_UNLOCK_SET_PATTERN.equals(key) || KEY_UNLOCK_SET_PIN.equals(key); return KEY_UNLOCK_BACKUP_INFO.equals(key) ||
KEY_UNLOCK_SET_PATTERN.equals(key) || KEY_UNLOCK_SET_PIN.equals(key);
} }
private boolean isBiometricSensorAvailable(int quality) { private boolean isBiometricSensorAvailable(int quality) {