Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1984333c authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Transitions - Add ALTERNATE_BOUNCER support" into tm-qpr-dev

parents cb5228cf 4153b90f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -933,7 +933,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
        }

        // The smartspace is not visible if the bouncer is showing, so don't shared element it.
        if (keyguardStateController.isBouncerShowing) {
        if (keyguardStateController.isPrimaryBouncerShowing) {
            return false
        }

+3 −3
Original line number Diff line number Diff line
@@ -1148,12 +1148,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
    private final KeyguardStateController.Callback mKeyguardStateControllerCallback =
            new KeyguardStateController.Callback() {
        @Override
        public void onBouncerShowingChanged() {
        public void onPrimaryBouncerShowingChanged() {
            synchronized (KeyguardViewMediator.this) {
                if (mKeyguardStateController.isBouncerShowing()) {
                if (mKeyguardStateController.isPrimaryBouncerShowing()) {
                    mPendingPinLock = false;
                }
                adjustStatusBarLocked(mKeyguardStateController.isBouncerShowing(), false);
                adjustStatusBarLocked(mKeyguardStateController.isPrimaryBouncerShowing(), false);
            }
        }
    };
+11 −11
Original line number Diff line number Diff line
@@ -68,8 +68,8 @@ interface KeyguardBouncerRepository {
    val resourceUpdateRequests: StateFlow<Boolean>
    val bouncerPromptReason: Int
    val bouncerErrorMessage: CharSequence?
    val isAlternateBouncerVisible: StateFlow<Boolean>
    val isAlternateBouncerUIAvailable: StateFlow<Boolean>
    val alternateBouncerVisible: StateFlow<Boolean>
    val alternateBouncerUIAvailable: StateFlow<Boolean>
    var lastAlternateBouncerVisibleTime: Long

    fun setPrimaryScrimmed(isScrimmed: Boolean)
@@ -159,12 +159,12 @@ constructor(
        get() = viewMediatorCallback.consumeCustomMessage()

    /** Values associated with the AlternateBouncer */
    private val _isAlternateBouncerVisible = MutableStateFlow(false)
    override val isAlternateBouncerVisible = _isAlternateBouncerVisible.asStateFlow()
    private val _alternateBouncerVisible = MutableStateFlow(false)
    override val alternateBouncerVisible = _alternateBouncerVisible.asStateFlow()
    override var lastAlternateBouncerVisibleTime: Long = NOT_VISIBLE
    private val _isAlternateBouncerUIAvailable = MutableStateFlow(false)
    override val isAlternateBouncerUIAvailable: StateFlow<Boolean> =
        _isAlternateBouncerUIAvailable.asStateFlow()
    private val _alternateBouncerUIAvailable = MutableStateFlow(false)
    override val alternateBouncerUIAvailable: StateFlow<Boolean> =
        _alternateBouncerUIAvailable.asStateFlow()

    init {
        setUpLogging()
@@ -179,16 +179,16 @@ constructor(
    }

    override fun setAlternateVisible(isVisible: Boolean) {
        if (isVisible && !_isAlternateBouncerVisible.value) {
        if (isVisible && !_alternateBouncerVisible.value) {
            lastAlternateBouncerVisibleTime = clock.uptimeMillis()
        } else if (!isVisible) {
            lastAlternateBouncerVisibleTime = NOT_VISIBLE
        }
        _isAlternateBouncerVisible.value = isVisible
        _alternateBouncerVisible.value = isVisible
    }

    override fun setAlternateBouncerUIAvailable(isAvailable: Boolean) {
        _isAlternateBouncerUIAvailable.value = isAvailable
        _alternateBouncerUIAvailable.value = isAvailable
    }

    override fun setPrimaryShow(keyguardBouncerModel: KeyguardBouncerModel?) {
@@ -290,7 +290,7 @@ constructor(
        resourceUpdateRequests
            .logDiffsForTable(buffer, "", "ResourceUpdateRequests", false)
            .launchIn(applicationScope)
        isAlternateBouncerUIAvailable
        alternateBouncerUIAvailable
            .logDiffsForTable(buffer, "", "IsAlternateBouncerUIAvailable", false)
            .launchIn(applicationScope)
    }
+0 −26
Original line number Diff line number Diff line
@@ -86,9 +86,6 @@ interface KeyguardRepository {
    /** Observable for the signal that keyguard is about to go away. */
    val isKeyguardGoingAway: Flow<Boolean>

    /** Observable for whether the bouncer is showing. */
    val isBouncerShowing: Flow<Boolean>

    /** Is the always-on display available to be used? */
    val isAodAvailable: Flow<Boolean>

@@ -304,29 +301,6 @@ constructor(
        awaitClose { keyguardStateController.removeCallback(callback) }
    }

    override val isBouncerShowing: Flow<Boolean> = conflatedCallbackFlow {
        val callback =
            object : KeyguardStateController.Callback {
                override fun onBouncerShowingChanged() {
                    trySendWithFailureLogging(
                        keyguardStateController.isBouncerShowing,
                        TAG,
                        "updated isBouncerShowing"
                    )
                }
            }

        keyguardStateController.addCallback(callback)
        // Adding the callback does not send an initial update.
        trySendWithFailureLogging(
            keyguardStateController.isBouncerShowing,
            TAG,
            "initial isBouncerShowing"
        )

        awaitClose { keyguardStateController.removeCallback(callback) }
    }

    override val isDozing: Flow<Boolean> =
        conflatedCallbackFlow {
                val callback =
+3 −3
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ constructor(
    var legacyAlternateBouncer: LegacyAlternateBouncer? = null
    var legacyAlternateBouncerVisibleTime: Long = NOT_VISIBLE

    val isVisible: Flow<Boolean> = bouncerRepository.isAlternateBouncerVisible
    val isVisible: Flow<Boolean> = bouncerRepository.alternateBouncerVisible

    /**
     * Sets the correct bouncer states to show the alternate bouncer if it can show.
@@ -86,7 +86,7 @@ constructor(

    fun isVisibleState(): Boolean {
        return if (isModernAlternateBouncerEnabled) {
            bouncerRepository.isAlternateBouncerVisible.value
            bouncerRepository.alternateBouncerVisible.value
        } else {
            legacyAlternateBouncer?.isShowingAlternateBouncer ?: false
        }
@@ -98,7 +98,7 @@ constructor(

    fun canShowAlternateBouncerForFingerprint(): Boolean {
        return if (isModernAlternateBouncerEnabled) {
            bouncerRepository.isAlternateBouncerUIAvailable.value &&
            bouncerRepository.alternateBouncerUIAvailable.value &&
                biometricSettingsRepository.isFingerprintEnrolled.value &&
                biometricSettingsRepository.isStrongBiometricAllowed.value &&
                biometricSettingsRepository.isFingerprintEnabledByDevicePolicy.value &&
Loading