Remove custom_biometric_prompt flag
Test: N/A
Bug: 302735104
Flag: EXEMPT removing android.hardware.biometrics.custom_biometric_prompt
Change-Id: I92935be0cc7e69e5a995872f4a1f571660680c7b
diff --git a/core/api/current.txt b/core/api/current.txt
index a131ea7..adaa2f5 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -293,7 +293,7 @@
field public static final String SET_ALARM = "com.android.alarm.permission.SET_ALARM";
field public static final String SET_ALWAYS_FINISH = "android.permission.SET_ALWAYS_FINISH";
field public static final String SET_ANIMATION_SCALE = "android.permission.SET_ANIMATION_SCALE";
- field @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public static final String SET_BIOMETRIC_DIALOG_ADVANCED = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED";
+ field public static final String SET_BIOMETRIC_DIALOG_ADVANCED = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED";
field public static final String SET_DEBUG_APP = "android.permission.SET_DEBUG_APP";
field @Deprecated public static final String SET_PREFERRED_APPLICATIONS = "android.permission.SET_PREFERRED_APPLICATIONS";
field public static final String SET_PROCESS_LIMIT = "android.permission.SET_PROCESS_LIMIT";
@@ -19045,11 +19045,11 @@
method @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public void authenticate(@NonNull android.hardware.biometrics.BiometricPrompt.CryptoObject, @NonNull android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.biometrics.BiometricPrompt.AuthenticationCallback);
method @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public void authenticate(@NonNull android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.biometrics.BiometricPrompt.AuthenticationCallback);
method @Nullable public int getAllowedAuthenticators();
- method @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") @Nullable public android.hardware.biometrics.PromptContentView getContentView();
+ method @Nullable public android.hardware.biometrics.PromptContentView getContentView();
method @Nullable public CharSequence getDescription();
- method @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") @Nullable @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.graphics.Bitmap getLogoBitmap();
- method @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") @Nullable @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public String getLogoDescription();
- method @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") @DrawableRes @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public int getLogoRes();
+ method @Nullable @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.graphics.Bitmap getLogoBitmap();
+ method @Nullable @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public String getLogoDescription();
+ method @DrawableRes @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public int getLogoRes();
method @Nullable public CharSequence getNegativeButtonText();
method @Nullable public CharSequence getSubtitle();
method @NonNull public CharSequence getTitle();
@@ -19096,12 +19096,12 @@
method @NonNull public android.hardware.biometrics.BiometricPrompt build();
method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setAllowedAuthenticators(int);
method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setConfirmationRequired(boolean);
- method @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setContentView(@NonNull android.hardware.biometrics.PromptContentView);
+ method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setContentView(@NonNull android.hardware.biometrics.PromptContentView);
method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setDescription(@NonNull CharSequence);
method @Deprecated @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setDeviceCredentialAllowed(boolean);
- method @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") @NonNull @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.hardware.biometrics.BiometricPrompt.Builder setLogoBitmap(@NonNull android.graphics.Bitmap);
- method @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") @NonNull @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.hardware.biometrics.BiometricPrompt.Builder setLogoDescription(@NonNull String);
- method @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") @NonNull @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.hardware.biometrics.BiometricPrompt.Builder setLogoRes(@DrawableRes int);
+ method @NonNull @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.hardware.biometrics.BiometricPrompt.Builder setLogoBitmap(@NonNull android.graphics.Bitmap);
+ method @NonNull @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.hardware.biometrics.BiometricPrompt.Builder setLogoDescription(@NonNull String);
+ method @NonNull @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.hardware.biometrics.BiometricPrompt.Builder setLogoRes(@DrawableRes int);
method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setNegativeButton(@NonNull CharSequence, @NonNull java.util.concurrent.Executor, @NonNull android.content.DialogInterface.OnClickListener);
method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setSubtitle(@NonNull CharSequence);
method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setTitle(@NonNull CharSequence);
@@ -19124,27 +19124,27 @@
method @Nullable public java.security.Signature getSignature();
}
- @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public interface PromptContentItem {
+ public interface PromptContentItem {
}
- @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public final class PromptContentItemBulletedText implements android.os.Parcelable android.hardware.biometrics.PromptContentItem {
+ public final class PromptContentItemBulletedText implements android.os.Parcelable android.hardware.biometrics.PromptContentItem {
ctor public PromptContentItemBulletedText(@NonNull String);
method public int describeContents();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.biometrics.PromptContentItemBulletedText> CREATOR;
}
- @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public final class PromptContentItemPlainText implements android.os.Parcelable android.hardware.biometrics.PromptContentItem {
+ public final class PromptContentItemPlainText implements android.os.Parcelable android.hardware.biometrics.PromptContentItem {
ctor public PromptContentItemPlainText(@NonNull String);
method public int describeContents();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.biometrics.PromptContentItemPlainText> CREATOR;
}
- @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public interface PromptContentView {
+ public interface PromptContentView {
}
- @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public final class PromptContentViewWithMoreOptionsButton implements android.os.Parcelable android.hardware.biometrics.PromptContentView {
+ public final class PromptContentViewWithMoreOptionsButton implements android.os.Parcelable android.hardware.biometrics.PromptContentView {
method public int describeContents();
method @Nullable @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public String getDescription();
method @NonNull @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.content.DialogInterface.OnClickListener getMoreOptionsButtonListener();
@@ -19159,7 +19159,7 @@
method @NonNull @RequiresPermission(android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED) public android.hardware.biometrics.PromptContentViewWithMoreOptionsButton.Builder setMoreOptionsButtonListener(@NonNull java.util.concurrent.Executor, @NonNull android.content.DialogInterface.OnClickListener);
}
- @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public final class PromptVerticalListContentView implements android.os.Parcelable android.hardware.biometrics.PromptContentView {
+ public final class PromptVerticalListContentView implements android.os.Parcelable android.hardware.biometrics.PromptContentView {
method public int describeContents();
method @Nullable public String getDescription();
method @NonNull public java.util.List<android.hardware.biometrics.PromptContentItem> getListItems();
diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java
index e3fdd26..3ff21d8 100644
--- a/core/java/android/hardware/biometrics/BiometricPrompt.java
+++ b/core/java/android/hardware/biometrics/BiometricPrompt.java
@@ -22,7 +22,6 @@
import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;
import static android.hardware.biometrics.BiometricManager.Authenticators;
import static android.hardware.biometrics.Flags.FLAG_ADD_KEY_AGREEMENT_CRYPTO_OBJECT;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
import static android.hardware.biometrics.Flags.FLAG_GET_OP_ID_CRYPTO_OBJECT;
import static android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE;
@@ -200,7 +199,6 @@
* @param logoRes A drawable resource of the logo that will be shown on the prompt.
* @return This builder.
*/
- @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
@RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED)
@NonNull
public BiometricPrompt.Builder setLogoRes(@DrawableRes int logoRes) {
@@ -226,7 +224,6 @@
* @param logoBitmap A bitmap drawable of the logo that will be shown on the prompt.
* @return This builder.
*/
- @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
@RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED)
@NonNull
public BiometricPrompt.Builder setLogoBitmap(@NonNull Bitmap logoBitmap) {
@@ -250,7 +247,6 @@
* @return This builder.
* @throws IllegalArgumentException If logo description is null.
*/
- @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
@RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED)
@NonNull
public BiometricPrompt.Builder setLogoDescription(@NonNull String logoDescription) {
@@ -342,7 +338,6 @@
* @param view The customized view information.
* @return This builder.
*/
- @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
@NonNull
public BiometricPrompt.Builder setContentView(@NonNull PromptContentView view) {
mPromptInfo.setContentView(view);
@@ -851,7 +846,6 @@
*
* @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)
@DrawableRes
public int getLogoRes() {
@@ -864,7 +858,6 @@
*
* @return The logo bitmap of the prompt, or null if the prompt has no logo bitmap set.
*/
- @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
@RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED)
@Nullable
public Bitmap getLogoBitmap() {
@@ -879,7 +872,6 @@
* @return The logo description of the prompt, or null if the prompt has no logo description
* set.
*/
- @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
@RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED)
@Nullable
public String getLogoDescription() {
@@ -939,7 +931,6 @@
*
* @return The content view for the prompt, or null if the prompt has no content view.
*/
- @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
@Nullable
public PromptContentView getContentView() {
return mPromptInfo.getContentView();
diff --git a/core/java/android/hardware/biometrics/PromptContentItem.java b/core/java/android/hardware/biometrics/PromptContentItem.java
index c47b37a..0c41782 100644
--- a/core/java/android/hardware/biometrics/PromptContentItem.java
+++ b/core/java/android/hardware/biometrics/PromptContentItem.java
@@ -16,14 +16,9 @@
package android.hardware.biometrics;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
-
-import android.annotation.FlaggedApi;
-
/**
* An item shown on {@link PromptContentView}.
*/
-@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
public interface PromptContentItem {
}
diff --git a/core/java/android/hardware/biometrics/PromptContentItemBulletedText.java b/core/java/android/hardware/biometrics/PromptContentItemBulletedText.java
index 25e5cca..a026498 100644
--- a/core/java/android/hardware/biometrics/PromptContentItemBulletedText.java
+++ b/core/java/android/hardware/biometrics/PromptContentItemBulletedText.java
@@ -16,9 +16,6 @@
package android.hardware.biometrics;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
-
-import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
@@ -26,7 +23,6 @@
/**
* A list item with bulleted text shown on {@link PromptVerticalListContentView}.
*/
-@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
public final class PromptContentItemBulletedText implements PromptContentItemParcelable {
private final String mText;
diff --git a/core/java/android/hardware/biometrics/PromptContentItemParcelable.java b/core/java/android/hardware/biometrics/PromptContentItemParcelable.java
index 668912cf..1860aae 100644
--- a/core/java/android/hardware/biometrics/PromptContentItemParcelable.java
+++ b/core/java/android/hardware/biometrics/PromptContentItemParcelable.java
@@ -16,15 +16,11 @@
package android.hardware.biometrics;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
-
-import android.annotation.FlaggedApi;
import android.os.Parcelable;
/**
* A parcelable {@link PromptContentItem}.
*/
-@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
sealed interface PromptContentItemParcelable extends PromptContentItem, Parcelable
permits PromptContentItemPlainText, PromptContentItemBulletedText {
}
diff --git a/core/java/android/hardware/biometrics/PromptContentItemPlainText.java b/core/java/android/hardware/biometrics/PromptContentItemPlainText.java
index 7919256..a5e6120 100644
--- a/core/java/android/hardware/biometrics/PromptContentItemPlainText.java
+++ b/core/java/android/hardware/biometrics/PromptContentItemPlainText.java
@@ -16,9 +16,6 @@
package android.hardware.biometrics;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
-
-import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
@@ -26,7 +23,6 @@
/**
* A list item with plain text shown on {@link PromptVerticalListContentView}.
*/
-@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
public final class PromptContentItemPlainText implements PromptContentItemParcelable {
private final String mText;
diff --git a/core/java/android/hardware/biometrics/PromptContentView.java b/core/java/android/hardware/biometrics/PromptContentView.java
index ff9313e..0836d72 100644
--- a/core/java/android/hardware/biometrics/PromptContentView.java
+++ b/core/java/android/hardware/biometrics/PromptContentView.java
@@ -16,13 +16,8 @@
package android.hardware.biometrics;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
-
-import android.annotation.FlaggedApi;
-
/**
* Contains the information of the template of content view for Biometric Prompt.
*/
-@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
public interface PromptContentView {
}
diff --git a/core/java/android/hardware/biometrics/PromptContentViewParcelable.java b/core/java/android/hardware/biometrics/PromptContentViewParcelable.java
index b5982d4..6e03563 100644
--- a/core/java/android/hardware/biometrics/PromptContentViewParcelable.java
+++ b/core/java/android/hardware/biometrics/PromptContentViewParcelable.java
@@ -16,15 +16,11 @@
package android.hardware.biometrics;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
-
-import android.annotation.FlaggedApi;
import android.os.Parcelable;
/**
* A parcelable {@link PromptContentView}.
*/
-@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
sealed interface PromptContentViewParcelable extends PromptContentView, Parcelable
permits PromptVerticalListContentView, PromptContentViewWithMoreOptionsButton {
}
diff --git a/core/java/android/hardware/biometrics/PromptContentViewWithMoreOptionsButton.java b/core/java/android/hardware/biometrics/PromptContentViewWithMoreOptionsButton.java
index 4b9d5ce..aa0ce58 100644
--- a/core/java/android/hardware/biometrics/PromptContentViewWithMoreOptionsButton.java
+++ b/core/java/android/hardware/biometrics/PromptContentViewWithMoreOptionsButton.java
@@ -17,10 +17,8 @@
package android.hardware.biometrics;
import static android.Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
import android.annotation.CallbackExecutor;
-import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -61,7 +59,6 @@
* .build();
* </pre>
*/
-@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
public final class PromptContentViewWithMoreOptionsButton implements PromptContentViewParcelable {
private static final String TAG = "PromptContentViewWithMoreOptionsButton";
@VisibleForTesting
diff --git a/core/java/android/hardware/biometrics/PromptInfo.java b/core/java/android/hardware/biometrics/PromptInfo.java
index df5d864..00ab766 100644
--- a/core/java/android/hardware/biometrics/PromptInfo.java
+++ b/core/java/android/hardware/biometrics/PromptInfo.java
@@ -217,7 +217,7 @@
* Returns if the PromptContentViewWithMoreOptionsButton is set.
*/
public boolean isContentViewMoreOptionsButtonUsed() {
- return Flags.customBiometricPrompt() && mContentView != null
+ return mContentView != null
&& mContentView instanceof PromptContentViewWithMoreOptionsButton;
}
diff --git a/core/java/android/hardware/biometrics/PromptVerticalListContentView.java b/core/java/android/hardware/biometrics/PromptVerticalListContentView.java
index 86006f8..2a521d1 100644
--- a/core/java/android/hardware/biometrics/PromptVerticalListContentView.java
+++ b/core/java/android/hardware/biometrics/PromptVerticalListContentView.java
@@ -16,9 +16,6 @@
package android.hardware.biometrics;
-import static android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT;
-
-import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Parcel;
@@ -48,7 +45,6 @@
* .build();
* </pre>
*/
-@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
public final class PromptVerticalListContentView implements PromptContentViewParcelable {
private static final String TAG = "PromptVerticalListContentView";
@VisibleForTesting
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 549f8df..7e3a1b0 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -6999,7 +6999,6 @@
<!-- Allows an application to set the advanced features on BiometricDialog (SystemUI), including
logo, logo description, and content view with more options button.
<p>Not for use by third-party applications.
- @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt")
-->
<permission android:name="android.permission.SET_BIOMETRIC_DIALOG_ADVANCED"
android:protectionLevel="signature|privileged" />
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
index 55fd344..c803097 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
@@ -28,7 +28,6 @@
import android.graphics.Rect
import android.graphics.drawable.BitmapDrawable
import android.hardware.biometrics.BiometricFingerprintConstants
-import android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT
import android.hardware.biometrics.PromptContentItemBulletedText
import android.hardware.biometrics.PromptContentView
import android.hardware.biometrics.PromptContentViewWithMoreOptionsButton
@@ -163,7 +162,7 @@
naturalDisplayWidth = 1000,
naturalDisplayHeight = 3000,
scaleFactor = 1f,
- rotation = if (isLandscape) Surface.ROTATION_90 else Surface.ROTATION_0
+ rotation = if (isLandscape) Surface.ROTATION_90 else Surface.ROTATION_0,
)
private lateinit var promptContentView: PromptContentView
@@ -180,21 +179,21 @@
whenever(
kosmos.packageManager.getApplicationInfo(
eq(OP_PACKAGE_NAME_WITH_APP_LOGO),
- anyInt()
+ anyInt(),
)
)
.thenReturn(applicationInfoWithIconAndDescription)
whenever(
kosmos.packageManager.getApplicationInfo(
eq(OP_PACKAGE_NAME_WITH_ACTIVITY_LOGO),
- anyInt()
+ anyInt(),
)
)
.thenReturn(applicationInfoWithIconAndDescription)
whenever(
kosmos.packageManager.getApplicationInfo(
eq(OP_PACKAGE_NAME_CAN_NOT_BE_FOUND),
- anyInt()
+ anyInt(),
)
)
.thenThrow(NameNotFoundException())
@@ -220,13 +219,13 @@
overrideResource(logoResFromApp, logoDrawableFromAppRes)
overrideResource(
R.array.config_useActivityLogoForBiometricPrompt,
- arrayOf(OP_PACKAGE_NAME_WITH_ACTIVITY_LOGO)
+ arrayOf(OP_PACKAGE_NAME_WITH_ACTIVITY_LOGO),
)
overrideResource(R.dimen.biometric_dialog_fingerprint_icon_width, mockFingerprintIconWidth)
overrideResource(
R.dimen.biometric_dialog_fingerprint_icon_height,
- mockFingerprintIconHeight
+ mockFingerprintIconHeight,
)
overrideResource(R.dimen.biometric_dialog_face_icon_size, mockFaceIconSize)
@@ -243,7 +242,7 @@
it.sensorType.toSensorType(),
it.allLocations.associateBy { sensorLocationInternal ->
sensorLocationInternal.displayId
- }
+ },
)
}
@@ -441,7 +440,7 @@
kosmos.promptViewModel.showAuthenticated(
modality = testCase.authenticatedModality,
- dismissAfterDelay = DELAY
+ dismissAfterDelay = DELAY,
)
// SFPS test cases
@@ -513,7 +512,7 @@
kosmos.promptViewModel.showAuthenticated(
modality = testCase.authenticatedModality,
dismissAfterDelay = DELAY,
- "TEST"
+ "TEST",
)
if (testCase.isFingerprintOnly) {
@@ -558,7 +557,7 @@
kosmos.promptViewModel.showAuthenticated(
modality = testCase.authenticatedModality,
- dismissAfterDelay = DELAY
+ dismissAfterDelay = DELAY,
)
if (testCase.isFaceOnly) {
@@ -598,7 +597,7 @@
kosmos.promptViewModel.showAuthenticated(
modality = testCase.authenticatedModality,
- dismissAfterDelay = DELAY
+ dismissAfterDelay = DELAY,
)
kosmos.promptViewModel.confirmAuthenticated()
@@ -701,7 +700,7 @@
.isEqualTo(
Pair(
expectedUdfpsOverlayParams.sensorBounds.width(),
- expectedUdfpsOverlayParams.sensorBounds.height()
+ expectedUdfpsOverlayParams.sensorBounds.height(),
)
)
} else {
@@ -834,7 +833,7 @@
kosmos.promptViewModel.showAuthenticated(
modality = testCase.authenticatedModality,
- dismissAfterDelay = DELAY
+ dismissAfterDelay = DELAY,
)
kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_0)
@@ -907,10 +906,7 @@
}
)
- assertButtonsVisible(
- cancel = expectConfirmation,
- confirm = expectConfirmation,
- )
+ assertButtonsVisible(cancel = expectConfirmation, confirm = expectConfirmation)
}
@Test
@@ -1158,10 +1154,7 @@
testScheduler.runCurrent()
assertThat(messages)
- .containsExactly(
- PromptMessage.Empty,
- PromptMessage.Error(expectedErrorMessage),
- )
+ .containsExactly(PromptMessage.Empty, PromptMessage.Error(expectedErrorMessage))
.inOrder()
testScheduler.advanceUntilIdle()
@@ -1221,10 +1214,7 @@
assertThat(authenticated?.needsUserConfirmation).isEqualTo(expectConfirmation)
if (expectConfirmation) {
assertThat(size).isEqualTo(PromptSize.MEDIUM)
- assertButtonsVisible(
- cancel = true,
- confirm = true,
- )
+ assertButtonsVisible(cancel = true, confirm = true)
kosmos.promptViewModel.confirmAuthenticated()
assertThat(message).isEqualTo(PromptMessage.Empty)
@@ -1251,10 +1241,7 @@
assertThat(authenticated?.needsUserConfirmation).isEqualTo(expectConfirmation)
if (expectConfirmation) {
assertThat(size).isEqualTo(PromptSize.MEDIUM)
- assertButtonsVisible(
- cancel = true,
- confirm = true,
- )
+ assertButtonsVisible(cancel = true, confirm = true)
if (testCase.modalities.hasSfps) {
kosmos.promptViewModel.showAuthenticated(BiometricModality.Fingerprint, 0)
@@ -1290,10 +1277,7 @@
if (expectConfirmation) {
if (testCase.isFaceOnly) {
assertThat(size).isEqualTo(PromptSize.MEDIUM)
- assertButtonsVisible(
- cancel = true,
- confirm = true,
- )
+ assertButtonsVisible(cancel = true, confirm = true)
kosmos.promptViewModel.confirmAuthenticated()
} else if (testCase.isCoex) {
@@ -1323,10 +1307,7 @@
assertThat(authenticated?.needsUserConfirmation).isEqualTo(expectConfirmation)
if (expectConfirmation) {
assertThat(size).isEqualTo(PromptSize.MEDIUM)
- assertButtonsVisible(
- cancel = true,
- confirm = true,
- )
+ assertButtonsVisible(cancel = true, confirm = true)
kosmos.promptViewModel.confirmAuthenticated()
assertThat(message).isEqualTo(PromptMessage.Empty)
@@ -1398,10 +1379,7 @@
assertThat(authenticating).isFalse()
assertThat(authenticated?.isAuthenticated).isTrue()
assertThat(authenticated?.needsUserConfirmation).isEqualTo(expectConfirmation)
- assertButtonsVisible(
- cancel = expectConfirmation,
- confirm = expectConfirmation,
- )
+ assertButtonsVisible(cancel = expectConfirmation, confirm = expectConfirmation)
}
@Test
@@ -1421,7 +1399,7 @@
errorMessage,
messageAfterError = helpMessage,
authenticateAfterError = false,
- failedModality = testCase.authenticatedModality
+ failedModality = testCase.authenticatedModality,
)
}
@@ -1472,7 +1450,7 @@
kosmos.promptViewModel.onAnnounceAccessibilityHint(
obtainMotionEvent(MotionEvent.ACTION_HOVER_ENTER),
- true
+ true,
)
if (testCase.modalities.hasUdfps) {
@@ -1497,14 +1475,13 @@
kosmos.promptViewModel.onAnnounceAccessibilityHint(
obtainMotionEvent(MotionEvent.ACTION_HOVER_ENTER),
- true
+ true,
)
assertThat(hint.isNullOrBlank()).isTrue()
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun descriptionOverriddenByVerticalListContentView() =
runGenericTest(description = "test description", contentView = promptContentView) {
val contentView by collectLastValue(kosmos.promptViewModel.contentView)
@@ -1515,11 +1492,10 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun descriptionOverriddenByContentViewWithMoreOptionsButton() =
runGenericTest(
description = "test description",
- contentView = promptContentViewWithMoreOptionsButton
+ contentView = promptContentViewWithMoreOptionsButton,
) {
val contentView by collectLastValue(kosmos.promptViewModel.contentView)
val description by collectLastValue(kosmos.promptViewModel.description)
@@ -1529,7 +1505,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun descriptionWithoutContentView() =
runGenericTest(description = "test description") {
val contentView by collectLastValue(kosmos.promptViewModel.contentView)
@@ -1540,7 +1515,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logo_nullIfPkgNameNotFound() =
runGenericTest(packageName = OP_PACKAGE_NAME_CAN_NOT_BE_FOUND) {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
@@ -1549,7 +1523,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logo_defaultFromActivityInfo() =
runGenericTest(packageName = OP_PACKAGE_NAME_WITH_ACTIVITY_LOGO) {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
@@ -1564,7 +1537,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logo_defaultIsNull() =
runGenericTest(packageName = OP_PACKAGE_NAME_NO_ICON) {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
@@ -1573,7 +1545,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logo_default() = runGenericTest {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
assertThat(logoInfo).isNotNull()
@@ -1581,7 +1552,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logo_resSetByApp() =
runGenericTest(logoRes = logoResFromApp) {
val expectedBitmap = context.getDrawable(logoResFromApp).toBitmap()
@@ -1591,7 +1561,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logo_bitmapSetByApp() =
runGenericTest(logoBitmap = logoBitmapFromApp) {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
@@ -1599,7 +1568,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logoDescription_emptyIfPkgNameNotFound() =
runGenericTest(packageName = OP_PACKAGE_NAME_CAN_NOT_BE_FOUND) {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
@@ -1607,7 +1575,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logoDescription_defaultFromActivityInfo() =
runGenericTest(packageName = OP_PACKAGE_NAME_WITH_ACTIVITY_LOGO) {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
@@ -1619,7 +1586,6 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logoDescription_defaultIsEmpty() =
runGenericTest(packageName = OP_PACKAGE_NAME_NO_ICON) {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
@@ -1627,14 +1593,12 @@
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logoDescription_default() = runGenericTest {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
assertThat(logoInfo!!.second).isEqualTo(defaultLogoDescriptionFromAppInfo)
}
@Test
- @EnableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
fun logoDescription_setByApp() =
runGenericTest(logoDescription = logoDescriptionFromApp) {
val logoInfo by collectLastValue(kosmos.promptViewModel.logoInfo)
@@ -1826,7 +1790,7 @@
kosmos.biometricStatusRepository.setFingerprintAcquiredStatus(
AcquiredFingerprintAuthenticationStatus(
AuthenticationReason.BiometricPromptAuthentication,
- BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_UNKNOWN
+ BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_UNKNOWN,
)
)
@@ -1893,7 +1857,7 @@
fingerprint =
fingerprintSensorPropertiesInternal(
strong = true,
- sensorType = FingerprintSensorProperties.TYPE_POWER_BUTTON
+ sensorType = FingerprintSensorProperties.TYPE_POWER_BUTTON,
)
.first(),
authenticatedModality = BiometricModality.Fingerprint,
@@ -1903,7 +1867,7 @@
fingerprint =
fingerprintSensorPropertiesInternal(
strong = true,
- sensorType = FingerprintSensorProperties.TYPE_POWER_BUTTON
+ sensorType = FingerprintSensorProperties.TYPE_POWER_BUTTON,
)
.first(),
authenticatedModality = BiometricModality.Fingerprint,
@@ -1913,7 +1877,7 @@
fingerprint =
fingerprintSensorPropertiesInternal(
strong = true,
- sensorType = FingerprintSensorProperties.TYPE_UDFPS_OPTICAL
+ sensorType = FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
)
.first(),
authenticatedModality = BiometricModality.Fingerprint,
@@ -1932,7 +1896,7 @@
fingerprint =
fingerprintSensorPropertiesInternal(
strong = true,
- sensorType = FingerprintSensorProperties.TYPE_POWER_BUTTON
+ sensorType = FingerprintSensorProperties.TYPE_POWER_BUTTON,
)
.first(),
authenticatedModality = BiometricModality.Fingerprint,
@@ -1958,7 +1922,7 @@
fingerprint =
fingerprintSensorPropertiesInternal(
strong = true,
- sensorType = FingerprintSensorProperties.TYPE_POWER_BUTTON
+ sensorType = FingerprintSensorProperties.TYPE_POWER_BUTTON,
)
.first(),
authenticatedModality = BiometricModality.Fingerprint,
@@ -1969,7 +1933,7 @@
fingerprint =
fingerprintSensorPropertiesInternal(
strong = true,
- sensorType = FingerprintSensorProperties.TYPE_UDFPS_OPTICAL
+ sensorType = FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
)
.first(),
authenticatedModality = BiometricModality.Fingerprint,
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
index 69ab976..51e08e2 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
@@ -33,7 +33,6 @@
import android.hardware.biometrics.BiometricAuthenticator.Modality;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricManager.Authenticators;
-import android.hardware.biometrics.Flags;
import android.hardware.biometrics.PromptInfo;
import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
@@ -676,10 +675,8 @@
final Runnable endActionRunnable = () -> {
setVisibility(View.INVISIBLE);
- if (Flags.customBiometricPrompt()) {
// TODO(b/288175645): resetPrompt calls should be lifecycle aware
mPromptSelectorInteractorProvider.get().resetPrompt(getRequestId());
- }
removeWindowIfAttached();
};
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/PromptSelectorInteractor.kt b/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/PromptSelectorInteractor.kt
index 6da5e42..e514172 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/PromptSelectorInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/PromptSelectorInteractor.kt
@@ -16,7 +16,6 @@
package com.android.systemui.biometrics.domain.interactor
-import android.hardware.biometrics.Flags
import android.hardware.biometrics.PromptInfo
import com.android.internal.widget.LockPatternUtils
import com.android.systemui.biometrics.Utils
@@ -187,8 +186,7 @@
) {
val hasCredentialViewShown = promptKind.value.isCredential()
val showBpForCredential =
- Flags.customBiometricPrompt() &&
- !Utils.isBiometricAllowed(promptInfo) &&
+ !Utils.isBiometricAllowed(promptInfo) &&
isDeviceCredentialAllowed(promptInfo) &&
promptInfo.contentView != null &&
!promptInfo.isContentViewMoreOptionsButtonUsed
@@ -211,10 +209,7 @@
PromptKind.Biometric.PaneType.ONE_PANE_NO_SENSOR_LANDSCAPE
else -> PromptKind.Biometric.PaneType.TWO_PANE_LANDSCAPE
}
- PromptKind.Biometric(
- modalities,
- paneType = paneType,
- )
+ PromptKind.Biometric(modalities, paneType = paneType)
} else {
PromptKind.Biometric(modalities)
}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
index e7e8d8f..9868c9b 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
@@ -22,7 +22,6 @@
import android.hardware.biometrics.BiometricAuthenticator
import android.hardware.biometrics.BiometricConstants
import android.hardware.biometrics.BiometricPrompt
-import android.hardware.biometrics.Flags
import android.hardware.face.FaceManager
import android.util.Log
import android.view.MotionEvent
@@ -93,7 +92,7 @@
val attributes =
view.context.obtainStyledAttributes(
R.style.TextAppearance_AuthCredential_Indicator,
- intArrayOf(android.R.attr.textColor)
+ intArrayOf(android.R.attr.textColor),
)
val textColorHint = attributes.getColor(0, 0)
attributes.recycle()
@@ -130,13 +129,13 @@
object : AccessibilityDelegateCompat() {
override fun onInitializeAccessibilityNodeInfo(
host: View,
- info: AccessibilityNodeInfoCompat
+ info: AccessibilityNodeInfoCompat,
) {
super.onInitializeAccessibilityNodeInfo(host, info)
info.addAction(
AccessibilityActionCompat(
AccessibilityNodeInfoCompat.ACTION_CLICK,
- view.context.getString(R.string.biometric_dialog_cancel_authentication)
+ view.context.getString(R.string.biometric_dialog_cancel_authentication),
)
)
}
@@ -189,13 +188,11 @@
subtitleView.text = viewModel.subtitle.first()
descriptionView.text = viewModel.description.first()
- if (Flags.customBiometricPrompt()) {
- BiometricCustomizedViewBinder.bind(
- customizedViewContainer,
- viewModel.contentView.first(),
- legacyCallback
- )
- }
+ BiometricCustomizedViewBinder.bind(
+ customizedViewContainer,
+ viewModel.contentView.first(),
+ legacyCallback,
+ )
// set button listeners
negativeButton.setOnClickListener { legacyCallback.onButtonNegative() }
@@ -233,10 +230,7 @@
lifecycleScope.launch {
viewModel.hideSensorIcon.collect { showWithoutIcon ->
if (!showWithoutIcon) {
- PromptIconViewBinder.bind(
- iconView,
- viewModel,
- )
+ PromptIconViewBinder.bind(iconView, viewModel)
}
}
}
@@ -421,7 +415,7 @@
launch {
viewModel.onAnnounceAccessibilityHint(
event,
- accessibilityManager.isTouchExplorationEnabled
+ accessibilityManager.isTouchExplorationEnabled,
)
}
false
@@ -444,10 +438,7 @@
haptics.flag,
)
} else {
- vibratorHelper.performHapticFeedback(
- view,
- haptics.constant,
- )
+ vibratorHelper.performHapticFeedback(view, haptics.constant)
}
}
is PromptViewModel.HapticsToPlay.MSDL -> {
@@ -561,14 +552,12 @@
viewModel.showAuthenticated(
modality = authenticatedModality,
dismissAfterDelay = 500,
- helpMessage = if (msgId != null) applicationContext.getString(msgId) else ""
+ helpMessage = if (msgId != null) applicationContext.getString(msgId) else "",
)
}
}
- private fun getHelpForSuccessfulAuthentication(
- authenticatedModality: BiometricModality,
- ): Int? {
+ private fun getHelpForSuccessfulAuthentication(authenticatedModality: BiometricModality): Int? {
// for coex, show a message when face succeeds after fingerprint has also started
if (authenticatedModality != BiometricModality.Face) {
return null
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/CredentialViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/CredentialViewBinder.kt
index 49f4b05..bb8d7ab 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/CredentialViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/CredentialViewBinder.kt
@@ -1,6 +1,5 @@
package com.android.systemui.biometrics.ui.binder
-import android.hardware.biometrics.Flags
import android.view.View
import android.view.ViewGroup
import android.widget.Button
@@ -67,7 +66,7 @@
updateForContentDimensions(
containerWidth,
containerHeight,
- 0 // animateDurationMs
+ 0, // animateDurationMs
)
}
}
@@ -81,13 +80,11 @@
subtitleView.textOrHide = header.subtitle
descriptionView.textOrHide = header.description
- if (Flags.customBiometricPrompt()) {
- BiometricCustomizedViewBinder.bind(
- customizedViewContainer,
- header.contentView,
- legacyCallback
- )
- }
+ BiometricCustomizedViewBinder.bind(
+ customizedViewContainer,
+ header.contentView,
+ legacyCallback,
+ )
iconView?.setImageDrawable(header.icon)
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/CredentialViewModel.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/CredentialViewModel.kt
index 761c3da..0c5c723 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/CredentialViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/CredentialViewModel.kt
@@ -2,7 +2,6 @@
import android.content.Context
import android.graphics.drawable.Drawable
-import android.hardware.biometrics.Flags.customBiometricPrompt
import android.hardware.biometrics.PromptContentView
import android.text.InputType
import com.android.internal.widget.LockPatternView
@@ -36,21 +35,17 @@
val header: Flow<CredentialHeaderViewModel> =
combine(
credentialInteractor.prompt.filterIsInstance<BiometricPromptRequest.Credential>(),
- credentialInteractor.showTitleOnly
+ credentialInteractor.showTitleOnly,
) { request, showTitleOnly ->
- val flagEnabled = customBiometricPrompt()
- val showTitleOnlyForCredential = showTitleOnly && flagEnabled
BiometricPromptHeaderViewModelImpl(
request,
user = request.userInfo,
title = request.title,
- subtitle = if (showTitleOnlyForCredential) "" else request.subtitle,
- contentView =
- if (flagEnabled && !showTitleOnlyForCredential) request.contentView else null,
- description =
- if (flagEnabled && request.contentView != null) "" else request.description,
+ subtitle = if (showTitleOnly) "" else request.subtitle,
+ contentView = if (!showTitleOnly) request.contentView else null,
+ description = if (request.contentView != null) "" else request.description,
icon = applicationContext.asLockIcon(request.userInfo.deviceCredentialOwnerId),
- showEmergencyCallButton = request.showEmergencyCallButton
+ showEmergencyCallButton = request.showEmergencyCallButton,
)
}
@@ -125,7 +120,7 @@
/** Check a pattern and update [validatedAttestation] or [remainingAttempts]. */
suspend fun checkCredential(
pattern: List<LockPatternView.Cell>,
- header: CredentialHeaderViewModel
+ header: CredentialHeaderViewModel,
) = checkCredential(credentialInteractor.checkCredential(header.asRequest(), pattern = pattern))
private suspend fun checkCredential(result: CredentialStatus) {
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt
index 168ba11..d71abf2 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt
@@ -27,7 +27,6 @@
import android.graphics.drawable.Drawable
import android.hardware.biometrics.BiometricFingerprintConstants
import android.hardware.biometrics.BiometricPrompt
-import android.hardware.biometrics.Flags.customBiometricPrompt
import android.hardware.biometrics.PromptContentView
import android.os.UserHandle
import android.text.TextPaint
@@ -145,13 +144,13 @@
rotatedBounds,
params.naturalDisplayWidth,
params.naturalDisplayHeight,
- rotation.ordinal
+ rotation.ordinal,
)
Rect(
rotatedBounds.left,
rotatedBounds.top,
params.logicalDisplayWidth - rotatedBounds.right,
- params.logicalDisplayHeight - rotatedBounds.bottom
+ params.logicalDisplayHeight - rotatedBounds.bottom,
)
}
.distinctUntilChanged()
@@ -263,7 +262,7 @@
promptKind,
displayStateInteractor.isLargeScreen,
displayStateInteractor.currentRotation,
- modalities
+ modalities,
) { forceLarge, promptKind, isLargeScreen, rotation, modalities ->
when {
forceLarge ||
@@ -351,7 +350,7 @@
0,
0,
landscapeMediumHorizontalPadding,
- landscapeMediumBottomPadding
+ landscapeMediumBottomPadding,
)
}
PromptPosition.Left ->
@@ -365,7 +364,7 @@
landscapeMediumHorizontalPadding,
0,
0,
- landscapeMediumBottomPadding
+ landscapeMediumBottomPadding,
)
}
PromptPosition.Top ->
@@ -474,7 +473,7 @@
promptSelectorInteractor.prompt
.map {
when {
- !(customBiometricPrompt()) || it == null -> Pair(null, "")
+ it == null -> Pair(null, "")
else -> context.getUserBadgedLogoInfo(it, iconProvider, activityTaskManager)
}
}
@@ -490,9 +489,7 @@
/** Custom content view for the prompt. */
val contentView: Flow<PromptContentView?> =
- promptSelectorInteractor.prompt
- .map { if (customBiometricPrompt()) it?.contentView else null }
- .distinctUntilChanged()
+ promptSelectorInteractor.prompt.map { it?.contentView }.distinctUntilChanged()
private val originalDescription =
promptSelectorInteractor.prompt.map { it?.description ?: "" }.distinctUntilChanged()
@@ -521,7 +518,7 @@
val attributes =
context.obtainStyledAttributes(
R.style.TextAppearance_AuthCredential_Title,
- intArrayOf(android.R.attr.textSize)
+ intArrayOf(android.R.attr.textSize),
)
val paint = TextPaint()
paint.textSize = attributes.getDimensionPixelSize(0, 0).toFloat()
@@ -566,7 +563,7 @@
private fun getHorizontalPadding(
size: PromptSize,
modalities: BiometricModalities,
- hasOnlyOneLineTitle: Boolean
+ hasOnlyOneLineTitle: Boolean,
) =
if (size.isSmall) {
-smallHorizontalGuidelinePadding
@@ -582,21 +579,13 @@
/** If the indicator (help, error) message should be shown. */
val isIndicatorMessageVisible: Flow<Boolean> =
- combine(
- size,
- position,
- message,
- ) { size, _, message ->
+ combine(size, position, message) { size, _, message ->
size.isMedium && message.message.isNotBlank()
}
/** If the auth is pending confirmation and the confirm button should be shown. */
val isConfirmButtonVisible: Flow<Boolean> =
- combine(
- size,
- position,
- isPendingConfirmation,
- ) { size, _, isPendingConfirmation ->
+ combine(size, position, isPendingConfirmation) { size, _, isPendingConfirmation ->
size.isNotSmall && isPendingConfirmation
}
@@ -606,24 +595,22 @@
/** If the negative button should be shown. */
val isNegativeButtonVisible: Flow<Boolean> =
- combine(
+ combine(size, position, isAuthenticated, promptSelectorInteractor.isCredentialAllowed) {
size,
- position,
- isAuthenticated,
- promptSelectorInteractor.isCredentialAllowed,
- ) { size, _, authState, credentialAllowed ->
+ _,
+ authState,
+ credentialAllowed ->
size.isNotSmall && authState.isNotAuthenticated && !credentialAllowed
}
/** If the cancel button should be shown (. */
val isCancelButtonVisible: Flow<Boolean> =
- combine(
+ combine(size, position, isAuthenticated, isNegativeButtonVisible, isConfirmButtonVisible) {
size,
- position,
- isAuthenticated,
- isNegativeButtonVisible,
- isConfirmButtonVisible,
- ) { size, _, authState, showNegativeButton, showConfirmButton ->
+ _,
+ authState,
+ showNegativeButton,
+ showConfirmButton ->
size.isNotSmall && authState.isAuthenticated && !showNegativeButton && showConfirmButton
}
@@ -633,33 +620,28 @@
* fingerprint sensor.
*/
val canTryAgainNow: Flow<Boolean> =
- combine(
- _canTryAgainNow,
+ combine(_canTryAgainNow, size, position, isAuthenticated, isRetrySupported) {
+ readyToTryAgain,
size,
- position,
- isAuthenticated,
- isRetrySupported,
- ) { readyToTryAgain, size, _, authState, supportsRetry ->
+ _,
+ authState,
+ supportsRetry ->
readyToTryAgain && size.isNotSmall && supportsRetry && authState.isNotAuthenticated
}
/** If the try again button show be shown (only the button, see [canTryAgainNow]). */
val isTryAgainButtonVisible: Flow<Boolean> =
- combine(
- canTryAgainNow,
- modalities,
- ) { tryAgainIsPossible, modalities ->
+ combine(canTryAgainNow, modalities) { tryAgainIsPossible, modalities ->
tryAgainIsPossible && modalities.hasFaceOnly
}
/** If the credential fallback button show be shown. */
val isCredentialButtonVisible: Flow<Boolean> =
- combine(
+ combine(size, position, isAuthenticated, promptSelectorInteractor.isCredentialAllowed) {
size,
- position,
- isAuthenticated,
- promptSelectorInteractor.isCredentialAllowed,
- ) { size, _, authState, credentialAllowed ->
+ _,
+ authState,
+ credentialAllowed ->
size.isMedium && authState.isNotAuthenticated && credentialAllowed
}
@@ -759,10 +741,7 @@
*
* Ignored if the user has already authenticated.
*/
- suspend fun showTemporaryHelp(
- message: String,
- messageAfterHelp: String = "",
- ) = coroutineScope {
+ suspend fun showTemporaryHelp(message: String, messageAfterHelp: String = "") = coroutineScope {
if (_isAuthenticated.value.isAuthenticated) {
return@coroutineScope
}
@@ -910,13 +889,13 @@
udfpsUtils.getTouchInNativeCoordinates(
event.getPointerId(0),
event,
- udfpsOverlayParams.value
+ udfpsOverlayParams.value,
)
if (
!udfpsUtils.isWithinSensorArea(
event.getPointerId(0),
event,
- udfpsOverlayParams.value
+ udfpsOverlayParams.value,
)
) {
_accessibilityHint.emit(
@@ -925,7 +904,7 @@
context,
scaledTouch.x,
scaledTouch.y,
- udfpsOverlayParams.value
+ udfpsOverlayParams.value,
)
)
}
@@ -948,10 +927,7 @@
if (msdlFeedback()) {
HapticsToPlay.MSDL(MSDLToken.UNLOCK, authInteractionProperties)
} else {
- HapticsToPlay.HapticConstant(
- HapticFeedbackConstants.BIOMETRIC_CONFIRM,
- flag = null,
- )
+ HapticsToPlay.HapticConstant(HapticFeedbackConstants.BIOMETRIC_CONFIRM, flag = null)
}
_hapticsToPlay.value = haptics
}
@@ -961,10 +937,7 @@
if (msdlFeedback()) {
HapticsToPlay.MSDL(MSDLToken.FAILURE, authInteractionProperties)
} else {
- HapticsToPlay.HapticConstant(
- HapticFeedbackConstants.BIOMETRIC_REJECT,
- flag = null,
- )
+ HapticsToPlay.HapticConstant(HapticFeedbackConstants.BIOMETRIC_REJECT, flag = null)
}
_hapticsToPlay.value = haptics
}
@@ -1006,7 +979,7 @@
private fun Context.getUserBadgedLogoInfo(
prompt: BiometricPromptRequest.Biometric,
iconProvider: IconProvider,
- activityTaskManager: ActivityTaskManager
+ activityTaskManager: ActivityTaskManager,
): Pair<Drawable?, String> {
var icon: Drawable? =
if (prompt.logoBitmap != null) BitmapDrawable(resources, prompt.logoBitmap) else null
@@ -1045,7 +1018,7 @@
packageManager
.getUserBadgedLabel(
packageManager.getApplicationLabel(appInfo),
- UserHandle.of(userId)
+ UserHandle.of(userId),
)
.toString()
}
@@ -1070,7 +1043,7 @@
private fun BiometricPromptRequest.Biometric.getApplicationInfo(
context: Context,
- componentNameForLogo: ComponentName?
+ componentNameForLogo: ComponentName?,
): ApplicationInfo? {
val packageName =
when {
@@ -1088,7 +1061,7 @@
try {
context.packageManager.getApplicationInfo(
packageName,
- PackageManager.MATCH_DISABLED_COMPONENTS or PackageManager.MATCH_ANY_USER
+ PackageManager.MATCH_DISABLED_COMPONENTS or PackageManager.MATCH_ANY_USER,
)
} catch (e: PackageManager.NameNotFoundException) {
Log.w(PromptViewModel.TAG, "Cannot find application info for $opPackageName", e)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt
index 7889b3c..b5ffcc3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt
@@ -22,7 +22,6 @@
import android.hardware.biometrics.BiometricAuthenticator
import android.hardware.biometrics.BiometricConstants
import android.hardware.biometrics.BiometricManager
-import android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT
import android.hardware.biometrics.PromptContentViewWithMoreOptionsButton
import android.hardware.biometrics.PromptInfo
import android.hardware.biometrics.PromptVerticalListContentView
@@ -176,7 +175,7 @@
BiometricStatusInteractorImpl(
activityTaskManager,
biometricStatusRepository,
- fingerprintRepository
+ fingerprintRepository,
)
iconProvider = IconProvider(context)
// Set up default logo icon
@@ -278,7 +277,7 @@
.onDismissed(
eq(AuthDialogCallback.DISMISSED_BIOMETRIC_AUTHENTICATED),
eq<ByteArray?>(null), /* credentialAttestation */
- eq(authContainer?.requestId ?: 0L)
+ eq(authContainer?.requestId ?: 0L),
)
assertThat(container.parent).isNull()
}
@@ -292,13 +291,13 @@
verify(callback)
.onSystemEvent(
eq(BiometricConstants.BIOMETRIC_SYSTEM_EVENT_EARLY_USER_CANCEL),
- eq(authContainer?.requestId ?: 0L)
+ eq(authContainer?.requestId ?: 0L),
)
verify(callback)
.onDismissed(
eq(AuthDialogCallback.DISMISSED_USER_CANCELED),
eq<ByteArray?>(null), /* credentialAttestation */
- eq(authContainer?.requestId ?: 0L)
+ eq(authContainer?.requestId ?: 0L),
)
assertThat(container.parent).isNull()
}
@@ -313,7 +312,7 @@
.onDismissed(
eq(AuthDialogCallback.DISMISSED_BUTTON_NEGATIVE),
eq<ByteArray?>(null), /* credentialAttestation */
- eq(authContainer?.requestId ?: 0L)
+ eq(authContainer?.requestId ?: 0L),
)
assertThat(container.parent).isNull()
}
@@ -340,7 +339,7 @@
.onDismissed(
eq(AuthDialogCallback.DISMISSED_ERROR),
eq<ByteArray?>(null), /* credentialAttestation */
- eq(authContainer?.requestId ?: 0L)
+ eq(authContainer?.requestId ?: 0L),
)
assertThat(authContainer!!.parent).isNull()
}
@@ -413,7 +412,6 @@
@Test
fun testShowBiometricUI_ContentViewWithMoreOptionsButton() {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
var isButtonClicked = false
val contentView =
PromptContentViewWithMoreOptionsButton.Builder()
@@ -450,11 +448,10 @@
@Test
fun testShowCredentialUI_withVerticalListContentView() {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
val container =
initializeFingerprintContainer(
authenticators = BiometricManager.Authenticators.DEVICE_CREDENTIAL,
- verticalListContentView = PromptVerticalListContentView.Builder().build()
+ verticalListContentView = PromptVerticalListContentView.Builder().build(),
)
// Two-step credential view should show -
// 1. biometric prompt without sensor 2. credential view ui
@@ -471,7 +468,6 @@
@Test
fun testShowCredentialUI_withContentViewWithMoreOptionsButton() {
- mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
val contentView =
PromptContentViewWithMoreOptionsButton.Builder()
.setMoreOptionsButtonListener(fakeExecutor) { _, _ -> }
@@ -479,7 +475,7 @@
val container =
initializeFingerprintContainer(
authenticators = BiometricManager.Authenticators.DEVICE_CREDENTIAL,
- contentViewWithMoreOptionsButton = contentView
+ contentViewWithMoreOptionsButton = contentView,
)
waitForIdleSync()
@@ -565,7 +561,7 @@
}
private fun initializeCredentialPasswordContainer(
- addToView: Boolean = true,
+ addToView: Boolean = true
): TestAuthContainerView {
whenever(userManager.getCredentialOwnerProfile(anyInt())).thenReturn(20)
whenever(lockPatternUtils.getKeyguardStoredPasswordQuality(eq(20)))
@@ -597,25 +593,25 @@
fingerprintProps = fingerprintSensorPropertiesInternal(),
verticalListContentView = verticalListContentView,
),
- addToView
+ addToView,
)
private fun initializeCoexContainer(
authenticators: Int = BiometricManager.Authenticators.BIOMETRIC_WEAK,
- addToView: Boolean = true
+ addToView: Boolean = true,
) =
initializeContainer(
TestAuthContainerView(
authenticators = authenticators,
fingerprintProps = fingerprintSensorPropertiesInternal(),
- faceProps = faceSensorPropertiesInternal()
+ faceProps = faceSensorPropertiesInternal(),
),
- addToView
+ addToView,
)
private fun initializeContainer(
view: TestAuthContainerView,
- addToView: Boolean
+ addToView: Boolean,
): TestAuthContainerView {
authContainer = view
@@ -668,7 +664,7 @@
biometricStatusInteractor,
udfpsUtils,
iconProvider,
- activityTaskManager
+ activityTaskManager,
),
{ credentialViewModel },
fakeExecutor,