Loading packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/AuthControllerTest.java +21 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import static org.mockito.Mockito.when; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.KeyguardManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; Loading Loading @@ -181,6 +182,8 @@ public class AuthControllerTest extends SysuiTestCase { @Captor private ArgumentCaptor<IFaceAuthenticatorsRegisteredCallback> mFaceAuthenticatorsRegisteredCaptor; @Captor private ArgumentCaptor<KeyguardManager.KeyguardLockedStateListener> mKeyguardLockedStateCaptor; @Captor private ArgumentCaptor<BiometricStateListener> mBiometricStateCaptor; @Captor private ArgumentCaptor<Integer> mModalityCaptor; Loading @@ -191,6 +194,8 @@ public class AuthControllerTest extends SysuiTestCase { @Mock private VibratorHelper mVibratorHelper; @Mock private KeyguardManager mKeyguardManager; @Mock private MSDLPlayer mMSDLPlayer; private TestableContext mContextSpy; Loading Loading @@ -271,6 +276,9 @@ public class AuthControllerTest extends SysuiTestCase { mFpAuthenticatorsRegisteredCaptor.getValue().onAllAuthenticatorsRegistered(fpProps); mFaceAuthenticatorsRegisteredCaptor.getValue().onAllAuthenticatorsRegistered(faceProps); verify(mKeyguardManager).addKeyguardLockedStateListener(any(), mKeyguardLockedStateCaptor.capture()); // Ensures that the operations posted on the handler get executed. waitForIdleSync(); } Loading Loading @@ -975,6 +983,18 @@ public class AuthControllerTest extends SysuiTestCase { eq(null) /* credentialAttestation */); } @Test public void testCloseDialog_whenDeviceLocks() throws Exception { showDialog(new int[]{1} /* sensorIds */, false /* credentialAllowed */); mKeyguardLockedStateCaptor.getValue().onKeyguardLockedStateChanged( true /* isKeyguardLocked */); verify(mReceiver).onDialogDismissed( eq(BiometricPrompt.DISMISSED_REASON_USER_CANCEL), eq(null) /* credentialAttestation */); } @Test public void testShowDialog_whenOwnerNotInForeground() { PromptInfo promptInfo = createTestPromptInfo(); Loading Loading @@ -1191,7 +1211,7 @@ public class AuthControllerTest extends SysuiTestCase { mWakefulnessLifecycle, mUserManager, mLockPatternUtils, () -> mUdfpsLogger, () -> mLogContextInteractor, () -> mPromptSelectionInteractor, () -> mCredentialViewModel, () -> mPromptViewModel, mInteractionJankMonitor, mHandler, mBackgroundExecutor, mUdfpsUtils, mVibratorHelper, mHandler, mBackgroundExecutor, mUdfpsUtils, mVibratorHelper, mKeyguardManager, mLazyViewCapture, mMSDLPlayer); } Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +0 −11 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.AlertDialog; import android.app.KeyguardManager; import android.content.Context; import android.content.res.Configuration; import android.graphics.PixelFormat; Loading Loading @@ -316,16 +315,6 @@ public class AuthContainerView extends LinearLayout mBiometricCallback = new BiometricCallback(); mMSDLPlayer = msdlPlayer; // Listener for when device locks from adaptive auth, dismiss prompt getContext().getSystemService(KeyguardManager.class).addKeyguardLockedStateListener( getContext().getMainExecutor(), isKeyguardLocked -> { if (isKeyguardLocked) { onStartedGoingToSleep(); } } ); final BiometricModalities biometricModalities = new BiometricModalities( Utils.findFirstSensorProperties(fpProps, mConfig.mSensorIds), Utils.findFirstSensorProperties(faceProps, mConfig.mSensorIds)); Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +11 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.systemui.util.ConvenienceExtensionsKt.toKotlinLazy; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityTaskManager; import android.app.KeyguardManager; import android.app.TaskStackListener; import android.content.BroadcastReceiver; import android.content.Context; Loading Loading @@ -732,6 +733,7 @@ public class AuthController implements @Background DelayableExecutor bgExecutor, @NonNull UdfpsUtils udfpsUtils, @NonNull VibratorHelper vibratorHelper, @NonNull KeyguardManager keyguardManager, Lazy<ViewCapture> daggerLazyViewCapture, @NonNull MSDLPlayer msdlPlayer) { mContext = context; Loading Loading @@ -762,6 +764,15 @@ public class AuthController implements mPromptViewModelProvider = promptViewModelProvider; mCredentialViewModelProvider = credentialViewModelProvider; keyguardManager.addKeyguardLockedStateListener( context.getMainExecutor(), isKeyguardLocked -> { if (isKeyguardLocked) { closeDialog("Device lock"); } } ); mOrientationListener = new BiometricDisplayListener( context, mDisplayManager, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/AuthControllerTest.java +21 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import static org.mockito.Mockito.when; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.KeyguardManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; Loading Loading @@ -181,6 +182,8 @@ public class AuthControllerTest extends SysuiTestCase { @Captor private ArgumentCaptor<IFaceAuthenticatorsRegisteredCallback> mFaceAuthenticatorsRegisteredCaptor; @Captor private ArgumentCaptor<KeyguardManager.KeyguardLockedStateListener> mKeyguardLockedStateCaptor; @Captor private ArgumentCaptor<BiometricStateListener> mBiometricStateCaptor; @Captor private ArgumentCaptor<Integer> mModalityCaptor; Loading @@ -191,6 +194,8 @@ public class AuthControllerTest extends SysuiTestCase { @Mock private VibratorHelper mVibratorHelper; @Mock private KeyguardManager mKeyguardManager; @Mock private MSDLPlayer mMSDLPlayer; private TestableContext mContextSpy; Loading Loading @@ -271,6 +276,9 @@ public class AuthControllerTest extends SysuiTestCase { mFpAuthenticatorsRegisteredCaptor.getValue().onAllAuthenticatorsRegistered(fpProps); mFaceAuthenticatorsRegisteredCaptor.getValue().onAllAuthenticatorsRegistered(faceProps); verify(mKeyguardManager).addKeyguardLockedStateListener(any(), mKeyguardLockedStateCaptor.capture()); // Ensures that the operations posted on the handler get executed. waitForIdleSync(); } Loading Loading @@ -975,6 +983,18 @@ public class AuthControllerTest extends SysuiTestCase { eq(null) /* credentialAttestation */); } @Test public void testCloseDialog_whenDeviceLocks() throws Exception { showDialog(new int[]{1} /* sensorIds */, false /* credentialAllowed */); mKeyguardLockedStateCaptor.getValue().onKeyguardLockedStateChanged( true /* isKeyguardLocked */); verify(mReceiver).onDialogDismissed( eq(BiometricPrompt.DISMISSED_REASON_USER_CANCEL), eq(null) /* credentialAttestation */); } @Test public void testShowDialog_whenOwnerNotInForeground() { PromptInfo promptInfo = createTestPromptInfo(); Loading Loading @@ -1191,7 +1211,7 @@ public class AuthControllerTest extends SysuiTestCase { mWakefulnessLifecycle, mUserManager, mLockPatternUtils, () -> mUdfpsLogger, () -> mLogContextInteractor, () -> mPromptSelectionInteractor, () -> mCredentialViewModel, () -> mPromptViewModel, mInteractionJankMonitor, mHandler, mBackgroundExecutor, mUdfpsUtils, mVibratorHelper, mHandler, mBackgroundExecutor, mUdfpsUtils, mVibratorHelper, mKeyguardManager, mLazyViewCapture, mMSDLPlayer); } Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +0 −11 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.AlertDialog; import android.app.KeyguardManager; import android.content.Context; import android.content.res.Configuration; import android.graphics.PixelFormat; Loading Loading @@ -316,16 +315,6 @@ public class AuthContainerView extends LinearLayout mBiometricCallback = new BiometricCallback(); mMSDLPlayer = msdlPlayer; // Listener for when device locks from adaptive auth, dismiss prompt getContext().getSystemService(KeyguardManager.class).addKeyguardLockedStateListener( getContext().getMainExecutor(), isKeyguardLocked -> { if (isKeyguardLocked) { onStartedGoingToSleep(); } } ); final BiometricModalities biometricModalities = new BiometricModalities( Utils.findFirstSensorProperties(fpProps, mConfig.mSensorIds), Utils.findFirstSensorProperties(faceProps, mConfig.mSensorIds)); Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +11 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.systemui.util.ConvenienceExtensionsKt.toKotlinLazy; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityTaskManager; import android.app.KeyguardManager; import android.app.TaskStackListener; import android.content.BroadcastReceiver; import android.content.Context; Loading Loading @@ -732,6 +733,7 @@ public class AuthController implements @Background DelayableExecutor bgExecutor, @NonNull UdfpsUtils udfpsUtils, @NonNull VibratorHelper vibratorHelper, @NonNull KeyguardManager keyguardManager, Lazy<ViewCapture> daggerLazyViewCapture, @NonNull MSDLPlayer msdlPlayer) { mContext = context; Loading Loading @@ -762,6 +764,15 @@ public class AuthController implements mPromptViewModelProvider = promptViewModelProvider; mCredentialViewModelProvider = credentialViewModelProvider; keyguardManager.addKeyguardLockedStateListener( context.getMainExecutor(), isKeyguardLocked -> { if (isKeyguardLocked) { closeDialog("Device lock"); } } ); mOrientationListener = new BiometricDisplayListener( context, mDisplayManager, Loading