Ensure sensor id is set before face detect.

Will follow up with a test case shortly (class doesn't have any existing tests).

Bug: 271296352
Bug: 270983148
Test: manual (no crash on lockscreen / boot)
Change-Id: I4b67a6b5a6e3b3ba176c90c8e2a0cf57b944ae48
This commit is contained in:
Joe Bolinger
2023-03-02 02:39:49 +00:00
parent a6b032d136
commit b781f1cc76
2 changed files with 9 additions and 10 deletions

View File

@@ -260,9 +260,8 @@ public class FaceService extends SystemService {
if (provider == null) {
Slog.w(TAG, "Null provider for authenticate");
return -1;
} else {
options.setSensorId(provider.first);
}
options.setSensorId(provider.first);
return provider.second.scheduleAuthenticate(token, operationId,
0 /* cookie */, new ClientMonitorCallbackConverter(receiver), options,
@@ -286,6 +285,7 @@ public class FaceService extends SystemService {
Slog.w(TAG, "Null provider for detectFace");
return -1;
}
options.setSensorId(provider.first);
return provider.second.scheduleFaceDetect(token,
new ClientMonitorCallbackConverter(receiver), options,

View File

@@ -261,7 +261,6 @@ public class FingerprintService extends SystemService {
final String opPackageName = options.getOpPackageName();
final String attributionTag = options.getAttributionTag();
final int userId = options.getUserId();
final int sensorId = options.getSensorId();
if (!canUseFingerprint(
opPackageName,
@@ -298,21 +297,22 @@ public class FingerprintService extends SystemService {
: BiometricsProtoEnums.CLIENT_FINGERPRINT_MANAGER;
final Pair<Integer, ServiceProvider> provider;
if (sensorId == FingerprintManager.SENSOR_ID_ANY) {
if (options.getSensorId() == FingerprintManager.SENSOR_ID_ANY) {
provider = mRegistry.getSingleProvider();
} else {
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
provider = new Pair<>(sensorId, mRegistry.getProviderForSensor(sensorId));
provider = new Pair<>(options.getSensorId(),
mRegistry.getProviderForSensor(options.getSensorId()));
}
if (provider == null) {
Slog.w(TAG, "Null provider for authenticate");
return -1;
} else {
options.setSensorId(provider.first);
}
options.setSensorId(provider.first);
final FingerprintSensorPropertiesInternal sensorProps =
provider.second.getSensorProperties(sensorId);
provider.second.getSensorProperties(options.getSensorId());
if (!isKeyguard && !Utils.isSettings(getContext(), opPackageName)
&& sensorProps != null && sensorProps.isAnyUdfpsType()) {
try {
@@ -431,9 +431,8 @@ public class FingerprintService extends SystemService {
if (provider == null) {
Slog.w(TAG, "Null provider for detectFingerprint");
return -1;
} else {
options.setSensorId(provider.first);
}
options.setSensorId(provider.first);
return provider.second.scheduleFingerDetect(token,
new ClientMonitorCallbackConverter(receiver), options,