diff options
| author | 2024-04-24 23:12:58 +0000 | |
|---|---|---|
| committer | 2024-04-24 23:12:58 +0000 | |
| commit | 50c36bfdaa2190db8625154b119a1d2deb4c489e (patch) | |
| tree | ff5676cd122ea641b3d0dc4fb00c4b24983e7172 | |
| parent | 97a462b1948c9aacb6547290594f476a218f54e1 (diff) | |
| parent | 87118017e8c0e2fcb2b283b036b9d7a9c9f39093 (diff) | |
Merge "Request face auth on posture change to OPENED" into 24D1-dev
7 files changed, 38 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 8c51a4e0ce66..519622e24b1f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -42,7 +42,6 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_OPENED; -import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_UNKNOWN; import android.annotation.AnyThread; import android.annotation.MainThread; @@ -1868,7 +1867,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab @Override public void onPostureChanged(@DevicePostureInt int posture) { if (posture == DEVICE_POSTURE_OPENED) { - mLogger.d("Posture changed to open - attempting to request active unlock"); + mLogger.d("Posture changed to open - attempting to request active" + + " unlock and run face auth"); + getFaceAuthInteractor().onDeviceUnfolded(); requestActiveUnlockFromWakeReason(PowerManager.WAKE_REASON_UNFOLD_DEVICE, false); } @@ -2434,9 +2435,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab updateFingerprintListeningState(BIOMETRIC_ACTION_START); } }); - if (mConfigFaceAuthSupportedPosture != DEVICE_POSTURE_UNKNOWN) { - mDevicePostureController.addCallback(mPostureCallback); - } + mDevicePostureController.addCallback(mPostureCallback); updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE); mTaskStackChangeListeners.registerTaskStackListener(mTaskStackListener); diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/FacePropertyRepository.kt b/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/FacePropertyRepository.kt index 59b59bf1e437..7d4ba8409718 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/FacePropertyRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/FacePropertyRepository.kt @@ -39,6 +39,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main +import com.android.systemui.keyguard.shared.model.DevicePosture import com.android.systemui.res.R import java.util.concurrent.Executor import javax.inject.Inject @@ -68,6 +69,8 @@ interface FacePropertyRepository { /** The info of current available camera. */ val cameraInfo: StateFlow<CameraInfo?> + + val supportedPostures: List<DevicePosture> } /** Describes a biometric sensor */ @@ -188,6 +191,15 @@ constructor( initialValue = if (cameraInfoList.isNotEmpty()) cameraInfoList[0] else null ) + private val supportedPosture = + applicationContext.resources.getInteger(R.integer.config_face_auth_supported_posture) + override val supportedPostures: List<DevicePosture> = + if (supportedPosture == 0) { + DevicePosture.entries + } else { + listOf(DevicePosture.toPosture(supportedPosture)) + } + private val defaultSensorLocation: StateFlow<Point?> = cameraInfo .map { it?.cameraLocation } diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt index 99bd25bf0e52..2e51206f800b 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt @@ -64,6 +64,7 @@ interface DeviceEntryFaceAuthInteractor { fun onPrimaryBouncerUserInput() fun onAccessibilityAction() fun onWalletLaunched() + fun onDeviceUnfolded() /** Whether face auth is considered class 3 */ fun isFaceAuthStrong(): Boolean diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt index 3b9416690a85..49d432662e83 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt @@ -66,4 +66,5 @@ class NoopDeviceEntryFaceAuthInteractor @Inject constructor() : DeviceEntryFaceA override fun onPrimaryBouncerUserInput() {} override fun onAccessibilityAction() {} override fun onWalletLaunched() = Unit + override fun onDeviceUnfolded() {} } diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt index 0c9fbc27cc5d..78f9a74be169 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt @@ -37,6 +37,7 @@ import com.android.systemui.deviceentry.shared.model.ErrorFaceAuthenticationStat import com.android.systemui.deviceentry.shared.model.FaceAuthenticationStatus import com.android.systemui.keyguard.data.repository.BiometricSettingsRepository import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor +import com.android.systemui.keyguard.shared.model.DevicePosture import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.log.FaceAuthenticationLogger import com.android.systemui.power.domain.interactor.PowerInteractor @@ -244,6 +245,12 @@ constructor( } } + override fun onDeviceUnfolded() { + if (facePropertyRepository.supportedPostures.contains(DevicePosture.OPENED)) { + runFaceAuth(FaceAuthUiEvent.FACE_AUTH_UPDATED_POSTURE_CHANGED, true) + } + } + override fun registerListener(listener: FaceAuthenticationListener) { listeners.add(listener) } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java index 336a97ef09f4..a2d06c081945 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java @@ -2013,6 +2013,16 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { } @Test + public void unfoldFromPostureChange_sendActionToFaceAuthInteractor() { + // WHEN device posture changes to unfold + deviceInPostureStateOpened(); + mTestableLooper.processAllMessages(); + + // THEN request face auth + verify(mFaceAuthInteractor).onDeviceUnfolded(); + } + + @Test public void detectFingerprint_onTemporaryLockoutReset_authenticateFingerprint() { ArgumentCaptor<FingerprintManager.LockoutResetCallback> fpLockoutResetCallbackCaptor = ArgumentCaptor.forClass(FingerprintManager.LockoutResetCallback.class); diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/data/repository/FakeFacePropertyRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/data/repository/FakeFacePropertyRepository.kt index 68ef55573dc8..ea069632c8c1 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/data/repository/FakeFacePropertyRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/data/repository/FakeFacePropertyRepository.kt @@ -19,6 +19,7 @@ package com.android.systemui.biometrics.data.repository import android.graphics.Point import com.android.systemui.biometrics.shared.model.LockoutMode +import com.android.systemui.keyguard.shared.model.DevicePosture import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow @@ -37,6 +38,8 @@ class FakeFacePropertyRepository : FacePropertyRepository { override val cameraInfo: StateFlow<CameraInfo?> get() = currentCameraInfo + override val supportedPostures: List<DevicePosture> = listOf(DevicePosture.CLOSED) + fun setLockoutMode(userId: Int, mode: LockoutMode) { lockoutModesForUser[userId] = mode } |