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

Commit 8c44d5bc authored by Chandru S's avatar Chandru S Committed by Android (Google) Code Review
Browse files

Merge "Disable face auth if any SIM is in secure state." into main

parents 3fdeba27 2f6c56c9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -235,6 +235,9 @@ filegroup {
    srcs: [
        /* Status bar fakes */
        "tests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/FakeAirplaneModeRepository.kt",
        "tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/FakeMobileConnectionRepository.kt",
        "tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/FakeMobileConnectionsRepository.kt",
        "tests/src/com/android/systemui/statusbar/pipeline/mobile/util/FakeMobileMappingsProxy.kt",
        "tests/src/com/android/systemui/statusbar/pipeline/shared/data/repository/FakeConnectivityRepository.kt",
        "tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/FakeWifiRepository.kt",

+13 −8
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.os.UserHandle
import android.util.Log
import com.android.internal.widget.LockPatternUtils
import com.android.systemui.Dumpable
import com.android.systemui.res.R
import com.android.systemui.biometrics.AuthController
import com.android.systemui.biometrics.data.repository.FacePropertyRepository
import com.android.systemui.biometrics.data.repository.FingerprintPropertyRepository
@@ -40,6 +39,8 @@ import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dump.DumpManager
import com.android.systemui.keyguard.shared.model.AuthenticationFlags
import com.android.systemui.keyguard.shared.model.DevicePosture
import com.android.systemui.res.R
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionsRepository
import com.android.systemui.user.data.repository.UserRepository
import java.io.PrintWriter
import javax.inject.Inject
@@ -133,6 +134,7 @@ constructor(
    devicePostureRepository: DevicePostureRepository,
    facePropertyRepository: FacePropertyRepository,
    fingerprintPropertyRepository: FingerprintPropertyRepository,
    mobileConnectionsRepository: MobileConnectionsRepository,
    dumpManager: DumpManager,
) : BiometricSettingsRepository, Dumpable {

@@ -346,11 +348,12 @@ constructor(
            .and(isFingerprintBiometricAllowed)
            .stateIn(scope, SharingStarted.Eagerly, false)

    override val isFaceAuthEnrolledAndEnabled: Flow<Boolean>
        get() = isFaceAuthenticationEnabled.and(isFaceEnrolled)
    override val isFaceAuthEnrolledAndEnabled: Flow<Boolean> =
        isFaceAuthenticationEnabled
            .and(isFaceEnrolled)
            .and(mobileConnectionsRepository.isAnySimSecure.isFalse())

    override val isFaceAuthCurrentlyAllowed: Flow<Boolean>
        get() =
    override val isFaceAuthCurrentlyAllowed: Flow<Boolean> =
        isFaceAuthEnrolledAndEnabled
            .and(isFaceBiometricsAllowed)
            .and(isFaceAuthSupportedInCurrentPosture)
@@ -426,3 +429,5 @@ private fun DevicePolicyManager.isNotActive(userId: Int, policy: Int): Boolean =

private fun Flow<Boolean>.and(anotherFlow: Flow<Boolean>): Flow<Boolean> =
    this.combine(anotherFlow) { a, b -> a && b }

private fun Flow<Boolean>.isFalse(): Flow<Boolean> = this.map { !it }
+4 −0
Original line number Diff line number Diff line
@@ -186,6 +186,10 @@ constructor(
            }
        )
    }

    fun logOnSimStateChanged() {
        buffer.log(TAG, LogLevel.INFO, "onSimStateChanged")
    }
}

private const val TAG = "MobileInputLog"
+8 −0
Original line number Diff line number Diff line
@@ -90,4 +90,12 @@ interface MobileConnectionsRepository {

    /** Fallback [MobileIconGroup] in the case where there is no icon in the mapping */
    val defaultMobileIconGroup: Flow<MobileIconGroup>

    /**
     * If any active SIM on the device is in
     * [android.telephony.TelephonyManager.SIM_STATE_PIN_REQUIRED] or
     * [android.telephony.TelephonyManager.SIM_STATE_PUK_REQUIRED] or
     * [android.telephony.TelephonyManager.SIM_STATE_PERM_DISABLED]
     */
    val isAnySimSecure: Flow<Boolean>
}
+2 −0
Original line number Diff line number Diff line
@@ -151,6 +151,8 @@ constructor(
    override val defaultMobileIconGroup: Flow<SignalIcon.MobileIconGroup> =
        activeRepo.flatMapLatest { it.defaultMobileIconGroup }

    override val isAnySimSecure: Flow<Boolean> = activeRepo.flatMapLatest { it.isAnySimSecure }

    override val defaultDataSubId: StateFlow<Int> =
        activeRepo
            .flatMapLatest { it.defaultDataSubId }
Loading