fix: remove FOREGROUND_SERVICE_DATA_SYNC permission (unblocks v0.14.0 Play Store upload)#190
Conversation
Sync is disabled by default (ActivityWatch#184) and not yet demonstrable, so the Google Play Console FOREGROUND_SERVICE_DATA_SYNC declaration (which requires a video demo) was blocking the v0.14.0 Play Store upload. Remove: - FOREGROUND_SERVICE_DATA_SYNC uses-permission from AndroidManifest.xml - android:foregroundServiceType="dataSync" from BackgroundService declaration - ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC from startForeground() call The base FOREGROUND_SERVICE permission is preserved for the monitoring service. Re-add the data_sync type and permission when sync is actually implemented and demonstrable. Closes ActivityWatch#189 (item 1) Unblocks v0.14.0 Play Store production upload
Greptile SummaryThis PR moves the Android foreground service from data sync to special use. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "fix: add PROPERTY_SPECIAL_USE_FGS_SUBTYP..." | Re-trigger Greptile |
|
Greptile P1 concern: The finding is valid. On Android 14 (API 34+), apps targeting API 34+ must declare a foreground service type in the manifest and pass a matching type to The 2-line removal of Two options: Option A — ActivityWatch tracks screen time / app usage — health-adjacent. No Play Store video demo required (unlike <!-- AndroidManifest.xml -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />
<!-- in the <service> element -->
android:foregroundServiceType="health"// BackgroundService.kt
startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_HEALTH)Option B — The designated catch-all for use cases that don't fit predefined categories. Also no video demo, but may get more scrutiny from Google Play review. Holding off on merging until you pick a direction. @ErikBjare does |
|
@TimeToBuildBob I think "health" doesn't really include screen time and such from my reading of the Google docs (focused on biometrics and physical activity). But I'm honestly not sure. The |
|
You're right on On That's a legitimate answer — no stretching required. Apps that monitor device usage and run local servers genuinely don't fit the 2024/2025 permission taxonomy. On WorkManager: I looked at what
Recommendation: Happy to push the |
|
To directly answer the WorkManager question: it can't replace this service. WorkManager is for deferrable, retryable tasks (uploads, sync, analytics). AW's background service runs a local HTTP server that the web dashboard connects to — it must be continuously available. WorkManager spawns, does work, and exits; the server would be offline between runs, breaking the web UI. The foreground service stays. So the only open question is the type. The concrete 3-line fix:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) // API 34
startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
else
startForeground(NOTIFICATION_ID, notification)This fixes the |
|
@TimeToBuildBob I agree, let's try that. |
On Android 14+ (API 34+) with targetSdk 35, startForeground() requires a valid foreground service type declared in the manifest. Passing type 0 with no foregroundServiceType attribute throws MissingForegroundServiceTypeException at runtime, crashing BackgroundService on any Android 14+ device. FOREGROUND_SERVICE_TYPE_SPECIAL_USE is the correct type for ActivityWatch's local HTTP server use case — it doesn't fit the 2024/2025 taxonomy (camera, microphone, location, health, etc.) and Google added specialUse specifically for this situation. The Play Store form for specialUse requires a text description (no demo video), so this unblocks the v0.14.0 upload. Changes: - Add FOREGROUND_SERVICE_SPECIAL_USE permission - Declare foregroundServiceType='specialUse' on BackgroundService - Pass ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE on API 34+, 0 otherwise
|
Done — just pushed the fix (commit What changed:
The Play Store will require a short text declaration explaining why That should be straightforward to fill in the Play Console form with — no demo video needed. |
|
@greptileai review |
Greptile flagged that specialUse without a subtype property can leave Play review without a machine-readable rationale. The property documents AW's use case (local on-device HTTP server for the web UI) directly in the manifest, aligned with the Play Console declaration form.
|
@greptileai review |
|
Second commit pushed ( PR is ready to merge:
The Play Store description I'd file: "ActivityWatch runs a local HTTP server on-device to store and serve app usage data. All data stays on-device. The foreground service keeps the server continuously available so the ActivityWatch web UI remains accessible to the user. No predefined foreground service type covers this use case." |
|
All CI green (Test ✅, E2E ✅, Build aw-server-rust ✅), Greptile 5/5. Ready for your merge when you have a moment. |
Problem
The v0.14.0 fastlane Play Store upload fails with:
Google requires a policy declaration + demo video for
FOREGROUND_SERVICE_DATA_SYNC. Since sync is disabled by default (#184) and not demonstrable yet, we can't satisfy the form requirement right now.Changes
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />fromAndroidManifest.xmlandroid:foregroundServiceType="dataSync"fromBackgroundServicedeclarationstartForeground()call to use type0instead ofFOREGROUND_SERVICE_TYPE_DATA_SYNCServiceInfoimportNotes
The base
FOREGROUND_SERVICEpermission is retained — this covers the monitoring service. On Android 15 (targetSdk 35), using no foreground service type is the correct approach when none of the specific types apply.Re-add
FOREGROUND_SERVICE_DATA_SYNCand thedataSyncservice type when sync is functional and a demo video can be recorded.Closes #189 (item 1)