Skip to content

Commit

Permalink
Merge branch 'release/2.10.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Jamet committed Jun 21, 2021
2 parents f49485e + bb2f641 commit e6f082a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -450,23 +453,23 @@ 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())
}
}

@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)
}
}

@RequiresApi(Build.VERSION_CODES.M)
override fun onAuthenticationSucceeded() {
activity?.runOnUiThread {
lifecycleScope.launch(Dispatchers.Main) {
when (biometricMode) {
Mode.BIOMETRIC_UNAVAILABLE -> {
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -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 {
Expand All @@ -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>()
Expand All @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/83.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Increase the saving speed of database #1028
* Fix advanced unlocking by device credential #1029
2 changes: 2 additions & 0 deletions fastlane/metadata/android/fr-FR/changelogs/83.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Augmentation de la rapidité de sauvegarde de la base de données #1028
* Correction du déverouillage avancé #1029

0 comments on commit e6f082a

Please sign in to comment.