summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2015-06-16 03:48:55 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-16 03:48:58 +0000
commitb1c6208c27041e6d161cc46b4f130b4abfcf8f88 (patch)
tree8457e53a8941c6e46a5f21520d2f37dde3137864
parent0d16281a03722f3f66a076718251c2166518d122 (diff)
parent599ef0e3cd848bbf8faa45147ac680d04d3ba333 (diff)
downloadframeworks_base-b1c6208c27041e6d161cc46b4f130b4abfcf8f88.zip
frameworks_base-b1c6208c27041e6d161cc46b4f130b4abfcf8f88.tar.gz
frameworks_base-b1c6208c27041e6d161cc46b4f130b4abfcf8f88.tar.bz2
Merge "Limit number of fingerprint templates that can be enrolled per device user" into mnc-dev
-rwxr-xr-xcore/res/res/values/config.xml3
-rwxr-xr-xcore/res/res/values/symbols.xml3
-rw-r--r--services/core/java/com/android/server/fingerprint/FingerprintService.java22
3 files changed, 22 insertions, 6 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index e7811df..997f995 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2196,6 +2196,9 @@
<!-- Keyguard component -->
<string name="config_keyguardComponent" translatable="false">com.android.systemui/com.android.systemui.keyguard.KeyguardService</string>
+ <!-- For performance and storage reasons, limit the number of fingerprints per user -->
+ <integer name="config_fingerprintMaxTemplatesPerUser">5</integer>
+
<!-- This config is used to force VoiceInteractionService to start on certain low ram devices.
It declares the package name of VoiceInteractionService that should be started. -->
<string translatable="false" name="config_forceVoiceInteractionServicePackage"></string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 45e5d17..ede843e 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2125,6 +2125,9 @@
<java-symbol type="string" name="fingerprint_error_lockout" />
<java-symbol type="string" name="fingerprint_name_template" />
+ <!-- Fingerprint config -->
+ <java-symbol type="integer" name="config_fingerprintMaxTemplatesPerUser"/>
+
<!-- From various Material changes -->
<java-symbol type="attr" name="titleTextAppearance" />
<java-symbol type="attr" name="subtitleTextAppearance" />
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 7f0be57..c52a1c1 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -33,6 +33,7 @@ import android.os.MessageQueue;
import android.os.RemoteException;
import android.os.SELinux;
import android.os.ServiceManager;
+import android.os.UserHandle;
import android.util.Slog;
import com.android.server.SystemService;
@@ -389,12 +390,12 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
}
}
- public List<Fingerprint> getEnrolledFingerprints(int groupId) {
- return mFingerprintUtils.getFingerprintsForUser(mContext, groupId);
+ public List<Fingerprint> getEnrolledFingerprints(int userId) {
+ return mFingerprintUtils.getFingerprintsForUser(mContext, userId);
}
- public boolean hasEnrolledFingerprints(int groupId) {
- return mFingerprintUtils.getFingerprintsForUser(mContext, groupId).size() > 0;
+ public boolean hasEnrolledFingerprints(int userId) {
+ return mFingerprintUtils.getFingerprintsForUser(mContext, userId).size() > 0;
}
boolean hasPermission(String permission) {
@@ -598,6 +599,15 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
public void enroll(final IBinder token, final byte[] cryptoToken, final int groupId,
final IFingerprintServiceReceiver receiver, final int flags) {
checkPermission(MANAGE_FINGERPRINT);
+ final int limit = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
+ final int callingUid = Binder.getCallingUid();
+ final int userId = UserHandle.getUserId(callingUid);
+ final int enrolled = FingerprintService.this.getEnrolledFingerprints(userId).size();
+ if (enrolled >= limit) {
+ Slog.w(TAG, "Too many fingerprints registered");
+ return;
+ }
final byte [] cryptoClone = Arrays.copyOf(cryptoToken, cryptoToken.length);
final boolean restricted = isRestricted();
@@ -689,11 +699,11 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
}
@Override // Binder call
- public List<Fingerprint> getEnrolledFingerprints(int groupId, String opPackageName) {
+ public List<Fingerprint> getEnrolledFingerprints(int userId, String opPackageName) {
if (!canUseFingerprint(opPackageName)) {
return Collections.emptyList();
}
- return FingerprintService.this.getEnrolledFingerprints(groupId);
+ return FingerprintService.this.getEnrolledFingerprints(userId);
}
@Override // Binder call