Skip to content
Snippets Groups Projects
Commit 49a5d9df authored by Haining Chen's avatar Haining Chen
Browse files

Disable adaptive auth for automotive devices by default

Bug: 323085596
Bug: 285053096
Test: atest AdaptiveAuthServiceTest
Change-Id: Ide837783914e88656c6b69f0b532740e6ed0d670
parent 96ff9923
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOM
import android.app.KeyguardManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.biometrics.AuthenticationStateListener;
import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricSourceType;
......@@ -187,6 +188,11 @@ public class AdaptiveAuthService extends SystemService {
}
private void reportAuthAttempt(int authType, boolean success, int userId) {
// Disable adaptive auth for automotive devices by default
if (getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
return;
}
if (success) {
// Deleting the entry effectively resets the counter of failed attempts for the user
mFailedAttemptsForUser.delete(userId);
......
......@@ -24,6 +24,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOM
import static com.android.server.adaptiveauth.AdaptiveAuthService.MAX_ALLOWED_FAILED_AUTH_ATTEMPTS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
......@@ -32,6 +33,7 @@ import static org.mockito.Mockito.when;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.biometrics.AuthenticationStateListener;
import android.hardware.biometrics.BiometricManager;
import android.os.RemoteException;
......@@ -103,6 +105,10 @@ public class AdaptiveAuthServiceTest {
mSetFlagsRule.enableFlags(FLAG_REPORT_BIOMETRIC_AUTH_ATTEMPTS);
mContext = spy(ApplicationProvider.getApplicationContext());
assumeTrue("Adaptive auth is disabled on device",
!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE));
when(mContext.getSystemService(BiometricManager.class)).thenReturn(mBiometricManager);
when(mContext.getSystemService(KeyguardManager.class)).thenReturn(mKeyguardManager);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment