Skip to content

fix: Replace WorkManager with ForegroundService to eliminate excessive wakelocks#378

Merged
d4rken merged 1 commit intomainfrom
fix/replace-workmanager-with-foreground-service
Feb 8, 2026
Merged

fix: Replace WorkManager with ForegroundService to eliminate excessive wakelocks#378
d4rken merged 1 commit intomainfrom
fix/replace-workmanager-with-foreground-service

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented Feb 8, 2026

Summary

  • Replace MonitorWorker (CoroutineWorker) with MonitorService (ForegroundService) to eliminate persistent ProcessorForegroundLck wakelock reported in Android Vitals
  • Add BootCompletedReceiver to restore post-reboot auto-start (previously handled by WorkManager internals)
  • Remove WorkManager dependency entirely (runtime, hilt-work, test)

Test plan

  • ./gradlew assembleFossDebug builds successfully
  • ./gradlew testFossDebugUnitTest passes
  • Monitoring works in MANUAL, AUTOMATIC, and ALWAYS modes
  • Notification appears when AirPods are connected
  • Service stops in MANUAL mode and AUTOMATIC timeout
  • Service survives device reboot (ALWAYS mode)
  • No ProcessorForegroundLck wakelock in adb shell dumpsys power

…e wakelocks

Replace MonitorWorker (CoroutineWorker) with MonitorService (ForegroundService)
to eliminate persistent ProcessorForegroundLck wakelock reported in Android Vitals.
Add BootCompletedReceiver for post-reboot auto-start.
Remove WorkManager dependency entirely.
@d4rken d4rken added the bug Something isn't working label Feb 8, 2026
@d4rken d4rken merged commit ebfffb1 into main Feb 8, 2026
13 checks passed
@d4rken d4rken deleted the fix/replace-workmanager-with-foreground-service branch February 8, 2026 13:19
@d4rken
Copy link
Copy Markdown
Member Author

d4rken commented Feb 26, 2026

Screenshot from 2026-02-26 11-55-33

So this obviously had an effect and it doesn't necessarily change energy consumption though because when our app is alive the device is alive, but the wake lock is now part of the system and no longer attributed to us. So Google Play Console is happy 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant