fix(android): report the app's version from /api/0/info - #240
Conversation
The webui footer showed `v0.14.0 (rust)` on a `v0.14.0b2` install: the server reported the aw-server-rust package version, which is the version of a component rather than of the app the user installed. Bump aw-server-rust to pick up `setVersionOverride` (#656) and call it at startup with the app's own versionName, read the same way MainActivity already reads it. The `(rust)` suffix is kept: aw-webui checks the version string for it to decide whether to offer the API browser link, which aw-server-rust does not serve. Part of ActivityWatch#236.
Greptile SummaryThe PR updates the bundled Rust server and supplies the Android application version before local-server startup so
Confidence Score: 5/5The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issues identified. The Android version is read through the established package metadata mechanism, the override is applied before the owning service starts the server, metadata lookup failure preserves existing behavior, and the normal CI path rebuilds native artifacts for the updated submodule revision. Important Files Changed
Reviews (1): Last reviewed commit: "fix(android): report the app's version f..." | Re-trigger Greptile |
Server should announce a api-browser capability or per-module versions so we don't have that check. |
|
Good point — using a capability flag or per-module version in the This PR only fixes the version number being wrong (reporting the aw-server-rust package version rather than the installed app version); the suffix question is a separate concern and best left for a future improvement to the info endpoint. |
|
CI status: The failure is Three reasons I read this as emulator flake:
Worth noting the job that would have caught a real problem here did its job: I can't re-run the job myself (needs admin on the repo), so this is unconfirmed rather than proven — a re-run before merge would settle it. |
Android half of item 3 in #236, the follow-up to ActivityWatch/aw-server-rust#656 (merged).
Problem
The webui footer showed
v0.14.0 (rust)on av0.14.0b2install:GET /api/0/inforeported the aw-server-rust package version, which is the version of a component rather than of the app the user installed.Fix
aw-server-rustsubmodule to pick upsetVersionOverride(feat(server): let packaged builds override the reported version aw-server-rust#656).setVersionOverrideexternal and call it fromRustInterface'sinit, right next to the existingsetDataDircall, so the override is set before the server starts.The version is read via
packageManager.getPackageInfo(...).versionName— the same mechanismMainActivity.versionalready uses. That avoids turning on thebuildConfigbuild feature (off by default since AGP 8) just to reachBuildConfig.VERSION_NAME.Why the
(rust)suffix staysThe reported string becomes
v0.14.0b2 (rust)rather than a barev0.14.0b2. aw-webui sniffs the version string forrust:Dropping the suffix would make the API browser link appear on Android, pointing at an endpoint aw-server-rust doesn't serve. The issue is that the version number was wrong, so only that is changed.
If the version can't be read, the override is skipped and the server keeps its current default — no behaviour change on that path.
Verification
./gradlew :mobile:compileDebugKotlin— this repo has no unit tests coveringRustInterface(it's a JNI shim), so the real check is CI's build plus a manual look at the footer on a debug build.Part of #236.