Merge "Add BP assets for sidefps" into tm-qpr-dev am: 23a112e900

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19805290

Change-Id: I011b617362be17cb654f766ffdace4e9d9bdcbf6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Joshua Mccloskey
2022-09-08 19:06:00 +00:00
committed by Automerger Merge Worker
21 changed files with 181 additions and 7 deletions

View File

@@ -51,7 +51,7 @@
android:id="@+id/biometric_icon_frame" android:id="@+id/biometric_icon_frame"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"> android:layout_gravity="center">
<com.airbnb.lottie.LottieAnimationView <com.airbnb.lottie.LottieAnimationView
android:id="@+id/biometric_icon" android:id="@+id/biometric_icon"
@@ -61,6 +61,13 @@
android:contentDescription="@null" android:contentDescription="@null"
android:scaleType="fitXY" /> android:scaleType="fitXY" />
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/biometric_icon_overlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:contentDescription="@null"
android:scaleType="fitXY" />
</FrameLayout> </FrameLayout>
<!-- For sensors such as UDFPS, this view is used during custom measurement/layout to add extra <!-- For sensors such as UDFPS, this view is used during custom measurement/layout to add extra

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -29,8 +29,9 @@ import com.android.systemui.biometrics.AuthBiometricView.STATE_PENDING_CONFIRMAT
/** Face/Fingerprint combined icon animator for BiometricPrompt. */ /** Face/Fingerprint combined icon animator for BiometricPrompt. */
class AuthBiometricFingerprintAndFaceIconController( class AuthBiometricFingerprintAndFaceIconController(
context: Context, context: Context,
iconView: LottieAnimationView iconView: LottieAnimationView,
) : AuthBiometricFingerprintIconController(context, iconView) { iconViewOverlay: LottieAnimationView
) : AuthBiometricFingerprintIconController(context, iconView, iconViewOverlay) {
override val actsAsConfirmButton: Boolean = true override val actsAsConfirmButton: Boolean = true

View File

@@ -39,5 +39,5 @@ class AuthBiometricFingerprintAndFaceView(
override fun onPointerDown(failedModalities: Set<Int>) = failedModalities.contains(TYPE_FACE) override fun onPointerDown(failedModalities: Set<Int>) = failedModalities.contains(TYPE_FACE)
override fun createIconController(): AuthIconController = override fun createIconController(): AuthIconController =
AuthBiometricFingerprintAndFaceIconController(mContext, mIconView) AuthBiometricFingerprintAndFaceIconController(mContext, mIconView, mIconViewOverlay)
} }

View File

@@ -18,6 +18,10 @@ package com.android.systemui.biometrics
import android.annotation.RawRes import android.annotation.RawRes
import android.content.Context import android.content.Context
import android.hardware.fingerprint.FingerprintManager
import android.view.DisplayInfo
import android.view.Surface
import android.view.View
import com.airbnb.lottie.LottieAnimationView import com.airbnb.lottie.LottieAnimationView
import com.android.systemui.R import com.android.systemui.R
import com.android.systemui.biometrics.AuthBiometricView.BiometricState import com.android.systemui.biometrics.AuthBiometricView.BiometricState
@@ -32,14 +36,18 @@ import com.android.systemui.biometrics.AuthBiometricView.STATE_PENDING_CONFIRMAT
/** Fingerprint only icon animator for BiometricPrompt. */ /** Fingerprint only icon animator for BiometricPrompt. */
open class AuthBiometricFingerprintIconController( open class AuthBiometricFingerprintIconController(
context: Context, context: Context,
iconView: LottieAnimationView iconView: LottieAnimationView,
protected val iconViewOverlay: LottieAnimationView
) : AuthIconController(context, iconView) { ) : AuthIconController(context, iconView) {
private val isSideFps: Boolean
var iconLayoutParamSize: Pair<Int, Int> = Pair(1, 1) var iconLayoutParamSize: Pair<Int, Int> = Pair(1, 1)
set(value) { set(value) {
if (field == value) { if (field == value) {
return return
} }
iconViewOverlay.layoutParams.width = value.first
iconViewOverlay.layoutParams.height = value.second
iconView.layoutParams.width = value.first iconView.layoutParams.width = value.first
iconView.layoutParams.height = value.second iconView.layoutParams.height = value.second
field = value field = value
@@ -50,9 +58,51 @@ open class AuthBiometricFingerprintIconController(
R.dimen.biometric_dialog_fingerprint_icon_width), R.dimen.biometric_dialog_fingerprint_icon_width),
context.resources.getDimensionPixelSize( context.resources.getDimensionPixelSize(
R.dimen.biometric_dialog_fingerprint_icon_height)) R.dimen.biometric_dialog_fingerprint_icon_height))
var sideFps = false
(context.getSystemService(Context.FINGERPRINT_SERVICE)
as FingerprintManager?)?.let { fpm ->
for (prop in fpm.sensorPropertiesInternal) {
if (prop.isAnySidefpsType) {
sideFps = true
}
}
}
isSideFps = sideFps
val displayInfo = DisplayInfo()
context.display?.getDisplayInfo(displayInfo)
if (isSideFps && displayInfo.rotation == Surface.ROTATION_180) {
iconView.rotation = 180f
}
} }
override fun updateIcon(@BiometricState lastState: Int, @BiometricState newState: Int) { private fun updateIconSideFps(@BiometricState lastState: Int, @BiometricState newState: Int) {
val displayInfo = DisplayInfo()
context.display?.getDisplayInfo(displayInfo)
val rotation = displayInfo.rotation
val iconAnimation = getSideFpsAnimationForTransition(rotation)
val iconViewOverlayAnimation =
getSideFpsOverlayAnimationForTransition(lastState, newState, rotation) ?: return
if (!(lastState == STATE_AUTHENTICATING_ANIMATING_IN && newState == STATE_AUTHENTICATING)) {
iconView.setAnimation(iconAnimation)
iconViewOverlay.setAnimation(iconViewOverlayAnimation)
}
val iconContentDescription = getIconContentDescription(newState)
if (iconContentDescription != null) {
iconView.contentDescription = iconContentDescription
iconViewOverlay.contentDescription = iconContentDescription
}
iconView.frame = 0
iconViewOverlay.frame = 0
if (shouldAnimateForTransition(lastState, newState)) {
iconView.playAnimation()
iconViewOverlay.playAnimation()
}
}
private fun updateIconNormal(@BiometricState lastState: Int, @BiometricState newState: Int) {
val icon = getAnimationForTransition(lastState, newState) ?: return val icon = getAnimationForTransition(lastState, newState) ?: return
if (!(lastState == STATE_AUTHENTICATING_ANIMATING_IN && newState == STATE_AUTHENTICATING)) { if (!(lastState == STATE_AUTHENTICATING_ANIMATING_IN && newState == STATE_AUTHENTICATING)) {
@@ -70,6 +120,15 @@ open class AuthBiometricFingerprintIconController(
} }
} }
override fun updateIcon(@BiometricState lastState: Int, @BiometricState newState: Int) {
if (isSideFps) {
updateIconSideFps(lastState, newState)
} else {
iconViewOverlay.visibility = View.GONE
updateIconNormal(lastState, newState)
}
}
private fun getIconContentDescription(@BiometricState newState: Int): CharSequence? { private fun getIconContentDescription(@BiometricState newState: Int): CharSequence? {
val id = when (newState) { val id = when (newState) {
STATE_IDLE, STATE_IDLE,
@@ -125,4 +184,89 @@ open class AuthBiometricFingerprintIconController(
} }
return if (id != null) return id else null return if (id != null) return id else null
} }
@RawRes
private fun getSideFpsAnimationForTransition(rotation: Int): Int = when (rotation) {
Surface.ROTATION_0 -> R.raw.BiometricPrompt_Landscape_Base
Surface.ROTATION_90 -> R.raw.BiometricPrompt_Portrait_Base_TopLeft
Surface.ROTATION_180 -> R.raw.BiometricPrompt_Landscape_Base
Surface.ROTATION_270 -> R.raw.BiometricPrompt_Portrait_Base_BottomRight
else -> R.raw.BiometricPrompt_Landscape_Base
}
@RawRes
private fun getSideFpsOverlayAnimationForTransition(
@BiometricState oldState: Int,
@BiometricState newState: Int,
rotation: Int
): Int? = when (newState) {
STATE_HELP,
STATE_ERROR -> {
when (rotation) {
Surface.ROTATION_0 -> R.raw.BiometricPrompt_Fingerprint_To_Error_Landscape
Surface.ROTATION_90 ->
R.raw.BiometricPrompt_Symbol_Fingerprint_To_Error_Portrait_TopLeft
Surface.ROTATION_180 ->
R.raw.BiometricPrompt_Fingerprint_To_Error_Landscape
Surface.ROTATION_270 ->
R.raw.BiometricPrompt_Symbol_Fingerprint_To_Error_Portrait_BottomRight
else -> R.raw.BiometricPrompt_Fingerprint_To_Error_Landscape
}
}
STATE_AUTHENTICATING_ANIMATING_IN,
STATE_AUTHENTICATING -> {
if (oldState == STATE_ERROR || oldState == STATE_HELP) {
when (rotation) {
Surface.ROTATION_0 ->
R.raw.BiometricPrompt_Symbol_Error_To_Fingerprint_Landscape
Surface.ROTATION_90 ->
R.raw.BiometricPrompt_Symbol_Error_To_Fingerprint_Portrait_TopLeft
Surface.ROTATION_180 ->
R.raw.BiometricPrompt_Symbol_Error_To_Fingerprint_Landscape
Surface.ROTATION_270 ->
R.raw.BiometricPrompt_Symbol_Error_To_Fingerprint_Portrait_BottomRight
else -> R.raw.BiometricPrompt_Symbol_Error_To_Fingerprint_Landscape
}
} else {
when (rotation) {
Surface.ROTATION_0 -> R.raw.BiometricPrompt_Fingerprint_To_Error_Landscape
Surface.ROTATION_90 ->
R.raw.BiometricPrompt_Symbol_Fingerprint_To_Error_Portrait_TopLeft
Surface.ROTATION_180 ->
R.raw.BiometricPrompt_Fingerprint_To_Error_Landscape
Surface.ROTATION_270 ->
R.raw.BiometricPrompt_Symbol_Fingerprint_To_Error_Portrait_BottomRight
else -> R.raw.BiometricPrompt_Fingerprint_To_Error_Landscape
}
}
}
STATE_AUTHENTICATED -> {
if (oldState == STATE_ERROR || oldState == STATE_HELP) {
when (rotation) {
Surface.ROTATION_0 ->
R.raw.BiometricPrompt_Symbol_Error_To_Success_Landscape
Surface.ROTATION_90 ->
R.raw.BiometricPrompt_Symbol_Error_To_Success_Portrait_TopLeft
Surface.ROTATION_180 ->
R.raw.BiometricPrompt_Symbol_Error_To_Success_Landscape
Surface.ROTATION_270 ->
R.raw.BiometricPrompt_Symbol_Error_To_Success_Portrait_BottomRight
else -> R.raw.BiometricPrompt_Symbol_Error_To_Success_Landscape
}
} else {
when (rotation) {
Surface.ROTATION_0 ->
R.raw.BiometricPrompt_Symbol_Fingerprint_To_Success_Landscape
Surface.ROTATION_90 ->
R.raw.BiometricPrompt_Symbol_Fingerprint_To_Success_Portrait_TopLeft
Surface.ROTATION_180 ->
R.raw.BiometricPrompt_Symbol_Fingerprint_To_Success_Landscape
Surface.ROTATION_270 ->
R.raw.BiometricPrompt_Symbol_Fingerprint_To_Success_Portrait_BottomRight
else -> R.raw.BiometricPrompt_Symbol_Fingerprint_To_Success_Landscape
}
}
}
else -> null
}
} }

View File

@@ -86,7 +86,7 @@ open class AuthBiometricFingerprintView(
override fun supportsSmallDialog() = false override fun supportsSmallDialog() = false
override fun createIconController(): AuthIconController = override fun createIconController(): AuthIconController =
AuthBiometricFingerprintIconController(mContext, mIconView) AuthBiometricFingerprintIconController(mContext, mIconView, mIconViewOverlay)
fun updateOverrideIconLayoutParamsSize() { fun updateOverrideIconLayoutParamsSize() {
udfpsAdapter?.let { udfpsAdapter?.let {

View File

@@ -133,6 +133,7 @@ public abstract class AuthBiometricView extends LinearLayout {
private TextView mSubtitleView; private TextView mSubtitleView;
private TextView mDescriptionView; private TextView mDescriptionView;
private View mIconHolderView; private View mIconHolderView;
protected LottieAnimationView mIconViewOverlay;
protected LottieAnimationView mIconView; protected LottieAnimationView mIconView;
protected TextView mIndicatorView; protected TextView mIndicatorView;
@@ -651,6 +652,7 @@ public abstract class AuthBiometricView extends LinearLayout {
mTitleView = findViewById(R.id.title); mTitleView = findViewById(R.id.title);
mSubtitleView = findViewById(R.id.subtitle); mSubtitleView = findViewById(R.id.subtitle);
mDescriptionView = findViewById(R.id.description); mDescriptionView = findViewById(R.id.description);
mIconViewOverlay = findViewById(R.id.biometric_icon_overlay);
mIconView = findViewById(R.id.biometric_icon); mIconView = findViewById(R.id.biometric_icon);
mIconHolderView = findViewById(R.id.biometric_icon_frame); mIconHolderView = findViewById(R.id.biometric_icon_frame);
mIndicatorView = findViewById(R.id.indicator); mIndicatorView = findViewById(R.id.indicator);
@@ -689,6 +691,11 @@ public abstract class AuthBiometricView extends LinearLayout {
mIconController = createIconController(); mIconController = createIconController();
if (mIconController.getActsAsConfirmButton()) { if (mIconController.getActsAsConfirmButton()) {
mIconViewOverlay.setOnClickListener((view)->{
if (mState == STATE_PENDING_CONFIRMATION) {
updateState(STATE_AUTHENTICATED);
}
});
mIconView.setOnClickListener((view) -> { mIconView.setOnClickListener((view) -> {
if (mState == STATE_PENDING_CONFIRMATION) { if (mState == STATE_PENDING_CONFIRMATION) {
updateState(STATE_AUTHENTICATED); updateState(STATE_AUTHENTICATED);