From fc42b5e2cb50862d24462d3913ac08e1a837a74d Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Tue, 23 Dec 2025 13:17:43 -0500 Subject: [PATCH 1/2] Fix redrawList crash bugs --- app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt | 4 +++- fastlane/metadata/android/en-US/changelog/NEXT.txt | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt index c8d1bcd6..21bd2d68 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt @@ -516,7 +516,9 @@ class MainActivity : AppCompatActivity(), AddFragment.SubscribeListener, Notific } } if (rerenderList) { - redrawList() + mainList.post { + redrawList() + } } } } diff --git a/fastlane/metadata/android/en-US/changelog/NEXT.txt b/fastlane/metadata/android/en-US/changelog/NEXT.txt index dc32384d..66c7f565 100644 --- a/fastlane/metadata/android/en-US/changelog/NEXT.txt +++ b/fastlane/metadata/android/en-US/changelog/NEXT.txt @@ -1,3 +1,4 @@ Maintenance + bug fixes: -* Updated target SDK version to 36 * Updated dependencies, minimum SDK version to 26, clean up legacy code, upgrade Gradle (ntfy-android#140, thanks to @cyb3rko) +* Updated target SDK version to 36 +* Fixed crashes with redrawing the list when temporarily muted topics expire From 1cb765ff4387f855ea4396ade7363458721c56b9 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Tue, 23 Dec 2025 15:38:08 -0500 Subject: [PATCH 2/2] Fix foreground service crashes, resolves ntfy#1520 --- app/build.gradle | 3 +++ .../ntfy/service/SubscriberServiceManager.kt | 23 +++++++++++-------- .../metadata/android/en-US/changelog/NEXT.txt | 1 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 81cf062b..aa02fe48 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,6 +37,9 @@ android { minifyEnabled false shrinkResources false debuggable false + // DEV/TEST ONLY: Uncomment this to test the release build with a debug key. + // This is required to test against the production Firebase config. + // signingConfig signingConfigs.debug } debug { minifyEnabled false diff --git a/app/src/main/java/io/heckel/ntfy/service/SubscriberServiceManager.kt b/app/src/main/java/io/heckel/ntfy/service/SubscriberServiceManager.kt index ed4dfda7..f86110c3 100644 --- a/app/src/main/java/io/heckel/ntfy/service/SubscriberServiceManager.kt +++ b/app/src/main/java/io/heckel/ntfy/service/SubscriberServiceManager.kt @@ -47,15 +47,20 @@ class SubscriberServiceManager(private val context: Context) { val app = context.applicationContext as Application val subscriptionIdsWithInstantStatus = app.repository.getSubscriptionIdsWithInstantStatus() val instantSubscriptions = subscriptionIdsWithInstantStatus.toList().filter { (_, instant) -> instant }.size - val action = if (instantSubscriptions > 0) SubscriberService.Action.START else SubscriberService.Action.STOP - val serviceState = SubscriberService.readServiceState(context) - if (serviceState == SubscriberService.ServiceState.STOPPED && action == SubscriberService.Action.STOP) { - return@withContext Result.success() - } - Log.d(TAG, "ServiceStartWorker: Starting foreground service with action $action (work ID: ${id})") - Intent(context, SubscriberService::class.java).also { - it.action = action.name - ContextCompat.startForegroundService(context, it) + if (instantSubscriptions > 0) { + // We have instant subscriptions, start the service + Log.d(TAG, "ServiceStartWorker: Starting foreground service (work ID: ${id})") + Intent(context, SubscriberService::class.java).also { + it.action = SubscriberService.Action.START.name + ContextCompat.startForegroundService(context, it) + } + } else { + // No instant subscriptions, stop the service using stopService() + // This avoids ForegroundServiceDidNotStartInTimeException, see #1520 + Log.d(TAG, "ServiceStartWorker: Stopping service (work ID: ${id})") + Intent(context, SubscriberService::class.java).also { + context.stopService(it) + } } } return Result.success() diff --git a/fastlane/metadata/android/en-US/changelog/NEXT.txt b/fastlane/metadata/android/en-US/changelog/NEXT.txt index 66c7f565..c32809b6 100644 --- a/fastlane/metadata/android/en-US/changelog/NEXT.txt +++ b/fastlane/metadata/android/en-US/changelog/NEXT.txt @@ -2,3 +2,4 @@ Maintenance + bug fixes: * Updated dependencies, minimum SDK version to 26, clean up legacy code, upgrade Gradle (ntfy-android#140, thanks to @cyb3rko) * Updated target SDK version to 36 * Fixed crashes with redrawing the list when temporarily muted topics expire +* Fixed ForegroundServiceDidNotStartInTimeException (#1520)