Show current screen lock as summary
Bug: 19819290 Change-Id: Iefdacd6b86f96e6f3577351e7f92b86217b1b7ad
This commit is contained in:
@@ -985,6 +985,9 @@
|
|||||||
<!-- Title for preference that guides the user through creating an unlock password [CHAR LIMIT=45] -->
|
<!-- Title for preference that guides the user through creating an unlock password [CHAR LIMIT=45] -->
|
||||||
<string name="unlock_set_unlock_password_summary">High security</string>
|
<string name="unlock_set_unlock_password_summary">High security</string>
|
||||||
|
|
||||||
|
<!-- Summary specifying that this is the current screen lock setting [CHAR LIMIT=45] -->
|
||||||
|
<string name="current_screen_lock">Current screen lock</string>
|
||||||
|
|
||||||
<!-- Content of warning dialog about disabling device protection features when user is switching from a secure unlock method to an insecure one. [CHAR LIMIT=NONE] -->
|
<!-- Content of warning dialog about disabling device protection features when user is switching from a secure unlock method to an insecure one. [CHAR LIMIT=NONE] -->
|
||||||
<string name="unlock_disable_frp_warning_content">Device protection features will no longer work.</string>
|
<string name="unlock_disable_frp_warning_content">Device protection features will no longer work.</string>
|
||||||
|
|
||||||
|
@@ -244,12 +244,40 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
addPreferencesFromResource(R.xml.security_settings_picker);
|
addPreferencesFromResource(R.xml.security_settings_picker);
|
||||||
disableUnusablePreferences(quality, hideDisabledPrefs);
|
disableUnusablePreferences(quality, hideDisabledPrefs);
|
||||||
|
updateCurrentPreference();
|
||||||
updatePreferenceSummaryIfNeeded();
|
updatePreferenceSummaryIfNeeded();
|
||||||
} else {
|
} else {
|
||||||
updateUnlockMethodAndFinish(quality, false);
|
updateUnlockMethodAndFinish(quality, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateCurrentPreference() {
|
||||||
|
String currentKey = getKeyForCurrent();
|
||||||
|
Preference preference = findPreference(currentKey);
|
||||||
|
if (preference != null) {
|
||||||
|
preference.setSummary(R.string.current_screen_lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getKeyForCurrent() {
|
||||||
|
if (mLockPatternUtils.isLockScreenDisabled()) {
|
||||||
|
return KEY_UNLOCK_SET_OFF;
|
||||||
|
}
|
||||||
|
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
|
||||||
|
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||||
|
return KEY_UNLOCK_SET_PATTERN;
|
||||||
|
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
||||||
|
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
|
||||||
|
return KEY_UNLOCK_SET_PIN;
|
||||||
|
case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
|
||||||
|
case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
|
||||||
|
return KEY_UNLOCK_SET_PASSWORD;
|
||||||
|
case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED:
|
||||||
|
return KEY_UNLOCK_SET_NONE;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/** increases the quality if necessary */
|
/** increases the quality if necessary */
|
||||||
private int upgradeQuality(int quality) {
|
private int upgradeQuality(int quality) {
|
||||||
quality = upgradeQualityForDPM(quality);
|
quality = upgradeQualityForDPM(quality);
|
||||||
|
Reference in New Issue
Block a user