use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by crdroidandroid.
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 ResurrectionRemix.
the class KeyguardUpdateMonitor method dump.
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("KeyguardUpdateMonitor state:");
pw.println(" SIM States:");
for (SimData data : mSimDatas.values()) {
pw.println(" " + data.toString());
}
pw.println(" Subs:");
if (mSubscriptionInfo != null) {
for (int i = 0; i < mSubscriptionInfo.size(); i++) {
pw.println(" " + mSubscriptionInfo.get(i));
}
}
pw.println(" Service states:");
for (int subId : mServiceStates.keySet()) {
pw.println(" " + subId + "=" + mServiceStates.get(subId));
}
if (mFpm != null && mFpm.isHardwareDetected()) {
final int userId = ActivityManager.getCurrentUser();
final int strongAuthFlags = mStrongAuthTracker.getStrongAuthForUser(userId);
pw.println(" Fingerprint state (user=" + userId + ")");
pw.println(" allowed=" + isUnlockingWithFingerprintAllowed());
pw.println(" auth'd=" + mUserFingerprintAuthenticated.get(userId));
pw.println(" authSinceBoot=" + getStrongAuthTracker().hasUserAuthenticatedSinceBoot());
pw.println(" disabled(DPM)=" + isFingerprintDisabled(userId));
pw.println(" possible=" + isUnlockWithFingerprintPossible(userId));
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
pw.println(" timedout=" + hasFingerprintUnlockTimedOut(userId));
pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
}
}
use of android.hardware.fingerprint.Fingerprint in project android_frameworks_base by ResurrectionRemix.
the class KeyguardUpdateMonitor method handleFingerprintAuthenticated.
private void handleFingerprintAuthenticated(int authUserId) {
Trace.beginSection("KeyGuardUpdateMonitor#handlerFingerPrintAuthenticated");
try {
final int userId;
try {
userId = ActivityManagerNative.getDefault().getCurrentUser().id;
} catch (RemoteException e) {
Log.e(TAG, "Failed to get current user id: ", e);
return;
}
if (userId != authUserId) {
Log.d(TAG, "Fingerprint authenticated for wrong user: " + authUserId);
return;
}
if (isFingerprintDisabled(userId)) {
Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId);
return;
}
onFingerprintAuthenticated(userId);
} finally {
setFingerprintRunningState(FINGERPRINT_STATE_STOPPED);
}
Trace.endSection();
}
use of android.hardware.fingerprint.Fingerprint in project android_packages_apps_Settings by omnirom.
the class FingerprintSettings method getFingerprintPreferenceForUser.
public static Preference getFingerprintPreferenceForUser(Context context, final int userId) {
final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(context);
if (fpm == null || !fpm.isHardwareDetected()) {
Log.v(TAG, "No fingerprint hardware detected!!");
return null;
}
Preference fingerprintPreference = new Preference(context);
fingerprintPreference.setKey(KEY_FINGERPRINT_SETTINGS);
fingerprintPreference.setTitle(R.string.security_settings_fingerprint_preference_title);
final List<Fingerprint> items = fpm.getEnrolledFingerprints(userId);
final int fingerprintCount = items != null ? items.size() : 0;
final String clazz;
if (fingerprintCount > 0) {
fingerprintPreference.setSummary(context.getResources().getQuantityString(R.plurals.security_settings_fingerprint_preference_summary, fingerprintCount, fingerprintCount));
clazz = FingerprintSettings.class.getName();
} else {
fingerprintPreference.setSummary(R.string.security_settings_fingerprint_preference_summary_none);
clazz = FingerprintEnrollIntroduction.class.getName();
}
fingerprintPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
final Context context = preference.getContext();
final UserManager userManager = UserManager.get(context);
if (Utils.startQuietModeDialogIfNecessary(context, userManager, userId)) {
return false;
}
Intent intent = new Intent();
intent.setClassName("com.android.settings", clazz);
intent.putExtra(Intent.EXTRA_USER_ID, userId);
context.startActivity(intent);
return true;
}
});
return fingerprintPreference;
}
use of android.hardware.fingerprint.Fingerprint in project platform_packages_apps_Settings by BlissRoms.
the class FingerprintSettings method getFingerprintPreferenceForUser.
public static Preference getFingerprintPreferenceForUser(Context context, final int userId) {
final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(context);
if (fpm == null || !fpm.isHardwareDetected()) {
Log.v(TAG, "No fingerprint hardware detected!!");
return null;
}
Preference fingerprintPreference = new Preference(context);
fingerprintPreference.setKey(KEY_FINGERPRINT_SETTINGS);
fingerprintPreference.setTitle(R.string.security_settings_fingerprint_preference_title);
final List<Fingerprint> items = fpm.getEnrolledFingerprints(userId);
final int fingerprintCount = items != null ? items.size() : 0;
final String clazz;
if (fingerprintCount > 0) {
fingerprintPreference.setSummary(context.getResources().getQuantityString(R.plurals.security_settings_fingerprint_preference_summary, fingerprintCount, fingerprintCount));
clazz = FingerprintSettings.class.getName();
} else {
fingerprintPreference.setSummary(R.string.security_settings_fingerprint_preference_summary_none);
clazz = FingerprintEnrollIntroduction.class.getName();
}
fingerprintPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
final Context context = preference.getContext();
final UserManager userManager = UserManager.get(context);
if (Utils.startQuietModeDialogIfNecessary(context, userManager, userId)) {
return false;
}
Intent intent = new Intent();
intent.setClassName("com.android.settings", clazz);
intent.putExtra(Intent.EXTRA_USER_ID, userId);
context.startActivity(intent);
return true;
}
});
return fingerprintPreference;
}
Aggregations