From: Kevin Chyn Date: Fri, 7 Apr 2017 23:29:19 +0000 (-0700) Subject: FingerprintSettings for non-owner should respond to fingerprint touches X-Git-Tag: android-x86-9.0-r1~1044^2~2112^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f4023b570c0170bde67484b6c58952dc6ca93136;p=android-x86%2Fframeworks-base.git FingerprintSettings for non-owner should respond to fingerprint touches Fixes 36869204 Test: create another account, enroll a fingerprint in the new account touch the sensor and make sure the finger you just enrolled gets highlighted Change-Id: Ib3e8d9ddc987a2c8b7f0878a83f4cbd025e13f7a --- diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index 656e01a1ab52..85f7056ba1ad 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -570,12 +570,12 @@ public class FingerprintService extends SystemService implements IHwBinder.Death * @return true if caller can use fingerprint API */ private boolean canUseFingerprint(String opPackageName, boolean requireForeground, int uid, - int pid) { + int pid, int userId) { checkPermission(USE_FINGERPRINT); if (isKeyguard(opPackageName)) { return true; // Keyguard is always allowed } - if (!isCurrentUserOrProfile(UserHandle.getCallingUserId())) { + if (!isCurrentUserOrProfile(userId)) { Slog.w(TAG,"Rejecting " + opPackageName + " ; not a current user or profile"); return false; } @@ -906,7 +906,7 @@ public class FingerprintService extends SystemService implements IHwBinder.Death @Override public void run() { if (!canUseFingerprint(opPackageName, true /* foregroundOnly */, - callingUid, pid)) { + callingUid, pid, callingUserId)) { if (DEBUG) Slog.v(TAG, "authenticate(): reject " + opPackageName); return; } @@ -933,10 +933,12 @@ public class FingerprintService extends SystemService implements IHwBinder.Death public void cancelAuthentication(final IBinder token, final String opPackageName) { final int uid = Binder.getCallingUid(); final int pid = Binder.getCallingPid(); + final int callingUserId = UserHandle.getCallingUserId(); mHandler.post(new Runnable() { @Override public void run() { - if (!canUseFingerprint(opPackageName, true /* foregroundOnly */, uid, pid)) { + if (!canUseFingerprint(opPackageName, true /* foregroundOnly */, uid, pid, + callingUserId)) { if (DEBUG) Slog.v(TAG, "cancelAuthentication(): reject " + opPackageName); } else { ClientMonitor client = mCurrentClient; @@ -996,7 +998,8 @@ public class FingerprintService extends SystemService implements IHwBinder.Death @Override // Binder call public boolean isHardwareDetected(long deviceId, String opPackageName) { if (!canUseFingerprint(opPackageName, false /* foregroundOnly */, - Binder.getCallingUid(), Binder.getCallingPid())) { + Binder.getCallingUid(), Binder.getCallingPid(), + UserHandle.getCallingUserId())) { return false; } @@ -1027,7 +1030,8 @@ public class FingerprintService extends SystemService implements IHwBinder.Death @Override // Binder call public List getEnrolledFingerprints(int userId, String opPackageName) { if (!canUseFingerprint(opPackageName, false /* foregroundOnly */, - Binder.getCallingUid(), Binder.getCallingPid())) { + Binder.getCallingUid(), Binder.getCallingPid(), + UserHandle.getCallingUserId())) { return Collections.emptyList(); } @@ -1037,7 +1041,8 @@ public class FingerprintService extends SystemService implements IHwBinder.Death @Override // Binder call public boolean hasEnrolledFingerprints(int userId, String opPackageName) { if (!canUseFingerprint(opPackageName, false /* foregroundOnly */, - Binder.getCallingUid(), Binder.getCallingPid())) { + Binder.getCallingUid(), Binder.getCallingPid(), + UserHandle.getCallingUserId())) { return false; }