From 0a745950dd425dbbb5e340caea81ba1bede12c8a Mon Sep 17 00:00:00 2001 From: Bob Date: Mon, 31 Aug 2026 15:13:05 +0000 Subject: [PATCH] fix(sync): pick up aw-server-rust API-key JNI client and set data dir ActivityWatch/aw-android#247: sync appeared to run but wrote nothing because GET /api/0/buckets 401'd. The JNI client now forwards [auth].api_key (ActivityWatch/aw-server-rust#666). Bump the submodule to 2ded7d7 (includes #666) and call SyncInterface.setDataDir so libaw_sync.so reads filesDir/config.toml on debug and work-profile installs, not only the release user-0 path. Git-Session-Id: e6b1 --- aw-server-rust | 2 +- .../main/java/net/activitywatch/android/SyncInterface.kt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/aw-server-rust b/aw-server-rust index 77defefd..2ded7d78 160000 --- a/aw-server-rust +++ b/aw-server-rust @@ -1 +1 @@ -Subproject commit 77defefd4945ecceedc417eea711c2613b451f2e +Subproject commit 2ded7d7875736e839867d5e849054cfffe40b2a7 diff --git a/mobile/src/main/java/net/activitywatch/android/SyncInterface.kt b/mobile/src/main/java/net/activitywatch/android/SyncInterface.kt index 0f914f07..dd8643f0 100644 --- a/mobile/src/main/java/net/activitywatch/android/SyncInterface.kt +++ b/mobile/src/main/java/net/activitywatch/android/SyncInterface.kt @@ -53,8 +53,12 @@ class SyncInterface(context: Context) { Os.setenv("XDG_CACHE_HOME", cacheDir, true) Os.setenv("XDG_CONFIG_HOME", "$filesDir/config", true) Os.setenv("XDG_DATA_HOME", "$filesDir/data", true) - + System.loadLibrary("aw_sync") + // libaw_sync.so has its own ANDROID_DATA_DIR static; RustInterface.setDataDir + // only updates libaw_server.so. Point this copy at filesDir so sync reads + // the same config.toml as the embedded server (ActivityWatch/aw-server-rust#666). + setDataDir(filesDir) Log.i(TAG, "aw-sync initialized with sync dir: $syncDir") } @@ -72,6 +76,7 @@ class SyncInterface(context: Context) { } // Native JNI functions + private external fun setDataDir(path: String) private external fun syncPullAll(port: Int, hostname: String): String private external fun syncPull(port: Int, hostname: String): String private external fun syncPush(port: Int, hostname: String): String