Purge biometric weak from internal code
Bug: 18931518 Change-Id: I5da41908b1d6895a69f981e139f2d268327fafcd
This commit is contained in:
@@ -76,12 +76,10 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
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_NONE = "unlock_set_none";
|
||||
private static final String KEY_UNLOCK_SET_BIOMETRIC_WEAK = "unlock_set_biometric_weak";
|
||||
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_PATTERN = "unlock_set_pattern";
|
||||
private static final int CONFIRM_EXISTING_REQUEST = 100;
|
||||
private static final int FALLBACK_REQUEST = 101;
|
||||
private static final int ENABLE_ENCRYPTION_REQUEST = 102;
|
||||
private static final String PASSWORD_CONFIRMED = "password_confirmed";
|
||||
|
||||
@@ -194,21 +192,6 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View v = super.onCreateView(inflater, container, savedInstanceState);
|
||||
final boolean onlyShowFallback = getActivity().getIntent()
|
||||
.getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
||||
if (onlyShowFallback) {
|
||||
View header = v.inflate(getActivity(),
|
||||
R.layout.weak_biometric_fallback_header, null);
|
||||
((ListView) v.findViewById(android.R.id.list)).addHeaderView(header, null, false);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
@@ -216,10 +199,6 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
mPasswordConfirmed = true;
|
||||
updatePreferencesOrFinish();
|
||||
} else if (requestCode == FALLBACK_REQUEST) {
|
||||
mChooseLockSettingsHelper.utils().deleteTempGallery();
|
||||
getActivity().setResult(resultCode);
|
||||
finish();
|
||||
} else if (requestCode == ENABLE_ENCRYPTION_REQUEST
|
||||
&& resultCode == Activity.RESULT_OK) {
|
||||
mRequirePassword = data.getBooleanExtra(
|
||||
@@ -248,22 +227,21 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
if (quality == -1) {
|
||||
// If caller didn't specify password quality, show UI and allow the user to choose.
|
||||
quality = intent.getIntExtra(MINIMUM_QUALITY_KEY, -1);
|
||||
MutableBoolean allowBiometric = new MutableBoolean(false);
|
||||
quality = upgradeQuality(quality, allowBiometric);
|
||||
quality = upgradeQuality(quality);
|
||||
final PreferenceScreen prefScreen = getPreferenceScreen();
|
||||
if (prefScreen != null) {
|
||||
prefScreen.removeAll();
|
||||
}
|
||||
addPreferencesFromResource(R.xml.security_settings_picker);
|
||||
disableUnusablePreferences(quality, allowBiometric);
|
||||
disableUnusablePreferences(quality);
|
||||
updatePreferenceSummaryIfNeeded();
|
||||
} else {
|
||||
updateUnlockMethodAndFinish(quality, false);
|
||||
}
|
||||
}
|
||||
|
||||
/** increases the quality if necessary, and returns whether biometric is allowed */
|
||||
private int upgradeQuality(int quality, MutableBoolean allowBiometric) {
|
||||
/** increases the quality if necessary */
|
||||
private int upgradeQuality(int quality) {
|
||||
quality = upgradeQualityForDPM(quality);
|
||||
quality = upgradeQualityForKeyStore(quality);
|
||||
return quality;
|
||||
@@ -292,28 +270,21 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
* implementation is in disableUnusablePreferenceImpl.
|
||||
*
|
||||
* @param quality the requested quality.
|
||||
* @param allowBiometric whether to allow biometic screen lock.
|
||||
*/
|
||||
protected void disableUnusablePreferences(final int quality,
|
||||
MutableBoolean allowBiometric) {
|
||||
disableUnusablePreferencesImpl(quality, allowBiometric, false /* hideDisabled */);
|
||||
protected void disableUnusablePreferences(final int quality) {
|
||||
disableUnusablePreferencesImpl(quality, false /* hideDisabled */);
|
||||
}
|
||||
|
||||
/***
|
||||
* Disables preferences that are less secure than required quality.
|
||||
*
|
||||
* @param quality the requested quality.
|
||||
* @param allowBiometric whether to allow biometic screen lock.
|
||||
* @param hideDisabled whether to hide disable screen lock options.
|
||||
*/
|
||||
protected void disableUnusablePreferencesImpl(final int quality,
|
||||
MutableBoolean allowBiometric, boolean hideDisabled) {
|
||||
boolean hideDisabled) {
|
||||
final PreferenceScreen entries = getPreferenceScreen();
|
||||
final Intent intent = getActivity().getIntent();
|
||||
final boolean onlyShowFallback = intent.getBooleanExtra(
|
||||
LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
||||
final boolean weakBiometricAvailable =
|
||||
mChooseLockSettingsHelper.utils().isBiometricWeakInstalled();
|
||||
|
||||
// if there are multiple users, disable "None" setting
|
||||
UserManager mUm = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||
@@ -331,10 +302,6 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
visible = singleUser; // don't show when there's more than 1 user
|
||||
} else if (KEY_UNLOCK_SET_NONE.equals(key)) {
|
||||
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
||||
} else if (KEY_UNLOCK_SET_BIOMETRIC_WEAK.equals(key)) {
|
||||
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK ||
|
||||
allowBiometric.value;
|
||||
visible = weakBiometricAvailable; // If not available, then don't show it.
|
||||
} else if (KEY_UNLOCK_SET_PATTERN.equals(key)) {
|
||||
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
|
||||
} else if (KEY_UNLOCK_SET_PIN.equals(key)) {
|
||||
@@ -345,7 +312,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
if (hideDisabled) {
|
||||
visible = visible && enabled;
|
||||
}
|
||||
if (!visible || (onlyShowFallback && !allowedForFallback(key))) {
|
||||
if (!visible) {
|
||||
entries.removePreference(pref);
|
||||
} else if (!enabled) {
|
||||
pref.setSummary(R.string.unlock_set_unlock_disabled_summary);
|
||||
@@ -381,46 +348,16 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the key is allowed for fallback (e.g. bio sensor). Returns true if it's
|
||||
* supported as a backup.
|
||||
*
|
||||
* @param key
|
||||
* @return true if allowed
|
||||
*/
|
||||
private boolean allowedForFallback(String key) {
|
||||
return KEY_UNLOCK_BACKUP_INFO.equals(key) ||
|
||||
KEY_UNLOCK_SET_PATTERN.equals(key) || KEY_UNLOCK_SET_PIN.equals(key);
|
||||
}
|
||||
|
||||
private Intent getBiometricSensorIntent() {
|
||||
Intent fallBackIntent = new Intent().setClass(getActivity(),
|
||||
ChooseLockGeneric.InternalActivity.class);
|
||||
fallBackIntent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, true);
|
||||
fallBackIntent.putExtra(CONFIRM_CREDENTIALS, false);
|
||||
fallBackIntent.putExtra(EXTRA_SHOW_FRAGMENT_TITLE,
|
||||
R.string.backup_lock_settings_picker_title);
|
||||
|
||||
boolean showTutorial = ALWAY_SHOW_TUTORIAL ||
|
||||
!mChooseLockSettingsHelper.utils().isBiometricWeakEverChosen();
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.facelock", "com.android.facelock.SetupIntro");
|
||||
intent.putExtra("showTutorial", showTutorial);
|
||||
PendingIntent pending = PendingIntent.getActivity(getActivity(), 0, fallBackIntent, 0);
|
||||
intent.putExtra("PendingIntent", pending);
|
||||
return intent;
|
||||
}
|
||||
|
||||
protected Intent getLockPasswordIntent(Context context, int quality,
|
||||
final boolean isFallback, int minLength, final int maxLength,
|
||||
int minLength, final int maxLength,
|
||||
boolean requirePasswordToDecrypt, boolean confirmCredentials) {
|
||||
return ChooseLockPassword.createIntent(context, quality, isFallback, minLength,
|
||||
return ChooseLockPassword.createIntent(context, quality, minLength,
|
||||
maxLength, requirePasswordToDecrypt, confirmCredentials);
|
||||
}
|
||||
|
||||
protected Intent getLockPatternIntent(Context context, final boolean isFallback,
|
||||
final boolean requirePassword, final boolean confirmCredentials) {
|
||||
return ChooseLockPattern.createIntent(context, isFallback, requirePassword,
|
||||
protected Intent getLockPatternIntent(Context context, final boolean requirePassword,
|
||||
final boolean confirmCredentials) {
|
||||
return ChooseLockPattern.createIntent(context, requirePassword,
|
||||
confirmCredentials);
|
||||
}
|
||||
|
||||
@@ -444,10 +381,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
throw new IllegalStateException("Tried to update password without confirming it");
|
||||
}
|
||||
|
||||
final boolean isFallback = getActivity().getIntent()
|
||||
.getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
||||
|
||||
quality = upgradeQuality(quality, null);
|
||||
quality = upgradeQuality(quality);
|
||||
|
||||
final Context context = getActivity();
|
||||
if (quality >= DevicePolicyManager.PASSWORD_QUALITY_NUMERIC) {
|
||||
@@ -456,33 +390,19 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
minLength = MIN_PASSWORD_LENGTH;
|
||||
}
|
||||
final int maxLength = mDPM.getPasswordMaximumLength(quality);
|
||||
Intent intent = getLockPasswordIntent(context, quality, isFallback, minLength,
|
||||
Intent intent = getLockPasswordIntent(context, quality, minLength,
|
||||
maxLength, mRequirePassword, /* confirm credentials */false);
|
||||
if (isFallback) {
|
||||
startActivityForResult(intent, FALLBACK_REQUEST);
|
||||
return;
|
||||
} else {
|
||||
mFinishPending = true;
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
startActivity(intent);
|
||||
}
|
||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
||||
Intent intent = getLockPatternIntent(context, isFallback, mRequirePassword,
|
||||
/* confirm credentials */false);
|
||||
if (isFallback) {
|
||||
startActivityForResult(intent, FALLBACK_REQUEST);
|
||||
return;
|
||||
} else {
|
||||
mFinishPending = true;
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
startActivity(intent);
|
||||
}
|
||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK) {
|
||||
Intent intent = getBiometricSensorIntent();
|
||||
mFinishPending = true;
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
startActivity(intent);
|
||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
||||
Intent intent = getLockPatternIntent(context, mRequirePassword,
|
||||
/* confirm credentials */false);
|
||||
mFinishPending = true;
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
startActivity(intent);
|
||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||
mChooseLockSettingsHelper.utils().clearLock(false);
|
||||
mChooseLockSettingsHelper.utils().clearLock();
|
||||
mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled);
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
finish();
|
||||
@@ -526,9 +446,6 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
} else if (KEY_UNLOCK_SET_NONE.equals(unlockMethod)) {
|
||||
updateUnlockMethodAndFinish(
|
||||
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, false /* disabled */ );
|
||||
} else if (KEY_UNLOCK_SET_BIOMETRIC_WEAK.equals(unlockMethod)) {
|
||||
maybeEnableEncryption(
|
||||
DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK, false);
|
||||
} else if (KEY_UNLOCK_SET_PATTERN.equals(unlockMethod)) {
|
||||
maybeEnableEncryption(
|
||||
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, false);
|
||||
|
@@ -63,7 +63,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
public static Intent createIntent(Context context, int quality, final boolean isFallback,
|
||||
public static Intent createIntent(Context context, int quality,
|
||||
int minLength, final int maxLength, boolean requirePasswordToDecrypt,
|
||||
boolean confirmCredentials) {
|
||||
Intent intent = new Intent().setClass(context, ChooseLockPassword.class);
|
||||
@@ -71,7 +71,6 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
intent.putExtra(PASSWORD_MIN_KEY, minLength);
|
||||
intent.putExtra(PASSWORD_MAX_KEY, maxLength);
|
||||
intent.putExtra(ChooseLockGeneric.CONFIRM_CREDENTIALS, confirmCredentials);
|
||||
intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, isFallback);
|
||||
intent.putExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, requirePasswordToDecrypt);
|
||||
return intent;
|
||||
}
|
||||
@@ -431,14 +430,12 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
}
|
||||
} else if (mUiStage == Stage.NeedToConfirm) {
|
||||
if (mFirstPin.equals(pin)) {
|
||||
final boolean isFallback = getActivity().getIntent().getBooleanExtra(
|
||||
LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
||||
boolean wasSecureBefore = mLockPatternUtils.isSecure();
|
||||
mLockPatternUtils.clearLock(isFallback);
|
||||
mLockPatternUtils.clearLock();
|
||||
final boolean required = getActivity().getIntent().getBooleanExtra(
|
||||
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
|
||||
mLockPatternUtils.setCredentialRequiredToDecrypt(required);
|
||||
mLockPatternUtils.saveLockPassword(pin, mRequestedQuality, isFallback);
|
||||
mLockPatternUtils.saveLockPassword(pin, mRequestedQuality);
|
||||
getActivity().setResult(RESULT_FINISHED);
|
||||
getActivity().finish();
|
||||
mDone = true;
|
||||
|
@@ -69,12 +69,11 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
public static Intent createIntent(Context context, final boolean isFallback,
|
||||
public static Intent createIntent(Context context,
|
||||
boolean requirePassword, boolean confirmCredentials) {
|
||||
Intent intent = new Intent(context, ChooseLockPattern.class);
|
||||
intent.putExtra("key_lock_method", "pattern");
|
||||
intent.putExtra(ChooseLockGeneric.CONFIRM_CREDENTIALS, confirmCredentials);
|
||||
intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, isFallback);
|
||||
intent.putExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, requirePassword);
|
||||
return intent;
|
||||
}
|
||||
@@ -563,16 +562,13 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
LockPatternUtils utils = mChooseLockSettingsHelper.utils();
|
||||
final boolean lockVirgin = !utils.isPatternEverChosen();
|
||||
|
||||
final boolean isFallback = getActivity().getIntent()
|
||||
.getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
||||
|
||||
boolean wasSecureBefore = utils.isSecure();
|
||||
|
||||
final boolean required = getActivity().getIntent().getBooleanExtra(
|
||||
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
|
||||
utils.setCredentialRequiredToDecrypt(required);
|
||||
utils.setLockPatternEnabled(true);
|
||||
utils.saveLockPattern(mChosenPattern, isFallback);
|
||||
utils.saveLockPattern(mChosenPattern);
|
||||
|
||||
if (lockVirgin) {
|
||||
utils.setVisiblePatternEnabled(true);
|
||||
|
@@ -72,9 +72,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
|
||||
// Lock Settings
|
||||
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_SECURITY_CATEGORY = "security_category";
|
||||
@@ -85,8 +82,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
private static final String KEY_MANAGE_TRUST_AGENTS = "manage_trust_agents";
|
||||
|
||||
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
|
||||
private static final int CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_IMPROVE_REQUEST = 124;
|
||||
private static final int CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_LIVELINESS_OFF = 125;
|
||||
private static final int CHANGE_TRUST_AGENT_SETTINGS = 126;
|
||||
|
||||
// Misc Settings
|
||||
@@ -104,7 +99,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
|
||||
// These switch preferences need special handling since they're not all stored in Settings.
|
||||
private static final String SWITCH_PREFERENCE_KEYS[] = { KEY_LOCK_AFTER_TIMEOUT,
|
||||
KEY_LOCK_ENABLED, KEY_VISIBLE_PATTERN, KEY_BIOMETRIC_WEAK_LIVELINESS,
|
||||
KEY_LOCK_ENABLED, KEY_VISIBLE_PATTERN,
|
||||
KEY_POWER_INSTANTLY_LOCKS, KEY_SHOW_PASSWORD, KEY_TOGGLE_INSTALL_APPLICATIONS };
|
||||
|
||||
// Only allow one trust agent on the platform.
|
||||
@@ -117,7 +112,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
private ListPreference mLockAfter;
|
||||
|
||||
private SwitchPreference mBiometricWeakLiveliness;
|
||||
private SwitchPreference mVisiblePattern;
|
||||
|
||||
private SwitchPreference mShowPassword;
|
||||
@@ -165,9 +159,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
} else {
|
||||
resid = R.xml.security_settings_chooser;
|
||||
}
|
||||
} else if (lockPatternUtils.usingBiometricWeak() &&
|
||||
lockPatternUtils.isBiometricWeakInstalled()) {
|
||||
resid = R.xml.security_settings_biometric_weak;
|
||||
} else {
|
||||
switch (lockPatternUtils.getKeyguardStoredPasswordQuality()) {
|
||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||
@@ -265,10 +256,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
updateLockAfterPreferenceSummary();
|
||||
}
|
||||
|
||||
// biometric weak liveliness
|
||||
mBiometricWeakLiveliness =
|
||||
(SwitchPreference) root.findPreference(KEY_BIOMETRIC_WEAK_LIVELINESS);
|
||||
|
||||
// visible pattern
|
||||
mVisiblePattern = (SwitchPreference) root.findPreference(KEY_VISIBLE_PATTERN);
|
||||
|
||||
@@ -284,15 +271,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
trustAgentPreference.getTitle()));
|
||||
}
|
||||
|
||||
// don't display visible pattern if biometric and backup is not pattern
|
||||
if (resid == R.xml.security_settings_biometric_weak &&
|
||||
mLockPatternUtils.getKeyguardStoredPasswordQuality() !=
|
||||
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
||||
if (securityCategory != null && mVisiblePattern != null) {
|
||||
securityCategory.removePreference(root.findPreference(KEY_VISIBLE_PATTERN));
|
||||
}
|
||||
}
|
||||
|
||||
// Append the rest of the settings
|
||||
addPreferencesFromResource(R.xml.security_settings_misc);
|
||||
|
||||
@@ -562,10 +540,6 @@ 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());
|
||||
}
|
||||
@@ -589,17 +563,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
|
||||
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
|
||||
R.string.lock_settings_picker_title, SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
|
||||
} else if (KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING.equals(key)) {
|
||||
ChooseLockSettingsHelper helper =
|
||||
new ChooseLockSettingsHelper(this.getActivity(), this);
|
||||
if (!helper.launchConfirmationActivity(
|
||||
CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_IMPROVE_REQUEST, null, null)) {
|
||||
// If this returns false, it means no password confirmation is required, so
|
||||
// go ahead and start improve.
|
||||
// Note: currently a backup is required for biometric_weak so this code path
|
||||
// can't be reached, but is here in case things change in the future
|
||||
startBiometricWeakImprove();
|
||||
}
|
||||
} else if (KEY_TRUST_AGENT.equals(key)) {
|
||||
ChooseLockSettingsHelper helper =
|
||||
new ChooseLockSettingsHelper(this.getActivity(), this);
|
||||
@@ -623,19 +586,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_IMPROVE_REQUEST &&
|
||||
resultCode == Activity.RESULT_OK) {
|
||||
startBiometricWeakImprove();
|
||||
return;
|
||||
} else if (requestCode == CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_LIVELINESS_OFF &&
|
||||
resultCode == Activity.RESULT_OK) {
|
||||
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
|
||||
lockPatternUtils.setBiometricWeakLivelinessEnabled(false);
|
||||
// Setting the mBiometricWeakLiveliness checked value to false is handled when onResume
|
||||
// is called by grabbing the value from lockPatternUtils. We can't set it here
|
||||
// because mBiometricWeakLiveliness could be null
|
||||
return;
|
||||
} else if (requestCode == CHANGE_TRUST_AGENT_SETTINGS && resultCode == Activity.RESULT_OK) {
|
||||
if (requestCode == CHANGE_TRUST_AGENT_SETTINGS && resultCode == Activity.RESULT_OK) {
|
||||
if (mTrustAgentClickIntent != null) {
|
||||
startActivity(mTrustAgentClickIntent);
|
||||
mTrustAgentClickIntent = null;
|
||||
@@ -663,26 +614,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
lockPatternUtils.setLockPatternEnabled((Boolean) value);
|
||||
} else if (KEY_VISIBLE_PATTERN.equals(key)) {
|
||||
lockPatternUtils.setVisiblePatternEnabled((Boolean) value);
|
||||
} else if (KEY_BIOMETRIC_WEAK_LIVELINESS.equals(key)) {
|
||||
if ((Boolean) value) {
|
||||
lockPatternUtils.setBiometricWeakLivelinessEnabled(true);
|
||||
} else {
|
||||
// In this case the user has just unchecked the checkbox, but this action requires
|
||||
// them to confirm their password. We need to re-check the checkbox until
|
||||
// they've confirmed their password
|
||||
mBiometricWeakLiveliness.setChecked(true);
|
||||
ChooseLockSettingsHelper helper =
|
||||
new ChooseLockSettingsHelper(this.getActivity(), this);
|
||||
if (!helper.launchConfirmationActivity(
|
||||
CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_LIVELINESS_OFF, null, null)) {
|
||||
// If this returns false, it means no password confirmation is required, so
|
||||
// go ahead and uncheck it here.
|
||||
// Note: currently a backup is required for biometric_weak so this code path
|
||||
// can't be reached, but is here in case things change in the future
|
||||
lockPatternUtils.setBiometricWeakLivelinessEnabled(false);
|
||||
mBiometricWeakLiveliness.setChecked(false);
|
||||
}
|
||||
}
|
||||
} else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) {
|
||||
mLockPatternUtils.setPowerButtonInstantlyLocks((Boolean) value);
|
||||
} else if (KEY_SHOW_PASSWORD.equals(key)) {
|
||||
@@ -706,12 +637,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
return R.string.help_url_security;
|
||||
}
|
||||
|
||||
public void startBiometricWeakImprove(){
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.facelock", "com.android.facelock.AddToSetup");
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* For Search. Please keep it in sync when updating "createPreferenceHierarchy()"
|
||||
*/
|
||||
@@ -832,13 +757,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
// Add options for lock/unlock screen
|
||||
int resId = getResIdForLockUnlockScreen(context, lockPatternUtils);
|
||||
|
||||
// don't display visible pattern if biometric and backup is not pattern
|
||||
if (resId == R.xml.security_settings_biometric_weak &&
|
||||
lockPatternUtils.getKeyguardStoredPasswordQuality() !=
|
||||
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
||||
keys.add(KEY_VISIBLE_PATTERN);
|
||||
}
|
||||
|
||||
// Do not display SIM lock for devices without an Icc card
|
||||
TelephonyManager tm = TelephonyManager.getDefault();
|
||||
if (!mIsPrimary || !tm.hasIccCard()) {
|
||||
|
@@ -99,11 +99,9 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric
|
||||
* screen lock options here.
|
||||
*
|
||||
* @param quality the requested quality.
|
||||
* @param allowBiometric whether to allow biometic screen lock
|
||||
*/
|
||||
@Override
|
||||
protected void disableUnusablePreferences(final int quality,
|
||||
MutableBoolean allowBiometric) {
|
||||
protected void disableUnusablePreferences(final int quality) {
|
||||
// At this part of the flow, the user has already indicated they want to add a pin,
|
||||
// pattern or password, so don't show "None" or "Slide". We disable them here and set
|
||||
// the HIDE_DISABLED flag to true to hide them. This only happens for setup wizard.
|
||||
@@ -111,24 +109,23 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric
|
||||
// installed with a policy we need to honor.
|
||||
final int newQuality = Math.max(quality,
|
||||
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
|
||||
super.disableUnusablePreferencesImpl(newQuality, allowBiometric,
|
||||
true /* hideDisabled */);
|
||||
super.disableUnusablePreferencesImpl(newQuality, true /* hideDisabled */);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getLockPasswordIntent(Context context, int quality, boolean isFallback,
|
||||
protected Intent getLockPasswordIntent(Context context, int quality,
|
||||
int minLength, int maxLength, boolean requirePasswordToDecrypt,
|
||||
boolean confirmCredentials) {
|
||||
final Intent intent = SetupChooseLockPassword.createIntent(context, quality,
|
||||
isFallback, minLength, maxLength, requirePasswordToDecrypt, confirmCredentials);
|
||||
minLength, maxLength, requirePasswordToDecrypt, confirmCredentials);
|
||||
SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getLockPatternIntent(Context context, boolean isFallback,
|
||||
protected Intent getLockPatternIntent(Context context,
|
||||
boolean requirePassword, boolean confirmCredentials) {
|
||||
final Intent intent = SetupChooseLockPattern.createIntent(context, isFallback,
|
||||
final Intent intent = SetupChooseLockPattern.createIntent(context,
|
||||
requirePassword, confirmCredentials);
|
||||
SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
|
||||
return intent;
|
||||
|
@@ -38,10 +38,10 @@ import android.view.WindowInsets;
|
||||
public class SetupChooseLockPassword extends ChooseLockPassword
|
||||
implements SetupWizardNavBar.NavigationBarListener {
|
||||
|
||||
public static Intent createIntent(Context context, int quality, final boolean isFallback,
|
||||
public static Intent createIntent(Context context, int quality,
|
||||
int minLength, final int maxLength, boolean requirePasswordToDecrypt,
|
||||
boolean confirmCredentials) {
|
||||
Intent intent = ChooseLockPassword.createIntent(context, quality, isFallback, minLength,
|
||||
Intent intent = ChooseLockPassword.createIntent(context, quality, minLength,
|
||||
maxLength, requirePasswordToDecrypt, confirmCredentials);
|
||||
intent.setClass(context, SetupChooseLockPassword.class);
|
||||
intent.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, false);
|
||||
|
@@ -38,9 +38,9 @@ import android.widget.Button;
|
||||
public class SetupChooseLockPattern extends ChooseLockPattern
|
||||
implements SetupWizardNavBar.NavigationBarListener {
|
||||
|
||||
public static Intent createIntent(Context context, final boolean isFallback,
|
||||
public static Intent createIntent(Context context,
|
||||
boolean requirePassword, boolean confirmCredentials) {
|
||||
Intent intent = ChooseLockPattern.createIntent(context, isFallback, requirePassword,
|
||||
Intent intent = ChooseLockPattern.createIntent(context, requirePassword,
|
||||
confirmCredentials);
|
||||
intent.setClass(context, SetupChooseLockPattern.class);
|
||||
return intent;
|
||||
|
Reference in New Issue
Block a user