use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_Settings by DirtyUnicorns.
the class SecuritySettingsTest method testSummaryProvider_noFpHardware_shouldSetSummaryWithNoFingerprint.
@Test
public void testSummaryProvider_noFpHardware_shouldSetSummaryWithNoFingerprint() {
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(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 DirtyUnicorns.
the class SuggestionsChecks method isSuggestionComplete.
public boolean isSuggestionComplete(Tile suggestion) {
ComponentName component = suggestion.intent.getComponent();
String className = component.getClassName();
if (className.equals(WallpaperSuggestionActivity.class.getName())) {
return hasWallpaperSet();
} else if (className.equals(WifiCallingSuggestionActivity.class.getName())) {
return isWifiCallingUnavailableOrEnabled();
} else if (className.equals(FingerprintSuggestionActivity.class.getName())) {
return !Utils.hasFingerprintHardware(mContext) || !isFingerprintEnabled() || isNotSingleFingerprintEnrolled();
} else if (className.equals(ScreenLockSuggestionActivity.class.getName())) {
return isDeviceSecured();
} else if (className.equals(FingerprintEnrollSuggestionActivity.class.getName())) {
final FingerprintManager manager = Utils.getFingerprintManagerOrNull(mContext);
if (manager == null || !isFingerprintEnabled() || !Utils.hasFingerprintHardware(mContext)) {
return true;
}
return manager.hasEnrolledFingerprints();
}
final SuggestionFeatureProvider provider = FeatureFactory.getFactory(mContext).getSuggestionFeatureProvider(mContext);
return provider.isSuggestionCompleted(mContext, component);
}
use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_Settings by DirtyUnicorns.
the class FingerprintEnrollIntroduction method onResume.
@Override
protected void onResume() {
super.onResume();
final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(this);
int errorMsg = 0;
if (fingerprintManager != null) {
final int max = getResources().getInteger(com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
final int numEnrolledFingerprints = fingerprintManager.getEnrolledFingerprints(mUserId).size();
if (numEnrolledFingerprints >= max) {
errorMsg = R.string.fingerprint_intro_error_max;
}
} else {
errorMsg = R.string.fingerprint_intro_error_unknown;
}
if (errorMsg == 0) {
mErrorText.setText(null);
getNextButton().setVisibility(View.VISIBLE);
} else {
mErrorText.setText(errorMsg);
getNextButton().setVisibility(View.GONE);
}
}
use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_Settings by crdroidandroid.
the class SuggestionsChecks method isSuggestionComplete.
public boolean isSuggestionComplete(Tile suggestion) {
ComponentName component = suggestion.intent.getComponent();
String className = component.getClassName();
if (className.equals(WallpaperSuggestionActivity.class.getName())) {
return hasWallpaperSet();
} else if (className.equals(WifiCallingSuggestionActivity.class.getName())) {
return isWifiCallingUnavailableOrEnabled();
} else if (className.equals(FingerprintSuggestionActivity.class.getName())) {
return !Utils.hasFingerprintHardware(mContext) || !isFingerprintEnabled() || isNotSingleFingerprintEnrolled();
} else if (className.equals(ScreenLockSuggestionActivity.class.getName())) {
return isDeviceSecured();
} else if (className.equals(FingerprintEnrollSuggestionActivity.class.getName())) {
final FingerprintManager manager = Utils.getFingerprintManagerOrNull(mContext);
if (manager == null || !isFingerprintEnabled() || !Utils.hasFingerprintHardware(mContext)) {
return true;
}
return manager.hasEnrolledFingerprints();
}
final SuggestionFeatureProvider provider = FeatureFactory.getFactory(mContext).getSuggestionFeatureProvider(mContext);
return provider.isSuggestionCompleted(mContext, component);
}
use of android.hardware.fingerprint.FingerprintManager in project android_packages_apps_Settings by crdroidandroid.
the class FingerprintEnrollIntroduction method onResume.
@Override
protected void onResume() {
super.onResume();
final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(this);
int errorMsg = 0;
if (fingerprintManager != null) {
final int max = getResources().getInteger(com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
final int numEnrolledFingerprints = fingerprintManager.getEnrolledFingerprints(mUserId).size();
if (numEnrolledFingerprints >= max) {
errorMsg = R.string.fingerprint_intro_error_max;
}
} else {
errorMsg = R.string.fingerprint_intro_error_unknown;
}
if (errorMsg == 0) {
mErrorText.setText(null);
getNextButton().setVisibility(View.VISIBLE);
} else {
mErrorText.setText(errorMsg);
getNextButton().setVisibility(View.GONE);
}
}
Aggregations