Merge branch 'release/2.10.5'

This commit is contained in:
J-Jamet
2021-06-21 17:57:03 +02:00
8 changed files with 27 additions and 42 deletions

View File

@@ -1,3 +1,7 @@
KeePassDX(2.10.5)
* Increase the saving speed of database #1028
* Fix advanced unlocking by device credential #1029
KeePassDX(2.10.4)
* Hot fix to increase the opening speed of database #1028

View File

@@ -11,8 +11,8 @@ android {
applicationId "com.kunzisoft.keepass"
minSdkVersion 15
targetSdkVersion 30
versionCode = 82
versionName = "2.10.4"
versionCode = 83
versionName = "2.10.5"
multiDexEnabled true
testApplicationId = "com.kunzisoft.keepass.tests"

View File

@@ -462,11 +462,6 @@ open class PasswordActivity : SpecialModeActivity(), AdvancedUnlockFragment.Buil
override fun onPause() {
mProgressDatabaseTaskProvider?.unregisterProgressTask()
// To prevent biometric prompt to appearing outside of the app
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
advancedUnlockFragment?.disconnect(hideViews = false, closePrompt = true)
}
// Reinit locking activity UI variable
LockingActivity.LOCKING_ACTIVITY_UI_VISIBLE_DURING_LOCK = null
mAllowAutoOpenBiometricPrompt = true

View File

@@ -30,6 +30,7 @@ import android.view.*
import androidx.annotation.RequiresApi
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricPrompt
import androidx.lifecycle.lifecycleScope
import com.getkeepsafe.taptargetview.TapTargetView
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.stylish.StylishFragment
@@ -38,6 +39,8 @@ import com.kunzisoft.keepass.database.exception.IODatabaseException
import com.kunzisoft.keepass.education.PasswordActivityEducation
import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.view.AdvancedUnlockInfoView
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedUnlockCallback {
@@ -309,7 +312,7 @@ class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedU
@RequiresApi(Build.VERSION_CODES.M)
private fun openAdvancedUnlockPrompt(cryptoPrompt: AdvancedUnlockCryptoPrompt) {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
if (allowOpenBiometricPrompt) {
if (cryptoPrompt.isDeviceCredentialOperation)
keepConnection = true
@@ -450,7 +453,7 @@ class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedU
}
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
Log.e(TAG, "Biometric authentication error. Code : $errorCode Error : $errString")
setAdvancedUnlockedMessageView(errString.toString())
}
@@ -458,7 +461,7 @@ class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedU
@RequiresApi(Build.VERSION_CODES.M)
override fun onAuthenticationFailed() {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
Log.e(TAG, "Biometric authentication failed, biometric not recognized")
setAdvancedUnlockedMessageView(R.string.advanced_unlock_not_recognized)
}
@@ -466,7 +469,7 @@ class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedU
@RequiresApi(Build.VERSION_CODES.M)
override fun onAuthenticationSucceeded() {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
when (biometricMode) {
Mode.BIOMETRIC_UNAVAILABLE -> {
}
@@ -524,7 +527,7 @@ class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedU
}
private fun showViews(show: Boolean) {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
mAdvancedUnlockInfoView?.visibility = if (show)
View.VISIBLE
else {
@@ -535,20 +538,20 @@ class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedU
@RequiresApi(Build.VERSION_CODES.M)
private fun setAdvancedUnlockedTitleView(textId: Int) {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
mAdvancedUnlockInfoView?.setTitle(textId)
}
}
@RequiresApi(Build.VERSION_CODES.M)
private fun setAdvancedUnlockedMessageView(textId: Int) {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
mAdvancedUnlockInfoView?.setMessage(textId)
}
}
private fun setAdvancedUnlockedMessageView(text: CharSequence) {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
mAdvancedUnlockInfoView?.message = text
}
}

View File

@@ -23,7 +23,6 @@ import android.content.*
import android.content.Context.BIND_ABOVE_CLIENT
import android.content.Context.BIND_NOT_FOREGROUND
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.IBinder
import android.util.Log
@@ -286,11 +285,6 @@ class ProgressDatabaseTaskProvider(private val activity: FragmentActivity) {
readOnly: Boolean,
cipherEntity: CipherDatabaseEntity?,
fixDuplicateUuid: Boolean) {
try {
activity.stopService(intentDatabaseTask)
} catch (e: Exception) {
Log.e(TAG, "Unable to stop the service", e)
}
start(Bundle().apply {
putParcelable(DatabaseTaskNotificationService.DATABASE_URI_KEY, databaseUri)
putParcelable(DatabaseTaskNotificationService.MAIN_CREDENTIAL_KEY, mainCredential)

View File

@@ -19,9 +19,7 @@
*/
package com.kunzisoft.keepass.services
import android.app.ActivityManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.*
@@ -50,7 +48,6 @@ import com.kunzisoft.keepass.utils.*
import com.kunzisoft.keepass.viewmodels.FileDatabaseInfo
import kotlinx.coroutines.*
import java.util.*
import java.util.concurrent.atomic.AtomicBoolean
import kotlin.collections.ArrayList
open class DatabaseTaskNotificationService : LockNotificationService(), ProgressTaskUpdater {
@@ -63,7 +60,6 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
private var mActionTaskBinder = ActionTaskBinder()
private var mActionTaskListeners = LinkedList<ActionTaskListener>()
private var mAllowFinishAction = AtomicBoolean()
private var mActionRunning = false
private var mDatabaseInfoListeners = LinkedList<DatabaseInfoListener>()
@@ -86,19 +82,17 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
fun getService(): DatabaseTaskNotificationService = this@DatabaseTaskNotificationService
fun addActionTaskListener(actionTaskListener: ActionTaskListener) {
mAllowFinishAction.set(true)
mActionTaskListeners.add(actionTaskListener)
if (!mActionTaskListeners.contains(actionTaskListener))
mActionTaskListeners.add(actionTaskListener)
}
fun removeActionTaskListener(actionTaskListener: ActionTaskListener) {
mActionTaskListeners.remove(actionTaskListener)
if (mActionTaskListeners.size == 0) {
mAllowFinishAction.set(false)
}
}
fun addDatabaseFileInfoListener(databaseInfoListener: DatabaseInfoListener) {
mDatabaseInfoListeners.add(databaseInfoListener)
if (!mDatabaseInfoListeners.contains(databaseInfoListener))
mDatabaseInfoListeners.add(databaseInfoListener)
}
fun removeDatabaseFileInfoListener(databaseInfoListener: DatabaseInfoListener) {
@@ -236,6 +230,8 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
mainScope.launch {
executeAction(this@DatabaseTaskNotificationService,
{
TimeoutHelper.temporarilyDisableTimeout()
mActionRunning = true
sendBroadcast(Intent(DATABASE_START_TASK_ACTION).apply {
@@ -427,23 +423,12 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
onPreExecute: () -> Unit,
onExecute: (ProgressTaskUpdater?) -> ActionRunnable?,
onPostExecute: (result: ActionRunnable.Result) -> Unit) {
mAllowFinishAction.set(false)
TimeoutHelper.temporarilyDisableTimeout()
onPreExecute.invoke()
withContext(Dispatchers.IO) {
onExecute.invoke(progressTaskUpdater)?.apply {
val asyncResult: Deferred<ActionRunnable.Result> = async {
val startTime = System.currentTimeMillis()
var timeIsUp = false
// Run the actionRunnable
run()
// Wait onBind or 4 seconds max
while (!mAllowFinishAction.get() && !timeIsUp) {
delay(100)
if (startTime + 4000 < System.currentTimeMillis())
timeIsUp = true
}
result
}
withContext(Dispatchers.Main) {

View File

@@ -0,0 +1,2 @@
* Increase the saving speed of database #1028
* Fix advanced unlocking by device credential #1029

View File

@@ -0,0 +1,2 @@
* Augmentation de la rapidité de sauvegarde de la base de données #1028
* Correction du déverouillage avancé #1029