Override package name for logo in ConfirmDeviceCredentialActivity.

Test: TODO
Flag: ACONFIG android.hardware.biometrics.custom_biometric_prompt NEXTFOOD
Bug: 337082634

Change-Id: If0c4851c8c0cb0fae01e9f30d6a6486f2ab2c71f
This commit is contained in:
Hao Dong
2024-05-08 06:52:17 +00:00
parent 67541a9444
commit 3b9c3cf530
2 changed files with 11 additions and 3 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.password; package com.android.settings.password;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
import android.content.ComponentName;
import android.hardware.biometrics.BiometricPrompt; import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.BiometricPrompt.AuthenticationCallback; import android.hardware.biometrics.BiometricPrompt.AuthenticationCallback;
import android.hardware.biometrics.BiometricPrompt.AuthenticationResult; import android.hardware.biometrics.BiometricPrompt.AuthenticationResult;
@@ -39,6 +40,7 @@ public class BiometricFragment extends InstrumentedFragment {
private static final String TAG = "ConfirmDeviceCredential/BiometricFragment"; private static final String TAG = "ConfirmDeviceCredential/BiometricFragment";
private static final String KEY_PROMPT_INFO = "prompt_info"; private static final String KEY_PROMPT_INFO = "prompt_info";
private static final String KEY_CALLING_ACTIVITY = "calling_activity";
// 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;
@@ -88,10 +90,13 @@ public class BiometricFragment extends InstrumentedFragment {
* @param promptInfo * @param promptInfo
* @return * @return
*/ */
public static BiometricFragment newInstance(PromptInfo promptInfo) { public static BiometricFragment newInstance(PromptInfo promptInfo,
ComponentName callingActivity) {
BiometricFragment biometricFragment = new BiometricFragment(); BiometricFragment biometricFragment = new BiometricFragment();
final Bundle bundle = new Bundle(); final Bundle bundle = new Bundle();
bundle.putParcelable(KEY_PROMPT_INFO, promptInfo); bundle.putParcelable(KEY_PROMPT_INFO, promptInfo);
bundle.putParcelable(KEY_CALLING_ACTIVITY, callingActivity);
biometricFragment.setArguments(bundle); biometricFragment.setArguments(bundle);
return biometricFragment; return biometricFragment;
} }
@@ -126,6 +131,7 @@ public class BiometricFragment extends InstrumentedFragment {
final Bundle bundle = getArguments(); final Bundle bundle = getArguments();
final PromptInfo promptInfo = bundle.getParcelable(KEY_PROMPT_INFO); final PromptInfo promptInfo = bundle.getParcelable(KEY_PROMPT_INFO);
final ComponentName callingActivity = bundle.getParcelable(KEY_CALLING_ACTIVITY);
BiometricPrompt.Builder promptBuilder = new BiometricPrompt.Builder(getContext()) BiometricPrompt.Builder promptBuilder = new BiometricPrompt.Builder(getContext())
.setTitle(promptInfo.getTitle()) .setTitle(promptInfo.getTitle())
@@ -141,7 +147,8 @@ public class BiometricFragment extends InstrumentedFragment {
.setDisallowBiometricsIfPolicyExists( .setDisallowBiometricsIfPolicyExists(
promptInfo.isDisallowBiometricsIfPolicyExists()) promptInfo.isDisallowBiometricsIfPolicyExists())
.setShowEmergencyCallButton(promptInfo.isShowEmergencyCallButton()) .setShowEmergencyCallButton(promptInfo.isShowEmergencyCallButton())
.setReceiveSystemEvents(true); .setReceiveSystemEvents(true)
.setComponentNameForConfirmDeviceCredentialActivity(callingActivity);
if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpaceFeatures() if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpaceFeatures()
&& Flags.enableBiometricsToUnlockPrivateSpace()) { && Flags.enableBiometricsToUnlockPrivateSpace()) {

View File

@@ -437,7 +437,8 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
boolean newFragment = false; boolean newFragment = false;
if (mBiometricFragment == null) { if (mBiometricFragment == null) {
mBiometricFragment = BiometricFragment.newInstance(promptInfo); mBiometricFragment = BiometricFragment.newInstance(promptInfo,
getCallingActivity());
newFragment = true; newFragment = true;
} }
mBiometricFragment.setCallbacks(mExecutor, mAuthenticationCallback); mBiometricFragment.setCallbacks(mExecutor, mAuthenticationCallback);