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

Commit 568bfcd1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix fpAuth AOD => GONE AodPromotedNotif sensitivity flicker" into main

parents 4057a82e bd4ec4cb
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.dump.dumpManager
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.domain.interactor.biometricUnlockInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.collectLastValue
@@ -59,6 +61,7 @@ class AODPromotedNotificationsInteractorTest : SysuiTestCase() {
            keyguardInteractor = keyguardInteractor,
            sensitiveNotificationProtectionInteractor = sensitiveNotificationProtectionInteractor,
            dumpManager = dumpManager,
            biometricUnlockInteractor = biometricUnlockInteractor,
        )
    }

@@ -128,6 +131,26 @@ class AODPromotedNotificationsInteractorTest : SysuiTestCase() {
            assertThat(content!!.title).isEqualTo("REDACTED")
        }

    @Test
    fun content_sensitive_unlocked_biometricUnlockDismissesKeyguard() =
        kosmos.runTest {
            // GIVEN a promoted entry
            val ronEntry = buildPublicPrivatePromotedOngoing()

            setKeyguardLocked(true)
            setScreenSharingProtectionActive(false)
            kosmos.fakeKeyguardRepository.setBiometricUnlockState(
                BiometricUnlockMode.UNLOCK_COLLAPSING
            )

            renderNotificationListInteractor.setRenderedList(listOf(ronEntry))

            // THEN aod content remains redacted
            val content by collectLastValue(underTest.content)
            assertThat(content).isNotNull()
            assertThat(content!!.title).isEqualTo("REDACTED")
        }

    private fun Kosmos.setKeyguardLocked(locked: Boolean) {
        fakeKeyguardRepository.setKeyguardDismissible(!locked)
    }
+10 −4
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ package com.android.systemui.statusbar.notification.promoted.domain.interactor

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dump.DumpManager
import com.android.systemui.keyguard.domain.interactor.BiometricUnlockInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
import com.android.systemui.statusbar.policy.domain.interactor.SensitiveNotificationProtectionInteractor
import com.android.systemui.util.kotlin.FlowDumperImpl
@@ -36,18 +38,22 @@ constructor(
    keyguardInteractor: KeyguardInteractor,
    sensitiveNotificationProtectionInteractor: SensitiveNotificationProtectionInteractor,
    dumpManager: DumpManager,
    biometricUnlockInteractor: BiometricUnlockInteractor,
) : FlowDumperImpl(dumpManager) {

    /**
     * Whether the system is unlocked and not screensharing such that private notification content
     * is allowed to show on the aod
     * Whether the system is unlocked, not screensharing such that private notification content is
     * allowed to show on the aod, and a biometric is not about to dismiss the keyguard
     */
    private val canShowPrivateNotificationContent: Flow<Boolean> =
        combine(
            keyguardInteractor.isKeyguardDismissible,
            sensitiveNotificationProtectionInteractor.isSensitiveStateActive,
        ) { isKeyguardDismissible, isSensitive ->
            isKeyguardDismissible && !isSensitive
            biometricUnlockInteractor.unlockState,
        ) { isKeyguardDismissible, isSensitive, biometricUnlockState ->
            isKeyguardDismissible &&
                !isSensitive &&
                !BiometricUnlockMode.dismissesKeyguard(biometricUnlockState.mode)
        }

    /** The content to show as the promoted notification on AOD */
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.notification.promoted.domain.interactor

import com.android.systemui.dump.dumpManager
import com.android.systemui.keyguard.domain.interactor.biometricUnlockInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.statusbar.policy.domain.interactor.sensitiveNotificationProtectionInteractor
@@ -28,5 +29,6 @@ val Kosmos.aodPromotedNotificationInteractor by
            keyguardInteractor = keyguardInteractor,
            sensitiveNotificationProtectionInteractor = sensitiveNotificationProtectionInteractor,
            dumpManager = dumpManager,
            biometricUnlockInteractor = biometricUnlockInteractor,
        )
    }