diff options
author | 2025-03-28 15:14:16 -0700 | |
---|---|---|
committer | 2025-04-01 20:40:49 -0700 | |
commit | 8b92cfaaec68bde3b48fa462ad3306e4f9be75b4 (patch) | |
tree | e38ee3b633f6536b47d327fc550de320cb3f481b /services | |
parent | a89cb70d5d1b51e47f249a9b6d0709ffa81f1b95 (diff) |
Revert "Add some new modality-specific APIs in BiometricManager."
Revert submission 32295314-fm_to_bm
Reason for revert:b/406937567#comment7
Bug: 406937567
Reverted changes: /q/submissionid:32295314-fm_to_bm
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ca851226c8aa3f83e40445db238715251bd38b37)
Merged-In: I7c9a506362b74bfe9f876b1191f3f8da4c93cd4c
Change-Id: I7c9a506362b74bfe9f876b1191f3f8da4c93cd4c
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/biometrics/AuthService.java | 50 | ||||
-rw-r--r-- | services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java | 39 |
2 files changed, 0 insertions, 89 deletions
diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java index eede4c9c59d0..b6768c9c087a 100644 --- a/services/core/java/com/android/server/biometrics/AuthService.java +++ b/services/core/java/com/android/server/biometrics/AuthService.java @@ -36,7 +36,6 @@ import android.content.Context; import android.content.pm.PackageManager; import android.hardware.biometrics.AuthenticationStateListener; import android.hardware.biometrics.BiometricAuthenticator; -import android.hardware.biometrics.BiometricEnrollmentStatus; import android.hardware.biometrics.BiometricManager; import android.hardware.biometrics.ComponentInfoInternal; import android.hardware.biometrics.IAuthService; @@ -418,55 +417,6 @@ public class AuthService extends SystemService { } @Override - public List<BiometricEnrollmentStatus> getEnrollmentStatus(String opPackageName) - throws RemoteException { - checkBiometricAdvancedPermission(); - final long identity = Binder.clearCallingIdentity(); - try { - final int userId = UserHandle.myUserId(); - final List<BiometricEnrollmentStatus> enrollmentStatusList = - new ArrayList<>(); - final IFingerprintService fingerprintService = mInjector.getFingerprintService(); - if (fingerprintService != null) { - final List<FingerprintSensorPropertiesInternal> fpProps = - fingerprintService.getSensorPropertiesInternal(opPackageName); - if (!fpProps.isEmpty()) { - int fpCount = fingerprintService.getEnrolledFingerprints(userId, - opPackageName, getContext().getAttributionTag()).size(); - enrollmentStatusList.add( - new BiometricEnrollmentStatus( - BiometricManager.TYPE_FINGERPRINT, fpCount)); - } else { - Slog.e(TAG, "No fingerprint sensors"); - } - } else { - Slog.e(TAG, "No fingerprint sensors"); - } - - final IFaceService faceService = mInjector.getFaceService(); - if (faceService != null) { - final List<FaceSensorPropertiesInternal> faceProps = - faceService.getSensorPropertiesInternal(opPackageName); - if (!faceProps.isEmpty()) { - int faceCount = faceService.getEnrolledFaces(faceProps.getFirst().sensorId, - userId, opPackageName).size(); - enrollmentStatusList.add( - new BiometricEnrollmentStatus( - BiometricManager.TYPE_FACE, faceCount)); - } else { - Slog.e(TAG, "No face sensors"); - } - } else { - Slog.e(TAG, "No face sensors"); - } - - return enrollmentStatusList; - } finally { - Binder.restoreCallingIdentity(identity); - } - } - - @Override public void registerEnabledOnKeyguardCallback( IBiometricEnabledOnKeyguardCallback callback) throws RemoteException { checkInternalPermission(); diff --git a/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java index cebdce9ed6cc..c7efa318af99 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java @@ -49,14 +49,11 @@ import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricService; import android.hardware.biometrics.IBiometricServiceReceiver; import android.hardware.biometrics.PromptInfo; -import android.hardware.biometrics.SensorProperties; import android.hardware.biometrics.fingerprint.SensorProps; import android.hardware.face.FaceSensorConfigurations; -import android.hardware.face.FaceSensorProperties; import android.hardware.face.FaceSensorPropertiesInternal; import android.hardware.face.IFaceService; import android.hardware.fingerprint.FingerprintSensorConfigurations; -import android.hardware.fingerprint.FingerprintSensorProperties; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.IFingerprintService; import android.hardware.iris.IIrisService; @@ -87,7 +84,6 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.mockito.stubbing.Stubber; -import java.util.ArrayList; import java.util.List; @Presubmit @@ -523,41 +519,6 @@ public class AuthServiceTest { verify(mBiometricService).getLastAuthenticationTime(eq(mUserId), eq(authenticators)); } - @Test - public void testGetEnrollmentStatus_callsFingerprintAndFaceService() throws Exception { - setInternalAndTestBiometricPermissions(mContext, true /* hasPermission */); - List<FaceSensorPropertiesInternal> faceProps = List.of(new FaceSensorPropertiesInternal( - 0 /* id */, - FaceSensorProperties.STRENGTH_STRONG, - 1 /* maxTemplatesAllowed */, - new ArrayList<>() /* componentInfo */, - FaceSensorProperties.TYPE_UNKNOWN, - true /* supportsFaceDetection */, - true /* supportsSelfIllumination */, - false /* resetLockoutRequiresChallenge */)); - List<FingerprintSensorPropertiesInternal> fpProps = List.of( - new FingerprintSensorPropertiesInternal(1 /* id */, - SensorProperties.STRENGTH_STRONG, - 5 /* maxEnrollmentsPerUser */, - new ArrayList<>() /* componentInfo */, - FingerprintSensorProperties.TYPE_UDFPS_OPTICAL, - false /* resetLockoutRequiresHardwareAuthToken */)); - when(mFaceService.getSensorPropertiesInternal(eq(TEST_OP_PACKAGE_NAME))).thenReturn( - faceProps); - when(mFingerprintService.getSensorPropertiesInternal(eq(TEST_OP_PACKAGE_NAME))).thenReturn( - fpProps); - when(mContext.getAttributionTag()).thenReturn("tag"); - mAuthService = new AuthService(mContext, mInjector); - mAuthService.onStart(); - - mAuthService.mImpl.getEnrollmentStatus(TEST_OP_PACKAGE_NAME); - - waitForIdle(); - verify(mFaceService).getEnrolledFaces(eq(0), eq(mUserId), eq(TEST_OP_PACKAGE_NAME)); - verify(mFingerprintService).getEnrolledFingerprints(eq(mUserId), eq(TEST_OP_PACKAGE_NAME), - eq("tag")); - } - private static void setInternalAndTestBiometricPermissions( Context context, boolean hasPermission) { for (String p : List.of(TEST_BIOMETRIC, MANAGE_BIOMETRIC, USE_BIOMETRIC_INTERNAL)) { |