use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by AOSPA.
the class FingerprintsUserState method parseFingerprintsLocked.
private void parseFingerprintsLocked(XmlPullParser parser) throws IOException, XmlPullParserException {
final int outerDepth = parser.getDepth();
int type;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
continue;
}
String tagName = parser.getName();
if (tagName.equals(TAG_FINGERPRINT)) {
String name = parser.getAttributeValue(null, ATTR_NAME);
String groupId = parser.getAttributeValue(null, ATTR_GROUP_ID);
String fingerId = parser.getAttributeValue(null, ATTR_FINGER_ID);
String deviceId = parser.getAttributeValue(null, ATTR_DEVICE_ID);
mFingerprints.add(new Fingerprint(name, Integer.parseInt(groupId), Integer.parseInt(fingerId), Integer.parseInt(deviceId)));
}
}
}
use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by AOSPA.
the class AuthenticationClient method onAuthenticated.
@Override
public boolean onAuthenticated(int fingerId, int groupId) {
boolean result = false;
boolean authenticated = fingerId != 0;
IFingerprintServiceReceiver receiver = getReceiver();
if (receiver != null) {
try {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_FINGERPRINT_AUTH, authenticated);
if (!authenticated) {
receiver.onAuthenticationFailed(getHalDeviceId());
} else {
if (DEBUG) {
Slog.v(TAG, "onAuthenticated(owner=" + getOwnerString() + ", id=" + fingerId + ", gp=" + groupId + ")");
}
Fingerprint fp = !getIsRestricted() ? new Fingerprint("", /* TODO */
groupId, fingerId, getHalDeviceId()) : null;
receiver.onAuthenticationSucceeded(getHalDeviceId(), fp, getTargetUserId());
}
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify Authenticated:", e);
// client failed
result = true;
}
} else {
// client not listening
result = true;
}
if (!authenticated) {
if (receiver != null) {
FingerprintUtils.vibrateFingerprintError(getContext());
}
// allow system-defined limit of number of attempts before giving up
boolean inLockoutMode = handleFailedAttempt();
// send lockout event in case driver doesn't enforce it.
if (inLockoutMode) {
try {
Slog.w(TAG, "Forcing lockout (fp driver code should do this!)");
receiver.onError(getHalDeviceId(), FingerprintManager.FINGERPRINT_ERROR_LOCKOUT);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify lockout:", e);
}
}
result |= inLockoutMode;
} else {
if (receiver != null) {
FingerprintUtils.vibrateFingerprintSuccess(getContext());
}
// we have a valid fingerprint, done
result |= true;
resetFailedAttempts();
}
return result;
}
use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by AOSPA.
the class FingerprintsUserState method getCopy.
private ArrayList<Fingerprint> getCopy(ArrayList<Fingerprint> array) {
ArrayList<Fingerprint> result = new ArrayList<Fingerprint>(array.size());
for (int i = 0; i < array.size(); i++) {
Fingerprint fp = array.get(i);
result.add(new Fingerprint(fp.getName(), fp.getGroupId(), fp.getFingerId(), fp.getDeviceId()));
}
return result;
}
use of android.hardware.fingerprint.Fingerprint in project platform_frameworks_base by android.
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 platform_frameworks_base by android.
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);
}
Aggregations