mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-04-04 21:37:37 +03:00
Update gradle and remove compatibility mode for FingerPrintManager
This commit is contained in:
parent
6c5b3b3a0d
commit
1791b15f85
6 changed files with 23 additions and 20 deletions
|
@ -105,7 +105,7 @@ dependencies {
|
|||
implementation 'commons-collections:commons-collections:3.2.1'
|
||||
// Base64
|
||||
implementation 'biz.source_code:base64coder:2010-12-19'
|
||||
implementation 'com.google.code.gson:gson:2.8.1'
|
||||
implementation 'com.google.code.gson:gson:2.8.4'
|
||||
implementation 'com.google.guava:guava:23.0-android'
|
||||
// Icon pack, classic for all, material for libre and pro
|
||||
implementation project(path: ':icon-pack-classic')
|
||||
|
|
|
@ -22,13 +22,13 @@ package com.kunzisoft.keepass.fingerprint;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.Build;
|
||||
import android.os.CancellationSignal;
|
||||
import android.security.keystore.KeyGenParameterSpec;
|
||||
import android.security.keystore.KeyPermanentlyInvalidatedException;
|
||||
import android.security.keystore.KeyProperties;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;
|
||||
import android.support.v4.os.CancellationSignal;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -52,19 +52,19 @@ public class FingerPrintHelper {
|
|||
|
||||
private static final String FINGERPRINT_KEYSTORE_KEY = "com.kunzisoft.keepass.fingerprint.key";
|
||||
|
||||
private FingerprintManagerCompat fingerprintManager;
|
||||
private FingerprintManager fingerprintManager;
|
||||
private KeyStore keyStore = null;
|
||||
private KeyGenerator keyGenerator = null;
|
||||
private Cipher cipher = null;
|
||||
private KeyguardManager keyguardManager = null;
|
||||
private FingerprintManagerCompat.CryptoObject cryptoObject = null;
|
||||
private FingerprintManager.CryptoObject cryptoObject = null;
|
||||
|
||||
private boolean initOk = false;
|
||||
private FingerPrintCallback fingerPrintCallback;
|
||||
private CancellationSignal cancellationSignal;
|
||||
private FingerprintManagerCompat.AuthenticationCallback authenticationCallback;
|
||||
private FingerprintManager.AuthenticationCallback authenticationCallback;
|
||||
|
||||
public void setAuthenticationCallback(final FingerprintManagerCompat.AuthenticationCallback authenticationCallback) {
|
||||
public void setAuthenticationCallback(final FingerprintManager.AuthenticationCallback authenticationCallback) {
|
||||
this.authenticationCallback = authenticationCallback;
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,8 @@ public class FingerPrintHelper {
|
|||
cancellationSignal = new CancellationSignal();
|
||||
fingerprintManager.authenticate(
|
||||
cryptoObject,
|
||||
0 /* flags */,
|
||||
cancellationSignal,
|
||||
0 /* flags */,
|
||||
authenticationCallback,
|
||||
null);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class FingerPrintHelper {
|
|||
final Context context,
|
||||
final FingerPrintCallback fingerPrintCallback) {
|
||||
|
||||
this.fingerprintManager = FingerprintManagerCompat.from(context);
|
||||
this.fingerprintManager = context.getSystemService(FingerprintManager.class);
|
||||
if (!isFingerprintSupported(fingerprintManager)) {
|
||||
// really not much to do when no fingerprint support found
|
||||
setInitOk(false);
|
||||
|
@ -112,7 +112,7 @@ public class FingerPrintHelper {
|
|||
KeyProperties.KEY_ALGORITHM_AES + "/"
|
||||
+ KeyProperties.BLOCK_MODE_CBC + "/"
|
||||
+ KeyProperties.ENCRYPTION_PADDING_PKCS7);
|
||||
this.cryptoObject = new FingerprintManagerCompat.CryptoObject(cipher);
|
||||
this.cryptoObject = new FingerprintManager.CryptoObject(cipher);
|
||||
setInitOk(true);
|
||||
} catch (final Exception e) {
|
||||
Log.e(TAG, "Unable to initialize the keystore", e);
|
||||
|
@ -122,7 +122,7 @@ public class FingerPrintHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isFingerprintSupported(FingerprintManagerCompat fingerprintManager) {
|
||||
public static boolean isFingerprintSupported(FingerprintManager fingerprintManager) {
|
||||
return fingerprintManager != null
|
||||
&& fingerprintManager.isHardwareDetected();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.app.backup.BackupManager;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
|
@ -427,7 +428,7 @@ public class PasswordActivity extends StylishActivity
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
|
||||
if ( PreferencesUtil.isFingerprintEnable(getApplicationContext())
|
||||
&& FingerPrintHelper.isFingerprintSupported(FingerprintManagerCompat.from(this))) {
|
||||
&& FingerPrintHelper.isFingerprintSupported(getSystemService(FingerprintManager.class))) {
|
||||
|
||||
TapTargetView.showFor(this,
|
||||
TapTarget.forView(fingerprintImageView,
|
||||
|
@ -567,7 +568,7 @@ public class PasswordActivity extends StylishActivity
|
|||
});
|
||||
|
||||
// callback for fingerprint findings
|
||||
fingerPrintHelper.setAuthenticationCallback(new FingerprintManagerCompat.AuthenticationCallback() {
|
||||
fingerPrintHelper.setAuthenticationCallback(new FingerprintManager.AuthenticationCallback() {
|
||||
@Override
|
||||
public void onAuthenticationError(
|
||||
final int errorCode,
|
||||
|
@ -599,7 +600,7 @@ public class PasswordActivity extends StylishActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationSucceeded(final FingerprintManagerCompat.AuthenticationResult result) {
|
||||
public void onAuthenticationSucceeded(final FingerprintManager.AuthenticationResult result) {
|
||||
switch (fingerPrintMode) {
|
||||
case STORE_MODE:
|
||||
// newly store the entered password in encrypted way
|
||||
|
@ -730,7 +731,7 @@ public class PasswordActivity extends StylishActivity
|
|||
// fingerprint not supported (by API level or hardware) so keep option hidden
|
||||
// or manually disable
|
||||
if (!PreferencesUtil .isFingerprintEnable(getApplicationContext())
|
||||
|| !FingerPrintHelper.isFingerprintSupported(FingerprintManagerCompat.from(this))) {
|
||||
|| !FingerPrintHelper.isFingerprintSupported(getSystemService(FingerprintManager.class))) {
|
||||
setFingerPrintVisibility(View.GONE);
|
||||
}
|
||||
// fingerprint is available but not configured show icon but in disabled state with some information
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -160,9 +161,10 @@ public class NestedSettingsFragment extends PreferenceFragmentCompat
|
|||
(SwitchPreference) findPreference(getString(R.string.fingerprint_enable_key));
|
||||
// < M solve verifyError exception
|
||||
boolean fingerprintSupported = false;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||
&& getActivity() != null)
|
||||
fingerprintSupported = FingerPrintHelper.isFingerprintSupported(
|
||||
FingerprintManagerCompat.from(getContext()));
|
||||
getActivity().getSystemService(FingerprintManager.class));
|
||||
if (!fingerprintSupported) {
|
||||
// False if under Marshmallow
|
||||
fingerprintEnablePreference.setChecked(false);
|
||||
|
|
|
@ -8,7 +8,7 @@ buildscript {
|
|||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Sat Oct 28 10:13:14 CDT 2017
|
||||
#Mon Jul 09 19:12:47 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue