Merge "Add FingerprintManager#hasEnrolledTemplatesForAnySensor"
This commit is contained in:
@@ -765,6 +765,26 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
||||
return hasEnrolledFingerprints(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified user has enrollments in any of the specified sensors.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
|
||||
public boolean hasEnrolledTemplatesForAnySensor(int userId,
|
||||
@NonNull List<FingerprintSensorPropertiesInternal> sensors) {
|
||||
if (mService == null) {
|
||||
Slog.w(TAG, "hasEnrolledTemplatesForAnySensor: no fingerprint service");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return mService.hasEnrolledTemplatesForAnySensor(userId, sensors,
|
||||
mContext.getOpPackageName());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@@ -778,7 +798,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
||||
try {
|
||||
mService.setUdfpsOverlayController(controller);
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,7 +815,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
||||
try {
|
||||
mService.onPointerDown(sensorId, x, y, minor, major);
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,7 +832,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
||||
try {
|
||||
mService.onPointerUp(sensorId);
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -885,9 +905,8 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
||||
}
|
||||
return mService.getSensorPropertiesInternal(mContext.getOpPackageName());
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,6 +100,9 @@ interface IFingerprintService {
|
||||
// Determine if a user has at least one enrolled fingerprint
|
||||
boolean hasEnrolledFingerprints(int userId, String opPackageName);
|
||||
|
||||
// Determine if a user has at least one enrolled fingerprint in any of the specified sensors
|
||||
boolean hasEnrolledTemplatesForAnySensor(int userId, in List<FingerprintSensorPropertiesInternal> sensors, String opPackageName);
|
||||
|
||||
// Return the LockoutTracker status for the specified user
|
||||
int getLockoutModeForUser(int userId);
|
||||
|
||||
|
||||
@@ -468,6 +468,27 @@ public class FingerprintService extends SystemService {
|
||||
.isEmpty();
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
public boolean hasEnrolledTemplatesForAnySensor(int userId,
|
||||
@NonNull List<FingerprintSensorPropertiesInternal> sensors,
|
||||
@NonNull String opPackageName) {
|
||||
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||
|
||||
for (FingerprintSensorPropertiesInternal prop : sensors) {
|
||||
final ServiceProvider provider = getProviderForSensor(prop.sensorId);
|
||||
if (provider == null) {
|
||||
Slog.w(TAG, "Null provider for sensorId: " + prop.sensorId
|
||||
+ ", caller: " + opPackageName);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!provider.getEnrolledFingerprints(prop.sensorId, userId).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
public @LockoutTracker.LockoutMode int getLockoutModeForUser(int userId) {
|
||||
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||
|
||||
Reference in New Issue
Block a user