Merge "Fix 3024522: Add new "Off" setting to LockScreen options."

This commit is contained in:
Jim Miller
2010-11-29 18:00:27 -08:00
committed by Android (Google) Code Review
3 changed files with 47 additions and 29 deletions

View File

@@ -582,62 +582,66 @@
<!-- Unlock Picker Settings --><skip /> <!-- Unlock Picker Settings --><skip />
<!-- Security Picker --><skip /> <!-- Security Picker --><skip />
<!-- Title for security picker to choose the unlock method: None/Pattern/PIN/Password --> <!-- Title for security picker to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
<string name="lock_settings_picker_title">Screen unlock security</string> <string name="lock_settings_picker_title">Screen unlock security</string>
<!-- Main Security lock settings --><skip /> <!-- Main Security lock settings --><skip />
<!-- Title for PreferenceScreen to launch picker for security method when there is none --> <!-- Title for PreferenceScreen to launch picker for security method when there is none [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_launch_picker_title">Set up screen lock</string> <string name="unlock_set_unlock_launch_picker_title">Set up screen lock</string>
<!-- Summary for PreferenceScreen to launch picker for security method when there is none --> <!-- Summary for PreferenceScreen to launch picker for security method when there is none [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_launch_picker_summary">Lock screen with a pattern, PIN, or password</string> <string name="unlock_set_unlock_launch_picker_summary">Lock screen with a pattern, PIN, or password</string>
<!-- Title for PreferenceScreen to change security method: None/Pattern/PIN/Password --> <!-- Title for PreferenceScreen to change security method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_launch_picker_change_title">Change screen lock</string> <string name="unlock_set_unlock_launch_picker_change_title">Change screen lock</string>
<!-- Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password --> <!-- Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_launch_picker_change_summary">Change or disable pattern, PIN, or password security</string> <string name="unlock_set_unlock_launch_picker_change_summary">Change or disable pattern, PIN, or password security</string>
<!-- Title for preference that disables unlock security [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_off_title">Off</string>
<!-- Summary for preference that disables unlock security [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_off_summary">Don\u0027t show the lock screen</string>
<!-- Title for preference that disables unlock security --> <!-- Title for preference that disables unlock security [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_none_title">None</string> <string name="unlock_set_unlock_none_title">None</string>
<!-- Summary for preference that disables unlock security --> <!-- Summary for preference that disables unlock security [CHAR LIMIT=45]-->
<string name="unlock_set_unlock_none_summary">Disable screen unlock security</string> <string name="unlock_set_unlock_none_summary">Disable screen unlock security</string>
<!-- Title for preference that guides the user through creating an unlock pattern --> <!-- Title for preference that guides the user through creating an unlock pattern [CHAR LIMIT=22]-->
<string name="unlock_set_unlock_pattern_title">Pattern</string> <string name="unlock_set_unlock_pattern_title">Pattern</string>
<!-- Summary for preference that guides the user through creating an unlock pattern --> <!-- Summary for preference that guides the user through creating an unlock pattern [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_pattern_summary">Draw pattern to unlock screen</string> <string name="unlock_set_unlock_pattern_summary">Draw pattern to unlock screen</string>
<!-- Title for preference that guides the user through creating an unlock PIN (Personal Identification Number) --> <!-- Title for preference that guides the user through creating an unlock PIN (Personal Identification Number) [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_pin_title">PIN</string> <string name="unlock_set_unlock_pin_title">PIN</string>
<!-- Summary for preference that guides the user through creating an unlock PIN (Personal Identification Number) --> <!-- Summary for preference that guides the user through creating an unlock PIN (Personal Identification Number) [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_pin_summary">Enter a numeric PIN to unlock screen</string> <string name="unlock_set_unlock_pin_summary">Enter a numeric PIN to unlock screen</string>
<!-- Title for preference that guides the user through creating an unlock password --> <!-- Title for preference that guides the user through creating an unlock password [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_password_title">Password</string> <string name="unlock_set_unlock_password_title">Password</string>
<!-- Title for preference that guides the user through creating an unlock password --> <!-- Title for preference that guides the user through creating an unlock password [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_password_summary">Enter a password to unlock screen</string> <string name="unlock_set_unlock_password_summary">Enter a password to unlock screen</string>
<!-- Summary for preference that has been disabled by DevicePolicyAdmin --> <!-- Summary for preference that has been disabled by DevicePolicyAdmin [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_disabled_summary">Disabled by remote device administrator</string> <string name="unlock_set_unlock_disabled_summary">Disabled by remote device administrator</string>
<!-- Title for option to turn of password/pin/pattern unlock. --> <!-- Title for option to turn of password/pin/pattern unlock. [CHAR LIMIT=22] -->
<string name="unlock_disable_lock_title">Turn off screen lock</string> <string name="unlock_disable_lock_title">Turn off screen lock</string>
<!-- Summary shown under unlock_disable_lock_title when pattern is in use and can be removed --> <!-- Summary shown under unlock_disable_lock_title when pattern is in use and can be removed [CHAR LIMIT=45] -->
<string name="unlock_disable_lock_pattern_summary">Remove unlock pattern</string> <string name="unlock_disable_lock_pattern_summary">Remove unlock pattern</string>
<!-- Summary shown under unlock_disable_lock_title when PIN is in use and can be removed --> <!-- Summary shown under unlock_disable_lock_title when PIN is in use and can be removed [CHAR LIMIT=45]-->
<string name="unlock_disable_lock_pin_summary">Remove unlock PIN</string> <string name="unlock_disable_lock_pin_summary">Remove unlock PIN</string>
<!-- Summary shown under unlock_disable_lock_title when password is in use and can be removed --> <!-- Summary shown under unlock_disable_lock_title when password is in use and can be removed [CHAR LIMIT=45]-->
<string name="unlock_disable_lock_password_summary">Remove unlock password</string> <string name="unlock_disable_lock_password_summary">Remove unlock password</string>
<!-- Title shown on security settings to allow the user to change their lockscreen pattern --> <!-- Title shown on security settings to allow the user to change their lockscreen pattern [CHAR LIMIT=22] -->
<string name="unlock_change_lock_pattern_title">Change unlock pattern</string> <string name="unlock_change_lock_pattern_title">Change unlock pattern</string>
<!-- Title shown on security settings to allow the user to change their lockscreen PIN --> <!-- Title shown on security settings to allow the user to change their lockscreen PIN [CHAR LIMIT=22] -->
<string name="unlock_change_lock_pin_title">Change unlock PIN</string> <string name="unlock_change_lock_pin_title">Change unlock PIN</string>
<!-- Title shown on security settings to allow the user to change their lockscreen password --> <!-- Title shown on security settings to allow the user to change their lockscreen password [CHAR LIMIT=22]-->
<string name="unlock_change_lock_password_title">Change unlock password</string> <string name="unlock_change_lock_password_title">Change unlock password</string>
<!-- Hint shown in dialog screen when password is too short --> <!-- Hint shown in dialog screen when password is too short -->

View File

@@ -20,6 +20,12 @@
android:key="security_picker_category" android:key="security_picker_category"
android:title="@string/lock_settings_picker_title"> android:title="@string/lock_settings_picker_title">
<PreferenceScreen
android:key="unlock_set_off"
android:title="@string/unlock_set_unlock_off_title"
android:summary="@string/unlock_set_unlock_off_summary"
android:persistent="false"/>
<PreferenceScreen <PreferenceScreen
android:key="unlock_set_none" android:key="unlock_set_none"
android:title="@string/unlock_set_unlock_none_title" android:title="@string/unlock_set_unlock_none_title"

View File

@@ -29,6 +29,7 @@ import android.preference.PreferenceScreen;
public class ChooseLockGeneric extends PreferenceActivity { public class ChooseLockGeneric extends PreferenceActivity {
private static final int MIN_PASSWORD_LENGTH = 4; private static final int MIN_PASSWORD_LENGTH = 4;
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_PIN = "unlock_set_pin"; private static final String KEY_UNLOCK_SET_PIN = "unlock_set_pin";
private static final String KEY_UNLOCK_SET_PASSWORD = "unlock_set_password"; private static final String KEY_UNLOCK_SET_PASSWORD = "unlock_set_password";
@@ -68,14 +69,16 @@ public class ChooseLockGeneric extends PreferenceActivity {
Preference preference) { Preference preference) {
final String key = preference.getKey(); final String key = preference.getKey();
boolean handled = true; boolean handled = true;
if (KEY_UNLOCK_SET_NONE.equals(key)) { if (KEY_UNLOCK_SET_OFF.equals(key)) {
updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED); updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, true);
} else if (KEY_UNLOCK_SET_NONE.equals(key)) {
updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, false);
} else if (KEY_UNLOCK_SET_PATTERN.equals(key)) { } else if (KEY_UNLOCK_SET_PATTERN.equals(key)) {
updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, false);
} else if (KEY_UNLOCK_SET_PIN.equals(key)) { } else if (KEY_UNLOCK_SET_PIN.equals(key)) {
updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC); updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC, false);
} else if (KEY_UNLOCK_SET_PASSWORD.equals(key)) { } else if (KEY_UNLOCK_SET_PASSWORD.equals(key)) {
updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC); updateUnlockMethodAndFinish(DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC, false);
} else { } else {
handled = false; handled = false;
} }
@@ -113,7 +116,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
addPreferencesFromResource(R.xml.security_settings_picker); addPreferencesFromResource(R.xml.security_settings_picker);
disableUnusablePreferences(mDPM.getPasswordQuality(null)); disableUnusablePreferences(mDPM.getPasswordQuality(null));
} else { } else {
updateUnlockMethodAndFinish(quality); updateUnlockMethodAndFinish(quality, false);
} }
} }
@@ -131,7 +134,9 @@ public class ChooseLockGeneric extends PreferenceActivity {
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;
if (KEY_UNLOCK_SET_NONE.equals(key)) { if (KEY_UNLOCK_SET_OFF.equals(key)) {
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
} else if (KEY_UNLOCK_SET_NONE.equals(key)) {
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED; enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
} else if (KEY_UNLOCK_SET_PATTERN.equals(key)) { } else if (KEY_UNLOCK_SET_PATTERN.equals(key)) {
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
@@ -154,8 +159,10 @@ public class ChooseLockGeneric extends PreferenceActivity {
* {@link DevicePolicyManager#PASSWORD_QUALITY_UNSPECIFIED}, password is cleared. * {@link DevicePolicyManager#PASSWORD_QUALITY_UNSPECIFIED}, password is cleared.
* *
* @param quality the desired quality. Ignored if DevicePolicyManager requires more security. * @param quality the desired quality. Ignored if DevicePolicyManager requires more security.
* @param disabled whether or not to show LockScreen at all. Only meaningful when quality is
* {@link DevicePolicyManager#PASSWORD_QUALITY_UNSPECIFIED}
*/ */
void updateUnlockMethodAndFinish(int quality) { void updateUnlockMethodAndFinish(int quality, boolean disabled) {
// Sanity check. We should never get here without confirming user's existing password first. // Sanity check. We should never get here without confirming user's existing password first.
if (!mPasswordConfirmed) { if (!mPasswordConfirmed) {
throw new IllegalStateException("Tried to update password without confirming first"); throw new IllegalStateException("Tried to update password without confirming first");
@@ -191,6 +198,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
startActivity(intent); startActivity(intent);
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) { } else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
mChooseLockSettingsHelper.utils().clearLock(); mChooseLockSettingsHelper.utils().clearLock();
mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled);
setResult(RESULT_OK); setResult(RESULT_OK);
} }
finish(); finish();