Plumb setRequireConfirmation to CC
Bug: 111461540 Test: Tested with modified demo app with original and new KeyguardManager APIs Change-Id: I56585fbfd704195586f2f516b35e9338e91b0346
This commit is contained in:
@@ -45,6 +45,7 @@ public class BiometricFragment extends InstrumentedFragment {
|
|||||||
private static final String KEY_SUBTITLE = "subtitle";
|
private static final String KEY_SUBTITLE = "subtitle";
|
||||||
private static final String KEY_DESCRIPTION = "description";
|
private static final String KEY_DESCRIPTION = "description";
|
||||||
private static final String KEY_NEGATIVE_TEXT = "negative_text";
|
private static final String KEY_NEGATIVE_TEXT = "negative_text";
|
||||||
|
private static final String KEY_REQUIRE_CONFIRMATION = "require_confirmation";
|
||||||
|
|
||||||
// Re-set by the application. Should be done upon orientation changes, etc
|
// Re-set by the application. Should be done upon orientation changes, etc
|
||||||
private Executor mClientExecutor;
|
private Executor mClientExecutor;
|
||||||
@@ -129,6 +130,7 @@ public class BiometricFragment extends InstrumentedFragment {
|
|||||||
.setDescription(mPromptInfo.getDescription())
|
.setDescription(mPromptInfo.getDescription())
|
||||||
.setNegativeButton(mPromptInfo.getNegativeButtonText(), mClientExecutor,
|
.setNegativeButton(mPromptInfo.getNegativeButtonText(), mClientExecutor,
|
||||||
mNegativeButtonListener)
|
mNegativeButtonListener)
|
||||||
|
.setRequireConfirmation(mPromptInfo.getRequireConfirmation())
|
||||||
.build();
|
.build();
|
||||||
mCancellationSignal = new CancellationSignal();
|
mCancellationSignal = new CancellationSignal();
|
||||||
|
|
||||||
@@ -173,6 +175,10 @@ public class BiometricFragment extends InstrumentedFragment {
|
|||||||
return mBundle.getCharSequence(KEY_NEGATIVE_TEXT);
|
return mBundle.getCharSequence(KEY_NEGATIVE_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getRequireConfirmation() {
|
||||||
|
return mBundle.getBoolean(KEY_REQUIRE_CONFIRMATION);
|
||||||
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private final Bundle mBundle = new Bundle();
|
private final Bundle mBundle = new Bundle();
|
||||||
|
|
||||||
@@ -196,6 +202,11 @@ public class BiometricFragment extends InstrumentedFragment {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setRequireConfirmation(boolean requireConfirmation) {
|
||||||
|
mBundle.putBoolean(KEY_REQUIRE_CONFIRMATION, requireConfirmation);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public PromptInfo build() {
|
public PromptInfo build() {
|
||||||
return new PromptInfo(mBundle);
|
return new PromptInfo(mBundle);
|
||||||
}
|
}
|
||||||
|
@@ -136,6 +136,10 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
mTitle = intent.getStringExtra(KeyguardManager.EXTRA_TITLE);
|
mTitle = intent.getStringExtra(KeyguardManager.EXTRA_TITLE);
|
||||||
mDetails = intent.getStringExtra(KeyguardManager.EXTRA_DESCRIPTION);
|
mDetails = intent.getStringExtra(KeyguardManager.EXTRA_DESCRIPTION);
|
||||||
|
|
||||||
|
final boolean requireConfirmation =
|
||||||
|
!intent.getBooleanExtra(KeyguardManager.EXTRA_USE_IMPLICIT, true);
|
||||||
|
|
||||||
String alternateButton = intent.getStringExtra(
|
String alternateButton = intent.getStringExtra(
|
||||||
KeyguardManager.EXTRA_ALTERNATE_BUTTON_LABEL);
|
KeyguardManager.EXTRA_ALTERNATE_BUTTON_LABEL);
|
||||||
boolean frp = KeyguardManager.ACTION_CONFIRM_FRP_CREDENTIAL.equals(intent.getAction());
|
boolean frp = KeyguardManager.ACTION_CONFIRM_FRP_CREDENTIAL.equals(intent.getAction());
|
||||||
@@ -170,7 +174,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
&& !lockPatternUtils.isSeparateProfileChallengeEnabled(mUserId)) {
|
&& !lockPatternUtils.isSeparateProfileChallengeEnabled(mUserId)) {
|
||||||
mCredentialMode = CREDENTIAL_MANAGED;
|
mCredentialMode = CREDENTIAL_MANAGED;
|
||||||
if (isBiometricAllowed(effectiveUserId)) {
|
if (isBiometricAllowed(effectiveUserId)) {
|
||||||
showBiometricPrompt();
|
showBiometricPrompt(requireConfirmation);
|
||||||
launchedBiometric = true;
|
launchedBiometric = true;
|
||||||
} else {
|
} else {
|
||||||
showConfirmCredentials();
|
showConfirmCredentials();
|
||||||
@@ -181,7 +185,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
if (isBiometricAllowed(effectiveUserId)) {
|
if (isBiometricAllowed(effectiveUserId)) {
|
||||||
// Don't need to check if biometrics / pin/pattern/pass are enrolled. It will go to
|
// Don't need to check if biometrics / pin/pattern/pass are enrolled. It will go to
|
||||||
// onAuthenticationError and do the right thing automatically.
|
// onAuthenticationError and do the right thing automatically.
|
||||||
showBiometricPrompt();
|
showBiometricPrompt(requireConfirmation);
|
||||||
launchedBiometric = true;
|
launchedBiometric = true;
|
||||||
} else {
|
} else {
|
||||||
showConfirmCredentials();
|
showConfirmCredentials();
|
||||||
@@ -242,7 +246,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
&& !isBiometricDisabledByAdmin(effectiveUserId);
|
&& !isBiometricDisabledByAdmin(effectiveUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showBiometricPrompt() {
|
private void showBiometricPrompt(boolean requireConfirmation) {
|
||||||
mBiometricManager.setActiveUser(mUserId);
|
mBiometricManager.setActiveUser(mUserId);
|
||||||
|
|
||||||
mBiometricFragment = (BiometricFragment) getSupportFragmentManager()
|
mBiometricFragment = (BiometricFragment) getSupportFragmentManager()
|
||||||
@@ -255,6 +259,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
.setSubtitle(mDetails)
|
.setSubtitle(mDetails)
|
||||||
.setNegativeButtonText(getResources()
|
.setNegativeButtonText(getResources()
|
||||||
.getString(R.string.confirm_device_credential_use_alternate_method))
|
.getString(R.string.confirm_device_credential_use_alternate_method))
|
||||||
|
.setRequireConfirmation(requireConfirmation)
|
||||||
.build();
|
.build();
|
||||||
mBiometricFragment = BiometricFragment.newInstance(info);
|
mBiometricFragment = BiometricFragment.newInstance(info);
|
||||||
newFragment = true;
|
newFragment = true;
|
||||||
|
Reference in New Issue
Block a user