Search in sources :

Example 76 with FingerprintManager

use of android.hardware.fingerprint.FingerprintManager in project LolliPin by OrangeGangsters.

the class PinLockTest method testPinEnablingChecking.

public void testPinEnablingChecking() throws SecurityException {
    enablePin();
    // Go to unlock
    clickOnView(R.id.button_unlock_pin);
    solo.waitForActivity(CustomPinActivity.class);
    solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
    // Test fingerprint if available
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        ImageView fingerprintImageView = (ImageView) solo.getView(com.github.omadahealth.lollipin.lib.R.id.pin_code_fingerprint_imageview);
        TextView fingerprintTextView = (TextView) solo.getView(com.github.omadahealth.lollipin.lib.R.id.pin_code_fingerprint_textview);
        FingerprintManager fingerprintManager = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
        FingerprintUiHelper fingerprintUiHelper = new FingerprintUiHelper.FingerprintUiHelperBuilder(fingerprintManager).build(fingerprintImageView, fingerprintTextView, (CustomPinActivity) solo.getCurrentActivity());
        if (fingerprintManager.isHardwareDetected() && fingerprintUiHelper.isFingerprintAuthAvailable()) {
            assertEquals(View.VISIBLE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
            assertEquals(View.VISIBLE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
        } else {
            assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
            assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
        }
    } else {
        assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
        assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
    }
    // Enter the code
    clickOnView(R.id.pin_code_button_1);
    clickOnView(R.id.pin_code_button_2);
    clickOnView(R.id.pin_code_button_3);
    clickOnView(R.id.pin_code_button_4);
    // Check view
    solo.waitForActivity(MainActivity.class);
    solo.assertCurrentActivity("MainActivity", MainActivity.class);
}
Also used : FingerprintManager(android.hardware.fingerprint.FingerprintManager) TextView(android.widget.TextView) FingerprintUiHelper(com.github.omadahealth.lollipin.lib.managers.FingerprintUiHelper) ImageView(android.widget.ImageView)

Example 77 with FingerprintManager

use of android.hardware.fingerprint.FingerprintManager in project LolliPin by OrangeGangsters.

the class FingerprintUiHelper method startListening.

/**
 * Starts listening to {@link FingerprintManager}
 *
 * @throws SecurityException If the hardware is not available, or the permission are not set
 */
public void startListening() throws SecurityException {
    if (initCipher()) {
        FingerprintManager.CryptoObject cryptoObject = new FingerprintManager.CryptoObject(mCipher);
        if (!isFingerprintAuthAvailable()) {
            return;
        }
        mCancellationSignal = new CancellationSignal();
        mSelfCancelled = false;
        mFingerprintManager.authenticate(cryptoObject, mCancellationSignal, 0, /* flags */
        this, null);
        mIcon.setImageResource(R.drawable.ic_fp_40px);
    }
}
Also used : FingerprintManager(android.hardware.fingerprint.FingerprintManager) CancellationSignal(android.os.CancellationSignal)

Example 78 with FingerprintManager

use of android.hardware.fingerprint.FingerprintManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetNewPasswordController method create.

public static SetNewPasswordController create(Context context, Ui ui, Intent intent, IBinder activityToken) {
    // Trying to figure out which user is setting new password. If it is
    // ACTION_SET_NEW_PARENT_PROFILE_PASSWORD or the calling user is not allowed to set
    // separate profile challenge, it is the current user to set new password. Otherwise,
    // it is the user who starts this activity setting new password.
    int userId = ActivityManager.getCurrentUser();
    if (ACTION_SET_NEW_PASSWORD.equals(intent.getAction())) {
        final int callingUserId = Utils.getSecureTargetUser(activityToken, UserManager.get(context), null, intent.getExtras()).getIdentifier();
        final LockPatternUtils lockPatternUtils = new LockPatternUtils(context);
        if (lockPatternUtils.isSeparateProfileChallengeAllowed(callingUserId)) {
            userId = callingUserId;
        }
    }
    // Create a wrapper of FingerprintManager for testing, see IFingerPrintManager for details.
    final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(context);
    final FaceManager faceManager = Utils.getFaceManagerOrNull(context);
    return new SetNewPasswordController(userId, context.getPackageManager(), fingerprintManager, faceManager, (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE), ui);
}
Also used : FingerprintManager(android.hardware.fingerprint.FingerprintManager) LockPatternUtils(com.android.internal.widget.LockPatternUtils) FaceManager(android.hardware.face.FaceManager)

Example 79 with FingerprintManager

use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_Settings by omnirom.

the class MultiBiometricEnrollHelper method launchFingerprintEnroll.

private void launchFingerprintEnroll() {
    final FingerprintManager fingerprintManager = mActivity.getSystemService(FingerprintManager.class);
    fingerprintManager.generateChallenge(mUserId, ((sensorId, userId, challenge) -> {
        final byte[] hardwareAuthToken = BiometricUtils.requestGatekeeperHat(mActivity, mGkPwHandle, mUserId, challenge);
        final Intent intent = BiometricUtils.getFingerprintIntroIntent(mActivity, mActivity.getIntent());
        intent.putExtra(BiometricEnrollBase.EXTRA_KEY_SENSOR_ID, sensorId);
        intent.putExtra(BiometricEnrollBase.EXTRA_KEY_CHALLENGE, challenge);
        BiometricUtils.launchEnrollForResult(mActivity, intent, REQUEST_FINGERPRINT_ENROLL, hardwareAuthToken, mGkPwHandle, mUserId);
    }));
}
Also used : NonNull(androidx.annotation.NonNull) ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) FaceManager(android.hardware.face.FaceManager) FingerprintManager(android.hardware.fingerprint.FingerprintManager) FragmentActivity(androidx.fragment.app.FragmentActivity) FingerprintManager(android.hardware.fingerprint.FingerprintManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 80 with FingerprintManager

use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_Settings by omnirom.

the class SetupFingerprintEnrollIntroduction method setFingerprintCount.

private Intent setFingerprintCount(Intent data) {
    if (data == null) {
        data = new Intent();
    }
    final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(this);
    if (fpm != null) {
        int enrolled = fpm.getEnrolledFingerprints(mUserId).size();
        data.putExtra(EXTRA_FINGERPRINT_ENROLLED_COUNT, enrolled);
    }
    return data;
}
Also used : FingerprintManager(android.hardware.fingerprint.FingerprintManager) Intent(android.content.Intent)

Aggregations

FingerprintManager (android.hardware.fingerprint.FingerprintManager)82 Test (org.junit.Test)18 Intent (android.content.Intent)11 ComponentName (android.content.ComponentName)8 Button (android.widget.Button)8 KeyguardManager (android.app.KeyguardManager)7 Context (android.content.Context)7 Fingerprint (android.hardware.fingerprint.Fingerprint)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 LockPatternUtils (com.android.internal.widget.LockPatternUtils)7 FingerprintEnrollSuggestionActivity (com.android.settings.Settings.FingerprintEnrollSuggestionActivity)6 FingerprintSuggestionActivity (com.android.settings.fingerprint.FingerprintSuggestionActivity)6 WallpaperSuggestionActivity (com.android.settings.wallpaper.WallpaperSuggestionActivity)6 TwoTargetPreference (com.android.settingslib.TwoTargetPreference)6 FooterPreference (com.android.settingslib.widget.FooterPreference)6 FaceManager (android.hardware.face.FaceManager)5