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);
}
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);
}
}
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);
}
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);
}));
}
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;
}
Aggregations