Loading core/java/android/hardware/biometrics/BiometricPrompt.java +7 −4 Original line number Diff line number Diff line Loading @@ -200,7 +200,10 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan throw new IllegalStateException( "Exclusively one of logo resource or logo bitmap can be set"); } mPromptInfo.setLogo(logoRes, convertDrawableToBitmap(mContext.getDrawable(logoRes))); if (logoRes != 0) { mPromptInfo.setLogo(logoRes, convertDrawableToBitmap(mContext.getDrawable(logoRes))); } return this; } Loading @@ -219,11 +222,11 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan @RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED) @NonNull public BiometricPrompt.Builder setLogoBitmap(@NonNull Bitmap logoBitmap) { if (mPromptInfo.getLogoRes() != -1) { if (mPromptInfo.getLogoRes() != 0) { throw new IllegalStateException( "Exclusively one of logo resource or logo bitmap can be set"); } mPromptInfo.setLogo(-1, logoBitmap); mPromptInfo.setLogo(0, logoBitmap); return this; } Loading Loading @@ -832,7 +835,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan * Gets the drawable resource of the logo for the prompt, as set by * {@link Builder#setLogoRes(int)}. Currently for system applications use only. * * @return The drawable resource of the logo, or -1 if the prompt has no logo resource set. * @return The drawable resource of the logo, or 0 if the prompt has no logo resource set. */ @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT) @RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED) Loading core/java/android/hardware/biometrics/PromptInfo.java +4 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import java.util.List; */ public class PromptInfo implements Parcelable { @DrawableRes private int mLogoRes = -1; @DrawableRes private int mLogoRes; @Nullable private Bitmap mLogoBitmap; @Nullable private String mLogoDescription; @NonNull private CharSequence mTitle; Loading Loading @@ -187,7 +187,7 @@ public class PromptInfo implements Parcelable { * this permission. */ public boolean requiresAdvancedPermission() { if (mLogoRes != -1) { if (mLogoRes != 0) { return true; } else if (mLogoBitmap != null) { return true; Loading Loading @@ -221,7 +221,7 @@ public class PromptInfo implements Parcelable { /** * Sets logo res and bitmap * * @param logoRes The logo res set by the app; Or -1 if the app sets bitmap directly. * @param logoRes The logo res set by the app; Or 0 if the app sets bitmap directly. * @param logoBitmap The bitmap from logoRes if the app sets logoRes; Or the bitmap set by the * app directly. */ Loading Loading @@ -351,7 +351,7 @@ public class PromptInfo implements Parcelable { public Bitmap getLogoBitmap() { // If mLogoRes has been set, return null since mLogoBitmap is from the res, but not from // the app directly. return mLogoRes == -1 ? mLogoBitmap : null; return mLogoRes == 0 ? mLogoBitmap : null; } public String getLogoDescription() { Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt +3 −4 Original line number Diff line number Diff line Loading @@ -1559,7 +1559,7 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa subtitle: String? = "s", description: String? = null, contentView: PromptContentView? = null, logoRes: Int = -1, logoRes: Int = 0, logoBitmap: Bitmap? = null, logoDescription: String? = null, packageName: String = OP_PACKAGE_NAME, Loading Loading @@ -1599,8 +1599,7 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa descriptionFromApp = description, contentViewFromApp = contentView, logoResFromApp = logoRes, logoBitmapFromApp = if (logoRes != -1) logoDrawableFromAppRes.toBitmap() else logoBitmap, logoBitmapFromApp = if (logoRes != 0) logoDrawableFromAppRes.toBitmap() else logoBitmap, logoDescriptionFromApp = logoDescription, packageName = packageName, ) Loading Loading @@ -1787,7 +1786,7 @@ private fun PromptSelectorInteractor.initializePrompt( subtitleFromApp: String? = "s", descriptionFromApp: String? = null, contentViewFromApp: PromptContentView? = null, logoResFromApp: Int = -1, logoResFromApp: Int = 0, logoBitmapFromApp: Bitmap? = null, logoDescriptionFromApp: String? = null, packageName: String = OP_PACKAGE_NAME, Loading Loading
core/java/android/hardware/biometrics/BiometricPrompt.java +7 −4 Original line number Diff line number Diff line Loading @@ -200,7 +200,10 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan throw new IllegalStateException( "Exclusively one of logo resource or logo bitmap can be set"); } mPromptInfo.setLogo(logoRes, convertDrawableToBitmap(mContext.getDrawable(logoRes))); if (logoRes != 0) { mPromptInfo.setLogo(logoRes, convertDrawableToBitmap(mContext.getDrawable(logoRes))); } return this; } Loading @@ -219,11 +222,11 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan @RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED) @NonNull public BiometricPrompt.Builder setLogoBitmap(@NonNull Bitmap logoBitmap) { if (mPromptInfo.getLogoRes() != -1) { if (mPromptInfo.getLogoRes() != 0) { throw new IllegalStateException( "Exclusively one of logo resource or logo bitmap can be set"); } mPromptInfo.setLogo(-1, logoBitmap); mPromptInfo.setLogo(0, logoBitmap); return this; } Loading Loading @@ -832,7 +835,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan * Gets the drawable resource of the logo for the prompt, as set by * {@link Builder#setLogoRes(int)}. Currently for system applications use only. * * @return The drawable resource of the logo, or -1 if the prompt has no logo resource set. * @return The drawable resource of the logo, or 0 if the prompt has no logo resource set. */ @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT) @RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED) Loading
core/java/android/hardware/biometrics/PromptInfo.java +4 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import java.util.List; */ public class PromptInfo implements Parcelable { @DrawableRes private int mLogoRes = -1; @DrawableRes private int mLogoRes; @Nullable private Bitmap mLogoBitmap; @Nullable private String mLogoDescription; @NonNull private CharSequence mTitle; Loading Loading @@ -187,7 +187,7 @@ public class PromptInfo implements Parcelable { * this permission. */ public boolean requiresAdvancedPermission() { if (mLogoRes != -1) { if (mLogoRes != 0) { return true; } else if (mLogoBitmap != null) { return true; Loading Loading @@ -221,7 +221,7 @@ public class PromptInfo implements Parcelable { /** * Sets logo res and bitmap * * @param logoRes The logo res set by the app; Or -1 if the app sets bitmap directly. * @param logoRes The logo res set by the app; Or 0 if the app sets bitmap directly. * @param logoBitmap The bitmap from logoRes if the app sets logoRes; Or the bitmap set by the * app directly. */ Loading Loading @@ -351,7 +351,7 @@ public class PromptInfo implements Parcelable { public Bitmap getLogoBitmap() { // If mLogoRes has been set, return null since mLogoBitmap is from the res, but not from // the app directly. return mLogoRes == -1 ? mLogoBitmap : null; return mLogoRes == 0 ? mLogoBitmap : null; } public String getLogoDescription() { Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt +3 −4 Original line number Diff line number Diff line Loading @@ -1559,7 +1559,7 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa subtitle: String? = "s", description: String? = null, contentView: PromptContentView? = null, logoRes: Int = -1, logoRes: Int = 0, logoBitmap: Bitmap? = null, logoDescription: String? = null, packageName: String = OP_PACKAGE_NAME, Loading Loading @@ -1599,8 +1599,7 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa descriptionFromApp = description, contentViewFromApp = contentView, logoResFromApp = logoRes, logoBitmapFromApp = if (logoRes != -1) logoDrawableFromAppRes.toBitmap() else logoBitmap, logoBitmapFromApp = if (logoRes != 0) logoDrawableFromAppRes.toBitmap() else logoBitmap, logoDescriptionFromApp = logoDescription, packageName = packageName, ) Loading Loading @@ -1787,7 +1786,7 @@ private fun PromptSelectorInteractor.initializePrompt( subtitleFromApp: String? = "s", descriptionFromApp: String? = null, contentViewFromApp: PromptContentView? = null, logoResFromApp: Int = -1, logoResFromApp: Int = 0, logoBitmapFromApp: Bitmap? = null, logoDescriptionFromApp: String? = null, packageName: String = OP_PACKAGE_NAME, Loading