Skip to content

fix(android): report app version in aw-server-rust info endpoint - #239

Closed
TimeToBuildBob wants to merge 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/version-override
Closed

fix(android): report app version in aw-server-rust info endpoint#239
TimeToBuildBob wants to merge 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/version-override

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Fixes item 3 of #236.

Problem

The footer in the webui showed v0.14.0 (rust) — the Cargo.toml version of the embedded aw-server-rust component — while the installed app was v0.14.0b2. The two diverge because aw-server-rust has its own release cadence and its Cargo.toml version is a component version, not the Android app version.

Fix

ActivityWatch/aw-server-rust#656 (merged 2026-08-25) added a setVersionOverride JNI entrypoint that accepts a version string and uses it verbatim in GET /api/0/info. This PR wires it up on the Android side:

  1. Declare the external funprivate external fun setVersionOverride(version: String), mirroring the existing setDataDir pattern.
  2. Call it at startup — in init {}, immediately after setDataDir(context.filesDir.absolutePath), call setVersionOverride(BuildConfig.VERSION_NAME). BuildConfig.VERSION_NAME carries the release version (e.g. 0.14.0b2) set by the build system.
  3. Bump the submodule — updates aw-server-rust from 75722f3 to 77defef to pick up #656.

After this change GET /api/0/info returns the Android release version, so the footer will read v0.14.0b2 (rust) (or whatever VERSION_NAME the build sets) instead of a stale Cargo version.

The footer showed "v0.14.0 (rust)" — the Cargo.toml component version —
while the installed app was v0.14.0b2.

Wire up the JNI entrypoint added in ActivityWatch/aw-server-rust#656:
declare `setVersionOverride` as an external fun and call it with
`BuildConfig.VERSION_NAME` immediately after `setDataDir`, so the
`GET /api/0/info` response reports the Android release version instead
of the embedded component's package version.

Also bumps the aw-server-rust submodule pointer to pick up #656.

Fixes item 3 of ActivityWatch#236.
@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown

Greptile Summary

The PR reports the Android application version from the embedded Rust server’s info endpoint.

  • Adds a Kotlin declaration for the native version-override function.
  • Sets the override to BuildConfig.VERSION_NAME during context-backed initialization.
  • Advances the aw-server-rust submodule to the implementation containing the new JNI entrypoint.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or non-blocking defects identified.

The server-owning startup path constructs RustInterface with a context, ensuring the Android version override is set before the local server starts, and the native artifact build is keyed to the updated submodule revision.

Important Files Changed

Filename Overview
mobile/src/main/java/net/activitywatch/android/RustInterface.kt Adds the application-version override to the context-backed native initialization path used by server startup.
aw-server-rust Advances the native server dependency to provide the corresponding version-override entrypoint.

Reviews (1): Last reviewed commit: "fix(android): report app version in aw-s..." | Re-trigger Greptile

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Closing this in favour of #240, which is the same fix without two problems this version has.

1. It doesn't compile. The Test job here fails with:

e: RustInterface.kt:36:32 Unresolved reference: BuildConfig

BuildConfig generation is off by default since AGP 8, and this project doesn't enable it (buildFeatures { viewBinding true } only, and nothing in gradle.properties). #240 reads the version via packageManager.getPackageInfo(...).versionName instead — the same mechanism MainActivity.version already uses — so no new build feature is needed.

2. It drops the (rust) suffix. aw-webui sniffs the version string:

li(v-if="!info.version.includes('rust')") #[a(:href="apiBrowserUrl") {{ $t('home.apiBrowser') }}]

Reporting a bare 0.14.0b2 would make the API browser link appear on Android, pointing at something aw-server-rust doesn't serve. #240 reports v0.14.0b2 (rust) — the version number is fixed, the capability sniff still works. It also keeps the v prefix, which the old default (v{} (rust)) had and this version drops.

Apologies for the duplicate — two sessions picked this up in the same few minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant