Search in sources :

Example 51 with Fingerprint

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)));
        }
    }
}
Also used : Fingerprint(android.hardware.fingerprint.Fingerprint) Fingerprint(android.hardware.fingerprint.Fingerprint)

Example 52 with Fingerprint

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));
    }
}
Also used : Fingerprint(android.hardware.fingerprint.Fingerprint)

Example 53 with Fingerprint

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();
}
Also used : RemoteException(android.os.RemoteException) Fingerprint(android.hardware.fingerprint.Fingerprint)

Example 54 with Fingerprint

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;
}
Also used : Context(android.content.Context) Fingerprint(android.hardware.fingerprint.Fingerprint) Intent(android.content.Intent) SpannableString(android.text.SpannableString) TextPaint(android.text.TextPaint) Fingerprint(android.hardware.fingerprint.Fingerprint) OnPreferenceClickListener(android.support.v7.preference.Preference.OnPreferenceClickListener) FooterPreference(com.android.settingslib.widget.FooterPreference) TwoTargetPreference(com.android.settingslib.TwoTargetPreference) Preference(android.support.v7.preference.Preference) FingerprintManager(android.hardware.fingerprint.FingerprintManager) UserManager(android.os.UserManager)

Example 55 with Fingerprint

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;
}
Also used : Context(android.content.Context) Fingerprint(android.hardware.fingerprint.Fingerprint) Intent(android.content.Intent) SpannableString(android.text.SpannableString) TextPaint(android.text.TextPaint) Fingerprint(android.hardware.fingerprint.Fingerprint) OnPreferenceClickListener(android.support.v7.preference.Preference.OnPreferenceClickListener) FooterPreference(com.android.settingslib.widget.FooterPreference) TwoTargetPreference(com.android.settingslib.TwoTargetPreference) Preference(android.support.v7.preference.Preference) FingerprintManager(android.hardware.fingerprint.FingerprintManager) UserManager(android.os.UserManager)

Aggregations

Fingerprint (android.hardware.fingerprint.Fingerprint)55 Context (android.content.Context)7 Intent (android.content.Intent)7 FingerprintManager (android.hardware.fingerprint.FingerprintManager)7 UserManager (android.os.UserManager)7 Preference (android.support.v7.preference.Preference)7 OnPreferenceClickListener (android.support.v7.preference.Preference.OnPreferenceClickListener)7 SpannableString (android.text.SpannableString)7 TextPaint (android.text.TextPaint)7 RemoteException (android.os.RemoteException)6 TwoTargetPreference (com.android.settingslib.TwoTargetPreference)6 FooterPreference (com.android.settingslib.widget.FooterPreference)6 UserInfo (android.content.pm.UserInfo)5 IFingerprintServiceReceiver (android.hardware.fingerprint.IFingerprintServiceReceiver)5 AtomicFile (android.util.AtomicFile)5 FileOutputStream (java.io.FileOutputStream)5 ArrayList (java.util.ArrayList)5 JSONArray (org.json.JSONArray)5 JSONException (org.json.JSONException)5 JSONObject (org.json.JSONObject)5