Skip to content

[BUG] #22

@AldenDana

Description

@AldenDana

Describe the bug

QuickBarService crashes 2 seconds after being enabled by the user, causing an infinite permission loop. The service successfully binds but immediately unbinds due to an IntentReceiver leak, preventing the app from being usable.

To Reproduce
Steps to reproduce the behavior:

Fresh install QuickBars from Google Play Store
Grant all required permissions (SYSTEM_ALERT_WINDOW, PACKAGE_USAGE_STATS, battery optimization disabled)
Enable QuickBarService in Android Accessibility Settings (either via system settings or in-app prompt)
Service binds successfully and shows "Successfully loaded bars and triggers" in logcat
2 seconds later: Service unbinds with IntentReceiver leak error
App returns to "Accessibility Permission Required" screen
Loop repeats indefinitely

Expected behavior
The accessibility service should remain bound after being enabled, allowing the app to proceed past the permission screen and function normally.
Screenshots/Video
Logcat showing the crash sequence:
QuickBarService: Successfully loaded bars and triggers.
[2 seconds later]
QuickBarService: Service unbound (onUnbind)
ActivityThread: Service dev.trooped.tvquickbars.services.QuickBarService has leaked IntentReceiver ac.x@e6f8815 that was originally registered here. Are you missing a call to unregisterReceiver()?
at dev.trooped.tvquickbars.services.QuickBarService.onServiceConnected(r8-map-id-f690d959cddd5083ecd7b46a1d5fe2641fe469630364fde574c2dabb071d1065:212)
at android.accessibilityservice.AccessibilityService.dispatchServiceConnected(AccessibilityService.java:501)

Environment (please complete the following information):

Android TV Device: Allwinner H313 TV Stick (eros-p1, sun50iw9p1) - AliExpress "Mortal Q2S Dongle"
Android Version: Android 14 (SDK 29)
QuickBars Version: 1.3.3
Home Assistant Version: Core 2025.11.3, Supervisor 2026.03.0, OS 16.3, Frontend 20251105.1

Additional context
Technical Analysis

Device Accessibility Framework Status:
The device's accessibility framework is confirmed working. Other accessibility services can be installed, and when QuickBarService is enabled via adb root, it binds successfully:
bash$ adb shell dumpsys accessibility
Bound services:{Service[label=QuickBars, feedbackType[], capabilities=8...]}

Enabled services:{{dev.trooped.tvquickbars/dev.trooped.tvquickbars.services.QuickBarService}}

Root Cause:
The crash appears to be an IntentReceiver leak in QuickBarService.onServiceConnected() at line 212. The service registers a BroadcastReceiver (likely for Home Assistant persistent background connection) but fails to properly unregister it when the service lifecycle terminates, causing Android to kill the service immediately.
Verified Permissions:
All permissions confirmed granted via ADB:

✅ enabled_accessibility_services = dev.trooped.tvquickbars/.services.QuickBarService
✅ accessibility_enabled = 1
✅ SYSTEM_ALERT_WINDOW granted
✅ PACKAGE_USAGE_STATS granted
✅ Battery optimization disabled

Suggested Fix:
Add unregisterReceiver() call in QuickBarService.onUnbind() and/or onDestroy() to properly clean up the BroadcastReceiver registered in onServiceConnected().
Alternatively, making Home Assistant integration setup optional/skippable during initial setup would allow users to enable the accessibility service without requiring HA configuration on first launch.
Full diagnostic logs and ADB session logs available upon request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions