Merge "Send callingUserId from AuthService -> BiometricServiceBase" into rvc-dev
This commit is contained in:
@@ -57,5 +57,5 @@ interface IBiometricAuthenticator {
|
||||
void setActiveUser(int uid);
|
||||
|
||||
// Gets the authenticator ID representing the current set of enrolled templates
|
||||
long getAuthenticatorId();
|
||||
long getAuthenticatorId(int callingUserId);
|
||||
}
|
||||
|
||||
@@ -65,5 +65,5 @@ interface IBiometricService {
|
||||
// Get a list of AuthenticatorIDs for authenticators which have enrolled templates and meet
|
||||
// the requirements for integrating with Keystore. The AuthenticatorID are known in Keystore
|
||||
// land as SIDs, and are used during key generation.
|
||||
long[] getAuthenticatorIds();
|
||||
long[] getAuthenticatorIds(int callingUserId);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ interface IFaceService {
|
||||
// long getHardwareDevice(int i);
|
||||
|
||||
// Gets the authenticator ID for face
|
||||
long getAuthenticatorId();
|
||||
long getAuthenticatorId(int callingUserId);
|
||||
|
||||
// Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
|
||||
void resetLockout(in byte [] token);
|
||||
|
||||
@@ -89,7 +89,7 @@ interface IFingerprintService {
|
||||
// long getHardwareDevice(int i);
|
||||
|
||||
// Gets the authenticator ID for fingerprint
|
||||
long getAuthenticatorId();
|
||||
long getAuthenticatorId(int callingUserId);
|
||||
|
||||
// Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
|
||||
void resetTimeout(in byte [] cryptoToken);
|
||||
|
||||
@@ -290,9 +290,10 @@ public class AuthService extends SystemService {
|
||||
// The permission check should be restored once Android Keystore no longer invokes this
|
||||
// method from inside app processes.
|
||||
|
||||
final int callingUserId = UserHandle.getCallingUserId();
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
return mBiometricService.getAuthenticatorIds();
|
||||
return mBiometricService.getAuthenticatorIds(callingUserId);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
|
||||
@@ -879,13 +879,13 @@ public class BiometricService extends SystemService {
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
public long[] getAuthenticatorIds() {
|
||||
public long[] getAuthenticatorIds(int callingUserId) {
|
||||
checkInternalPermission();
|
||||
|
||||
final List<Long> ids = new ArrayList<>();
|
||||
for (AuthenticatorWrapper authenticator : mAuthenticators) {
|
||||
try {
|
||||
final long id = authenticator.impl.getAuthenticatorId();
|
||||
final long id = authenticator.impl.getAuthenticatorId(callingUserId);
|
||||
if (Utils.isAtLeastStrength(authenticator.getActualStrength(),
|
||||
Authenticators.BIOMETRIC_STRONG) && id != 0) {
|
||||
ids.add(id);
|
||||
|
||||
@@ -1250,9 +1250,8 @@ public abstract class BiometricServiceBase extends SystemService
|
||||
/***
|
||||
* @return authenticator id for the calling user
|
||||
*/
|
||||
protected long getAuthenticatorId() {
|
||||
final int userId = getUserOrWorkProfileId(null /* clientPackage */,
|
||||
UserHandle.getCallingUserId());
|
||||
protected long getAuthenticatorId(int callingUserId) {
|
||||
final int userId = getUserOrWorkProfileId(null /* clientPackage */, callingUserId);
|
||||
return mAuthenticatorIds.getOrDefault(userId, 0L);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class FaceAuthenticator extends IBiometricAuthenticator.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAuthenticatorId() throws RemoteException {
|
||||
return mFaceService.getAuthenticatorId();
|
||||
public long getAuthenticatorId(int callingUserId) throws RemoteException {
|
||||
return mFaceService.getAuthenticatorId(callingUserId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,9 +608,9 @@ public class FaceService extends BiometricServiceBase {
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
public long getAuthenticatorId() {
|
||||
public long getAuthenticatorId(int callingUserId) {
|
||||
checkPermission(USE_BIOMETRIC_INTERNAL);
|
||||
return FaceService.this.getAuthenticatorId();
|
||||
return FaceService.this.getAuthenticatorId(callingUserId);
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class FingerprintAuthenticator extends IBiometricAuthenticator.Stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAuthenticatorId() throws RemoteException {
|
||||
return mFingerprintService.getAuthenticatorId();
|
||||
public long getAuthenticatorId(int callingUserId) throws RemoteException {
|
||||
return mFingerprintService.getAuthenticatorId(callingUserId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,9 +412,9 @@ public class FingerprintService extends BiometricServiceBase {
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
public long getAuthenticatorId() {
|
||||
public long getAuthenticatorId(int callingUserId) {
|
||||
checkPermission(USE_BIOMETRIC_INTERNAL);
|
||||
return FingerprintService.this.getAuthenticatorId();
|
||||
return FingerprintService.this.getAuthenticatorId(callingUserId);
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class IrisAuthenticator extends IBiometricAuthenticator.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAuthenticatorId() throws RemoteException {
|
||||
public long getAuthenticatorId(int callingUserId) throws RemoteException {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user