Use parent profile for device credential

Flag: Flags.ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE
Bug: 320458435
Test: N/A
Change-Id: I9ee46d53df5f0617da643f1cf51db811a5eec478
This commit is contained in:
Diya Bera
2024-02-08 17:11:39 -08:00
parent 33173589ab
commit f7ffa201f4
2 changed files with 10 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.BiometricPrompt.AuthenticationCallback;
import android.hardware.biometrics.BiometricPrompt.AuthenticationResult;
import android.hardware.biometrics.PromptInfo;
import android.multiuser.Flags;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -140,8 +141,14 @@ public class BiometricFragment extends InstrumentedFragment {
.setDisallowBiometricsIfPolicyExists(
promptInfo.isDisallowBiometricsIfPolicyExists())
.setShowEmergencyCallButton(promptInfo.isShowEmergencyCallButton())
.setReceiveSystemEvents(true)
.setAllowBackgroundAuthentication(true);
.setReceiveSystemEvents(true);
if (Flags.enableBiometricsToUnlockPrivateSpace()) {
promptBuilder = promptBuilder.setAllowBackgroundAuthentication(true /* allow */,
promptInfo.shouldUseParentProfileForDeviceCredential());
} else {
promptBuilder = promptBuilder.setAllowBackgroundAuthentication(true /* allow */);
}
// Check if the default subtitle should be used if subtitle is null/empty
if (promptInfo.isUseDefaultSubtitle()) {

View File

@@ -311,6 +311,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
mForceVerifyPath = userProperties.isCredentialShareableWithParent();
if (android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
&& isBiometricAllowed(effectiveUserId, mUserId)) {
promptInfo.setUseParentProfileForDeviceCredential(true);
showBiometricPrompt(promptInfo, effectiveUserId);
launchedBiometric = true;
} else {