Merge "Update settings together with frameworks/base"

This commit is contained in:
Kevin Chyn
2020-08-19 22:33:04 +00:00
committed by Android (Google) Code Review
20 changed files with 130 additions and 101 deletions

View File

@@ -104,13 +104,13 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); .getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
final int userId = getIntent() final int userId = getIntent()
.getIntExtra(Intent.EXTRA_USER_ID, UserHandle.USER_NULL); .getIntExtra(Intent.EXTRA_USER_ID, UserHandle.USER_NULL);
final byte[] gkPw = getIntent().getByteArrayExtra( final long gkPwHandle = getIntent().getLongExtra(
ChooseLockSettingsHelper.EXTRA_KEY_GK_PW); ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
intent.putExtra(Intent.EXTRA_USER_ID, userId); intent.putExtra(Intent.EXTRA_USER_ID, userId);
if (gkPw != null) { if (gkPwHandle != 0L) {
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW, gkPw); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, gkPwHandle);
} }
} }

View File

@@ -190,7 +190,7 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
final ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(this); final ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(this);
builder.setRequestCode(CONFIRM_REQUEST) builder.setRequestCode(CONFIRM_REQUEST)
.setTitle(getString(titleResId)) .setTitle(getString(titleResId))
.setRequestGatekeeperPassword(true) .setRequestGatekeeperPasswordHandle(true)
.setForegroundOnly(true) .setForegroundOnly(true)
.setReturnCredentials(true); .setReturnCredentials(true);

View File

@@ -224,7 +224,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY, intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY,
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true); intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, true); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, true);
intent.putExtra(getExtraKeyForBiometric(), true); intent.putExtra(getExtraKeyForBiometric(), true);
if (mUserId != UserHandle.USER_NULL) { if (mUserId != UserHandle.USER_NULL) {
intent.putExtra(Intent.EXTRA_USER_ID, mUserId); intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
@@ -278,6 +278,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
getNextButton().setEnabled(false); getNextButton().setEnabled(false);
getChallenge(((sensorId, challenge) -> { getChallenge(((sensorId, challenge) -> {
mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge); mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge);
BiometricUtils.removeGatekeeperPasswordHandle(this, data);
getNextButton().setEnabled(true); getNextButton().setEnabled(true);
})); }));
} else { } else {
@@ -291,6 +292,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
getNextButton().setEnabled(false); getNextButton().setEnabled(false);
getChallenge(((sensorId, challenge) -> { getChallenge(((sensorId, challenge) -> {
mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge); mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge);
BiometricUtils.removeGatekeeperPasswordHandle(this, data);
getNextButton().setEnabled(true); getNextButton().setEnabled(true);
})); }));
} else { } else {

View File

@@ -16,7 +16,6 @@
package com.android.settings.biometrics; package com.android.settings.biometrics;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@@ -39,20 +38,42 @@ public class BiometricUtils {
*/ */
public static byte[] requestGatekeeperHat(Context context, Intent result, int userId, public static byte[] requestGatekeeperHat(Context context, Intent result, int userId,
long challenge) { long challenge) {
final byte[] gkPassword = result.getByteArrayExtra( final long gatekeeperPasswordHandle = result.getLongExtra(
ChooseLockSettingsHelper.EXTRA_KEY_GK_PW); ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L);
if (gkPassword == null) { if (gatekeeperPasswordHandle == 0L) {
throw new IllegalStateException("Gatekeeper Password is null!!"); throw new IllegalStateException("Gatekeeper Password is missing!!");
} }
final LockPatternUtils utils = new LockPatternUtils(context); final LockPatternUtils utils = new LockPatternUtils(context);
return utils.verifyGatekeeperPassword(gkPassword, challenge, userId).getGatekeeperHAT(); return utils.verifyGatekeeperPasswordHandle(gatekeeperPasswordHandle, challenge, userId)
.getGatekeeperHAT();
} }
public static boolean containsGatekeeperPassword(Intent data) { public static boolean containsGatekeeperPassword(Intent data) {
if (data == null) { if (data == null) {
return false; return false;
} }
return data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW) != null; return data.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L) != 0L;
}
/**
* Requests {@link com.android.server.locksettings.LockSettingsService} to remove the
* gatekeeper password associated with a previous
* {@link ChooseLockSettingsHelper.Builder#setRequestGatekeeperPasswordHandle(boolean)}
*
* @param context Caller's context
* @param data The onActivityResult intent from ChooseLock* or ConfirmLock*
*/
public static void removeGatekeeperPasswordHandle(Context context, Intent data) {
if (data == null) {
return;
}
final long gatekeeperPasswordsHandle = data.getLongExtra(
ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L);
if (gatekeeperPasswordsHandle == 0L) {
return;
}
final LockPatternUtils utils = new LockPatternUtils(context);
utils.removeGatekeeperPasswordHandle(gatekeeperPasswordsHandle);
} }
} }

View File

@@ -105,6 +105,7 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
// the challenge is ready. Let's just do this for now. // the challenge is ready. Let's just do this for now.
mFaceManager.generateChallenge((sensorId, challenge) -> { mFaceManager.generateChallenge((sensorId, challenge) -> {
mToken = BiometricUtils.requestGatekeeperHat(this, getIntent(), mUserId, challenge); mToken = BiometricUtils.requestGatekeeperHat(this, getIntent(), mUserId, challenge);
BiometricUtils.removeGatekeeperPasswordHandle(this, getIntent());
mFooterBarMixin.getPrimaryButton().setEnabled(true); mFooterBarMixin.getPrimaryButton().setEnabled(true);
}); });
} }

View File

@@ -207,7 +207,7 @@ public class FaceSettings extends DashboardFragment {
new ChooseLockSettingsHelper.Builder(getActivity(), this); new ChooseLockSettingsHelper.Builder(getActivity(), this);
final boolean launched = builder.setRequestCode(CONFIRM_REQUEST) final boolean launched = builder.setRequestCode(CONFIRM_REQUEST)
.setTitle(getString(R.string.security_settings_face_preference_title)) .setTitle(getString(R.string.security_settings_face_preference_title))
.setRequestGatekeeperPassword(true) .setRequestGatekeeperPasswordHandle(true)
.setUserId(mUserId) .setUserId(mUserId)
.setForegroundOnly(true) .setForegroundOnly(true)
.setReturnCredentials(true) .setReturnCredentials(true)
@@ -247,6 +247,7 @@ public class FaceSettings extends DashboardFragment {
mFaceManager.generateChallenge((sensorId, challenge) -> { mFaceManager.generateChallenge((sensorId, challenge) -> {
mToken = BiometricUtils.requestGatekeeperHat(getPrefContext(), data, mUserId, mToken = BiometricUtils.requestGatekeeperHat(getPrefContext(), data, mUserId,
challenge); challenge);
BiometricUtils.removeGatekeeperPasswordHandle(getPrefContext(), data);
mAttentionController.setToken(mToken); mAttentionController.setToken(mToken);
mEnrollController.setToken(mToken); mEnrollController.setToken(mToken);
mConfirmingPassword = false; mConfirmingPassword = false;

View File

@@ -67,6 +67,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase {
final FingerprintManager fpm = getSystemService(FingerprintManager.class); final FingerprintManager fpm = getSystemService(FingerprintManager.class);
fpm.generateChallenge((sensorId, challenge) -> { fpm.generateChallenge((sensorId, challenge) -> {
mToken = BiometricUtils.requestGatekeeperHat(this, getIntent(), mUserId, challenge); mToken = BiometricUtils.requestGatekeeperHat(this, getIntent(), mUserId, challenge);
BiometricUtils.removeGatekeeperPasswordHandle(this, getIntent());
// Put this into the intent. This is really just to work around the fact that the // Put this into the intent. This is really just to work around the fact that the
// enrollment sidecar gets the HAT from the activity's intent, rather than having // enrollment sidecar gets the HAT from the activity's intent, rather than having

View File

@@ -574,6 +574,7 @@ public class FingerprintSettings extends SubSettings {
mFingerprintManager.generateChallenge((sensorId, challenge) -> { mFingerprintManager.generateChallenge((sensorId, challenge) -> {
mToken = BiometricUtils.requestGatekeeperHat(getActivity(), data, mToken = BiometricUtils.requestGatekeeperHat(getActivity(), data,
mUserId, challenge); mUserId, challenge);
BiometricUtils.removeGatekeeperPasswordHandle(getActivity(), data);
updateAddPreference(); updateAddPreference();
}); });
} else { } else {
@@ -643,7 +644,7 @@ public class FingerprintSettings extends SubSettings {
new ChooseLockSettingsHelper.Builder(getActivity(), this); new ChooseLockSettingsHelper.Builder(getActivity(), this);
final boolean launched = builder.setRequestCode(CONFIRM_REQUEST) final boolean launched = builder.setRequestCode(CONFIRM_REQUEST)
.setTitle(getString(R.string.security_settings_fingerprint_preference_title)) .setTitle(getString(R.string.security_settings_fingerprint_preference_title))
.setRequestGatekeeperPassword(true) .setRequestGatekeeperPasswordHandle(true)
.setUserId(mUserId) .setUserId(mUserId)
.setForegroundOnly(true) .setForegroundOnly(true)
.setReturnCredentials(true) .setReturnCredentials(true)
@@ -658,7 +659,7 @@ public class FingerprintSettings extends SubSettings {
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS,
true); true);
intent.putExtra(Intent.EXTRA_USER_ID, mUserId); intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, true); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, true);
intent.putExtra(Intent.EXTRA_USER_ID, mUserId); intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
startActivityForResult(intent, CHOOSE_LOCK_GENERIC_REQUEST); startActivityForResult(intent, CHOOSE_LOCK_GENERIC_REQUEST);
} }

View File

@@ -144,7 +144,7 @@ public class ChooseLockGeneric extends SettingsActivity {
private LockPatternUtils mLockPatternUtils; private LockPatternUtils mLockPatternUtils;
private DevicePolicyManager mDpm; private DevicePolicyManager mDpm;
private boolean mRequestGatekeeperPassword = false; private boolean mRequestGatekeeperPasswordHandle = false;
private boolean mPasswordConfirmed = false; private boolean mPasswordConfirmed = false;
private boolean mWaitingForConfirmation = false; private boolean mWaitingForConfirmation = false;
private boolean mForChangeCredRequiredForBoot = false; private boolean mForChangeCredRequiredForBoot = false;
@@ -210,8 +210,8 @@ public class ChooseLockGeneric extends SettingsActivity {
ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD); ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
} }
mRequestGatekeeperPassword = intent.getBooleanExtra( mRequestGatekeeperPasswordHandle = intent.getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false); ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, false);
mForFingerprint = intent.getBooleanExtra( mForFingerprint = intent.getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false); ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
mForFace = intent.getBooleanExtra( mForFace = intent.getBooleanExtra(
@@ -388,7 +388,7 @@ public class ChooseLockGeneric extends SettingsActivity {
// Gatekeeper Password should not imply it came from biometric setup/settings. // Gatekeeper Password should not imply it came from biometric setup/settings.
startActivityForResult( startActivityForResult(
intent, intent,
mIsSetNewPassword && mRequestGatekeeperPassword mIsSetNewPassword && mRequestGatekeeperPasswordHandle
? CHOOSE_LOCK_BEFORE_BIOMETRIC_REQUEST ? CHOOSE_LOCK_BEFORE_BIOMETRIC_REQUEST
: ENABLE_ENCRYPTION_REQUEST); : ENABLE_ENCRYPTION_REQUEST);
} else { } else {
@@ -438,10 +438,11 @@ public class ChooseLockGeneric extends SettingsActivity {
&& resultCode == BiometricEnrollBase.RESULT_FINISHED) { && resultCode == BiometricEnrollBase.RESULT_FINISHED) {
Intent intent = getBiometricEnrollIntent(getActivity()); Intent intent = getBiometricEnrollIntent(getActivity());
if (data != null) { if (data != null) {
// ChooseLockGeneric should have requested that the Gatekeeper Password be // ChooseLockGeneric should have requested for a Gatekeeper Password Handle to
// returned, so that biometric enrollment(s) can subsequently request Gatekeeper // be returned, so that biometric enrollment(s) can subsequently request
// to create HardwareAuthToken(s) wrapping biometric-specific challenges. Send // Gatekeeper to create HardwareAuthToken(s) wrapping biometric-specific
// the extras (including the GK Password) to the enrollment activity. // challenges. Send the extras (including the GK Password) to the enrollment
// activity.
intent.putExtras(data.getExtras()); intent.putExtras(data.getExtras());
} }
// Forward the target user id to fingerprint setup page. // Forward the target user id to fingerprint setup page.
@@ -727,7 +728,7 @@ public class ChooseLockGeneric extends SettingsActivity {
.setForFingerprint(mForFingerprint) .setForFingerprint(mForFingerprint)
.setForFace(mForFace) .setForFace(mForFace)
.setUserId(mUserId) .setUserId(mUserId)
.setRequestGatekeeperPassword(mRequestGatekeeperPassword); .setRequestGatekeeperPasswordHandle(mRequestGatekeeperPasswordHandle);
if (mUserPassword != null) { if (mUserPassword != null) {
builder.setPassword(mUserPassword); builder.setPassword(mUserPassword);
} }
@@ -743,7 +744,7 @@ public class ChooseLockGeneric extends SettingsActivity {
.setForFingerprint(mForFingerprint) .setForFingerprint(mForFingerprint)
.setForFace(mForFace) .setForFace(mForFace)
.setUserId(mUserId) .setUserId(mUserId)
.setRequestGatekeeperPassword(mRequestGatekeeperPassword); .setRequestGatekeeperPasswordHandle(mRequestGatekeeperPasswordHandle);
if (mUserPassword != null) { if (mUserPassword != null) {
builder.setPattern(mUserPassword); builder.setPattern(mUserPassword);
} }
@@ -784,13 +785,13 @@ public class ChooseLockGeneric extends SettingsActivity {
intent.putExtra(EXTRA_SHOW_OPTIONS_BUTTON, chooseLockSkipped); intent.putExtra(EXTRA_SHOW_OPTIONS_BUTTON, chooseLockSkipped);
} }
intent.putExtra(EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS, getIntent().getExtras()); intent.putExtra(EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS, getIntent().getExtras());
// If the caller requested Gatekeeper Password to be returned, we assume it came // If the caller requested Gatekeeper Password Handle to be returned, we assume it
// from biometric enrollment. onActivityResult will put the LockSettingsService // came from biometric enrollment. onActivityResult will put the LockSettingsService
// into the extras and launch biometric enrollment. This should be cleaned up, // into the extras and launch biometric enrollment. This should be cleaned up,
// since requesting Gatekeeper Password should not imply it came from biometric // since requesting a Gatekeeper Password Handle should not imply it came from
// setup/settings. // biometric setup/settings.
startActivityForResult(intent, startActivityForResult(intent,
mIsSetNewPassword && mRequestGatekeeperPassword mIsSetNewPassword && mRequestGatekeeperPasswordHandle
? CHOOSE_LOCK_BEFORE_BIOMETRIC_REQUEST ? CHOOSE_LOCK_BEFORE_BIOMETRIC_REQUEST
: CHOOSE_LOCK_REQUEST); : CHOOSE_LOCK_REQUEST);
return; return;

View File

@@ -73,7 +73,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternUtils.RequestThrottledException;
import com.android.internal.widget.LockscreenCredential; import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.PasswordValidationError; import com.android.internal.widget.PasswordValidationError;
import com.android.internal.widget.TextViewInputDisabler; import com.android.internal.widget.TextViewInputDisabler;
@@ -130,9 +129,10 @@ public class ChooseLockPassword extends SettingsActivity {
return this; return this;
} }
public IntentBuilder setRequestGatekeeperPassword(boolean requestGatekeeperPassword) { public IntentBuilder setRequestGatekeeperPasswordHandle(
mIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, boolean requestGatekeeperPasswordHandle) {
requestGatekeeperPassword); mIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE,
requestGatekeeperPasswordHandle);
return this; return this;
} }
@@ -492,7 +492,7 @@ public class ChooseLockPassword extends SettingsActivity {
mCurrentCredential = intent.getParcelableExtra( mCurrentCredential = intent.getParcelableExtra(
ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD); ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
mRequestGatekeeperPassword = intent.getBooleanExtra( mRequestGatekeeperPassword = intent.getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false); ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, false);
if (savedInstanceState == null) { if (savedInstanceState == null) {
updateStage(Stage.Introduction); updateStage(Stage.Introduction);
if (confirmCredentials) { if (confirmCredentials) {
@@ -501,7 +501,7 @@ public class ChooseLockPassword extends SettingsActivity {
builder.setRequestCode(CONFIRM_EXISTING_REQUEST) builder.setRequestCode(CONFIRM_EXISTING_REQUEST)
.setTitle(getString(R.string.unlock_set_unlock_launch_picker_title)) .setTitle(getString(R.string.unlock_set_unlock_launch_picker_title))
.setReturnCredentials(true) .setReturnCredentials(true)
.setRequestGatekeeperPassword(mRequestGatekeeperPassword) .setRequestGatekeeperPasswordHandle(mRequestGatekeeperPassword)
.setUserId(mUserId) .setUserId(mUserId)
.show(); .show();
} }
@@ -970,16 +970,16 @@ public class ChooseLockPassword extends SettingsActivity {
// path to return a Gatekeeper Password based on the credential that the user // path to return a Gatekeeper Password based on the credential that the user
// chose. This should only be run if the credential was successfully set. // chose. This should only be run if the credential was successfully set.
final VerifyCredentialResponse response = mUtils.verifyCredential(mChosenPassword, final VerifyCredentialResponse response = mUtils.verifyCredential(mChosenPassword,
mUserId, LockPatternUtils.VERIFY_FLAG_RETURN_GK_PW); mUserId, LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE);
if (!response.isMatched() || response.getGatekeeperPw() == null) { if (!response.isMatched() || !response.containsGatekeeperPasswordHandle()) {
Log.e(TAG, "critical: bad response or missing GK PW for known good password: " Log.e(TAG, "critical: bad response or missing GK PW handle for known good"
+ response.toString()); + " password: " + response.toString());
} }
result = new Intent(); result = new Intent();
result.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW, result.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE,
response.getGatekeeperPw()); response.getGatekeeperPasswordHandle());
} }
return Pair.create(success, result); return Pair.create(success, result);
} }

View File

@@ -112,9 +112,10 @@ public class ChooseLockPattern extends SettingsActivity {
return this; return this;
} }
public IntentBuilder setRequestGatekeeperPassword(boolean requestGatekeeperPassword) { public IntentBuilder setRequestGatekeeperPasswordHandle(
mIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, boolean requestGatekeeperPasswordHandle) {
requestGatekeeperPassword); mIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE,
requestGatekeeperPasswordHandle);
return this; return this;
} }
@@ -562,7 +563,7 @@ public class ChooseLockPattern extends SettingsActivity {
mCurrentCredential = mCurrentCredential =
intent.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD); intent.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
mRequestGatekeeperPassword = intent.getBooleanExtra( mRequestGatekeeperPassword = intent.getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false); ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, false);
if (savedInstanceState == null) { if (savedInstanceState == null) {
if (confirmCredentials) { if (confirmCredentials) {
@@ -575,7 +576,7 @@ public class ChooseLockPattern extends SettingsActivity {
final boolean launched = builder.setRequestCode(CONFIRM_EXISTING_REQUEST) final boolean launched = builder.setRequestCode(CONFIRM_EXISTING_REQUEST)
.setTitle(getString(R.string.unlock_set_unlock_launch_picker_title)) .setTitle(getString(R.string.unlock_set_unlock_launch_picker_title))
.setReturnCredentials(true) .setReturnCredentials(true)
.setRequestGatekeeperPassword(mRequestGatekeeperPassword) .setRequestGatekeeperPasswordHandle(mRequestGatekeeperPassword)
.setUserId(mUserId) .setUserId(mUserId)
.show(); .show();
@@ -915,16 +916,16 @@ public class ChooseLockPattern extends SettingsActivity {
// path to return a Gatekeeper Password based on the credential that the user // path to return a Gatekeeper Password based on the credential that the user
// chose. This should only be run if the credential was successfully set. // chose. This should only be run if the credential was successfully set.
final VerifyCredentialResponse response = mUtils.verifyCredential(mChosenPattern, final VerifyCredentialResponse response = mUtils.verifyCredential(mChosenPattern,
userId, LockPatternUtils.VERIFY_FLAG_RETURN_GK_PW); userId, LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE);
if (!response.isMatched() || response.getGatekeeperPw() == null) { if (!response.isMatched() || !response.containsGatekeeperPasswordHandle()) {
Log.e(TAG, "critical: bad response or missing GK HAT for known good pattern: " Log.e(TAG, "critical: bad response or missing GK PW handle for known good"
+ response.toString()); + " pattern: " + response.toString());
} }
result = new Intent(); result = new Intent();
result.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW, result.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE,
response.getGatekeeperPw()); response.getGatekeeperPasswordHandle());
} }
return Pair.create(success, result); return Pair.create(success, result);
} }

View File

@@ -31,9 +31,7 @@ import android.util.Log;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.android.internal.widget.ICheckCredentialProgressCallback;
import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockscreenCredential;
import com.android.settings.SetupWizardUtils; import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.core.SubSettingLauncher; import com.android.settings.core.SubSettingLauncher;
@@ -56,10 +54,10 @@ public final class ChooseLockSettingsHelper {
public static final String EXTRA_KEY_FOR_FACE = "for_face"; public static final String EXTRA_KEY_FOR_FACE = "for_face";
public static final String EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT = "for_cred_req_boot"; public static final String EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT = "for_cred_req_boot";
public static final String EXTRA_KEY_FOREGROUND_ONLY = "foreground_only"; public static final String EXTRA_KEY_FOREGROUND_ONLY = "foreground_only";
public static final String EXTRA_KEY_REQUEST_GK_PW = "request_gk_pw"; public static final String EXTRA_KEY_REQUEST_GK_PW_HANDLE = "request_gk_pw_handle";
// Gatekeeper password, which can subsequently be used to generate Gatekeeper // Gatekeeper password handle, which can subsequently be used to generate Gatekeeper
// HardwareAuthToken(s) via LockSettingsService#verifyGatekeeperPassword // HardwareAuthToken(s) via LockSettingsService#verifyGatekeeperPasswordHandle
public static final String EXTRA_KEY_GK_PW = "gk_pw"; public static final String EXTRA_KEY_GK_PW_HANDLE = "gk_pw_handle";
/** /**
* When EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL and EXTRA_KEY_UNIFICATION_PROFILE_ID are * When EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL and EXTRA_KEY_UNIFICATION_PROFILE_ID are
@@ -126,7 +124,7 @@ public final class ChooseLockSettingsHelper {
private int mUserId; private int mUserId;
private boolean mAllowAnyUserId; private boolean mAllowAnyUserId;
private boolean mForceVerifyPath; private boolean mForceVerifyPath;
boolean mRequestGatekeeperPassword; boolean mRequestGatekeeperPasswordHandle;
public Builder(@NonNull Activity activity) { public Builder(@NonNull Activity activity) {
mActivity = activity; mActivity = activity;
@@ -182,12 +180,12 @@ public final class ChooseLockSettingsHelper {
* @param returnCredentials if true, puts the following credentials into intent for * @param returnCredentials if true, puts the following credentials into intent for
* onActivityResult with the following keys: * onActivityResult with the following keys:
* {@link #EXTRA_KEY_TYPE}, {@link #EXTRA_KEY_PASSWORD}, * {@link #EXTRA_KEY_TYPE}, {@link #EXTRA_KEY_PASSWORD},
* {@link #EXTRA_KEY_CHALLENGE_TOKEN}, {@link #EXTRA_KEY_GK_PW} * {@link #EXTRA_KEY_CHALLENGE_TOKEN},
* {@link #EXTRA_KEY_GK_PW_HANDLE}
* Note that if this is true, this can only be called internally. * Note that if this is true, this can only be called internally.
* *
* This should also generally be set if * This should also generally be set if
* {@link #setRequestGatekeeperPassword(boolean)} (boolean)} is * {@link #setRequestGatekeeperPasswordHandle(boolean)} is set.
* set.
*/ */
@NonNull public Builder setReturnCredentials(boolean returnCredentials) { @NonNull public Builder setReturnCredentials(boolean returnCredentials) {
mReturnCredentials = returnCredentials; mReturnCredentials = returnCredentials;
@@ -241,17 +239,18 @@ public final class ChooseLockSettingsHelper {
} }
/** /**
* Requests that LockSettingsService return the Gatekeeper Password (instead of the * Requests that LockSettingsService return a handle to the Gatekeeper Password (instead of
* Gatekeeper HAT). This allows us to use a single entry of the user's credential * the Gatekeeper HAT). This allows us to use a single entry of the user's credential
* to create multiple Gatekeeper HATs containing distinct challenges via * to create multiple Gatekeeper HATs containing distinct challenges via
* {@link LockPatternUtils#verifyGatekeeperPassword(byte[], long, int)}. * {@link LockPatternUtils#verifyGatekeeperPasswordHandle(long, long, int)}.
* *
* Upon confirmation of the user's password, the Gatekeeper Password will be returned via * Upon confirmation of the user's password, the Gatekeeper Password Handle will be returned
* onActivityResult with the key being {@link #EXTRA_KEY_GK_PW}. * via onActivityResult with the key being {@link #EXTRA_KEY_GK_PW_HANDLE}.
* @param requestGatekeeperPassword * @param requestGatekeeperPasswordHandle
*/ */
@NonNull public Builder setRequestGatekeeperPassword(boolean requestGatekeeperPassword) { @NonNull public Builder setRequestGatekeeperPasswordHandle(
mRequestGatekeeperPassword = requestGatekeeperPassword; boolean requestGatekeeperPasswordHandle) {
mRequestGatekeeperPasswordHandle = requestGatekeeperPasswordHandle;
return this; return this;
} }
@@ -266,10 +265,10 @@ public final class ChooseLockSettingsHelper {
+ " onActivityResult"); + " onActivityResult");
} }
if (mRequestGatekeeperPassword && !mReturnCredentials) { if (mRequestGatekeeperPasswordHandle && !mReturnCredentials) {
// HAT containing the signed challenge will not be available to the caller. // HAT containing the signed challenge will not be available to the caller.
Log.w(TAG, "Requested gatekeeper password but not requesting ReturnCredentials. Are" Log.w(TAG, "Requested gatekeeper password handle but not requesting"
+ " you sure this is what you want?"); + " ReturnCredentials. Are you sure this is what you want?");
} }
return new ChooseLockSettingsHelper(this, mActivity, mFragment); return new ChooseLockSettingsHelper(this, mActivity, mFragment);
@@ -289,14 +288,14 @@ public final class ChooseLockSettingsHelper {
mBuilder.mDescription, mBuilder.mReturnCredentials, mBuilder.mExternal, mBuilder.mDescription, mBuilder.mReturnCredentials, mBuilder.mExternal,
mBuilder.mForceVerifyPath, mBuilder.mUserId, mBuilder.mAlternateButton, mBuilder.mForceVerifyPath, mBuilder.mUserId, mBuilder.mAlternateButton,
mBuilder.mAllowAnyUserId, mBuilder.mForegroundOnly, mBuilder.mAllowAnyUserId, mBuilder.mForegroundOnly,
mBuilder.mRequestGatekeeperPassword); mBuilder.mRequestGatekeeperPasswordHandle);
} }
private boolean launchConfirmationActivity(int request, @Nullable CharSequence title, private boolean launchConfirmationActivity(int request, @Nullable CharSequence title,
@Nullable CharSequence header, @Nullable CharSequence description, @Nullable CharSequence header, @Nullable CharSequence description,
boolean returnCredentials, boolean external, boolean forceVerifyPath, boolean returnCredentials, boolean external, boolean forceVerifyPath,
int userId, @Nullable CharSequence alternateButton, boolean allowAnyUser, int userId, @Nullable CharSequence alternateButton, boolean allowAnyUser,
boolean foregroundOnly, boolean requestGatekeeperPassword) { boolean foregroundOnly, boolean requestGatekeeperPasswordHandle) {
final int effectiveUserId = UserManager.get(mActivity).getCredentialOwnerProfile(userId); final int effectiveUserId = UserManager.get(mActivity).getCredentialOwnerProfile(userId);
boolean launched = false; boolean launched = false;
@@ -307,7 +306,7 @@ public final class ChooseLockSettingsHelper {
? ConfirmLockPattern.InternalActivity.class ? ConfirmLockPattern.InternalActivity.class
: ConfirmLockPattern.class, returnCredentials, external, : ConfirmLockPattern.class, returnCredentials, external,
forceVerifyPath, userId, alternateButton, allowAnyUser, forceVerifyPath, userId, alternateButton, allowAnyUser,
foregroundOnly, requestGatekeeperPassword); foregroundOnly, requestGatekeeperPasswordHandle);
break; break;
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX: case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
@@ -320,7 +319,7 @@ public final class ChooseLockSettingsHelper {
? ConfirmLockPassword.InternalActivity.class ? ConfirmLockPassword.InternalActivity.class
: ConfirmLockPassword.class, returnCredentials, external, : ConfirmLockPassword.class, returnCredentials, external,
forceVerifyPath, userId, alternateButton, allowAnyUser, forceVerifyPath, userId, alternateButton, allowAnyUser,
foregroundOnly, requestGatekeeperPassword); foregroundOnly, requestGatekeeperPasswordHandle);
break; break;
} }
return launched; return launched;
@@ -330,7 +329,7 @@ public final class ChooseLockSettingsHelper {
CharSequence message, Class<?> activityClass, boolean returnCredentials, CharSequence message, Class<?> activityClass, boolean returnCredentials,
boolean external, boolean forceVerifyPath, int userId, boolean external, boolean forceVerifyPath, int userId,
@Nullable CharSequence alternateButton, boolean allowAnyUser, @Nullable CharSequence alternateButton, boolean allowAnyUser,
boolean foregroundOnly, boolean requestGatekeeperPassword) { boolean foregroundOnly, boolean requestGatekeeperPasswordHandle) {
final Intent intent = new Intent(); final Intent intent = new Intent();
intent.putExtra(ConfirmDeviceCredentialBaseFragment.TITLE_TEXT, title); intent.putExtra(ConfirmDeviceCredentialBaseFragment.TITLE_TEXT, title);
intent.putExtra(ConfirmDeviceCredentialBaseFragment.HEADER_TEXT, header); intent.putExtra(ConfirmDeviceCredentialBaseFragment.HEADER_TEXT, header);
@@ -346,8 +345,8 @@ public final class ChooseLockSettingsHelper {
intent.putExtra(KeyguardManager.EXTRA_ALTERNATE_BUTTON_LABEL, alternateButton); intent.putExtra(KeyguardManager.EXTRA_ALTERNATE_BUTTON_LABEL, alternateButton);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOREGROUND_ONLY, foregroundOnly); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOREGROUND_ONLY, foregroundOnly);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_ALLOW_ANY_USER, allowAnyUser); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_ALLOW_ANY_USER, allowAnyUser);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE,
requestGatekeeperPassword); requestGatekeeperPasswordHandle);
intent.setClassName(SETTINGS_PACKAGE_NAME, activityClass.getName()); intent.setClassName(SETTINGS_PACKAGE_NAME, activityClass.getName());
if (external) { if (external) {

View File

@@ -74,7 +74,7 @@ public class ChooseLockTypeDialogFragment extends InstrumentedDialogFragment
// Copy the original extras into the new intent // Copy the original extras into the new intent
copyBooleanExtra(activityIntent, intent, copyBooleanExtra(activityIntent, intent,
ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false); ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, false);
copyBooleanExtra(activityIntent, intent, copyBooleanExtra(activityIntent, intent,
ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, false); ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, false);
if (activityIntent.hasExtra( if (activityIntent.hasExtra(

View File

@@ -102,7 +102,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr
ChooseLockSettingsHelper.EXTRA_KEY_RETURN_CREDENTIALS, false); ChooseLockSettingsHelper.EXTRA_KEY_RETURN_CREDENTIALS, false);
mReturnGatekeeperPassword = intent.getBooleanExtra( mReturnGatekeeperPassword = intent.getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false); ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, false);
mForceVerifyPath = intent.getBooleanExtra( mForceVerifyPath = intent.getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_FORCE_VERIFY, false); ChooseLockSettingsHelper.EXTRA_KEY_FORCE_VERIFY, false);

View File

@@ -386,7 +386,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
if (mReturnGatekeeperPassword) { if (mReturnGatekeeperPassword) {
if (isInternalActivity()) { if (isInternalActivity()) {
startVerifyPassword(credential, intent, startVerifyPassword(credential, intent,
LockPatternUtils.VERIFY_FLAG_RETURN_GK_PW); LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE);
return; return;
} }
} else if (mForceVerifyPath) { } else if (mForceVerifyPath) {
@@ -414,9 +414,9 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
mPendingLockCheck = null; mPendingLockCheck = null;
final boolean matched = response.isMatched(); final boolean matched = response.isMatched();
if (matched && mReturnCredentials) { if (matched && mReturnCredentials) {
if ((flags & LockPatternUtils.VERIFY_FLAG_RETURN_GK_PW) != 0) { if ((flags & LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE) != 0) {
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW, intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE,
response.getGatekeeperPw()); response.getGatekeeperPasswordHandle());
} else { } else {
intent.putExtra( intent.putExtra(
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN,

View File

@@ -428,7 +428,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
if (mReturnGatekeeperPassword) { if (mReturnGatekeeperPassword) {
if (isInternalActivity()) { if (isInternalActivity()) {
startVerifyPattern(credential, intent, startVerifyPattern(credential, intent,
LockPatternUtils.VERIFY_FLAG_RETURN_GK_PW); LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE);
return; return;
} }
} else if (mForceVerifyPath) { } else if (mForceVerifyPath) {
@@ -457,9 +457,9 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
mPendingLockCheck = null; mPendingLockCheck = null;
final boolean matched = response.isMatched(); final boolean matched = response.isMatched();
if (matched && mReturnCredentials) { if (matched && mReturnCredentials) {
if ((flags & LockPatternUtils.VERIFY_FLAG_RETURN_GK_PW) != 0) { if ((flags & LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE) != 0) {
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW, intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE,
response.getGatekeeperPw()); response.getGatekeeperPasswordHandle());
} else { } else {
intent.putExtra( intent.putExtra(
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN,

View File

@@ -139,7 +139,7 @@ final class SetNewPasswordController {
PASSWORD_QUALITY_SOMETHING); PASSWORD_QUALITY_SOMETHING);
chooseLockExtras.putBoolean( chooseLockExtras.putBoolean(
ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true); ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true);
chooseLockExtras.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, true); chooseLockExtras.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, true);
chooseLockExtras.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, true); chooseLockExtras.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, true);
return chooseLockExtras; return chooseLockExtras;
} }
@@ -150,7 +150,7 @@ final class SetNewPasswordController {
PASSWORD_QUALITY_SOMETHING); PASSWORD_QUALITY_SOMETHING);
chooseLockExtras.putBoolean( chooseLockExtras.putBoolean(
ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true); ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true);
chooseLockExtras.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, true); chooseLockExtras.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, true);
chooseLockExtras.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, true); chooseLockExtras.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, true);
return chooseLockExtras; return chooseLockExtras;
} }

View File

@@ -110,12 +110,13 @@ public class ChooseLockPasswordTest {
@Test @Test
public void intentBuilder_setRequestGatekeeperPassword_shouldAddExtras() { public void intentBuilder_setRequestGatekeeperPassword_shouldAddExtras() {
Intent intent = new IntentBuilder(application) Intent intent = new IntentBuilder(application)
.setRequestGatekeeperPassword(true) .setRequestGatekeeperPasswordHandle(true)
.setPasswordQuality(PASSWORD_QUALITY_ALPHANUMERIC) .setPasswordQuality(PASSWORD_QUALITY_ALPHANUMERIC)
.setUserId(123) .setUserId(123)
.build(); .build();
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false)) assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE,
false))
.named("EXTRA_KEY_REQUEST_GK_PW") .named("EXTRA_KEY_REQUEST_GK_PW")
.isTrue(); .isTrue();
assertThat(intent.getIntExtra(PASSWORD_TYPE_KEY, 0)) assertThat(intent.getIntExtra(PASSWORD_TYPE_KEY, 0))

View File

@@ -74,12 +74,12 @@ public class ChooseLockPatternTest {
@Test @Test
public void intentBuilder_setRequestGatekeeperPassword_shouldAddExtras() { public void intentBuilder_setRequestGatekeeperPassword_shouldAddExtras() {
Intent intent = new IntentBuilder(application) Intent intent = new IntentBuilder(application)
.setRequestGatekeeperPassword(true) .setRequestGatekeeperPasswordHandle(true)
.setUserId(123) .setUserId(123)
.build(); .build();
assertThat(intent assertThat(intent
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false)) .getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, false))
.named("EXTRA_KEY_REQUEST_GK_PW") .named("EXTRA_KEY_REQUEST_GK_PW")
.isTrue(); .isTrue();
assertThat(intent assertThat(intent

View File

@@ -23,7 +23,7 @@ import static com.android.settings.password.ChooseLockGeneric.ChooseLockGenericF
import static com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY; import static com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE; import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT; import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW; import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@@ -270,7 +270,7 @@ public final class SetNewPasswordControllerTest {
actualBundle.getBoolean(HIDE_DISABLED_PREFS)); actualBundle.getBoolean(HIDE_DISABLED_PREFS));
assertTrue( assertTrue(
"Fingerprint enroll must request Gatekeeper Password.", "Fingerprint enroll must request Gatekeeper Password.",
actualBundle.getBoolean(EXTRA_KEY_REQUEST_GK_PW)); actualBundle.getBoolean(EXTRA_KEY_REQUEST_GK_PW_HANDLE));
assertTrue( assertTrue(
"The request must be a fingerprint set up request.", "The request must be a fingerprint set up request.",
actualBundle.getBoolean(EXTRA_KEY_FOR_FINGERPRINT)); actualBundle.getBoolean(EXTRA_KEY_FOR_FINGERPRINT));
@@ -290,7 +290,7 @@ public final class SetNewPasswordControllerTest {
actualBundle.getBoolean(HIDE_DISABLED_PREFS)); actualBundle.getBoolean(HIDE_DISABLED_PREFS));
assertTrue( assertTrue(
"Face enroll must request Gatekeeper Password", "Face enroll must request Gatekeeper Password",
actualBundle.getBoolean(EXTRA_KEY_REQUEST_GK_PW)); actualBundle.getBoolean(EXTRA_KEY_REQUEST_GK_PW_HANDLE));
assertTrue( assertTrue(
"The request must be a face set up request.", "The request must be a face set up request.",
actualBundle.getBoolean(EXTRA_KEY_FOR_FACE)); actualBundle.getBoolean(EXTRA_KEY_FOR_FACE));