use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_Settings by crdroidandroid.
the class SecuritySettingsTest method testSummaryProvider_noFpFeature_shouldSetSummaryWithNoFingerprint.
@Test
public void testSummaryProvider_noFpFeature_shouldSetSummaryWithNoFingerprint() {
final FingerprintManager fpm = mock(FingerprintManager.class);
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)).thenReturn(false);
mSummaryProvider.setListening(true);
verify(mContext).getString(R.string.security_dashboard_summary_no_fingerprint);
}
use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_Settings by crdroidandroid.
the class SecuritySettingsTest method testSummaryProvider_hasFingerPrint_hasStaticSummary.
@Test
public void testSummaryProvider_hasFingerPrint_hasStaticSummary() {
final FingerprintManager fpm = mock(FingerprintManager.class);
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)).thenReturn(true);
// Cast to Object to workaround a robolectric casting bug
when((Object) mContext.getSystemService(FingerprintManager.class)).thenReturn(fpm);
when(fpm.isHardwareDetected()).thenReturn(true);
mSummaryProvider.setListening(true);
verify(mContext).getString(R.string.security_dashboard_summary);
}
use of android.hardware.fingerprint.FingerprintManager in project MagiskManager by topjohnwu.
the class FingerprintHelper method canUseFingerprint.
public static boolean canUseFingerprint() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
return false;
MagiskManager mm = MagiskManager.get();
KeyguardManager km = mm.getSystemService(KeyguardManager.class);
FingerprintManager fm = mm.getSystemService(FingerprintManager.class);
return km.isKeyguardSecure() && fm != null && fm.isHardwareDetected() && fm.hasEnrolledFingerprints();
}
use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_crDroidSettings by crdroidandroid.
the class LockScreen method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.crdroid_settings_lockscreen);
PreferenceCategory interfaceCategory = (PreferenceCategory) findPreference(LOCKSCREEN_INTERFACE_CATEGORY);
PreferenceCategory gestCategory = (PreferenceCategory) findPreference(LOCKSCREEN_GESTURES_CATEGORY);
FingerprintManager mFingerprintManager = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
mUdfpsSettings = (Preference) findPreference(KEY_UDFPS_SETTINGS);
mFingerprintVib = (Preference) findPreference(KEY_FP_SUCCESS_VIBRATE);
mFingerprintVibErr = (Preference) findPreference(KEY_FP_ERROR_VIBRATE);
mRippleEffect = (Preference) findPreference(KEY_RIPPLE_EFFECT);
if (mFingerprintManager == null || !mFingerprintManager.isHardwareDetected()) {
interfaceCategory.removePreference(mUdfpsSettings);
gestCategory.removePreference(mFingerprintVib);
gestCategory.removePreference(mFingerprintVibErr);
gestCategory.removePreference(mRippleEffect);
} else {
if (!Utils.isPackageInstalled(getContext(), "com.crdroid.udfps.icons")) {
interfaceCategory.removePreference(mUdfpsSettings);
} else {
gestCategory.removePreference(mFingerprintVib);
gestCategory.removePreference(mFingerprintVibErr);
}
}
}
use of android.hardware.fingerprint.FingerprintManager in project EhViewer by seven332.
the class SetSecurityActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_security);
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
mPatternView = (LockPatternView) ViewUtils.$$(this, R.id.pattern_view);
mCancel = ViewUtils.$$(this, R.id.cancel);
mSet = ViewUtils.$$(this, R.id.set);
mFingerprint = (CheckBox) ViewUtils.$$(this, R.id.fingerprint_checkbox);
String pattern = Settings.getSecurity();
if (!TextUtils.isEmpty(pattern)) {
mPatternView.setPattern(LockPatternView.DisplayMode.Correct, LockPatternUtils.stringToPattern(pattern));
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
// noinspection ResourceType
if (fingerprintManager != null && hasEnrolledFingerprints(fingerprintManager)) {
mFingerprint.setVisibility(View.VISIBLE);
mFingerprint.setChecked(Settings.getEnableFingerprint());
}
}
mCancel.setOnClickListener(this);
mSet.setOnClickListener(this);
}
Aggregations