diff --git a/packages/SystemUI/res/layout/auth_biometric_contents.xml b/packages/SystemUI/res/layout/auth_biometric_contents.xml index 81691898dfe5c..efc661a6e974d 100644 --- a/packages/SystemUI/res/layout/auth_biometric_contents.xml +++ b/packages/SystemUI/res/layout/auth_biometric_contents.xml @@ -55,13 +55,7 @@ android:layout_height="wrap_content" android:layout_gravity="center"> - + + + + + \ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java index fb160f2a2f007..11ac34480b0b9 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java @@ -953,6 +953,10 @@ public abstract class AuthBiometricView extends LinearLayout implements AuthBiom return Utils.isDeviceCredentialAllowed(mPromptInfo); } + public LottieAnimationView getIconView() { + return mIconView; + } + @AuthDialog.DialogSize int getSize() { return mSize; } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/DisplayStateInteractor.kt b/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/DisplayStateInteractor.kt index c935aa290e210..26b6f2a7a3cc6 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/DisplayStateInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/DisplayStateInteractor.kt @@ -78,6 +78,7 @@ constructor( sendFoldStateUpdate(isFolded) } } + sendFoldStateUpdate(false) screenSizeFoldProvider.registerCallback(callback, mainExecutor) awaitClose { screenSizeFoldProvider.unregisterCallback(callback) } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/AuthBiometricFingerprintIconViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/AuthBiometricFingerprintIconViewBinder.kt new file mode 100644 index 0000000000000..bd0907e588ca6 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/AuthBiometricFingerprintIconViewBinder.kt @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.android.systemui.biometrics.ui.binder + +import android.view.DisplayInfo +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.repeatOnLifecycle +import com.airbnb.lottie.LottieAnimationView +import com.android.systemui.biometrics.AuthBiometricFingerprintView +import com.android.systemui.biometrics.ui.viewmodel.AuthBiometricFingerprintViewModel +import com.android.systemui.lifecycle.repeatWhenAttached +import kotlinx.coroutines.launch + +/** Sub-binder for [AuthBiometricFingerprintView.mIconView]. */ +object AuthBiometricFingerprintIconViewBinder { + + /** + * Binds a [AuthBiometricFingerprintView.mIconView] to a [AuthBiometricFingerprintViewModel]. + */ + @JvmStatic + fun bind(view: LottieAnimationView, viewModel: AuthBiometricFingerprintViewModel) { + view.repeatWhenAttached { + repeatOnLifecycle(Lifecycle.State.STARTED) { + val displayInfo = DisplayInfo() + view.context.display?.getDisplayInfo(displayInfo) + viewModel.setRotation(displayInfo.rotation) + viewModel.onConfigurationChanged(view.context.resources.configuration) + launch { viewModel.iconAsset.collect { iconAsset -> view.setAnimation(iconAsset) } } + } + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/AuthBiometricFingerprintViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/AuthBiometricFingerprintViewBinder.kt index ae0cf3771ed3c..9c1bcec2f396d 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/AuthBiometricFingerprintViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/AuthBiometricFingerprintViewBinder.kt @@ -17,31 +17,18 @@ package com.android.systemui.biometrics.ui.binder -import android.view.Surface -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.repeatOnLifecycle import com.android.systemui.biometrics.AuthBiometricFingerprintView import com.android.systemui.biometrics.ui.viewmodel.AuthBiometricFingerprintViewModel -import com.android.systemui.lifecycle.repeatWhenAttached -import kotlinx.coroutines.launch object AuthBiometricFingerprintViewBinder { - /** Binds a [AuthBiometricFingerprintView] to a [AuthBiometricFingerprintViewModel]. */ + /** + * Binds a [AuthBiometricFingerprintView.mIconView] to a [AuthBiometricFingerprintViewModel]. + */ @JvmStatic fun bind(view: AuthBiometricFingerprintView, viewModel: AuthBiometricFingerprintViewModel) { - view.repeatWhenAttached { - repeatOnLifecycle(Lifecycle.State.STARTED) { - viewModel.onConfigurationChanged(view.context.resources.configuration) - viewModel.setRotation(view.context.display?.orientation ?: Surface.ROTATION_0) - launch { - viewModel.iconAsset.collect { iconAsset -> - if (view.isSfps) { - view.updateIconViewAnimation(iconAsset) - } - } - } - } + if (view.isSfps) { + AuthBiometricFingerprintIconViewBinder.bind(view.getIconView(), viewModel) } } }