Loading packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt +19 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.bouncer.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.internal.logging.uiEventLoggerFake import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository Loading @@ -25,6 +26,7 @@ import com.android.systemui.authentication.domain.interactor.AuthenticationResul import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate import com.android.systemui.bouncer.shared.logging.BouncerUiEvent import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.coroutines.collectValues import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor Loading Loading @@ -53,6 +55,7 @@ class BouncerInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().apply { fakeSceneContainerFlags.enabled = true } private val kosmos = testKosmos().apply { fakeSceneContainerFlags.enabled = true } private val testScope = kosmos.testScope private val testScope = kosmos.testScope private val authenticationInteractor = kosmos.authenticationInteractor private val authenticationInteractor = kosmos.authenticationInteractor private val uiEventLoggerFake = kosmos.uiEventLoggerFake private lateinit var underTest: BouncerInteractor private lateinit var underTest: BouncerInteractor Loading Loading @@ -83,6 +86,7 @@ class BouncerInteractorTest : SysuiTestCase() { // Thus, when auth method is sim, we expect to skip here. // Thus, when auth method is sim, we expect to skip here. assertThat(underTest.authenticate(FakeAuthenticationRepository.DEFAULT_PIN)) assertThat(underTest.authenticate(FakeAuthenticationRepository.DEFAULT_PIN)) .isEqualTo(AuthenticationResult.SKIPPED) .isEqualTo(AuthenticationResult.SKIPPED) assertThat(uiEventLoggerFake.numLogs()).isEqualTo(0) } } @Test @Test Loading @@ -104,6 +108,8 @@ class BouncerInteractorTest : SysuiTestCase() { // Wrong 6-digit pin // Wrong 6-digit pin assertThat(underTest.authenticate(listOf(1, 2, 3, 5, 5, 6), tryAutoConfirm = true)) assertThat(underTest.authenticate(listOf(1, 2, 3, 5, 5, 6), tryAutoConfirm = true)) .isEqualTo(AuthenticationResult.FAILED) .isEqualTo(AuthenticationResult.FAILED) assertThat(uiEventLoggerFake[0].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_FAILURE.id) // Correct input. // Correct input. assertThat( assertThat( Loading @@ -113,6 +119,9 @@ class BouncerInteractorTest : SysuiTestCase() { ) ) ) ) .isEqualTo(AuthenticationResult.SUCCEEDED) .isEqualTo(AuthenticationResult.SUCCEEDED) assertThat(uiEventLoggerFake[1].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS.id) assertThat(uiEventLoggerFake.numLogs()).isEqualTo(2) } } @Test @Test Loading Loading @@ -148,6 +157,8 @@ class BouncerInteractorTest : SysuiTestCase() { // Wrong input. // Wrong input. assertThat(underTest.authenticate("alohamora".toList())) assertThat(underTest.authenticate("alohamora".toList())) .isEqualTo(AuthenticationResult.FAILED) .isEqualTo(AuthenticationResult.FAILED) assertThat(uiEventLoggerFake[0].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_FAILURE.id) // Too short input. // Too short input. assertThat( assertThat( Loading @@ -165,6 +176,9 @@ class BouncerInteractorTest : SysuiTestCase() { // Correct input. // Correct input. assertThat(underTest.authenticate("password".toList())) assertThat(underTest.authenticate("password".toList())) .isEqualTo(AuthenticationResult.SUCCEEDED) .isEqualTo(AuthenticationResult.SUCCEEDED) assertThat(uiEventLoggerFake[1].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS.id) assertThat(uiEventLoggerFake.numLogs()).isEqualTo(2) } } @Test @Test Loading @@ -187,6 +201,8 @@ class BouncerInteractorTest : SysuiTestCase() { assertThat(wrongPattern.size) assertThat(wrongPattern.size) .isAtLeast(kosmos.fakeAuthenticationRepository.minPatternLength) .isAtLeast(kosmos.fakeAuthenticationRepository.minPatternLength) assertThat(underTest.authenticate(wrongPattern)).isEqualTo(AuthenticationResult.FAILED) assertThat(underTest.authenticate(wrongPattern)).isEqualTo(AuthenticationResult.FAILED) assertThat(uiEventLoggerFake[0].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_FAILURE.id) // Too short input. // Too short input. val tooShortPattern = val tooShortPattern = Loading @@ -200,6 +216,9 @@ class BouncerInteractorTest : SysuiTestCase() { // Correct input. // Correct input. assertThat(underTest.authenticate(FakeAuthenticationRepository.PATTERN)) assertThat(underTest.authenticate(FakeAuthenticationRepository.PATTERN)) .isEqualTo(AuthenticationResult.SUCCEEDED) .isEqualTo(AuthenticationResult.SUCCEEDED) assertThat(uiEventLoggerFake[1].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS.id) assertThat(uiEventLoggerFake.numLogs()).isEqualTo(2) } } @Test @Test Loading packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt +21 −0 Original line number Original line Diff line number Diff line Loading @@ -16,16 +16,23 @@ package com.android.systemui.bouncer.domain.interactor package com.android.systemui.bouncer.domain.interactor import android.app.StatusBarManager.SESSION_KEYGUARD import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneKey import com.android.internal.logging.UiEventLogger import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor import com.android.systemui.authentication.domain.interactor.AuthenticationResult import com.android.systemui.authentication.domain.interactor.AuthenticationResult import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Password import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Pattern import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Pin import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Sim import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Sim import com.android.systemui.bouncer.data.repository.BouncerRepository import com.android.systemui.bouncer.data.repository.BouncerRepository import com.android.systemui.bouncer.shared.logging.BouncerUiEvent import com.android.systemui.classifier.FalsingClassifier import com.android.systemui.classifier.FalsingClassifier import com.android.systemui.classifier.domain.interactor.FalsingInteractor import com.android.systemui.classifier.domain.interactor.FalsingInteractor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor import com.android.systemui.log.SessionTracker import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.shared.model.Scenes Loading @@ -50,6 +57,8 @@ constructor( private val deviceEntryFaceAuthInteractor: DeviceEntryFaceAuthInteractor, private val deviceEntryFaceAuthInteractor: DeviceEntryFaceAuthInteractor, private val falsingInteractor: FalsingInteractor, private val falsingInteractor: FalsingInteractor, private val powerInteractor: PowerInteractor, private val powerInteractor: PowerInteractor, private val uiEventLogger: UiEventLogger, private val sessionTracker: SessionTracker, sceneInteractor: SceneInteractor, sceneInteractor: SceneInteractor, ) { ) { private val _onIncorrectBouncerInput = MutableSharedFlow<Unit>() private val _onIncorrectBouncerInput = MutableSharedFlow<Unit>() Loading Loading @@ -162,6 +171,18 @@ constructor( ) { ) { _onIncorrectBouncerInput.emit(Unit) _onIncorrectBouncerInput.emit(Unit) } } if (authenticationInteractor.getAuthenticationMethod() in setOf(Pin, Password, Pattern)) { if (authResult == AuthenticationResult.SUCCEEDED) { uiEventLogger.log(BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS) } else if (authResult == AuthenticationResult.FAILED) { uiEventLogger.log( BouncerUiEvent.BOUNCER_PASSWORD_FAILURE, sessionTracker.getSessionId(SESSION_KEYGUARD) ) } } return authResult return authResult } } Loading packages/SystemUI/src/com/android/systemui/bouncer/shared/logging/BouncerUiEvent.kt 0 → 100644 +37 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.bouncer.shared.logging import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEventLogger /** * Legacy bouncer UI events {@link com.android.keyguard.KeyguardSecurityContainer.BouncerUiEvent}. * Only contains that used by metrics. */ enum class BouncerUiEvent(private val _id: Int) : UiEventLogger.UiEventEnum { @UiEvent(doc = "Bouncer is dismissed using extended security access.") BOUNCER_DISMISS_EXTENDED_ACCESS(413), // PASSWORD here includes password, pattern, and pin. @UiEvent(doc = "Bouncer is successfully unlocked using password.") BOUNCER_PASSWORD_SUCCESS(418), @UiEvent(doc = "An attempt to unlock bouncer using password has failed.") BOUNCER_PASSWORD_FAILURE(419); override fun getId() = _id } packages/SystemUI/tests/utils/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorKosmos.kt +4 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.bouncer.domain.interactor package com.android.systemui.bouncer.domain.interactor import com.android.internal.logging.uiEventLogger import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.bouncer.data.repository.bouncerRepository import com.android.systemui.bouncer.data.repository.bouncerRepository import com.android.systemui.classifier.domain.interactor.falsingInteractor import com.android.systemui.classifier.domain.interactor.falsingInteractor Loading @@ -23,6 +24,7 @@ import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInt import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.testScope import com.android.systemui.log.sessionTracker import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor Loading @@ -34,6 +36,8 @@ val Kosmos.bouncerInteractor by Fixture { deviceEntryFaceAuthInteractor = deviceEntryFaceAuthInteractor, deviceEntryFaceAuthInteractor = deviceEntryFaceAuthInteractor, falsingInteractor = falsingInteractor, falsingInteractor = falsingInteractor, powerInteractor = powerInteractor, powerInteractor = powerInteractor, uiEventLogger = uiEventLogger, sessionTracker = sessionTracker, sceneInteractor = sceneInteractor, sceneInteractor = sceneInteractor, ) ) } } packages/SystemUI/tests/utils/src/com/android/systemui/log/SessionTrackerKosmos.kt 0 → 100644 +23 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.log import com.android.systemui.kosmos.Kosmos import com.android.systemui.util.mockito.mock val Kosmos.sessionTracker: SessionTracker by Kosmos.Fixture { sessionTrackerMock } val Kosmos.sessionTrackerMock: SessionTracker by Kosmos.Fixture { mock() } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt +19 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.bouncer.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.internal.logging.uiEventLoggerFake import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository Loading @@ -25,6 +26,7 @@ import com.android.systemui.authentication.domain.interactor.AuthenticationResul import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate import com.android.systemui.bouncer.shared.logging.BouncerUiEvent import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.coroutines.collectValues import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor Loading Loading @@ -53,6 +55,7 @@ class BouncerInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().apply { fakeSceneContainerFlags.enabled = true } private val kosmos = testKosmos().apply { fakeSceneContainerFlags.enabled = true } private val testScope = kosmos.testScope private val testScope = kosmos.testScope private val authenticationInteractor = kosmos.authenticationInteractor private val authenticationInteractor = kosmos.authenticationInteractor private val uiEventLoggerFake = kosmos.uiEventLoggerFake private lateinit var underTest: BouncerInteractor private lateinit var underTest: BouncerInteractor Loading Loading @@ -83,6 +86,7 @@ class BouncerInteractorTest : SysuiTestCase() { // Thus, when auth method is sim, we expect to skip here. // Thus, when auth method is sim, we expect to skip here. assertThat(underTest.authenticate(FakeAuthenticationRepository.DEFAULT_PIN)) assertThat(underTest.authenticate(FakeAuthenticationRepository.DEFAULT_PIN)) .isEqualTo(AuthenticationResult.SKIPPED) .isEqualTo(AuthenticationResult.SKIPPED) assertThat(uiEventLoggerFake.numLogs()).isEqualTo(0) } } @Test @Test Loading @@ -104,6 +108,8 @@ class BouncerInteractorTest : SysuiTestCase() { // Wrong 6-digit pin // Wrong 6-digit pin assertThat(underTest.authenticate(listOf(1, 2, 3, 5, 5, 6), tryAutoConfirm = true)) assertThat(underTest.authenticate(listOf(1, 2, 3, 5, 5, 6), tryAutoConfirm = true)) .isEqualTo(AuthenticationResult.FAILED) .isEqualTo(AuthenticationResult.FAILED) assertThat(uiEventLoggerFake[0].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_FAILURE.id) // Correct input. // Correct input. assertThat( assertThat( Loading @@ -113,6 +119,9 @@ class BouncerInteractorTest : SysuiTestCase() { ) ) ) ) .isEqualTo(AuthenticationResult.SUCCEEDED) .isEqualTo(AuthenticationResult.SUCCEEDED) assertThat(uiEventLoggerFake[1].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS.id) assertThat(uiEventLoggerFake.numLogs()).isEqualTo(2) } } @Test @Test Loading Loading @@ -148,6 +157,8 @@ class BouncerInteractorTest : SysuiTestCase() { // Wrong input. // Wrong input. assertThat(underTest.authenticate("alohamora".toList())) assertThat(underTest.authenticate("alohamora".toList())) .isEqualTo(AuthenticationResult.FAILED) .isEqualTo(AuthenticationResult.FAILED) assertThat(uiEventLoggerFake[0].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_FAILURE.id) // Too short input. // Too short input. assertThat( assertThat( Loading @@ -165,6 +176,9 @@ class BouncerInteractorTest : SysuiTestCase() { // Correct input. // Correct input. assertThat(underTest.authenticate("password".toList())) assertThat(underTest.authenticate("password".toList())) .isEqualTo(AuthenticationResult.SUCCEEDED) .isEqualTo(AuthenticationResult.SUCCEEDED) assertThat(uiEventLoggerFake[1].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS.id) assertThat(uiEventLoggerFake.numLogs()).isEqualTo(2) } } @Test @Test Loading @@ -187,6 +201,8 @@ class BouncerInteractorTest : SysuiTestCase() { assertThat(wrongPattern.size) assertThat(wrongPattern.size) .isAtLeast(kosmos.fakeAuthenticationRepository.minPatternLength) .isAtLeast(kosmos.fakeAuthenticationRepository.minPatternLength) assertThat(underTest.authenticate(wrongPattern)).isEqualTo(AuthenticationResult.FAILED) assertThat(underTest.authenticate(wrongPattern)).isEqualTo(AuthenticationResult.FAILED) assertThat(uiEventLoggerFake[0].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_FAILURE.id) // Too short input. // Too short input. val tooShortPattern = val tooShortPattern = Loading @@ -200,6 +216,9 @@ class BouncerInteractorTest : SysuiTestCase() { // Correct input. // Correct input. assertThat(underTest.authenticate(FakeAuthenticationRepository.PATTERN)) assertThat(underTest.authenticate(FakeAuthenticationRepository.PATTERN)) .isEqualTo(AuthenticationResult.SUCCEEDED) .isEqualTo(AuthenticationResult.SUCCEEDED) assertThat(uiEventLoggerFake[1].eventId) .isEqualTo(BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS.id) assertThat(uiEventLoggerFake.numLogs()).isEqualTo(2) } } @Test @Test Loading
packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt +21 −0 Original line number Original line Diff line number Diff line Loading @@ -16,16 +16,23 @@ package com.android.systemui.bouncer.domain.interactor package com.android.systemui.bouncer.domain.interactor import android.app.StatusBarManager.SESSION_KEYGUARD import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneKey import com.android.internal.logging.UiEventLogger import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor import com.android.systemui.authentication.domain.interactor.AuthenticationResult import com.android.systemui.authentication.domain.interactor.AuthenticationResult import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Password import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Pattern import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Pin import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Sim import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Sim import com.android.systemui.bouncer.data.repository.BouncerRepository import com.android.systemui.bouncer.data.repository.BouncerRepository import com.android.systemui.bouncer.shared.logging.BouncerUiEvent import com.android.systemui.classifier.FalsingClassifier import com.android.systemui.classifier.FalsingClassifier import com.android.systemui.classifier.domain.interactor.FalsingInteractor import com.android.systemui.classifier.domain.interactor.FalsingInteractor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor import com.android.systemui.log.SessionTracker import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.shared.model.Scenes Loading @@ -50,6 +57,8 @@ constructor( private val deviceEntryFaceAuthInteractor: DeviceEntryFaceAuthInteractor, private val deviceEntryFaceAuthInteractor: DeviceEntryFaceAuthInteractor, private val falsingInteractor: FalsingInteractor, private val falsingInteractor: FalsingInteractor, private val powerInteractor: PowerInteractor, private val powerInteractor: PowerInteractor, private val uiEventLogger: UiEventLogger, private val sessionTracker: SessionTracker, sceneInteractor: SceneInteractor, sceneInteractor: SceneInteractor, ) { ) { private val _onIncorrectBouncerInput = MutableSharedFlow<Unit>() private val _onIncorrectBouncerInput = MutableSharedFlow<Unit>() Loading Loading @@ -162,6 +171,18 @@ constructor( ) { ) { _onIncorrectBouncerInput.emit(Unit) _onIncorrectBouncerInput.emit(Unit) } } if (authenticationInteractor.getAuthenticationMethod() in setOf(Pin, Password, Pattern)) { if (authResult == AuthenticationResult.SUCCEEDED) { uiEventLogger.log(BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS) } else if (authResult == AuthenticationResult.FAILED) { uiEventLogger.log( BouncerUiEvent.BOUNCER_PASSWORD_FAILURE, sessionTracker.getSessionId(SESSION_KEYGUARD) ) } } return authResult return authResult } } Loading
packages/SystemUI/src/com/android/systemui/bouncer/shared/logging/BouncerUiEvent.kt 0 → 100644 +37 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.bouncer.shared.logging import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEventLogger /** * Legacy bouncer UI events {@link com.android.keyguard.KeyguardSecurityContainer.BouncerUiEvent}. * Only contains that used by metrics. */ enum class BouncerUiEvent(private val _id: Int) : UiEventLogger.UiEventEnum { @UiEvent(doc = "Bouncer is dismissed using extended security access.") BOUNCER_DISMISS_EXTENDED_ACCESS(413), // PASSWORD here includes password, pattern, and pin. @UiEvent(doc = "Bouncer is successfully unlocked using password.") BOUNCER_PASSWORD_SUCCESS(418), @UiEvent(doc = "An attempt to unlock bouncer using password has failed.") BOUNCER_PASSWORD_FAILURE(419); override fun getId() = _id }
packages/SystemUI/tests/utils/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorKosmos.kt +4 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.bouncer.domain.interactor package com.android.systemui.bouncer.domain.interactor import com.android.internal.logging.uiEventLogger import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.bouncer.data.repository.bouncerRepository import com.android.systemui.bouncer.data.repository.bouncerRepository import com.android.systemui.classifier.domain.interactor.falsingInteractor import com.android.systemui.classifier.domain.interactor.falsingInteractor Loading @@ -23,6 +24,7 @@ import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInt import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.testScope import com.android.systemui.log.sessionTracker import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor Loading @@ -34,6 +36,8 @@ val Kosmos.bouncerInteractor by Fixture { deviceEntryFaceAuthInteractor = deviceEntryFaceAuthInteractor, deviceEntryFaceAuthInteractor = deviceEntryFaceAuthInteractor, falsingInteractor = falsingInteractor, falsingInteractor = falsingInteractor, powerInteractor = powerInteractor, powerInteractor = powerInteractor, uiEventLogger = uiEventLogger, sessionTracker = sessionTracker, sceneInteractor = sceneInteractor, sceneInteractor = sceneInteractor, ) ) } }
packages/SystemUI/tests/utils/src/com/android/systemui/log/SessionTrackerKosmos.kt 0 → 100644 +23 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.log import com.android.systemui.kosmos.Kosmos import com.android.systemui.util.mockito.mock val Kosmos.sessionTracker: SessionTracker by Kosmos.Fixture { sessionTrackerMock } val Kosmos.sessionTrackerMock: SessionTracker by Kosmos.Fixture { mock() }