pipe auth token through confirm and set password

ConfirmDeviceCredentialsActivity and ChooseLockGeneric now understand
CLSH.EXTRA_KEY_HAS_CHALLENGE and CLSH.EXTRA_KEY_CHALLENGE in their
launching intents. If present, they return a hw_auth_token_t verifying
the challenge passed in as a field in keyed by
CLSH.EXTRA_KEY_CHALLENGE_TOKEN in their result intents.

Change-Id: I0b4e02b6a798a9e57d02522880a180dffadfcde1
This commit is contained in:
Andres Morales
2015-04-12 15:38:25 -07:00
parent c1235be6f0
commit 6609b0c22a
7 changed files with 188 additions and 18 deletions

View File

@@ -89,6 +89,8 @@ public class ChooseLockGeneric extends SettingsActivity {
private ChooseLockSettingsHelper mChooseLockSettingsHelper;
private DevicePolicyManager mDPM;
private KeyStore mKeyStore;
private boolean mHasChallenge = false;
private long mChallenge;
private boolean mPasswordConfirmed = false;
private boolean mWaitingForConfirmation = false;
private int mEncryptionRequestQuality;
@@ -133,6 +135,11 @@ public class ChooseLockGeneric extends SettingsActivity {
mPasswordConfirmed = !confirmCredentials;
}
mHasChallenge = getActivity().getIntent().getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false);
mChallenge = getActivity().getIntent().getLongExtra(
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0);
if (savedInstanceState != null) {
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
mWaitingForConfirmation = savedInstanceState.getBoolean(WAITING_FOR_CONFIRMATION);
@@ -389,8 +396,13 @@ public class ChooseLockGeneric extends SettingsActivity {
maxLength, requirePasswordToDecrypt, confirmCredentials);
}
// SetupWizard version will not need this as they will never be changing a password
// TODO: confirm
protected Intent getLockPasswordIntent(Context context, int quality,
int minLength, final int maxLength,
boolean requirePasswordToDecrypt, long challenge) {
return ChooseLockPassword.createIntent(context, quality, minLength,
maxLength, requirePasswordToDecrypt, challenge);
}
private Intent getLockPasswordIntent(Context context, int quality, int minLength,
final int maxLength, boolean requirePasswordToDecrypt, String password) {
return ChooseLockPassword.createIntent(context, quality, minLength, maxLength,
@@ -403,8 +415,11 @@ public class ChooseLockGeneric extends SettingsActivity {
confirmCredentials);
}
// SetupWizard version will not need this as they will never be changing a password
// TODO: confirm
protected Intent getLockPatternIntent(Context context, final boolean requirePassword,
long challenge) {
return ChooseLockPattern.createIntent(context, requirePassword, challenge);
}
private Intent getLockPatternIntent(Context context, final boolean requirePassword,
final String pattern) {
return ChooseLockPattern.createIntent(context, requirePassword, pattern);
@@ -439,12 +454,24 @@ public class ChooseLockGeneric extends SettingsActivity {
minLength = MIN_PASSWORD_LENGTH;
}
final int maxLength = mDPM.getPasswordMaximumLength(quality);
Intent intent = getLockPasswordIntent(context, quality, minLength,
Intent intent;
if (mHasChallenge) {
intent = getLockPasswordIntent(context, quality, minLength,
maxLength, mRequirePassword, mChallenge);
} else {
intent = getLockPasswordIntent(context, quality, minLength,
maxLength, mRequirePassword, mUserPassword);
}
startActivityForResult(intent, CHOOSE_LOCK_REQUEST);
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
Intent intent = getLockPatternIntent(context, mRequirePassword,
Intent intent;
if (mHasChallenge) {
intent = getLockPatternIntent(context, mRequirePassword,
mChallenge);
} else {
intent = getLockPatternIntent(context, mRequirePassword,
mUserPassword);
}
startActivityForResult(intent, CHOOSE_LOCK_REQUEST);
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
mChooseLockSettingsHelper.utils().clearLock();