diff options
| author | 2023-12-22 13:43:26 +0000 | |
|---|---|---|
| committer | 2023-12-22 13:43:26 +0000 | |
| commit | 4171b4dd69f889570541e702e5a318b6f8f673b0 (patch) | |
| tree | 169304811391fbf5ac9bca48ee5bafd84629617c | |
| parent | 0d1ba636d12d8cf3e37bcf8fe1ad82e0e4503843 (diff) | |
Revert "Fix race condition between PromptIconViewBinder and BiometricSizeBinder"
This reverts commit 0d1ba636d12d8cf3e37bcf8fe1ad82e0e4503843.
Reason for revert: possible culprit to b/317291041
Change-Id: I0a9e32ee3cc80522c954deea88e2b040fabb5d32
4 files changed, 4 insertions, 55 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index 83d415fa936e..ab23564a1df4 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -403,13 +403,6 @@ public class AuthContainerView extends LinearLayout final BiometricPromptLayout view = (BiometricPromptLayout) layoutInflater.inflate( R.layout.biometric_prompt_layout, null, false); - /** - * View is only set visible in BiometricViewSizeBinder once PromptSize is determined - * that accounts for iconView size, to prevent prompt resizing being visible to the - * user. - * TODO(b/288175072): May be able to remove this once constraint layout is implemented - */ - view.setVisibility(View.INVISIBLE); mBiometricView = BiometricViewBinder.bind(view, viewModel, mPanelController, // TODO(b/201510778): This uses the wrong timeout in some cases getJankListener(view, TRANSIT, 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 a7fb6f72a41e..90e4a3821634 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 @@ -97,13 +97,7 @@ object BiometricViewBinder { val iconOverlayView = view.requireViewById<LottieAnimationView>(R.id.biometric_icon_overlay) val iconView = view.requireViewById<LottieAnimationView>(R.id.biometric_icon) - /** - * View is only set visible in BiometricViewSizeBinder once PromptSize is determined that - * accounts for iconView size, to prevent prompt resizing being visible to the user. - * - * TODO(b/288175072): May be able to remove this once constraint layout is implemented - */ - iconView.addLottieOnCompositionLoadedListener { viewModel.setIsIconViewLoaded(true) } + PromptIconViewBinder.bind( iconView, iconOverlayView, diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewSizeBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewSizeBinder.kt index f340bd81f951..7e16d1e1d668 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewSizeBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewSizeBinder.kt @@ -30,6 +30,7 @@ import androidx.core.animation.addListener import androidx.core.view.doOnLayout import androidx.core.view.isGone import androidx.lifecycle.lifecycleScope +import com.android.systemui.res.R import com.android.systemui.biometrics.AuthPanelController import com.android.systemui.biometrics.Utils import com.android.systemui.biometrics.ui.BiometricPromptLayout @@ -40,8 +41,6 @@ import com.android.systemui.biometrics.ui.viewmodel.isMedium import com.android.systemui.biometrics.ui.viewmodel.isNullOrNotSmall import com.android.systemui.biometrics.ui.viewmodel.isSmall import com.android.systemui.lifecycle.repeatWhenAttached -import com.android.systemui.res.R -import kotlinx.coroutines.flow.combine import kotlinx.coroutines.launch /** Helper for [BiometricViewBinder] to handle resize transitions. */ @@ -93,22 +92,8 @@ object BiometricViewSizeBinder { // TODO(b/251476085): migrate the legacy panel controller and simplify this view.repeatWhenAttached { var currentSize: PromptSize? = null - lifecycleScope.launch { - /** - * View is only set visible in BiometricViewSizeBinder once PromptSize is - * determined that accounts for iconView size, to prevent prompt resizing being - * visible to the user. - * - * TODO(b/288175072): May be able to remove isIconViewLoaded once constraint - * layout is implemented - */ - combine(viewModel.isIconViewLoaded, viewModel.size, ::Pair).collect { - (isIconViewLoaded, size) -> - if (!isIconViewLoaded) { - return@collect - } - + viewModel.size.collect { size -> // prepare for animated size transitions for (v in viewsToHideWhenSmall) { v.showTextOrHide(forceHide = size.isSmall) @@ -211,9 +196,8 @@ object BiometricViewSizeBinder { } } } + currentSize = size - view.visibility = View.VISIBLE - viewModel.setIsIconViewLoaded(false) notifyAccessibilityChanged() } } 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 d899827ebb2e..6d0a58e202bd 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 @@ -192,28 +192,6 @@ constructor( val iconViewModel: PromptIconViewModel = PromptIconViewModel(this, displayStateInteractor, promptSelectorInteractor) - private val _isIconViewLoaded = MutableStateFlow(false) - - /** - * For prompts with an iconView, false until the prompt's iconView animation has been loaded in - * the view, otherwise true by default. Used for BiometricViewSizeBinder to wait for the icon - * asset to be loaded before determining the prompt size. - */ - val isIconViewLoaded: Flow<Boolean> = - combine(credentialKind, _isIconViewLoaded.asStateFlow()) { credentialKind, isIconViewLoaded - -> - if (credentialKind is PromptKind.Biometric) { - isIconViewLoaded - } else { - true - } - } - - // Sets whether the prompt's iconView animation has been loaded in the view yet. - fun setIsIconViewLoaded(iconViewLoaded: Boolean) { - _isIconViewLoaded.value = iconViewLoaded - } - /** Padding for prompt UI elements */ val promptPadding: Flow<Rect> = combine(size, displayStateInteractor.currentRotation) { size, rotation -> |