fix: shutdown now stops foreground service (#455)#521
Merged
torlando-tech merged 1 commit intomainfrom Feb 22, 2026
Merged
Conversation
Contributor
Greptile SummaryThis PR fixes issue #455 by implementing proper foreground service shutdown. The solution uses a SharedPreferences flag ( Key changes:
Previous reviewer concerns addressed: Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 0849910 |
app/src/main/java/com/lxmf/messenger/service/ReticulumService.kt
Outdated
Show resolved
Hide resolved
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
5 tasks
Owner
Author
app/src/main/java/com/lxmf/messenger/service/ReticulumService.kt
Outdated
Show resolved
Hide resolved
…455) Previously, pressing Shutdown only called reticulumProtocol.shutdown() via IPC but never sent ACTION_STOP to the Android service, so the foreground notification persisted and restart mechanisms brought the service back. Changes: - SettingsViewModel/DebugViewModel: set is_user_shutdown SharedPreferences flag, unbind first (prevents auto-rebind race), send ACTION_STOP intent - ReticulumService: check is_user_shutdown flag in onStartCommand (blocks START_STICKY restart), onDestroy (skips scheduleServiceRestart), and ACTION_START (clears flag for normal launches) - InterfaceConfigManager: clear is_user_shutdown flag before restart - DebugViewModel: guard fetchDebugInfo against shutdown state, clear UI immediately on shutdown to prevent "Unknown error" display Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9520030 to
0849910
Compare
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reticulumProtocol.shutdown()via IPC but never sentACTION_STOP, so the service kept runningis_user_shutdownSharedPreferences flag to preventSTART_STICKY,scheduleServiceRestart(), and auto-rebind from restarting the service after user-initiated shutdownChanges
ACTION_STOPintentis_user_shutdowninonStartCommand(blocksSTART_STICKY),onDestroy(skips restart scheduling), andACTION_START(clears flag)is_user_shutdownflag before interface-change restartfetchDebugInfoagainst shutdown state, clear UI immediately to prevent "Unknown error"Test plan
🤖 Generated with Claude Code