Loading src/com/android/settings/password/BiometricFragment.java +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.hardware.biometrics.PromptInfo; import android.multiuser.Flags; import android.os.Bundle; import android.os.CancellationSignal; import android.text.TextUtils; import androidx.annotation.NonNull; Loading Loading @@ -149,6 +150,13 @@ public class BiometricFragment extends InstrumentedFragment { .setShowEmergencyCallButton(promptInfo.isShowEmergencyCallButton()) .setReceiveSystemEvents(true) .setComponentNameForConfirmDeviceCredentialActivity(callingActivity); if (promptInfo.getLogoRes() != 0){ promptBuilder.setLogoRes(promptInfo.getLogoRes()); } String logoDescription = promptInfo.getLogoDescription(); if (!TextUtils.isEmpty(logoDescription)) { promptBuilder.setLogoDescription(logoDescription); } if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpaceFeatures() && Flags.enableBiometricsToUnlockPrivateSpace()) { Loading src/com/android/settings/password/ConfirmDeviceCredentialActivity.java +32 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ package com.android.settings.password; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PASSWORD_HEADER; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PATTERN_HEADER; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PIN_HEADER; import static android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import android.app.Activity; Loading @@ -31,6 +32,7 @@ import android.app.trust.TrustManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.UserProperties; import android.content.res.Configuration; import android.graphics.Color; Loading @@ -44,6 +46,7 @@ import android.os.Looper; import android.os.UserHandle; import android.os.UserManager; import android.os.storage.StorageManager; import android.text.TextUtils; import android.util.Log; import android.view.WindowManager; Loading @@ -65,6 +68,12 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { private static final String TAG_BIOMETRIC_FRAGMENT = "fragment"; /** Use this extra value to provide a custom logo for the biometric prompt. **/ public static final String CUSTOM_BIOMETRIC_PROMPT_LOGO_RES_ID_KEY = "custom_logo_res_id"; /** Use this extra value to provide a custom logo description for the biometric prompt. **/ public static final String CUSTOM_BIOMETRIC_PROMPT_LOGO_DESCRIPTION_KEY = "custom_logo_description"; public static class InternalActivity extends ConfirmDeviceCredentialActivity { } Loading Loading @@ -202,6 +211,21 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { promptInfo.setDescription(mDetails); promptInfo.setDisallowBiometricsIfPolicyExists(mCheckDevicePolicyManager); if (android.multiuser.Flags.enablePrivateSpaceFeatures() && android.multiuser.Flags.usePrivateSpaceIconInBiometricPrompt() && hasSetBiometricDialogAdvanced(mContext, getLaunchedFromUid()) ) { int iconResId = intent.getIntExtra(CUSTOM_BIOMETRIC_PROMPT_LOGO_RES_ID_KEY, 0); if (iconResId != 0) { promptInfo.setLogoRes(iconResId); } String logoDescription = intent.getStringExtra( CUSTOM_BIOMETRIC_PROMPT_LOGO_DESCRIPTION_KEY); if (!TextUtils.isEmpty(logoDescription)) { promptInfo.setLogoDescription(logoDescription); } } final int policyType = mDevicePolicyManager.getManagedSubscriptionsPolicy().getPolicyType(); if (isEffectiveUserManagedProfile Loading Loading @@ -409,6 +433,14 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { } } /** * Checks if the calling uid has the permission to set biometric dialog icon and description. */ private static boolean hasSetBiometricDialogAdvanced(@NonNull Context context, int callingUid) { return context.checkPermission(SET_BIOMETRIC_DIALOG_ADVANCED, /* pid */ -1, callingUid) == PackageManager.PERMISSION_GRANTED; } // User could be locked while Effective user is unlocked even though the effective owns the // credential. Otherwise, biometric can't unlock fbe/keystore through // verifyTiedProfileChallenge. In such case, we also wanna show the user message that Loading src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java +10 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static android.app.admin.DevicePolicyManager.ACTION_SET_NEW_PASSWORD; import static com.android.internal.app.SetScreenLockDialogActivity.LAUNCH_REASON_PRIVATE_SPACE_SETTINGS_ACCESS; import static com.android.settings.activityembedding.EmbeddedDeepLinkUtils.tryStartMultiPaneDeepLink; import static com.android.settings.password.ConfirmDeviceCredentialActivity.CUSTOM_BIOMETRIC_PROMPT_LOGO_DESCRIPTION_KEY; import static com.android.settings.password.ConfirmDeviceCredentialActivity.CUSTOM_BIOMETRIC_PROMPT_LOGO_RES_ID_KEY; import android.app.ActivityOptions; import android.app.KeyguardManager; Loading Loading @@ -228,6 +230,14 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity { private void authenticatePrivateSpaceEntry() { Intent credentialIntent = mPrivateSpaceMaintainer.getPrivateProfileLockCredentialIntent(); if (credentialIntent != null) { if (android.multiuser.Flags.usePrivateSpaceIconInBiometricPrompt()) { credentialIntent.putExtra(CUSTOM_BIOMETRIC_PROMPT_LOGO_RES_ID_KEY, com.android.internal.R.drawable.stat_sys_private_profile_status); credentialIntent.putExtra(CUSTOM_BIOMETRIC_PROMPT_LOGO_DESCRIPTION_KEY, getApplicationContext().getString( com.android.internal.R.string.private_space_biometric_prompt_title )); } mVerifyDeviceLock.launch(credentialIntent); } else { Log.e(TAG, "verifyCredentialIntent is null even though device lock is set"); Loading Loading
src/com/android/settings/password/BiometricFragment.java +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.hardware.biometrics.PromptInfo; import android.multiuser.Flags; import android.os.Bundle; import android.os.CancellationSignal; import android.text.TextUtils; import androidx.annotation.NonNull; Loading Loading @@ -149,6 +150,13 @@ public class BiometricFragment extends InstrumentedFragment { .setShowEmergencyCallButton(promptInfo.isShowEmergencyCallButton()) .setReceiveSystemEvents(true) .setComponentNameForConfirmDeviceCredentialActivity(callingActivity); if (promptInfo.getLogoRes() != 0){ promptBuilder.setLogoRes(promptInfo.getLogoRes()); } String logoDescription = promptInfo.getLogoDescription(); if (!TextUtils.isEmpty(logoDescription)) { promptBuilder.setLogoDescription(logoDescription); } if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpaceFeatures() && Flags.enableBiometricsToUnlockPrivateSpace()) { Loading
src/com/android/settings/password/ConfirmDeviceCredentialActivity.java +32 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ package com.android.settings.password; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PASSWORD_HEADER; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PATTERN_HEADER; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PIN_HEADER; import static android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import android.app.Activity; Loading @@ -31,6 +32,7 @@ import android.app.trust.TrustManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.UserProperties; import android.content.res.Configuration; import android.graphics.Color; Loading @@ -44,6 +46,7 @@ import android.os.Looper; import android.os.UserHandle; import android.os.UserManager; import android.os.storage.StorageManager; import android.text.TextUtils; import android.util.Log; import android.view.WindowManager; Loading @@ -65,6 +68,12 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { private static final String TAG_BIOMETRIC_FRAGMENT = "fragment"; /** Use this extra value to provide a custom logo for the biometric prompt. **/ public static final String CUSTOM_BIOMETRIC_PROMPT_LOGO_RES_ID_KEY = "custom_logo_res_id"; /** Use this extra value to provide a custom logo description for the biometric prompt. **/ public static final String CUSTOM_BIOMETRIC_PROMPT_LOGO_DESCRIPTION_KEY = "custom_logo_description"; public static class InternalActivity extends ConfirmDeviceCredentialActivity { } Loading Loading @@ -202,6 +211,21 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { promptInfo.setDescription(mDetails); promptInfo.setDisallowBiometricsIfPolicyExists(mCheckDevicePolicyManager); if (android.multiuser.Flags.enablePrivateSpaceFeatures() && android.multiuser.Flags.usePrivateSpaceIconInBiometricPrompt() && hasSetBiometricDialogAdvanced(mContext, getLaunchedFromUid()) ) { int iconResId = intent.getIntExtra(CUSTOM_BIOMETRIC_PROMPT_LOGO_RES_ID_KEY, 0); if (iconResId != 0) { promptInfo.setLogoRes(iconResId); } String logoDescription = intent.getStringExtra( CUSTOM_BIOMETRIC_PROMPT_LOGO_DESCRIPTION_KEY); if (!TextUtils.isEmpty(logoDescription)) { promptInfo.setLogoDescription(logoDescription); } } final int policyType = mDevicePolicyManager.getManagedSubscriptionsPolicy().getPolicyType(); if (isEffectiveUserManagedProfile Loading Loading @@ -409,6 +433,14 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { } } /** * Checks if the calling uid has the permission to set biometric dialog icon and description. */ private static boolean hasSetBiometricDialogAdvanced(@NonNull Context context, int callingUid) { return context.checkPermission(SET_BIOMETRIC_DIALOG_ADVANCED, /* pid */ -1, callingUid) == PackageManager.PERMISSION_GRANTED; } // User could be locked while Effective user is unlocked even though the effective owns the // credential. Otherwise, biometric can't unlock fbe/keystore through // verifyTiedProfileChallenge. In such case, we also wanna show the user message that Loading
src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java +10 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static android.app.admin.DevicePolicyManager.ACTION_SET_NEW_PASSWORD; import static com.android.internal.app.SetScreenLockDialogActivity.LAUNCH_REASON_PRIVATE_SPACE_SETTINGS_ACCESS; import static com.android.settings.activityembedding.EmbeddedDeepLinkUtils.tryStartMultiPaneDeepLink; import static com.android.settings.password.ConfirmDeviceCredentialActivity.CUSTOM_BIOMETRIC_PROMPT_LOGO_DESCRIPTION_KEY; import static com.android.settings.password.ConfirmDeviceCredentialActivity.CUSTOM_BIOMETRIC_PROMPT_LOGO_RES_ID_KEY; import android.app.ActivityOptions; import android.app.KeyguardManager; Loading Loading @@ -228,6 +230,14 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity { private void authenticatePrivateSpaceEntry() { Intent credentialIntent = mPrivateSpaceMaintainer.getPrivateProfileLockCredentialIntent(); if (credentialIntent != null) { if (android.multiuser.Flags.usePrivateSpaceIconInBiometricPrompt()) { credentialIntent.putExtra(CUSTOM_BIOMETRIC_PROMPT_LOGO_RES_ID_KEY, com.android.internal.R.drawable.stat_sys_private_profile_status); credentialIntent.putExtra(CUSTOM_BIOMETRIC_PROMPT_LOGO_DESCRIPTION_KEY, getApplicationContext().getString( com.android.internal.R.string.private_space_biometric_prompt_title )); } mVerifyDeviceLock.launch(credentialIntent); } else { Log.e(TAG, "verifyCredentialIntent is null even though device lock is set"); Loading