make sure quick-unlock code is respected always, release 1.01b

This commit is contained in:
Philipp Crocoll 2017-01-25 05:01:26 +01:00
parent a6a99e3685
commit 7ccf55f84f
6 changed files with 32 additions and 18 deletions

View File

@ -229,7 +229,10 @@ namespace keepass2android.Io
if (cursor != null && cursor.MoveToFirst()) if (cursor != null && cursor.MoveToFirst())
{ {
int flags = cursor.GetInt(cursor.GetColumnIndex(DocumentsContract.Document.ColumnFlags)); int column = cursor.GetColumnIndex(DocumentsContract.Document.ColumnFlags);
if (column < 0)
return false; //seems like this is not supported. See below for reasoning to return false.
int flags = cursor.GetInt(column);
Kp2aLog.Log("File flags: " + flags); Kp2aLog.Log("File flags: " + flags);
if ((flags & (long) DocumentContractFlags.SupportsWrite) == 0) if ((flags & (long) DocumentContractFlags.SupportsWrite) == 0)
{ {

View File

@ -26,6 +26,7 @@ namespace keepass2android
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog)); AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog));
builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title)); builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
List<string> changeLog = new List<string>{ List<string> changeLog = new List<string>{
ctx.GetString(Resource.String.ChangeLog_1_01b),
ctx.GetString(Resource.String.ChangeLog_1_01), ctx.GetString(Resource.String.ChangeLog_1_01),
ctx.GetString(Resource.String.ChangeLog_1_0_0e), ctx.GetString(Resource.String.ChangeLog_1_0_0e),
ctx.GetString(Resource.String.ChangeLog_1_0_0), ctx.GetString(Resource.String.ChangeLog_1_0_0),

View File

@ -925,7 +925,7 @@ namespace keepass2android
RequestPermissions(new[] { Manifest.Permission.UseFingerprint }, FingerprintPermissionRequestCode); RequestPermissions(new[] { Manifest.Permission.UseFingerprint }, FingerprintPermissionRequestCode);
} }
const int FingerprintPermissionRequestCode = 0; const int FingerprintPermissionRequestCode = 99;
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{ {
@ -1768,34 +1768,39 @@ namespace keepass2android
FindViewById(Resource.Id.otpInitView).Visibility = _challengeSecret == null ? ViewStates.Visible : ViewStates.Gone; FindViewById(Resource.Id.otpInitView).Visibility = _challengeSecret == null ? ViewStates.Visible : ViewStates.Gone;
} }
// OnResume is run every time the activity comes to the foreground. This code should only run when the activity is started (OnStart), but must
// be run in OnResume rather than OnStart so that it always occurrs after OnActivityResult (when re-creating a killed activity, OnStart occurs before OnActivityResult)
//use !IsFinishing to make sure we're not starting another activity when we're already finishing (e.g. due to TaskComplete in OnActivityResult) //use !IsFinishing to make sure we're not starting another activity when we're already finishing (e.g. due to TaskComplete in OnActivityResult)
//use !performingLoad to make sure we're not already loading the database (after ActivityResult from File-Prepare-Activity; this would cause _loadDbTask to exist when we reload later!) //use !performingLoad to make sure we're not already loading the database (after ActivityResult from File-Prepare-Activity; this would cause _loadDbTask to exist when we reload later!)
if (_starting && !IsFinishing && !_performingLoad) if ( !IsFinishing && !_performingLoad)
{ {
_starting = false;
if (App.Kp2a.DatabaseIsUnlocked) if (App.Kp2a.DatabaseIsUnlocked)
{ {
LaunchNextActivity(); LaunchNextActivity();
} }
else if (App.Kp2a.QuickUnlockEnabled && App.Kp2a.QuickLocked) else if (App.Kp2a.QuickUnlockEnabled && App.Kp2a.QuickLocked)
{ {
var i = new Intent(this, typeof(QuickUnlock)); var i = new Intent(this, typeof (QuickUnlock));
PutIoConnectionToIntent(_ioConnection, i); PutIoConnectionToIntent(_ioConnection, i);
Kp2aLog.Log("Starting QuickUnlock"); Kp2aLog.Log("Starting QuickUnlock");
StartActivityForResult(i, 0); StartActivityForResult(i, 0);
} }
else else
{ {
//database not yet loaded. // OnResume is run every time the activity comes to the foreground. This code should only run when the activity is started (OnStart), but must
// be run in OnResume rather than OnStart so that it always occurrs after OnActivityResult (when re-creating a killed activity, OnStart occurs before OnActivityResult)
//check if pre-loading is enabled but wasn't started yet: if (!_starting)
if (_loadDbTask == null && _prefs.GetBoolean(GetString(Resource.String.PreloadDatabaseEnabled_key), true))
{ {
// Create task to kick off file loading while the user enters the password
_loadDbTask = Task.Factory.StartNew<MemoryStream>(PreloadDbFile); _starting = false;
_loadDbTaskOffline = App.Kp2a.OfflineMode;
//database not yet loaded.
//check if pre-loading is enabled but wasn't started yet:
if (_loadDbTask == null && _prefs.GetBoolean(GetString(Resource.String.PreloadDatabaseEnabled_key), true))
{
// Create task to kick off file loading while the user enters the password
_loadDbTask = Task.Factory.StartNew<MemoryStream>(PreloadDbFile);
_loadDbTaskOffline = App.Kp2a.OfflineMode;
}
} }
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="86" android:versionCode="88"
android:versionName="1.01-pre4" android:versionName="1.01-b"
package="keepass2android.keepass2android" package="keepass2android.keepass2android"
android:installLocation="auto"> android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" /> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />

View File

@ -710,7 +710,7 @@
* Bug fixes * Bug fixes
</string> </string>
<string name="ChangeLog_0_8_6"> <string name="ChangeLog_0_8_6">
Έκδοση 0.8.6</b>\n Έκδοση 0.8.6\n
* Support for Twofish cipher\n * Support for Twofish cipher\n
* Allow editing of groups\n * Allow editing of groups\n
* Allow moving of entries and groups\n * Allow moving of entries and groups\n

View File

@ -680,6 +680,11 @@
<string name="ActivateAutoFillService_btnAutoFill">Use AutoFill service</string> <string name="ActivateAutoFillService_btnAutoFill">Use AutoFill service</string>
<string name="ActivateAutoFillService_toast">Please enable the Keepass2Android service.</string> <string name="ActivateAutoFillService_toast">Please enable the Keepass2Android service.</string>
<string name="ShowKeyboardDuringFingerprintAuth">Show soft keyboard for password input when fingerprint scan is active.</string> <string name="ShowKeyboardDuringFingerprintAuth">Show soft keyboard for password input when fingerprint scan is active.</string>
<string name="ChangeLog_1_01b">
Version 1.01-b\n
* Fix for QuickUnlock sometimes failing despite correct code.\n
</string>
<string name="ChangeLog_0_9_8c"> <string name="ChangeLog_0_9_8c">
Version 0.9.8c\n Version 0.9.8c\n
* Fix for SSL vulnerability in Microsoft Live SDK (used when accessing files via OneDrive)\n * Fix for SSL vulnerability in Microsoft Live SDK (used when accessing files via OneDrive)\n