Merge "Fix margins and positioning for the small (implicit) face view." into udc-dev

This commit is contained in:
TreeHugger Robot
2023-06-03 00:45:10 +00:00
committed by Android (Google) Code Review
2 changed files with 30 additions and 5 deletions

View File

@@ -614,7 +614,11 @@ public class AuthContainerView extends LinearLayout
return ((AuthBiometricFingerprintView) view).isUdfps();
}
if (view instanceof BiometricPromptLayout) {
return ((BiometricPromptLayout) view).isUdfps();
// this will force the prompt to align itself on the edge of the screen
// instead of centering (temporary workaround to prevent small implicit view
// from breaking due to the way gravity / margins are set in the legacy
// AuthPanelController
return true;
}
return false;

View File

@@ -19,8 +19,11 @@ package com.android.systemui.biometrics.ui.binder
import android.animation.Animator
import android.animation.AnimatorSet
import android.animation.ValueAnimator
import android.view.Surface
import android.view.View
import android.view.ViewGroup
import android.view.WindowInsets
import android.view.WindowManager
import android.view.accessibility.AccessibilityManager
import android.widget.TextView
import androidx.core.animation.addListener
@@ -52,7 +55,9 @@ object BiometricViewSizeBinder {
panelViewController: AuthPanelController,
jankListener: BiometricJankListener,
) {
val accessibilityManager = view.context.getSystemService(AccessibilityManager::class.java)!!
val windowManager = requireNotNull(view.context.getSystemService(WindowManager::class.java))
val accessibilityManager =
requireNotNull(view.context.getSystemService(AccessibilityManager::class.java))
fun notifyAccessibilityChanged() {
Utils.notifyAccessibilityContentChanged(accessibilityManager, view)
}
@@ -102,15 +107,26 @@ object BiometricViewSizeBinder {
when {
size.isSmall -> {
iconHolderView.alpha = 1f
val bottomInset =
windowManager.maximumWindowMetrics.windowInsets
.getInsets(WindowInsets.Type.navigationBars())
.bottom
iconHolderView.y =
view.height - iconHolderView.height - iconPadding
if (view.isLandscape()) {
(view.height - iconHolderView.height - bottomInset) / 2f
} else {
view.height -
iconHolderView.height -
iconPadding -
bottomInset
}
val newHeight =
iconHolderView.height + 2 * iconPadding.toInt() -
iconHolderView.height + (2 * iconPadding.toInt()) -
iconHolderView.paddingTop -
iconHolderView.paddingBottom
panelViewController.updateForContentDimensions(
width,
newHeight,
newHeight + bottomInset,
0, /* animateDurationMs */
)
}
@@ -181,6 +197,11 @@ object BiometricViewSizeBinder {
}
}
private fun View.isLandscape(): Boolean {
val r = context.display.rotation
return r == Surface.ROTATION_90 || r == Surface.ROTATION_270
}
private fun TextView.showTextOrHide(forceHide: Boolean = false) {
visibility = if (forceHide || text.isBlank()) View.GONE else View.VISIBLE
}