diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java index 72333cc9417df..5c56aab9a6112 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java @@ -298,34 +298,38 @@ public class KeyguardPatternViewController @Override public void showPromptReason(int reason) { /// TODO: move all this logic into the MessageAreaController? + int resId = 0; switch (reason) { case PROMPT_REASON_RESTART: - mMessageAreaController.setMessage(R.string.kg_prompt_reason_restart_pattern); + resId = R.string.kg_prompt_reason_restart_pattern; break; case PROMPT_REASON_TIMEOUT: - mMessageAreaController.setMessage(R.string.kg_prompt_reason_timeout_pattern); + resId = R.string.kg_prompt_reason_timeout_pattern; break; case PROMPT_REASON_DEVICE_ADMIN: - mMessageAreaController.setMessage(R.string.kg_prompt_reason_device_admin); + resId = R.string.kg_prompt_reason_device_admin; break; case PROMPT_REASON_USER_REQUEST: - mMessageAreaController.setMessage(R.string.kg_prompt_reason_user_request); + resId = R.string.kg_prompt_reason_user_request; break; case PROMPT_REASON_PREPARE_FOR_UPDATE: - mMessageAreaController.setMessage(R.string.kg_prompt_reason_timeout_pattern); + resId = R.string.kg_prompt_reason_timeout_pattern; break; case PROMPT_REASON_NON_STRONG_BIOMETRIC_TIMEOUT: - mMessageAreaController.setMessage(R.string.kg_prompt_reason_timeout_pattern); + resId = R.string.kg_prompt_reason_timeout_pattern; break; case PROMPT_REASON_TRUSTAGENT_EXPIRED: - mMessageAreaController.setMessage(R.string.kg_prompt_reason_timeout_pattern); + resId = R.string.kg_prompt_reason_timeout_pattern; break; case PROMPT_REASON_NONE: break; default: - mMessageAreaController.setMessage(R.string.kg_prompt_reason_timeout_pattern); + resId = R.string.kg_prompt_reason_timeout_pattern; break; } + if (resId != 0) { + mMessageAreaController.setMessage(getResources().getText(resId), /* animate= */ false); + } } @Override diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 1a572b729a6e4..85ea028d69602 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -40,6 +40,7 @@ import android.metrics.LogMaker; import android.os.SystemClock; import android.os.UserHandle; import android.telephony.TelephonyManager; +import android.text.TextUtils; import android.util.Log; import android.util.MathUtils; import android.util.Slog; @@ -64,6 +65,7 @@ import com.android.keyguard.KeyguardSecurityContainer.BouncerUiEvent; import com.android.keyguard.KeyguardSecurityContainer.SwipeListener; import com.android.keyguard.KeyguardSecurityModel.SecurityMode; import com.android.keyguard.dagger.KeyguardBouncerScope; +import com.android.settingslib.Utils; import com.android.settingslib.utils.ThreadUtils; import com.android.systemui.Gefingerpoken; import com.android.systemui.R; @@ -634,6 +636,16 @@ public class KeyguardSecurityContainerController extends ViewController val showMessage: StateFlow val resourceUpdateRequests: StateFlow - val bouncerPromptReason: Int - val bouncerErrorMessage: CharSequence? val alternateBouncerVisible: StateFlow val alternateBouncerUIAvailable: StateFlow val sideFpsShowing: StateFlow @@ -145,11 +143,6 @@ constructor( override val showMessage = _showMessage.asStateFlow() private val _resourceUpdateRequests = MutableStateFlow(false) override val resourceUpdateRequests = _resourceUpdateRequests.asStateFlow() - override val bouncerPromptReason: Int - get() = viewMediatorCallback.bouncerPromptReason - override val bouncerErrorMessage: CharSequence? - get() = viewMediatorCallback.consumeCustomMessage() - /** Values associated with the AlternateBouncer */ private val _alternateBouncerVisible = MutableStateFlow(false) override val alternateBouncerVisible = _alternateBouncerVisible.asStateFlow() diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt index 77541e931e08a..24a5b3cd639e0 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt @@ -21,15 +21,12 @@ import android.content.res.ColorStateList import android.hardware.biometrics.BiometricSourceType import android.os.Handler import android.os.Trace -import android.os.UserHandle -import android.os.UserManager import android.util.Log import android.view.View import com.android.keyguard.KeyguardConstants import com.android.keyguard.KeyguardSecurityModel import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.KeyguardUpdateMonitorCallback -import com.android.settingslib.Utils import com.android.systemui.DejankUtils import com.android.systemui.R import com.android.systemui.classifier.FalsingCollector @@ -44,12 +41,12 @@ import com.android.systemui.plugins.ActivityStarter import com.android.systemui.shared.system.SysUiStatsLog import com.android.systemui.statusbar.phone.KeyguardBypassController import com.android.systemui.statusbar.policy.KeyguardStateController -import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map +import javax.inject.Inject /** * Encapsulates business logic for interacting with the lock-screen primary (pin/pattern/password) @@ -84,12 +81,6 @@ constructor( /** Runnable to show the primary bouncer. */ val showRunnable = Runnable { repository.setPrimaryShow(true) - primaryBouncerView.delegate?.showPromptReason(repository.bouncerPromptReason) - (repository.bouncerErrorMessage as? String)?.let { - repository.setShowMessage( - BouncerShowMessageModel(message = it, Utils.getColorError(context)) - ) - } repository.setPrimaryShowingSoon(false) primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.VISIBLE) } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt index 468a6b52c5e5e..927df551aa45a 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt @@ -121,6 +121,7 @@ object KeyguardBouncerViewBinder { securityContainerController.showPrimarySecurityScreen( /* turningOff= */ false ) + securityContainerController.setInitialMessage() securityContainerController.appear() securityContainerController.onResume( KeyguardSecurityView.SCREEN_ON diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardBouncerRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardBouncerRepository.kt index 1dda47223dd66..8a6d2aa7dd210 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardBouncerRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardBouncerRepository.kt @@ -48,8 +48,6 @@ class FakeKeyguardBouncerRepository : KeyguardBouncerRepository { override val showMessage = _showMessage.asStateFlow() private val _resourceUpdateRequests = MutableStateFlow(false) override val resourceUpdateRequests = _resourceUpdateRequests.asStateFlow() - override val bouncerPromptReason = 0 - override val bouncerErrorMessage: CharSequence? = null private val _isAlternateBouncerVisible = MutableStateFlow(false) override val alternateBouncerVisible = _isAlternateBouncerVisible.asStateFlow() override var lastAlternateBouncerVisibleTime: Long = 0L