2/n: Add setRequestGatekeeperPassword to ChooseLockSettingsHelper
This change adds the plumbing on Settings side for ConfirmLock*. ChooseLock* will be done in a follow-up CL. The changes in this CL are not invoked by any code path yet. This will also be integrated in a follow-up CL. Bug: 161765592 Perform the following with a local change to use ChooseLockSettingsHelper#setRequestGatekeeperPassword(true) Test: GK PW is received when setRequestGatekeeperPassword(true) Test: GK PW + Challenge sent to GK, GK verifies and caller receives GK HAT successfully Change-Id: Ibd809784b5599343f34836bc5f3e709627b7f22a
This commit is contained in:
@@ -77,6 +77,7 @@ import com.android.internal.widget.LockPatternUtils.RequestThrottledException;
|
||||
import com.android.internal.widget.LockscreenCredential;
|
||||
import com.android.internal.widget.PasswordValidationError;
|
||||
import com.android.internal.widget.TextViewInputDisabler;
|
||||
import com.android.internal.widget.VerifyCredentialResponse;
|
||||
import com.android.settings.EncryptionInterstitial;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
@@ -967,19 +968,24 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
}
|
||||
Intent result = null;
|
||||
if (success && mHasChallenge) {
|
||||
byte[] token;
|
||||
VerifyCredentialResponse response;
|
||||
try {
|
||||
token = mUtils.verifyCredential(mChosenPassword, mChallenge, mUserId);
|
||||
response = mUtils.verifyCredential(mChosenPassword, mChallenge, mUserId,
|
||||
0 /* flags */);
|
||||
} catch (RequestThrottledException e) {
|
||||
token = null;
|
||||
response = null;
|
||||
}
|
||||
|
||||
if (token == null) {
|
||||
Log.e(TAG, "critical: no token returned for known good password.");
|
||||
if (response == null) {
|
||||
Log.e(TAG, "critical: null response for known good password");
|
||||
} else if (!response.isMatched() || response.getGatekeeperHAT() == null) {
|
||||
Log.e(TAG, "critical: bad response or missing GK HAT for known good password: "
|
||||
+ response.toString());
|
||||
}
|
||||
|
||||
result = new Intent();
|
||||
result.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
||||
result.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN,
|
||||
response.getGatekeeperHAT());
|
||||
}
|
||||
return Pair.create(success, result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user