fix: downloads use WorkManager foreground service + inline progress

- DownloadWorker: foreground service with notification + setProgressAsync
- ActiveDownload state tracked via WorkManager LiveData observation
- Downloads tab shows progress bar + % for in-flight downloads
- Survives screen lock / background
- Fixed FGS type for Android 14+ (FOREGROUND_SERVICE_TYPE_DATA_SYNC)
This commit is contained in:
Mathieu Moran
2026-08-12 02:27:33 -04:00
parent bc29a01337
commit e19511fc67
4 changed files with 106 additions and 17 deletions
+19 -12
View File
@@ -88,16 +88,12 @@ radio. This has two implications:
`/boot/firmware/config.txt` to free the PL011 UART for the SIM868 GPS module (see
Phase 1 bring-up notes). **This completely disables the onboard Bluetooth
controller.** To use Bluetooth for mediacenter:
- **Option A:** Use a USB Bluetooth dongle instead (preserves GPS UART routing,
cleaner separation, likely better range/audio quality with BT 5.0).
- **Option B:** Use the mini-UART (`/dev/ttyS0`) for the SIM868 at a lower,
core-frequency-dependent baud rate, re-enable the onboard Bluetooth for the
PL011 UART. Riskier — mini-UART is less stable and baud rate depends on the
core clock, which can drift.
**Recommendation: Option A (USB dongle).** The onboard Bluetooth is disabled for
GPS, and a USB dongle is cheap, isolated, and doesn't require touching the
already-working GPS UART config.
- ~~**Option A:** Use a USB Bluetooth dongle~~ — **CONFIRMED: owner has a USB
Bluetooth dongle on hand.** This preserves GPS UART routing, gives cleaner
separation (no WiFi/BT combo-chip contention), and likely provides better
range/audio quality.
- ~~**Option B:** Use the mini-UART~~ — ruled out. No need to touch the
already-working GPS UART config.
---
@@ -294,6 +290,17 @@ Add M6 later as an optimization for Spotify specifically.
---
## Hardware Status
| Component | Status |
|-----------|--------|
| USB Bluetooth dongle | ✅ Confirmed — owner has one on hand |
| Car radio Bluetooth capability | ❓ Unknown — Q1 (does the 2013 Yaris radio have Bluetooth/A2DP?) |
| Test Bluetooth speaker (for M1 validation) | ❓ Unknown — needed to simulate radio side if car radio has no BT |
| Pi 3 USB port availability | ⚠️ Check — already has PL2303 OBD adapter + TP-Link T3U WiFi + possibly E3372 LTE modem; may need a powered USB hub |
---
## Open Questions (to resolve during M1)
| # | Question | Impact |
@@ -301,7 +308,7 @@ Add M6 later as an optimization for Spotify specifically.
| Q1 | Does the 2013 Yaris radio have Bluetooth at all? If so, which profiles? | Defines what the Pi needs to broadcast (A2DP vs HFP only) |
| Q2 | Can the Pi's BCM43438 (or a USB dongle) maintain two simultaneous Bluetooth connections (phone + radio) without audio dropouts? | Determines if USB dongle is required |
| Q3 | What is the real end-to-end latency (phone → Pi → radio)? | Determines if this is usable for video/navigation or music-only |
| Q4 | Does `dtoverlay=disable-bt` permanently block the onboard Bluetooth, or can it be re-enabled while keeping the SIM868 on mini-UART? | Determines if USB dongle is mandatory |
| Q4 | ~~Does `dtoverlay=disable-bt` permanently block the onboard Bluetooth?~~ | ✅ Resolved — USB dongle confirmed available, onboard BT stays disabled for GPS |
| Q5 | Does the car radio support AVRCP metadata display (track title/artist on the radio screen)? | Determines if Phase M2 metadata relay is worth building |
---
@@ -328,7 +335,7 @@ Add M6 later as an optimization for Spotify specifically.
|------|-----------|--------|------------|
| Audio latency too high for video/nav | Medium | High | Phase M1 validates early; M6 (Spotify Connect) bypasses it for music |
| Bluetooth coexistence with WiFi hotspot causes dropouts | Medium | Medium | USB dongle + 5 GHz WiFi on wlan1 (already available) |
| `disable-bt` overlay blocks all Bluetooth | High (confirmed) | Low | USB dongle is the planned path anyway |
| `disable-bt` overlay blocks onboard Bluetooth | High (confirmed) | Low | ✅ USB dongle confirmed available — onboard BT stays disabled, dongle handles mediacenter |
| AVRCP relay via DBus is unreliable or incomplete | Medium | Medium | Fall back to phone-side controls only; M1 validates |
| Car radio has no Bluetooth at all | ? | High | M1 clarifies; if no BT radio, this project needs a different approach (FM transmitter? aux cable? replace the head unit?) |