Skip to content

aw-sync: Android sync UX needs a complete pass (setup flow, default-off, storage access) #1357

Description

@TimeToBuildBob

Background

Filed out of discussion in ActivityWatch/aw-server-rust#630, which traced Android native OOM crashes to an unbounded event fetch in sync_one().

In that thread @ErikBjare asked the right follow-up: what does the user actually do to get their Android and desktop data synced? The answer is: there is no user-facing setup flow, and the underlying mechanism is blocked by Android storage restrictions.

Current state (Android sync, as implemented)

Android sync dir is resolved as Android/data/net.activitywatch.android/files/sync/ (set via AW_SYNC_DIR env var in SyncInterface.kt). The sync DB structure mirrors desktop: {hostname}/{device_id}/*.db.

  • Push (push_with_hostname): Android writes its own events into sync_dir/{device_name}/{device_id}/*.db. This works in isolation (modulo the OOM bug in App doesn't open after installing it and opening it (Mac OS Big Sur) #630).
  • Pull (pull_all): Android scans sync_dir for {hostname}/{device_id}/*.db files from OTHER devices. There is no mechanism to get those files onto the phone. On desktop, users share ~/ActivityWatchSync via Syncthing/Dropbox/etc. On Android, the app's data dir (Android/data/...) is scoped storage — not accessible to other apps since Android 11+, so Syncthing cannot write into it, making the typical desktop sync flow non-replicable on mobile.

In practice: pull_all() silently no-ops on a typical Android device (no remote db files found). Push works, but the data stays trapped on the phone.

Problems to fix

  1. Sync disabled by default on Android — automatic sync fires every 15 min (via SyncScheduler), potentially crashing (OOM) or consuming battery/I/O for work that is currently pointless. It should be off by default, with a setting to enable it.

  2. Android sync directory is not accessible via Syncthing/standard apps — the app data dir is scoped to the app. For Android sync to work at all, either:

    • The app needs to use a user-accessible location (e.g., a user-picked directory via Storage Access Framework / ACTION_OPEN_DOCUMENT_TREE)
    • Or provide its own sync transport (Bluetooth, local Wi-Fi, explicit export/share flow)
  3. No setup UI — no settings screen, no documentation, no in-app explanation of how sync works or what the user needs to do.

  4. SyncScheduler runs unconditionally — no check for whether sync is configured, no user-accessible enable/disable toggle.

Suggested next steps (not prescriptive — up to maintainers)

  • Add a settings toggle to enable/disable automatic sync (default: off)
  • Consider Storage Access Framework for Android sync dir (user picks a directory accessible to both the app and Syncthing/etc.)
  • Add a sync status/setup screen explaining the current sync dir path and what users need to do
  • Document the intended mobile sync flow somewhere visible

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions