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

Commit 1a2f222f authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Introduce bouncer delay behind flag" into udc-dev am: 9e358f75

parents 397c713d 9e358f75
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -889,4 +889,8 @@
    -->
    <dimen name="shade_swipe_collapse_threshold">0.5</dimen>
    <!-- [END] MULTI SHADE -->

    <!-- Time (in ms) to delay the bouncer views from showing when passive auth may be used for
    device entry. -->
    <integer name="primary_bouncer_passive_auth_delay">250</integer>
</resources>
+27 −13
Original line number Diff line number Diff line
@@ -2884,7 +2884,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
    }

    /**
     * If the current state of the device allows for triggering active unlock. This does not
     * include active unlock availability.
     */
    public boolean canTriggerActiveUnlockBasedOnDeviceState() {
        return shouldTriggerActiveUnlock(/* shouldLog */ false);
    }

    private boolean shouldTriggerActiveUnlock() {
        return shouldTriggerActiveUnlock(/* shouldLog */ true);
    }

    private boolean shouldTriggerActiveUnlock(boolean shouldLog) {
        // Triggers:
        final boolean triggerActiveUnlockForAssistant = shouldTriggerActiveUnlockForAssistant();
        final boolean awakeKeyguard = mPrimaryBouncerFullyShown || mAlternateBouncerShowing
@@ -2914,6 +2926,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        && !mKeyguardGoingAway
                        && !mSecureCameraLaunched;

        if (shouldLog) {
            // Aggregate relevant fields for debug logging.
            logListenerModelData(
                    new KeyguardActiveUnlockModel(
@@ -2927,6 +2940,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                            mSwitchingUser,
                            triggerActiveUnlockForAssistant,
                            userCanDismissLockScreen));
        }

        return shouldTriggerActiveUnlock;
    }
+0 −2
Original line number Diff line number Diff line
@@ -46,8 +46,6 @@ interface KeyguardFaceAuthModule {
        impl: SystemUIKeyguardFaceAuthInteractor
    ): KeyguardFaceAuthInteractor

    @Binds fun trustRepository(impl: TrustRepositoryImpl): TrustRepository

    companion object {
        @Provides
        @SysUISingleton
+2 −0
Original line number Diff line number Diff line
@@ -45,4 +45,6 @@ interface KeyguardRepositoryModule {

    @Binds
    fun keyguardBouncerRepository(impl: KeyguardBouncerRepositoryImpl): KeyguardBouncerRepository

    @Binds fun trustRepository(impl: TrustRepositoryImpl): TrustRepository
}
+14 −7
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@ import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
@@ -40,6 +42,9 @@ import kotlinx.coroutines.flow.shareIn
interface TrustRepository {
    /** Flow representing whether the current user is trusted. */
    val isCurrentUserTrusted: Flow<Boolean>

    /** Flow representing whether active unlock is available for the current user. */
    val isCurrentUserActiveUnlockAvailable: StateFlow<Boolean>
}

@SysUISingleton
@@ -89,11 +94,13 @@ constructor(
            }
            .shareIn(applicationScope, started = SharingStarted.Eagerly, replay = 1)

    override val isCurrentUserTrusted: Flow<Boolean>
        get() =
    override val isCurrentUserTrusted: Flow<Boolean> =
        combine(trust, userRepository.selectedUserInfo, ::Pair)
            .map { latestTrustModelForUser[it.second.id]?.isTrusted ?: false }
            .distinctUntilChanged()
            .onEach { logger.isCurrentUserTrusted(it) }
            .onStart { emit(false) }

    // TODO: Implement based on TrustManager callback b/267322286
    override val isCurrentUserActiveUnlockAvailable: StateFlow<Boolean> = MutableStateFlow(true)
}
Loading