fix for crash on Android 4.x (NoBackupFilesDir is ApiLevel >= 21)
try to fall back to Samsung fingerprint API even on Android 6 -> 1.0.0c
This commit is contained in:
@@ -253,7 +253,7 @@ namespace keepass2android.Io
|
||||
if (ioc.IsLocalFile())
|
||||
{
|
||||
bool requiresPermission = !(ioc.Path.StartsWith(activity.Activity.FilesDir.CanonicalPath)
|
||||
|| ioc.Path.StartsWith(activity.Activity.NoBackupFilesDir.CanonicalPath));
|
||||
|| ioc.Path.StartsWith(IoUtil.GetInternalDirectory(activity.Activity).CanonicalPath));
|
||||
|
||||
var extDirectory = activity.Activity.GetExternalFilesDir(null);
|
||||
if ((extDirectory != null) && (ioc.Path.StartsWith(extDirectory.CanonicalPath)))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Java.IO;
|
||||
using KeePassLib.Serialization;
|
||||
|
||||
@@ -53,7 +54,7 @@ namespace keepass2android.Io
|
||||
try
|
||||
{
|
||||
File filesDir = context.FilesDir.CanonicalFile;
|
||||
File noBackupDir = context.NoBackupFilesDir.CanonicalFile;
|
||||
File noBackupDir = GetInternalDirectory(context).CanonicalFile;
|
||||
File ourFile = new File(path).CanonicalFile;
|
||||
//http://www.java2s.com/Tutorial/Java/0180__File/Checkswhetherthechilddirectoryisasubdirectoryofthebasedirectory.htm
|
||||
|
||||
@@ -93,5 +94,13 @@ namespace keepass2android.Io
|
||||
writeTransaction.CommitWrite();
|
||||
}
|
||||
}
|
||||
|
||||
public static Java.IO.File GetInternalDirectory(Context ctx)
|
||||
{
|
||||
if ((int)Android.OS.Build.VERSION.SdkInt >= 21)
|
||||
return ctx.NoBackupFilesDir;
|
||||
else
|
||||
return ctx.FilesDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace keepass2android
|
||||
}
|
||||
catch (DuplicateUuidsException e)
|
||||
{
|
||||
Kp2aLog.LogUnexpectedError(e);
|
||||
Kp2aLog.Log(e.ToString());
|
||||
Finish(false, _app.GetResourceString(UiStringKey.DuplicateUuidsError) + " " + e.Message + _app.GetResourceString(UiStringKey.DuplicateUuidsErrorAdditional), Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user