Loading packages/SystemUI/src/com/android/systemui/log/dagger/SecureLockDeviceLog.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.dagger import javax.inject.Qualifier /** A [Qualifier] for the log buffer for the secure lock device feature. */ @Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class SecureLockDeviceLog packages/SystemUI/src/com/android/systemui/securelockdevice/dagger/SecureLockDeviceModule.kt +13 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.deviceentry.domain.interactor.DeviceEntryBiometricSettingsInteractor import com.android.systemui.deviceentry.domain.interactor.SystemUIDeviceEntryFaceAuthInteractor import com.android.systemui.keyguard.data.repository.BiometricSettingsRepository import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBufferFactory import com.android.systemui.log.dagger.SecureLockDeviceLog import com.android.systemui.securelockdevice.data.repository.SecureLockDeviceRepository import com.android.systemui.securelockdevice.data.repository.SecureLockDeviceRepositoryImpl import com.android.systemui.securelockdevice.domain.interactor.SecureLockDeviceInteractor Loading @@ -32,6 +35,7 @@ import dagger.Provides import java.util.concurrent.Executor import kotlinx.coroutines.CoroutineScope /** Dagger module for secure lock device feature. */ @Module interface SecureLockDeviceModule { Loading @@ -54,6 +58,7 @@ interface SecureLockDeviceModule { @SysUISingleton fun providesSecureLockDeviceInteractor( @Application applicationScope: CoroutineScope, @SecureLockDeviceLog logBuffer: LogBuffer, secureLockDeviceRepository: SecureLockDeviceRepository, biometricSettingsInteractor: DeviceEntryBiometricSettingsInteractor, deviceEntryFaceAuthInteractor: SystemUIDeviceEntryFaceAuthInteractor, Loading @@ -62,6 +67,7 @@ interface SecureLockDeviceModule { ): SecureLockDeviceInteractor { return SecureLockDeviceInteractor( applicationScope = applicationScope, logBuffer = logBuffer, secureLockDeviceRepository = secureLockDeviceRepository, biometricSettingsInteractor = biometricSettingsInteractor, deviceEntryFaceAuthInteractor = deviceEntryFaceAuthInteractor, Loading @@ -69,5 +75,12 @@ interface SecureLockDeviceModule { facePropertyInteractor = facePropertyInteractor, ) } @Provides @SysUISingleton @SecureLockDeviceLog fun provideSecureLockDeviceLogBuffer(factory: LogBufferFactory): LogBuffer { return factory.create("SecureLockDeviceLog", 100) } } } packages/SystemUI/src/com/android/systemui/securelockdevice/domain/interactor/SecureLockDeviceInteractor.kt +25 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.deviceentry.domain.interactor.DeviceEntryBiometricSettingsInteractor import com.android.systemui.deviceentry.domain.interactor.SystemUIDeviceEntryFaceAuthInteractor import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.log.dagger.SecureLockDeviceLog import com.android.systemui.securelockdevice.data.repository.SecureLockDeviceRepository import javax.inject.Inject import kotlinx.coroutines.CoroutineScope Loading @@ -37,12 +40,21 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.stateIn /** Handles business logic for secure lock device. */ /** * Handles business logic for secure lock device. * * Secure lock device is a feature called by a privileged component to remotely enable secure lock * on the device across all users. Secure lock is an enhanced security state that restricts access * to sensitive data (app notifications, widgets, quick settings, assistant, etc), and locks the * device under the calling user's credentials with multi-factor authentication for device entry, * such as two-factor primary authentication and strong biometric authentication. */ @SysUISingleton class SecureLockDeviceInteractor @Inject constructor( @Application applicationScope: CoroutineScope, @SecureLockDeviceLog private val logBuffer: LogBuffer, secureLockDeviceRepository: SecureLockDeviceRepository, biometricSettingsInteractor: DeviceEntryBiometricSettingsInteractor, private val deviceEntryFaceAuthInteractor: SystemUIDeviceEntryFaceAuthInteractor, Loading Loading @@ -120,6 +132,12 @@ constructor( /** Called upon updates to strong biometric authenticated status. */ fun onBiometricAuthenticatedStateUpdated(authState: PromptAuthState) { logBuffer.log( TAG, LogLevel.DEBUG, { str1 = authState.toString() }, { "onBiometricAuthenticatedStateUpdated: authState=$str1" }, ) _strongBiometricAuthenticationComplete.value = authState.isAuthenticatedAndConfirmed } Loading @@ -129,6 +147,7 @@ constructor( * indicating the biometric auth UI is ready for dismissal */ fun onReadyToDismissBiometricAuth() { logBuffer.log(TAG, LogLevel.DEBUG, "onReadyToDismissBiometricAuth") _isFullyUnlockedAndReadyToDismiss.value = true } Loading Loading @@ -170,7 +189,12 @@ constructor( /** Called when biometric authentication is requested for secure lock device. */ // TODO: call when secure lock device biometric auth is shown fun onBiometricAuthRequested() { logBuffer.log(TAG, LogLevel.DEBUG, "onBiometricAuthRequested") _shouldShowBiometricAuth.value = true deviceEntryFaceAuthInteractor.onSecureLockDeviceBiometricAuthRequested() } companion object { private const val TAG = "SecureLockDeviceInteractor" } } packages/SystemUI/tests/utils/src/com/android/systemui/securelockdevice/domain/interactor/SecureLockDeviceInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -22,12 +22,14 @@ import com.android.systemui.deviceentry.domain.interactor.deviceEntryBiometricSe import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.log.logcatLogBuffer import com.android.systemui.securelockdevice.data.repository.secureLockDeviceRepository val Kosmos.secureLockDeviceInteractor by Kosmos.Fixture { SecureLockDeviceInteractor( applicationScope = applicationCoroutineScope, logBuffer = logcatLogBuffer("SecureLockDeviceLog"), secureLockDeviceRepository = secureLockDeviceRepository, biometricSettingsInteractor = deviceEntryBiometricSettingsInteractor, deviceEntryFaceAuthInteractor = deviceEntryFaceAuthInteractor, Loading Loading
packages/SystemUI/src/com/android/systemui/log/dagger/SecureLockDeviceLog.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.dagger import javax.inject.Qualifier /** A [Qualifier] for the log buffer for the secure lock device feature. */ @Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class SecureLockDeviceLog
packages/SystemUI/src/com/android/systemui/securelockdevice/dagger/SecureLockDeviceModule.kt +13 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.deviceentry.domain.interactor.DeviceEntryBiometricSettingsInteractor import com.android.systemui.deviceentry.domain.interactor.SystemUIDeviceEntryFaceAuthInteractor import com.android.systemui.keyguard.data.repository.BiometricSettingsRepository import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBufferFactory import com.android.systemui.log.dagger.SecureLockDeviceLog import com.android.systemui.securelockdevice.data.repository.SecureLockDeviceRepository import com.android.systemui.securelockdevice.data.repository.SecureLockDeviceRepositoryImpl import com.android.systemui.securelockdevice.domain.interactor.SecureLockDeviceInteractor Loading @@ -32,6 +35,7 @@ import dagger.Provides import java.util.concurrent.Executor import kotlinx.coroutines.CoroutineScope /** Dagger module for secure lock device feature. */ @Module interface SecureLockDeviceModule { Loading @@ -54,6 +58,7 @@ interface SecureLockDeviceModule { @SysUISingleton fun providesSecureLockDeviceInteractor( @Application applicationScope: CoroutineScope, @SecureLockDeviceLog logBuffer: LogBuffer, secureLockDeviceRepository: SecureLockDeviceRepository, biometricSettingsInteractor: DeviceEntryBiometricSettingsInteractor, deviceEntryFaceAuthInteractor: SystemUIDeviceEntryFaceAuthInteractor, Loading @@ -62,6 +67,7 @@ interface SecureLockDeviceModule { ): SecureLockDeviceInteractor { return SecureLockDeviceInteractor( applicationScope = applicationScope, logBuffer = logBuffer, secureLockDeviceRepository = secureLockDeviceRepository, biometricSettingsInteractor = biometricSettingsInteractor, deviceEntryFaceAuthInteractor = deviceEntryFaceAuthInteractor, Loading @@ -69,5 +75,12 @@ interface SecureLockDeviceModule { facePropertyInteractor = facePropertyInteractor, ) } @Provides @SysUISingleton @SecureLockDeviceLog fun provideSecureLockDeviceLogBuffer(factory: LogBufferFactory): LogBuffer { return factory.create("SecureLockDeviceLog", 100) } } }
packages/SystemUI/src/com/android/systemui/securelockdevice/domain/interactor/SecureLockDeviceInteractor.kt +25 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.deviceentry.domain.interactor.DeviceEntryBiometricSettingsInteractor import com.android.systemui.deviceentry.domain.interactor.SystemUIDeviceEntryFaceAuthInteractor import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.log.dagger.SecureLockDeviceLog import com.android.systemui.securelockdevice.data.repository.SecureLockDeviceRepository import javax.inject.Inject import kotlinx.coroutines.CoroutineScope Loading @@ -37,12 +40,21 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.stateIn /** Handles business logic for secure lock device. */ /** * Handles business logic for secure lock device. * * Secure lock device is a feature called by a privileged component to remotely enable secure lock * on the device across all users. Secure lock is an enhanced security state that restricts access * to sensitive data (app notifications, widgets, quick settings, assistant, etc), and locks the * device under the calling user's credentials with multi-factor authentication for device entry, * such as two-factor primary authentication and strong biometric authentication. */ @SysUISingleton class SecureLockDeviceInteractor @Inject constructor( @Application applicationScope: CoroutineScope, @SecureLockDeviceLog private val logBuffer: LogBuffer, secureLockDeviceRepository: SecureLockDeviceRepository, biometricSettingsInteractor: DeviceEntryBiometricSettingsInteractor, private val deviceEntryFaceAuthInteractor: SystemUIDeviceEntryFaceAuthInteractor, Loading Loading @@ -120,6 +132,12 @@ constructor( /** Called upon updates to strong biometric authenticated status. */ fun onBiometricAuthenticatedStateUpdated(authState: PromptAuthState) { logBuffer.log( TAG, LogLevel.DEBUG, { str1 = authState.toString() }, { "onBiometricAuthenticatedStateUpdated: authState=$str1" }, ) _strongBiometricAuthenticationComplete.value = authState.isAuthenticatedAndConfirmed } Loading @@ -129,6 +147,7 @@ constructor( * indicating the biometric auth UI is ready for dismissal */ fun onReadyToDismissBiometricAuth() { logBuffer.log(TAG, LogLevel.DEBUG, "onReadyToDismissBiometricAuth") _isFullyUnlockedAndReadyToDismiss.value = true } Loading Loading @@ -170,7 +189,12 @@ constructor( /** Called when biometric authentication is requested for secure lock device. */ // TODO: call when secure lock device biometric auth is shown fun onBiometricAuthRequested() { logBuffer.log(TAG, LogLevel.DEBUG, "onBiometricAuthRequested") _shouldShowBiometricAuth.value = true deviceEntryFaceAuthInteractor.onSecureLockDeviceBiometricAuthRequested() } companion object { private const val TAG = "SecureLockDeviceInteractor" } }
packages/SystemUI/tests/utils/src/com/android/systemui/securelockdevice/domain/interactor/SecureLockDeviceInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -22,12 +22,14 @@ import com.android.systemui.deviceentry.domain.interactor.deviceEntryBiometricSe import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.log.logcatLogBuffer import com.android.systemui.securelockdevice.data.repository.secureLockDeviceRepository val Kosmos.secureLockDeviceInteractor by Kosmos.Fixture { SecureLockDeviceInteractor( applicationScope = applicationCoroutineScope, logBuffer = logcatLogBuffer("SecureLockDeviceLog"), secureLockDeviceRepository = secureLockDeviceRepository, biometricSettingsInteractor = deviceEntryBiometricSettingsInteractor, deviceEntryFaceAuthInteractor = deviceEntryFaceAuthInteractor, Loading