DO NOT MERGE Refactor passwords/pins/patterns to byte[]
Relating to packages/apps/Settings
Bug: 120484642
Test: manual - test setting and unlocking passwords/pins/patterns.
automated - atest packages/apps/Settings/tests/robotests/src/com/android/settings/password/
Change-Id: Idec8338d141c185bef67ade12035fdb2fa9d17ea
(cherry picked from commit b27c4308a2)
This commit is contained in:
@@ -172,7 +172,7 @@ public class CryptKeeperSettings extends InstrumentedPreferenceFragment {
|
||||
|
||||
if (helper.utils().getKeyguardStoredPasswordQuality(UserHandle.myUserId())
|
||||
== DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||
showFinalConfirmation(StorageManager.CRYPT_TYPE_DEFAULT, "");
|
||||
showFinalConfirmation(StorageManager.CRYPT_TYPE_DEFAULT, "".getBytes());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -192,14 +192,14 @@ public class CryptKeeperSettings extends InstrumentedPreferenceFragment {
|
||||
// confirmation prompt; otherwise, go back to the initial state.
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
int type = data.getIntExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE, -1);
|
||||
String password = data.getStringExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
|
||||
if (!TextUtils.isEmpty(password)) {
|
||||
byte[] password = data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
|
||||
if (!(password == null || password.length == 0)) {
|
||||
showFinalConfirmation(type, password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showFinalConfirmation(int type, String password) {
|
||||
private void showFinalConfirmation(int type, byte[] password) {
|
||||
Preference preference = new Preference(getPreferenceManager().getContext());
|
||||
preference.setFragment(CryptKeeperConfirm.class.getName());
|
||||
preference.setTitle(R.string.crypt_keeper_confirm_title);
|
||||
@@ -207,16 +207,16 @@ public class CryptKeeperSettings extends InstrumentedPreferenceFragment {
|
||||
((SettingsActivity) getActivity()).onPreferenceStartFragment(null, preference);
|
||||
}
|
||||
|
||||
private void addEncryptionInfoToPreference(Preference preference, int type, String password) {
|
||||
private void addEncryptionInfoToPreference(Preference preference, int type, byte[] password) {
|
||||
Activity activity = getActivity();
|
||||
DevicePolicyManager dpm = (DevicePolicyManager)
|
||||
activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
if (dpm.getDoNotAskCredentialsOnBoot()) {
|
||||
preference.getExtras().putInt(TYPE, StorageManager.CRYPT_TYPE_DEFAULT);
|
||||
preference.getExtras().putString(PASSWORD, "");
|
||||
preference.getExtras().putByteArray(PASSWORD, "".getBytes());
|
||||
} else {
|
||||
preference.getExtras().putInt(TYPE, type);
|
||||
preference.getExtras().putString(PASSWORD, password);
|
||||
preference.getExtras().putByteArray(PASSWORD, password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user