Search in sources :

Example 61 with FingerprintManager

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);
}
Also used : FingerprintManager(android.hardware.fingerprint.FingerprintManager) Test(org.junit.Test)

Example 62 with FingerprintManager

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);
}
Also used : FingerprintManager(android.hardware.fingerprint.FingerprintManager) Test(org.junit.Test)

Example 63 with FingerprintManager

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();
}
Also used : MagiskManager(com.topjohnwu.magisk.MagiskManager) FingerprintManager(android.hardware.fingerprint.FingerprintManager) KeyguardManager(android.app.KeyguardManager)

Example 64 with FingerprintManager

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);
        }
    }
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) FingerprintManager(android.hardware.fingerprint.FingerprintManager)

Example 65 with FingerprintManager

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

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