From 2a87eaf3e57e509776a87ff0b2220e45d8cd9b9e Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 15 Apr 2022 12:21:14 +0200 Subject: [PATCH] Upgrade to 3.4.2 and fix service parameter and workflow --- CHANGELOG | 3 +++ app/build.gradle | 4 ++-- app/src/main/AndroidManifest.xml | 1 + .../keepass/activities/EntrySelectionLauncherActivity.kt | 3 +-- .../keepass/database/action/DatabaseTaskProvider.kt | 2 +- .../keepass/services/AttachmentFileNotificationService.kt | 8 ++++++-- .../kunzisoft/keepass/services/LockNotificationService.kt | 2 ++ fastlane/metadata/android/en-US/changelogs/111.txt | 1 + fastlane/metadata/android/fr-FR/changelogs/111.txt | 1 + 9 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/111.txt create mode 100644 fastlane/metadata/android/fr-FR/changelogs/111.txt diff --git a/CHANGELOG b/CHANGELOG index 447e58134..3abe670de 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +KeePassDX(3.4.2) + * Fix service parameter and workflow to remove notification when service is killed + KeePassDX(3.4.1) * Fix search mode with Magikeyboard #1292 * Fix select another entry with Magikeyboard #1293 diff --git a/app/build.gradle b/app/build.gradle index 5d2d55980..b3d3b35e1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "com.kunzisoft.keepass" minSdkVersion 15 targetSdkVersion 31 - versionCode = 110 - versionName = "3.4.1" + versionCode = 111 + versionName = "3.4.2" multiDexEnabled true testApplicationId = "com.kunzisoft.keepass.tests" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 60213c449..57a34d5ea 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -158,6 +158,7 @@ diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt index 6d8aea863..f1f077f15 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt @@ -205,8 +205,7 @@ class EntrySelectionLauncherActivity : DatabaseModeActivity() { } // New task needed because don't launch from an Activity context intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or - Intent.FLAG_ACTIVITY_CLEAR_TASK or - Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS + Intent.FLAG_ACTIVITY_CLEAR_TASK context.startActivity(intent) } } diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/DatabaseTaskProvider.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/DatabaseTaskProvider.kt index 18468a863..8430bd816 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/action/DatabaseTaskProvider.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/action/DatabaseTaskProvider.kt @@ -248,7 +248,7 @@ class DatabaseTaskProvider { private fun bindService() { initServiceConnection() serviceConnection?.let { - context.bindService(intentDatabaseTask, it, BIND_AUTO_CREATE or BIND_NOT_FOREGROUND or BIND_ABOVE_CLIENT) + context.bindService(intentDatabaseTask, it, BIND_AUTO_CREATE or BIND_IMPORTANT or BIND_ABOVE_CLIENT) } } diff --git a/app/src/main/java/com/kunzisoft/keepass/services/AttachmentFileNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/services/AttachmentFileNotificationService.kt index 853079985..d54a7a603 100644 --- a/app/src/main/java/com/kunzisoft/keepass/services/AttachmentFileNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/services/AttachmentFileNotificationService.kt @@ -27,6 +27,7 @@ import android.os.Binder import android.os.Build import android.os.IBinder import android.util.Log +import androidx.core.app.ServiceCompat import com.kunzisoft.keepass.R import com.kunzisoft.keepass.database.action.DatabaseTaskProvider import com.kunzisoft.keepass.database.element.Attachment @@ -36,7 +37,10 @@ import com.kunzisoft.keepass.model.EntryAttachmentState import com.kunzisoft.keepass.model.StreamDirection import com.kunzisoft.keepass.tasks.BinaryDatabaseManager import com.kunzisoft.keepass.utils.UriUtil -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import java.util.* import java.util.concurrent.CopyOnWriteArrayList @@ -275,7 +279,7 @@ class AttachmentFileNotificationService: LockNotificationService() { AttachmentState.COMPLETE, AttachmentState.CANCELED, AttachmentState.ERROR -> { - stopForeground(false) + ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_DETACH) notificationManager?.notify(attachmentNotification.notificationId, builder.build()) } else -> { startForeground(attachmentNotification.notificationId, builder.build()) diff --git a/app/src/main/java/com/kunzisoft/keepass/services/LockNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/services/LockNotificationService.kt index 9adc2b150..5118fc203 100644 --- a/app/src/main/java/com/kunzisoft/keepass/services/LockNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/services/LockNotificationService.kt @@ -20,6 +20,7 @@ package com.kunzisoft.keepass.services import android.content.Intent +import androidx.core.app.ServiceCompat import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.utils.LockReceiver import com.kunzisoft.keepass.utils.registerLockReceiver @@ -33,6 +34,7 @@ abstract class LockNotificationService : NotificationService() { protected open fun actionOnLock() { // Stop the service in all cases + ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE) stopSelf() } diff --git a/fastlane/metadata/android/en-US/changelogs/111.txt b/fastlane/metadata/android/en-US/changelogs/111.txt new file mode 100644 index 000000000..8130654cf --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/111.txt @@ -0,0 +1 @@ + * Fix service parameter and workflow to remove notification when service is killed \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/changelogs/111.txt b/fastlane/metadata/android/fr-FR/changelogs/111.txt new file mode 100644 index 000000000..102156e70 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/111.txt @@ -0,0 +1 @@ + * Correction du paramètre de service et du flux de travail pour supprimer la notification lorsque le service est tué \ No newline at end of file