Repository: thunderbird/thunderbird-android (language: kotlin)

Issue:
Notification causes vibration for account despite disabled vibration
**Describe the bug**
Since version 5.905, the settings of disabled vibrations for a single account doesn't have a effect. The notification still causes a vibration.

**To Reproduce**
Steps to reproduce the behavior:
1. Add a account and set the notification to not cause vibrations.
2. Receive a email. Note that the notification causes vibration.

**Expected behavior**
The notification should not cause a vibration, since it is disabled

**Screenshots**


**Environment (please complete the following information):**
 - K-9 Mail version: 5.905
 - Android version: 7.1.2
 - Device: BQ Aquaris U plus
 - Account type: IMAP

**Additional context**
The problem started appearing in version 5.905.


Discussion hints:
nan

Pull request: Only set vibration pattern if vibration is enabled
Fixes #5811

Test command: ./gradlew :app:core:testDebugUnitTest --tests "com.fsck.k9.notification.NewMailNotificationManagerTest"

Fix patch:
diff --git a/app/core/src/main/java/com/fsck/k9/notification/BaseNotificationDataCreator.kt b/app/core/src/main/java/com/fsck/k9/notification/BaseNotificationDataCreator.kt
index 443091bd8dd..936f884c4dd 100644
--- a/app/core/src/main/java/com/fsck/k9/notification/BaseNotificationDataCreator.kt
+++ b/app/core/src/main/java/com/fsck/k9/notification/BaseNotificationDataCreator.kt
@@ -46,7 +46,8 @@ internal class BaseNotificationDataCreator {
 
     private fun createNotificationAppearance(account: Account): NotificationAppearance {
         return with(account.notificationSetting) {
-            NotificationAppearance(ringtone = ringtone, vibrationPattern = vibration, ledColor = ledColor)
+            val vibrationPattern = if (isVibrateEnabled) vibration else null
+            NotificationAppearance(ringtone, vibrationPattern, ledColor)
         }
     }
 }


Test patch:
diff --git a/app/core/src/test/java/com/fsck/k9/notification/BaseNotificationDataCreatorTest.kt b/app/core/src/test/java/com/fsck/k9/notification/BaseNotificationDataCreatorTest.kt
index 3ba7af999b5..5b0cf007a33 100644
--- a/app/core/src/test/java/com/fsck/k9/notification/BaseNotificationDataCreatorTest.kt
+++ b/app/core/src/test/java/com/fsck/k9/notification/BaseNotificationDataCreatorTest.kt
@@ -148,6 +148,7 @@ class BaseNotificationDataCreatorTest {
 
     @Test
     fun `vibration pattern`() {
+        account.notificationSetting.isVibrateEnabled = true
         account.notificationSetting.vibratePattern = 3
         account.notificationSetting.vibrateTimes = 2
         val notificationData = createNotificationData()
@@ -192,7 +193,6 @@ class BaseNotificationDataCreatorTest {
         return Account("00000000-0000-4000-0000-000000000000").apply {
             description = "account name"
             identities = listOf(Identity())
-            notificationSetting.vibrateTimes = 1
         }
     }
 }
diff --git a/app/core/src/test/java/com/fsck/k9/notification/NewMailNotificationManagerTest.kt b/app/core/src/test/java/com/fsck/k9/notification/NewMailNotificationManagerTest.kt
index 4fac48792e8..99d0b8c35cd 100644
--- a/app/core/src/test/java/com/fsck/k9/notification/NewMailNotificationManagerTest.kt
+++ b/app/core/src/test/java/com/fsck/k9/notification/NewMailNotificationManagerTest.kt
@@ -248,7 +248,6 @@ class NewMailNotificationManagerTest {
         return Account(ACCOUNT_UUID).apply {
             description = ACCOUNT_NAME
             chipColor = ACCOUNT_COLOR
-            notificationSetting.vibrateTimes = 1
         }
     }