summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/fingerprint/FingerprintService.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 1066434f10f1..df7fcb59b8c0 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -470,10 +470,10 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
/**
* @param opPackageName name of package for caller
- * @param foregroundOnly only allow this call while app is in the foreground
+ * @param requireForeground only allow this call while app is in the foreground
* @return true if caller can use fingerprint API
*/
- private boolean canUseFingerprint(String opPackageName, boolean foregroundOnly, int uid,
+ private boolean canUseFingerprint(String opPackageName, boolean requireForeground, int uid,
int pid) {
checkPermission(USE_FINGERPRINT);
if (isKeyguard(opPackageName)) {
@@ -488,7 +488,7 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
Slog.w(TAG, "Rejecting " + opPackageName + " ; permission denied");
return false;
}
- if (foregroundOnly && !isForegroundActivity(uid, pid)) {
+ if (requireForeground && !(isForegroundActivity(uid, pid) || currentClient(opPackageName))){
Slog.w(TAG, "Rejecting " + opPackageName + " ; not in foreground");
return false;
}
@@ -496,6 +496,14 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
}
/**
+ * @param opPackageName package of the caller
+ * @return true if this is the same client currently using fingerprint
+ */
+ private boolean currentClient(String opPackageName) {
+ return mCurrentClient != null && mCurrentClient.getOwnerString().equals(opPackageName);
+ }
+
+ /**
* @param clientPackage
* @return true if this is keyguard package
*/