From 8452cdaf042c24acaa12792762ef0a2be0b11e65 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 9 Jan 2025 16:14:21 +0100 Subject: [PATCH] Switch `PushService` to the `specialUse` foreground service type --- app-k9mail/badging/fossRelease-badging.txt | 4 +++- app-k9mail/badging/fullRelease-badging.txt | 4 +++- app-thunderbird/badging/fossBeta-badging.txt | 4 +++- app-thunderbird/badging/fossDaily-badging.txt | 4 +++- app-thunderbird/badging/fossRelease-badging.txt | 4 +++- app-thunderbird/badging/fullBeta-badging.txt | 4 +++- app-thunderbird/badging/fullDaily-badging.txt | 4 +++- app-thunderbird/badging/fullRelease-badging.txt | 4 +++- legacy/common/src/main/AndroidManifest.xml | 12 +++++++++--- .../java/com/fsck/k9/controller/push/PushService.kt | 4 +++- 10 files changed, 36 insertions(+), 12 deletions(-) diff --git a/app-k9mail/badging/fossRelease-badging.txt b/app-k9mail/badging/fossRelease-badging.txt index 64b319d4c3c..036053d250e 100644 --- a/app-k9mail/badging/fossRelease-badging.txt +++ b/app-k9mail/badging/fossRelease-badging.txt @@ -11,7 +11,8 @@ uses-permission: name='android.permission.INTERNET' uses-permission: name='android.permission.VIBRATE' uses-permission: name='android.permission.WAKE_LOCK' uses-permission: name='android.permission.FOREGROUND_SERVICE' -uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' +uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' maxSdkVersion='33' +uses-permission: name='android.permission.FOREGROUND_SERVICE_SPECIAL_USE' uses-permission: name='android.permission.SCHEDULE_EXACT_ALARM' uses-permission: name='android.permission.USE_BIOMETRIC' uses-permission: name='android.permission.USE_FINGERPRINT' @@ -79,6 +80,7 @@ application-icon-65534:'res/drawable-v26/ic_launcher.xml' application: label='K-9 Mail' icon='res/drawable-v26/ic_launcher.xml' uses-library-not-required:'com.sec.android.app.multiwindow' launchable-activity: name='com.fsck.k9.activity.MessageList' label='' icon='' +property: name='android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE' value='This service is used to maintain a continuous connection to an IMAP server to be able to provide instant notifications to the user when a new email arrives. Firebase Cloud Messaging is not suitable for this task, neither are mechanisms like AndroidX WorkManager. Other foreground service types aren't a good fit for this use case.' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' feature-group: label='' diff --git a/app-k9mail/badging/fullRelease-badging.txt b/app-k9mail/badging/fullRelease-badging.txt index ebd2c145afd..078ff87d9d8 100644 --- a/app-k9mail/badging/fullRelease-badging.txt +++ b/app-k9mail/badging/fullRelease-badging.txt @@ -11,7 +11,8 @@ uses-permission: name='android.permission.INTERNET' uses-permission: name='android.permission.VIBRATE' uses-permission: name='android.permission.WAKE_LOCK' uses-permission: name='android.permission.FOREGROUND_SERVICE' -uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' +uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' maxSdkVersion='33' +uses-permission: name='android.permission.FOREGROUND_SERVICE_SPECIAL_USE' uses-permission: name='android.permission.SCHEDULE_EXACT_ALARM' uses-permission: name='android.permission.USE_BIOMETRIC' uses-permission: name='android.permission.USE_FINGERPRINT' @@ -80,6 +81,7 @@ application-icon-65534:'res/drawable-v26/ic_launcher.xml' application: label='K-9 Mail' icon='res/drawable-v26/ic_launcher.xml' uses-library-not-required:'com.sec.android.app.multiwindow' launchable-activity: name='com.fsck.k9.activity.MessageList' label='' icon='' +property: name='android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE' value='This service is used to maintain a continuous connection to an IMAP server to be able to provide instant notifications to the user when a new email arrives. Firebase Cloud Messaging is not suitable for this task, neither are mechanisms like AndroidX WorkManager. Other foreground service types aren't a good fit for this use case.' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' feature-group: label='' diff --git a/app-thunderbird/badging/fossBeta-badging.txt b/app-thunderbird/badging/fossBeta-badging.txt index 7f11c8fa182..9405656afa9 100644 --- a/app-thunderbird/badging/fossBeta-badging.txt +++ b/app-thunderbird/badging/fossBeta-badging.txt @@ -12,7 +12,8 @@ uses-permission: name='android.permission.INTERNET' uses-permission: name='android.permission.VIBRATE' uses-permission: name='android.permission.WAKE_LOCK' uses-permission: name='android.permission.FOREGROUND_SERVICE' -uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' +uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' maxSdkVersion='33' +uses-permission: name='android.permission.FOREGROUND_SERVICE_SPECIAL_USE' uses-permission: name='android.permission.SCHEDULE_EXACT_ALARM' uses-permission: name='android.permission.USE_BIOMETRIC' uses-permission: name='android.permission.USE_FINGERPRINT' @@ -80,6 +81,7 @@ application-icon-65534:'res/mipmap-anydpi-v26/ic_launcher.xml' application: label='Thunderbird Beta' icon='res/mipmap-anydpi-v26/ic_launcher.xml' uses-library-not-required:'com.sec.android.app.multiwindow' launchable-activity: name='com.fsck.k9.activity.MessageList' label='' icon='' +property: name='android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE' value='This service is used to maintain a continuous connection to an IMAP server to be able to provide instant notifications to the user when a new email arrives. Firebase Cloud Messaging is not suitable for this task, neither are mechanisms like AndroidX WorkManager. Other foreground service types aren't a good fit for this use case.' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' feature-group: label='' diff --git a/app-thunderbird/badging/fossDaily-badging.txt b/app-thunderbird/badging/fossDaily-badging.txt index 18bb1d0ba08..b7406091586 100644 --- a/app-thunderbird/badging/fossDaily-badging.txt +++ b/app-thunderbird/badging/fossDaily-badging.txt @@ -12,7 +12,8 @@ uses-permission: name='android.permission.INTERNET' uses-permission: name='android.permission.VIBRATE' uses-permission: name='android.permission.WAKE_LOCK' uses-permission: name='android.permission.FOREGROUND_SERVICE' -uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' +uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' maxSdkVersion='33' +uses-permission: name='android.permission.FOREGROUND_SERVICE_SPECIAL_USE' uses-permission: name='android.permission.SCHEDULE_EXACT_ALARM' uses-permission: name='android.permission.USE_BIOMETRIC' uses-permission: name='android.permission.USE_FINGERPRINT' @@ -80,6 +81,7 @@ application-icon-65534:'res/mipmap-anydpi-v26/ic_launcher.xml' application: label='Thunderbird Daily' icon='res/mipmap-anydpi-v26/ic_launcher.xml' uses-library-not-required:'com.sec.android.app.multiwindow' launchable-activity: name='com.fsck.k9.activity.MessageList' label='' icon='' +property: name='android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE' value='This service is used to maintain a continuous connection to an IMAP server to be able to provide instant notifications to the user when a new email arrives. Firebase Cloud Messaging is not suitable for this task, neither are mechanisms like AndroidX WorkManager. Other foreground service types aren't a good fit for this use case.' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' feature-group: label='' diff --git a/app-thunderbird/badging/fossRelease-badging.txt b/app-thunderbird/badging/fossRelease-badging.txt index 9459d33b6b4..5245a96f951 100644 --- a/app-thunderbird/badging/fossRelease-badging.txt +++ b/app-thunderbird/badging/fossRelease-badging.txt @@ -12,7 +12,8 @@ uses-permission: name='android.permission.INTERNET' uses-permission: name='android.permission.VIBRATE' uses-permission: name='android.permission.WAKE_LOCK' uses-permission: name='android.permission.FOREGROUND_SERVICE' -uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' +uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' maxSdkVersion='33' +uses-permission: name='android.permission.FOREGROUND_SERVICE_SPECIAL_USE' uses-permission: name='android.permission.SCHEDULE_EXACT_ALARM' uses-permission: name='android.permission.USE_BIOMETRIC' uses-permission: name='android.permission.USE_FINGERPRINT' @@ -80,6 +81,7 @@ application-icon-65534:'res/mipmap-anydpi-v26/ic_launcher.xml' application: label='Thunderbird' icon='res/mipmap-anydpi-v26/ic_launcher.xml' uses-library-not-required:'com.sec.android.app.multiwindow' launchable-activity: name='com.fsck.k9.activity.MessageList' label='' icon='' +property: name='android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE' value='This service is used to maintain a continuous connection to an IMAP server to be able to provide instant notifications to the user when a new email arrives. Firebase Cloud Messaging is not suitable for this task, neither are mechanisms like AndroidX WorkManager. Other foreground service types aren't a good fit for this use case.' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' feature-group: label='' diff --git a/app-thunderbird/badging/fullBeta-badging.txt b/app-thunderbird/badging/fullBeta-badging.txt index 4dd678d92dd..a3fb8a75d30 100644 --- a/app-thunderbird/badging/fullBeta-badging.txt +++ b/app-thunderbird/badging/fullBeta-badging.txt @@ -12,7 +12,8 @@ uses-permission: name='android.permission.INTERNET' uses-permission: name='android.permission.VIBRATE' uses-permission: name='android.permission.WAKE_LOCK' uses-permission: name='android.permission.FOREGROUND_SERVICE' -uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' +uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' maxSdkVersion='33' +uses-permission: name='android.permission.FOREGROUND_SERVICE_SPECIAL_USE' uses-permission: name='android.permission.SCHEDULE_EXACT_ALARM' uses-permission: name='android.permission.USE_BIOMETRIC' uses-permission: name='android.permission.USE_FINGERPRINT' @@ -81,6 +82,7 @@ application-icon-65534:'res/mipmap-anydpi-v26/ic_launcher.xml' application: label='Thunderbird Beta' icon='res/mipmap-anydpi-v26/ic_launcher.xml' uses-library-not-required:'com.sec.android.app.multiwindow' launchable-activity: name='com.fsck.k9.activity.MessageList' label='' icon='' +property: name='android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE' value='This service is used to maintain a continuous connection to an IMAP server to be able to provide instant notifications to the user when a new email arrives. Firebase Cloud Messaging is not suitable for this task, neither are mechanisms like AndroidX WorkManager. Other foreground service types aren't a good fit for this use case.' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' feature-group: label='' diff --git a/app-thunderbird/badging/fullDaily-badging.txt b/app-thunderbird/badging/fullDaily-badging.txt index f945a9a6355..30fc3dee79b 100644 --- a/app-thunderbird/badging/fullDaily-badging.txt +++ b/app-thunderbird/badging/fullDaily-badging.txt @@ -12,7 +12,8 @@ uses-permission: name='android.permission.INTERNET' uses-permission: name='android.permission.VIBRATE' uses-permission: name='android.permission.WAKE_LOCK' uses-permission: name='android.permission.FOREGROUND_SERVICE' -uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' +uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' maxSdkVersion='33' +uses-permission: name='android.permission.FOREGROUND_SERVICE_SPECIAL_USE' uses-permission: name='android.permission.SCHEDULE_EXACT_ALARM' uses-permission: name='android.permission.USE_BIOMETRIC' uses-permission: name='android.permission.USE_FINGERPRINT' @@ -81,6 +82,7 @@ application-icon-65534:'res/mipmap-anydpi-v26/ic_launcher.xml' application: label='Thunderbird Daily' icon='res/mipmap-anydpi-v26/ic_launcher.xml' uses-library-not-required:'com.sec.android.app.multiwindow' launchable-activity: name='com.fsck.k9.activity.MessageList' label='' icon='' +property: name='android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE' value='This service is used to maintain a continuous connection to an IMAP server to be able to provide instant notifications to the user when a new email arrives. Firebase Cloud Messaging is not suitable for this task, neither are mechanisms like AndroidX WorkManager. Other foreground service types aren't a good fit for this use case.' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' feature-group: label='' diff --git a/app-thunderbird/badging/fullRelease-badging.txt b/app-thunderbird/badging/fullRelease-badging.txt index 70f974c7781..cfd8ac722da 100644 --- a/app-thunderbird/badging/fullRelease-badging.txt +++ b/app-thunderbird/badging/fullRelease-badging.txt @@ -12,7 +12,8 @@ uses-permission: name='android.permission.INTERNET' uses-permission: name='android.permission.VIBRATE' uses-permission: name='android.permission.WAKE_LOCK' uses-permission: name='android.permission.FOREGROUND_SERVICE' -uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' +uses-permission: name='android.permission.FOREGROUND_SERVICE_DATA_SYNC' maxSdkVersion='33' +uses-permission: name='android.permission.FOREGROUND_SERVICE_SPECIAL_USE' uses-permission: name='android.permission.SCHEDULE_EXACT_ALARM' uses-permission: name='android.permission.USE_BIOMETRIC' uses-permission: name='android.permission.USE_FINGERPRINT' @@ -81,6 +82,7 @@ application-icon-65534:'res/mipmap-anydpi-v26/ic_launcher.xml' application: label='Thunderbird' icon='res/mipmap-anydpi-v26/ic_launcher.xml' uses-library-not-required:'com.sec.android.app.multiwindow' launchable-activity: name='com.fsck.k9.activity.MessageList' label='' icon='' +property: name='android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE' value='This service is used to maintain a continuous connection to an IMAP server to be able to provide instant notifications to the user when a new email arrives. Firebase Cloud Messaging is not suitable for this task, neither are mechanisms like AndroidX WorkManager. Other foreground service types aren't a good fit for this use case.' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' feature-group: label='' diff --git a/legacy/common/src/main/AndroidManifest.xml b/legacy/common/src/main/AndroidManifest.xml index 6218fd207e6..a9654fd2bdc 100644 --- a/legacy/common/src/main/AndroidManifest.xml +++ b/legacy/common/src/main/AndroidManifest.xml @@ -26,7 +26,8 @@ - + + @@ -242,8 +243,13 @@ + android:foregroundServiceType="dataSync|specialUse" + > + + = 29) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + startForeground(notificationId, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE) + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { startForeground(notificationId, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC) } else { startForeground(notificationId, notification)