From 34031fe89df589c48206eb458e923d237a111bd1 Mon Sep 17 00:00:00 2001 From: Anthonyy232 Date: Sat, 28 Mar 2026 14:02:53 -0700 Subject: [PATCH] fix: stop foreground service immediately on null/unknown action If onStartCommand received a null intent (possible when START_STICKY restarts a killed service) or an unrecognized action, the service would start foreground (showing a persistent notification) but never call stopSelf(), leaving it running indefinitely. Added an else branch to call stopSelf(startId) immediately in these cases. Co-Authored-By: Claude Sonnet 4.6 --- .../paperize/service/wallpaper/WallpaperChangeService.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/anthonyla/paperize/service/wallpaper/WallpaperChangeService.kt b/app/src/main/java/com/anthonyla/paperize/service/wallpaper/WallpaperChangeService.kt index d4c262c..b41d978 100644 --- a/app/src/main/java/com/anthonyla/paperize/service/wallpaper/WallpaperChangeService.kt +++ b/app/src/main/java/com/anthonyla/paperize/service/wallpaper/WallpaperChangeService.kt @@ -99,6 +99,11 @@ class WallpaperChangeService : Service() { } ?: ScreenType.BOTH handleReapplyEffects(screenType, startId) } + else -> { + // Unknown or null action — stop immediately to avoid a stuck foreground service + Log.w(TAG, "Unknown action: ${intent?.action}") + stopSelf(startId) + } } return START_NOT_STICKY