Fix margins and positioning for the small (implicit) face view.

This temporary workaround only impacts the new prompt, but should be simplified once the shared code is decoupled. The existing layout logic is too tightly coupled with UDFPS and additional changes/replacements to the legacy panel controller are still needed.

Bug: 272510026
Test: manual (use BP test app with coex, uncheck require confirmation and check 0, 90, 270 rotations)
Change-Id: I9fe9692dc8008549f9dad7932e07b0fa16503afd
This commit is contained in:
Joe Bolinger
2023-06-02 04:10:34 +00:00
parent e6ce51f316
commit fe745c557f
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
}