[DO NOT MERGE] fpService#authWithPrompt uses correct user handle.

CTS > BYOD Managed Provisioning > Authentication Bound Keys

Verified Fingerprint-bound key test works as expected.

Test: Manually verified CTS
Bug: 231932206
Change-Id: I473c9c28cd0fbb01f4dd48447ddea8aa32834131
(cherry picked from commit f3650a6dee)
This commit is contained in:
Joshua McCloskey
2022-05-31 23:49:50 +00:00
committed by Joshua Mccloskey
parent c59352ed18
commit c79346286e

View File

@@ -298,8 +298,8 @@ public class FingerprintService extends SystemService {
if (!isKeyguard && !Utils.isSettings(getContext(), opPackageName) if (!isKeyguard && !Utils.isSettings(getContext(), opPackageName)
&& sensorProps != null && sensorProps.isAnyUdfpsType()) { && sensorProps != null && sensorProps.isAnyUdfpsType()) {
try { try {
authenticateWithPrompt(operationId, sensorProps, userId, receiver, authenticateWithPrompt(operationId, sensorProps, callingUid,
opPackageName); callingUserId, receiver, opPackageName);
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
Slog.e(TAG, "Invalid package", e); Slog.e(TAG, "Invalid package", e);
} }
@@ -313,13 +313,14 @@ public class FingerprintService extends SystemService {
private void authenticateWithPrompt( private void authenticateWithPrompt(
final long operationId, final long operationId,
@NonNull final FingerprintSensorPropertiesInternal props, @NonNull final FingerprintSensorPropertiesInternal props,
final int uId,
final int userId, final int userId,
final IFingerprintServiceReceiver receiver, final IFingerprintServiceReceiver receiver,
final String opPackageName) throws PackageManager.NameNotFoundException { final String opPackageName) throws PackageManager.NameNotFoundException {
final Context context = getUiContext(); final Context context = getUiContext();
final Context promptContext = context.createPackageContextAsUser( final Context promptContext = context.createPackageContextAsUser(
opPackageName, 0 /* flags */, UserHandle.getUserHandleForUid(userId)); opPackageName, 0 /* flags */, UserHandle.getUserHandleForUid(uId));
final Executor executor = context.getMainExecutor(); final Executor executor = context.getMainExecutor();
final BiometricPrompt biometricPrompt = new BiometricPrompt.Builder(promptContext) final BiometricPrompt biometricPrompt = new BiometricPrompt.Builder(promptContext)