Set initial message after
view is inflated. Do not tie it to a stateflow as it can cause multiple messages to show up during show. Fixes: 273402680 Test: with bouncer prompt after restart device. Change-Id: I838b47970278db4911c05278df6fe8c8de02c066
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<Keyguard
|
||||
mKeyguardStateController.isFaceAuthEnabled());
|
||||
}
|
||||
|
||||
/** Sets an initial message that would override the default message */
|
||||
public void setInitialMessage() {
|
||||
CharSequence customMessage = mViewMediatorCallback.consumeCustomMessage();
|
||||
if (!TextUtils.isEmpty(customMessage)) {
|
||||
showMessage(customMessage, Utils.getColorError(getContext()));
|
||||
return;
|
||||
}
|
||||
showPromptReason(mViewMediatorCallback.getBouncerPromptReason());
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the bouncer and start appear animations.
|
||||
*
|
||||
|
||||
@@ -65,8 +65,6 @@ interface KeyguardBouncerRepository {
|
||||
val keyguardAuthenticated: StateFlow<Boolean?>
|
||||
val showMessage: StateFlow<BouncerShowMessageModel?>
|
||||
val resourceUpdateRequests: StateFlow<Boolean>
|
||||
val bouncerPromptReason: Int
|
||||
val bouncerErrorMessage: CharSequence?
|
||||
val alternateBouncerVisible: StateFlow<Boolean>
|
||||
val alternateBouncerUIAvailable: StateFlow<Boolean>
|
||||
val sideFpsShowing: StateFlow<Boolean>
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ object KeyguardBouncerViewBinder {
|
||||
securityContainerController.showPrimarySecurityScreen(
|
||||
/* turningOff= */ false
|
||||
)
|
||||
securityContainerController.setInitialMessage()
|
||||
securityContainerController.appear()
|
||||
securityContainerController.onResume(
|
||||
KeyguardSecurityView.SCREEN_ON
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user