use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by AOSPA.
the class FingerprintService method dumpInternal.
private void dumpInternal(PrintWriter pw) {
JSONObject dump = new JSONObject();
try {
dump.put("service", "Fingerprint Manager");
JSONArray sets = new JSONArray();
for (UserInfo user : UserManager.get(getContext()).getUsers()) {
final int userId = user.getUserHandle().getIdentifier();
final int N = mFingerprintUtils.getFingerprintsForUser(mContext, userId).size();
PerformanceStats stats = mPerformanceMap.get(userId);
PerformanceStats cryptoStats = mCryptoPerformanceMap.get(userId);
JSONObject set = new JSONObject();
set.put("id", userId);
set.put("count", N);
set.put("accept", (stats != null) ? stats.accept : 0);
set.put("reject", (stats != null) ? stats.reject : 0);
set.put("acquire", (stats != null) ? stats.acquire : 0);
set.put("lockout", (stats != null) ? stats.lockout : 0);
// cryptoStats measures statistics about secure fingerprint transactions
// (e.g. to unlock password storage, make secure purchases, etc.)
set.put("acceptCrypto", (cryptoStats != null) ? cryptoStats.accept : 0);
set.put("rejectCrypto", (cryptoStats != null) ? cryptoStats.reject : 0);
set.put("acquireCrypto", (cryptoStats != null) ? cryptoStats.acquire : 0);
set.put("lockoutCrypto", (cryptoStats != null) ? cryptoStats.lockout : 0);
sets.put(set);
}
dump.put("prints", sets);
} catch (JSONException e) {
Slog.e(TAG, "dump formatting failure", e);
}
pw.println(dump);
}
use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by AOSPA.
the class FingerprintService method startEnrollment.
private void startEnrollment(IBinder token, byte[] cryptoToken, int userId, IFingerprintServiceReceiver receiver, int flags, boolean restricted, String opPackageName) {
updateActiveGroup(userId, opPackageName);
// default group for fingerprint enrollment
final int groupId = userId;
EnrollClient client = new EnrollClient(getContext(), mHalDeviceId, token, receiver, userId, groupId, cryptoToken, restricted, opPackageName) {
@Override
public IFingerprintDaemon getFingerprintDaemon() {
return FingerprintService.this.getFingerprintDaemon();
}
@Override
public void notifyUserActivity() {
FingerprintService.this.userActivity();
}
};
startClient(client, true);
}
use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by AOSPA.
the class FingerprintsUserState method doWriteState.
private void doWriteState() {
AtomicFile destination = new AtomicFile(mFile);
ArrayList<Fingerprint> fingerprints;
synchronized (this) {
fingerprints = getCopy(mFingerprints);
}
FileOutputStream out = null;
try {
out = destination.startWrite();
XmlSerializer serializer = Xml.newSerializer();
serializer.setOutput(out, "utf-8");
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
serializer.startDocument(null, true);
serializer.startTag(null, TAG_FINGERPRINTS);
final int count = fingerprints.size();
for (int i = 0; i < count; i++) {
Fingerprint fp = fingerprints.get(i);
serializer.startTag(null, TAG_FINGERPRINT);
serializer.attribute(null, ATTR_FINGER_ID, Integer.toString(fp.getFingerId()));
serializer.attribute(null, ATTR_NAME, fp.getName().toString());
serializer.attribute(null, ATTR_GROUP_ID, Integer.toString(fp.getGroupId()));
serializer.attribute(null, ATTR_DEVICE_ID, Long.toString(fp.getDeviceId()));
serializer.endTag(null, TAG_FINGERPRINT);
}
serializer.endTag(null, TAG_FINGERPRINTS);
serializer.endDocument();
destination.finishWrite(out);
// Any error while writing is fatal.
} catch (Throwable t) {
Slog.wtf(TAG, "Failed to write settings, restoring backup", t);
destination.failWrite(out);
throw new IllegalStateException("Failed to write fingerprints", t);
} finally {
IoUtils.closeQuietly(out);
}
}
use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by AOSPA.
the class FingerprintsUserState method renameFingerprint.
public void renameFingerprint(int fingerId, CharSequence name) {
synchronized (this) {
for (int i = 0; i < mFingerprints.size(); i++) {
if (mFingerprints.get(i).getFingerId() == fingerId) {
Fingerprint old = mFingerprints.get(i);
mFingerprints.set(i, new Fingerprint(name, old.getGroupId(), old.getFingerId(), old.getDeviceId()));
scheduleWriteStateLocked();
break;
}
}
}
}
use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by AOSPA.
the class FingerprintsUserState method getUniqueName.
/**
* Finds a unique name for the given fingerprint
* @return unique name
*/
private String getUniqueName() {
int guess = 1;
while (true) {
// Not the most efficient algorithm in the world, but there shouldn't be more than 10
String name = mCtx.getString(com.android.internal.R.string.fingerprint_name_template, guess);
if (isUnique(name)) {
return name;
}
guess++;
}
}
Aggregations