Skip to content

armgit / andee

Public Imported from GitHub
0

Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。

feat(selfcheck): add a version row, and stop claiming there is no telemetry

booboosui86e37f479ff2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0274a3d..36e9b3e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,9 +8,8 @@ Notable changes to Andee. The format follows [Keep a Changelog](https://keepacha
Android template shipped with. Rather than pretend otherwise, this file records the policy going
forward and states plainly where the project is:
-- `versionCode` / `versionName` live in `app/build.gradle` and are currently **`1` / `1.0`**.
-- The first tagged release should be **`v1.0.0`** with `versionName "1.0.0"` — note that `"1.0"` is
- not a valid SemVer string, so the two need to be reconciled at that point.
+- `versionCode` / `versionName` live in `app/build.gradle` and are currently **`1` / `"1.0.0"`**.
+- The first tagged release should be **`v1.0.0`**, matching the `versionName` already in the file.
- Thereafter: releases are tagged `vMAJOR.MINOR.PATCH`, `versionName` mirrors the tag without the
leading `v`, and `versionCode` increases by one per release. `versionCode` must increase
**monotonically** or Android refuses the upgrade; the same number must never be reused for
@@ -66,8 +65,9 @@ build time would close this hole; it is not implemented yet.)
- `README.zh-CN.md` — the Chinese setup guide, split out from `README.md`.
- `DISCLAIMER.md` + `DISCLAIMER.zh-CN.md` — the user-facing terms, one file per language (same
convention as the two READMEs). Covers the four things Apache-2.0 does not: **where your data
- actually goes** (no telemetry in the repo, but speech goes to Volcengine and the conversation plus
- every tool result goes to the brain endpoint you configure), **what the software is genuinely
+ actually goes** (at the time this file was written, no telemetry in the repo, but speech goes to
+ Volcengine and the conversation plus every tool result goes to the brain endpoint you configure),
+ **what the software is genuinely
capable of** (it can complete a payment by tapping; the only guardrail is Android's `FLAG_SECURE`),
**who bears the consequences**, and third-party platform terms.
- `docs/acceptable-use.md` + `docs/acceptable-use.zh-CN.md` — the prohibited uses, one file per
@@ -80,6 +80,33 @@ build time would close this hole; it is not implemented yet.)
- Both READMEs now carry a warning above the fold and a `## Disclaimer and acceptable use` section;
`SECURITY.md` states the triage boundary (steering it is a vulnerability; doing what it was built
to do is documented behaviour).
+- **A 版本 row in the self-check list — the first thing this app ever sends anywhere.** It asks a
+ version service whether a newer build exists and reports the answer as one more row in the same list
+ the device diagnostics live in: one row, one renderer, no second settings page. The level mapping is
+ the deliberate part. **Current → OK, newer release available → NOTE, forced update → WARN, and
+ everything undetermined → NOTE.** An outdated app is not a broken one, and only FAIL and WARN may
+ raise the startup card, so a vendor that popped a card every time it shipped a patch would be
+ nagware — which is the exact failure `SelfCheck`'s level doc is written against. The forced case is
+ the one real WARN, because the service is then saying this build is no longer supported. A
+ statistics endpoint being unreachable is never the user's problem, so it never paints the card red.
+ **The address is a hardcoded constant, not a setting.** `VERSION_API_BASE` lives in
+ `device/SelfCheck.kt` (`https://andee.kuafuai.net`), with no settings row, no build flag and no
+ `local.properties` key behind it, so turning the check off means editing that line and rebuilding.
+ That is a deliberate trade rather than an oversight: a check which can be silently misconfigured is
+ a check that silently stops working, and this one should be on for everyone or off for everyone.
+ The price is that there is no build-time way to opt out, and `docs/permissions.md` now says so
+ instead of pretending otherwise — which it had to, because the first cut of this feature did put the
+ address in `local.properties` and then advertised a fresh clone as reporting nothing.
+- **`res/xml/network_security_config.xml` deliberately did *not* gain the version host, on the second
+ pass.** Android refuses cleartext HTTP to any host not named there, and what it produces —
+ `CLEARTEXT communication to X not permitted by network security policy` — arrives as a version row
+ reading 查不到, a message about a policy rather than about anything the user did. So the first cut
+ added the service's IP address to that file, which is the right move *for a `http://` address*. The
+ address then became `https://andee.kuafuai.net`, which needs no exception at all, and the entry was
+ deleted rather than left in place: an exception for a host nobody calls only widens what this app
+ will talk to in the clear. `124.71.176.202` (the CodeFlying backend) is still listed and still needs
+ to be. The rule to carry forward is that this file tracks the addresses actually in use — adding a
+ line is part of pointing the app at plain HTTP, and removing it is part of moving away.
### Changed
@@ -221,6 +248,24 @@ build time would close this hole; it is not implemented yet.)
inventing a measurement. Only its framing moved: it opened on WeChat, which a non-Chinese reader
reads as someone else's app having someone else's problem, so it now opens on the general
behaviour and names WeChat as the one we happened to measure.
+- **The blanket "没有任何遥测 / no telemetry at all" claim is gone, because the version row above
+ made it false.** It appeared in nine places — `DISCLAIMER.md`, `DISCLAIMER.zh-CN.md`,
+ `docs/permissions.md`, `docs/permissions.zh-CN.md`, both READMEs, and both README badges — and all
+ nine were in the same voice: not "we anonymise it", not "opt out in settings", but a flat statement
+ that the reader was invisible. A check that carries an IP, a phone model and a stable per-install ID
+ is telemetry by any ordinary reading of the word, so keeping the sentence would have converted a
+ product guarantee into a lie. The replacements keep the half that is still true and still
+ checkable — no analytics SDK, no crash reporting, no event tracking, no advertising ID, all four
+ confirmed by the same grep the old text quoted — and then state the single exception field by field,
+ in a row of its own in the data table, next to an explicit list of what that request does *not*
+ carry (conversation, screen, app list, contacts, location, crash log, advertising ID). `docs/permissions.md`
+ is the canonical copy; the rest point at it. The badge went from `遥测-无` / `telemetry-none` to
+ `遥测-不含内容` / `telemetry-no content`, because "no content" is the claim that survives.
+ Worth recording for whoever edits these next: the old sentence was true of the *repository* on the
+ day it was written and was always going to be false the moment the project shipped anything that
+ phoned home. This file had already annotated that distinction in the DISCLAIMER's own entry above —
+ *"we do not collect your data", which is true of the maintainers and false of the device* — and the
+ claim that had to be corrected anyway was the neighbouring one about the maintainers.
### Removed
diff --git a/DISCLAIMER.md b/DISCLAIMER.md
index c03ce6d..202e157 100644
--- a/DISCLAIMER.md
+++ b/DISCLAIMER.md
@@ -26,9 +26,9 @@ An **experimental** piece of software that you install on **your own device**. I
## 2. Where your data goes (read this before deciding to use it)
-**The short version: the maintainers receive nothing about you. "Your data never leaves the device" is nevertheless false.**
+**The short version: no analytics SDK, no crash reporting, no event tracking and no advertising ID — but "the maintainers receive nothing about you" is false too, with exactly one exception: the version check in the table below.**
-**There is no telemetry in this repository.** No analytics SDK, no crash reporting, no tracking, no device fingerprinting. A search of `app/build.gradle` and `app/src/main/` for `firebase` / `analytics` / `sentry` / `crashlytics` returns zero. If you install this and use it, we do not know.
+**First, the part that is not there (grep it yourself):** no analytics SDK, no crash reporting, no event tracking, no advertising ID. A search of `app/build.gradle` and `app/src/main/` for `firebase` / `analytics` / `sentry` / `crashlytics` returns zero. And unless you tap **Check again** on the self-check page, the app sends nothing outward during normal use.
**But data does leave the device, to wherever it is configured to go:**
@@ -37,13 +37,16 @@ An **experimental** piece of software that you install on **your own device**. I
| Your speech (ASR) and its speech (TTS) | **Volcengine / ByteDance cloud** | `openspeech.bytedance.com` |
| The conversation, **and every tool result** | The "brain" you configured | `brain=local` (the out-of-box default) → `api.deepseek.com`; in hub mode, your own `hub_url` |
| The private notebook (`Notebook` — what it remembers about you, what it promised) | **On this device only** | Filtered out of the hub payload |
+| **Version check**: your version number, phone model / brand / OS version, UI language, one random install ID | **A server the maintainers run** (not a third party) | Once on first launch, and once per tap on the self-check page's **Check again**; capped at 10 per IP per day |
The second row needs spelling out: **tool results are part of the conversation.** The SMS text it read, your contacts, your call log, notification contents, your location, and its reading of the screen all travel to the endpoint you configured.
+**The last row needs spelling out too, because it is a different kind of thing from the two above it.** Those two go to an endpoint *you* configured; this one comes to us. It carries the version number, the phone model, the brand, the Android release, the UI language, and a random ID this install generated for itself (`body-xxxxxxxx`, new on every reinstall — **not `ANDROID_ID`**). The server necessarily also sees your IP, from which it derives a country / region / city. **It does not carry**: conversation content, screen content, which apps you have installed, contacts, location, crash logs or an advertising ID. **Nor can it be switched off** — the address is a constant compiled into the code, with no setting and no build flag behind it, so stopping it means editing the source and rebuilding. Field by field, in **[docs/permissions.md](docs/permissions.md)**.
+
**So "local mode" does not mean "processed locally."** Local mode swaps the hub for whichever provider you typed in. It does not keep a single byte on the device.
Therefore:
-- *"We do not monitor or store your data"* — **true.** We have neither the capability nor the endpoint.
+- *"We do not monitor or store your data"* — **mostly true, but do not overclaim it.** No database, no behavioural analysis, and no reading of anything you send; the one exception is the version check, which tells us that some device of some model on some IP is running 1.0.0.
- *"Your data never leaves the device"* — **false. Do not claim it.**
## 3. What it can actually do (not hypotheticals — current state of the code)
diff --git a/DISCLAIMER.zh-CN.md b/DISCLAIMER.zh-CN.md
index a6195f7..61974c5 100644
--- a/DISCLAIMER.zh-CN.md
+++ b/DISCLAIMER.zh-CN.md
@@ -25,9 +25,9 @@
## 2. 数据去哪(决定要不要用之前,请读完这段)
-**结论先说:维护者收不到你的任何数据;但"你的数据不会离开设备"是假的。**
+**结论先说:仓库里没有统计 SDK、没有崩溃上报、没有埋点,也没有广告 ID;但"维护者收不到你的任何数据"同样是假的 —— 有且只有一处例外,就是下面表里的「版本自检」。**
-**这个仓库里没有任何遥测。** 没有统计 SDK、没有崩溃上报、没有埋点、没有设备指纹。`app/build.gradle` 与 `app/src/main/` 中 `firebase` / `analytics` / `sentry` / `crashlytics` 全部为零。你装了它、用了它,我们不知道。
+**先说不含的那部分(可以自己 grep 验证):** 没有统计 SDK、没有崩溃上报、没有埋点、没有广告 ID。`app/build.gradle` 与 `app/src/main/` 中 `firebase` / `analytics` / `sentry` / `crashlytics` 全部为零。你不动自检页上的「重新检查」,App 平时也不会往外发任何东西。
**但数据会离开设备,去到它被配置指向的地方:**
@@ -36,13 +36,16 @@
| 你说的话(语音识别)、它说的话(语音合成) | **火山引擎(字节跳动)云端** | `openspeech.bytedance.com` |
| 对话内容,**以及全部工具返回结果** | 你配置的"大脑" | `brain=local`(开箱默认)→ `api.deepseek.com`;hub 模式下走你自己的 `hub_url` |
| 私人笔记本(`Notebook`:它记住的你、以及它答应过的事) | **只在本机** | 不进 hub 载荷,不外发 |
+| **版本自检**:当前版本号、手机型号 / 品牌 / 系统版本、界面语言、一个随机安装 ID | **维护者自己的一台服务器**(不是第三方) | 首次启动一次,以及在自检页点「重新检查」时一次;同一 IP 每天最多 10 次 |
第二行必须说透:**工具返回结果就是对话的一部分**。它读到的短信正文、通讯录、通话记录、通知内容、定位、以及它对屏幕的"理解",都会随对话发到你配置的那个端点。
+**最后一行也必须说透,因为它和上面两行性质不同:** 上面两行发给你自己配的端点,这一行是我们自己收。它带的是版本号、机型、品牌、系统版本、界面语言,以及这个安装自己生成的随机 ID(`body-xxxxxxxx`,重装即换,**不是 `ANDROID_ID`**);服务器那边还必然看得到你的 IP,并由它解析出国家 / 地区 / 城市。**它不带**:对话内容、屏幕内容、你装了哪些应用、通讯录、定位、崩溃日志、广告 ID。**这一项也关不掉** —— 地址是编译进代码的常量,没有设置项、没有编译开关,只能用改源码重编的方式停掉。逐字段的清单在 **[docs/permissions.zh-CN.md](docs/permissions.zh-CN.md)**。
+
**因此"本机模式"不等于"本地处理"** —— 本机模式只是把大脑从 hub 换成了你填的那个服务商。它没有让数据留在设备上,一个字都没有。
所以:
-- 「我们不会监控和存储您的数据」——**成立**。我们根本没有这个能力,也没有这个接口。
+- 「我们不会监控和存储您的数据」——**基本成立,但别把话说满**。不落库、不做行为分析、不看你发的内容;唯一的例外是版本自检,它让我们知道"某个 IP 上,有一台某个型号的设备在跑 1.0.0"。
- 「您的数据不会离开设备」——**不成立,而且不要说**。
## 3. 它真的能做什么(以下都不是危言耸听,是代码里的现状)
diff --git a/README.md b/README.md
index f02942a..dbeae1f 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0%20%2B%20conditions-155eef"></a>
<a href="app/build.gradle"><img alt="Platform" src="https://img.shields.io/badge/platform-Android%2011%2B%20(API%2030)-3ddc84"></a>
<a href="app/build.gradle"><img alt="Kotlin" src="https://img.shields.io/badge/Kotlin-1.9.22-7f52ff"></a>
- <a href="SECURITY.md"><img alt="No telemetry" src="https://img.shields.io/badge/telemetry-none-0f6e56"></a>
+ <a href="docs/permissions.md"><img alt="No content telemetry" src="https://img.shields.io/badge/telemetry-no%20content-0f6e56"></a>
<a href="CONTRIBUTING.md"><img alt="PRs welcome" src="https://img.shields.io/badge/PRs-welcome-fdb062"></a>
</p>
@@ -72,7 +72,9 @@ they are yours like any other — edit them, or delete them:
screenshot, and aims on a labelled grid instead of doing coordinate maths — the thing general models
are worst at.
- **Lives on the phone.** The brain runs on the device against any OpenAI-compatible model (DeepSeek
- by default). No vendor backend, no account, **no telemetry at all**.
+ by default). No vendor backend, no account. The only thing it ever sends us is a version number and
+ a phone model, when it checks whether there is an update — the full field list is in
+ [docs/permissions.md](docs/permissions.md).
- **Gets to know you.** A private notebook, a real scheduler, a nightly review of its own
conversations, and **scenes** — ways of working it proposes after doing the same kind of thing with
you a few times.
@@ -439,8 +441,11 @@ is through.
Most claims in this category — including the well-funded ones — are launch claims that no outside
party has audited. This project's claims are duller and checkable, in code you can read right now:
-- **No telemetry at all.** Not "we anonymise it", not "opt out in settings". There is no analytics
- SDK in this repo.
+- **No analytics SDK, and none of your content reaches us.** Not "we anonymise it", not "opt out in
+ settings": there is no analytics SDK in this repo. The one thing that does reach the maintainers is
+ the version check — your version number, phone model, brand, OS release, UI language and a random
+ per-install ID, and nothing else. Field by field, in
+ [docs/permissions.md](docs/permissions.md).
- **The notebook cannot leave the device.** It is not a policy, it is a filter:
`net/ToolSchemas.kt` drops every `localOnly` tool from the hub payload before it is registered.
Habits and promises are physically incapable of being sent.
@@ -902,9 +907,10 @@ The four points worth reading even if you read nothing else:
on that path.** Keep a human present for anything financial, and treat *"the AI did it"* as no
defence, because it is not one.
- **What it sends is yours.** Messages, posts, calls and orders go out under your name.
-- **Your data leaves the device.** No telemetry exists in this repo — but speech goes to Volcengine,
- and the conversation plus every tool result goes to whichever brain endpoint you configure. Local
- mode changes the destination, not the fact.
+- **Your data leaves the device.** There is no analytics SDK in this repo — but speech goes to
+ Volcengine, the conversation plus every tool result goes to whichever brain endpoint you configure,
+ and the version check goes to a server the maintainers run. Local mode changes the destination, not
+ the fact.
- **It can be steered by what is on screen.** Anyone who can get you to open a page can influence it.
## License
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 5358e18..fbf67f9 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -18,7 +18,7 @@
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0%20%2B%20conditions-155eef"></a>
<a href="app/build.gradle"><img alt="Platform" src="https://img.shields.io/badge/platform-Android%2011%2B%20(API%2030)-3ddc84"></a>
<a href="app/build.gradle"><img alt="Kotlin" src="https://img.shields.io/badge/Kotlin-1.9.22-7f52ff"></a>
- <a href="SECURITY.md"><img alt="无遥测" src="https://img.shields.io/badge/遥测-无-0f6e56"></a>
+ <a href="docs/permissions.zh-CN.md"><img alt="遥测不含内容" src="https://img.shields.io/badge/遥测-不含内容-0f6e56"></a>
<a href="CONTRIBUTING.zh-CN.md"><img alt="PRs welcome" src="https://img.shields.io/badge/PRs-welcome-fdb062"></a>
</p>
@@ -69,7 +69,8 @@ https://github.com/user-attachments/assets/866e8333-e97b-4bf5-9525-540f9fdb01cd
- **任何 App 都能用,而不是一张"已接入应用"清单。** 它读无障碍树和截图,在一张带标号的网格上
瞄准,而不是自己算坐标 —— 那恰恰是通用大模型最不擅长的事。
- **住在手机上。** 大脑就跑在设备本机,接任意 OpenAI 兼容模型(默认 DeepSeek)。没有厂商后端、
- 不用注册账号、**没有任何遥测**。
+ 不用注册账号。它唯一会发给我们的东西是版本号和机型 —— 只在你查更新的时候发,字段清单见
+ [docs/permissions.zh-CN.md](docs/permissions.zh-CN.md)。
- **会越来越懂你。** 私人笔记本、真的定时任务、没人时自己复盘对话,还有**情景** —— 同一类事陪你
做过几次之后,它会主动提议"要不要存成一个情景"。
- **有性格。** 五个形象、十四种情绪,表情由模型自己挑,一句话说到一半都能换脸。
@@ -302,8 +303,10 @@ OpenAI 兼容端点(`llm_api_key`,默认 `https://api.deepseek.com`)。**
这一类产品里的多数说法 —— 包括那些融资充裕的 —— 都是发布时的主张,没有第三方审计过。而
这个项目的说法更无聊,但**可以核对**,就在你现在能读的代码里:
-- **没有任何遥测。** 不是"我们做了匿名化",也不是"可以在设置里关掉"。这个仓库里根本没有
- 数据分析 SDK。
+- **没有数据分析 SDK,也没有你的内容流向我们。** 不是"我们做了匿名化",也不是"可以在设置里关掉"。
+ 这个仓库里根本没有数据分析 SDK。唯一会到达维护者手上的是版本自检:版本号、手机型号、品牌、
+ 系统版本、界面语言,以及一个随机安装 ID,别的什么都没有。逐字段列在
+ [docs/permissions.zh-CN.md](docs/permissions.zh-CN.md)。
- **笔记本出不了设备。** 这不是一句政策,是一道过滤:`net/ToolSchemas.kt` 在注册之前就把所有
`localOnly` 工具从发往 hub 的载荷里剔掉了。习惯和承诺在物理上无法被发出去。
- **唤醒词全离线。** 本机 MFCC + DTW 模板匹配(`app/.../wake/`)。存的是特征向量,从不存录音,
@@ -803,8 +806,9 @@ CLAUDE.md 给 AI 编码助手看的架构说明(英文)
`FLAG_SECURE`,**本项目对这条路径没有任何技术围栏**。任何涉及钱的操作都要人在场;并且请记住
**"是 AI 自己做的"不是抗辩理由**,因为它确实不是。
- **他发出去的东西是你的。** 消息、帖子、通话、订单,署名都是你。
-- **你的数据会离开设备。** 本仓库没有任何遥测,但语音会走火山引擎,对话连同**全部工具返回结果**
- 会走到你配置的那个大脑端点。"本机模式"换的是目的地,不是这个事实。
+- **你的数据会离开设备。** 本仓库里没有数据分析 SDK,但语音会走火山引擎,对话连同**全部工具返回
+ 结果**会走到你配置的那个大脑端点,版本自检会走到一台维护者自己跑的服务器。"本机模式"换的是
+ 目的地,不是这个事实。
- **他能被屏幕上的字操纵。** 任何能让你打开一个页面的人,都可能影响到他。
## Star History
diff --git a/app/src/main/java/net/kuafuai/andee/device/SelfCheck.kt b/app/src/main/java/net/kuafuai/andee/device/SelfCheck.kt
index 54fc64f..b3b94ec 100644
--- a/app/src/main/java/net/kuafuai/andee/device/SelfCheck.kt
+++ b/app/src/main/java/net/kuafuai/andee/device/SelfCheck.kt
@@ -16,6 +16,8 @@ import android.provider.Settings
import androidx.annotation.StringRes
import net.kuafuai.andee.R
import net.kuafuai.andee.config.VoiceConfig
+import net.kuafuai.andee.BuildConfig
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
@@ -25,6 +27,7 @@ import org.json.JSONObject
import java.io.IOException
import java.net.InetSocketAddress
import java.net.Socket
+import java.util.Locale
import java.util.concurrent.TimeUnit
/**
@@ -162,11 +165,14 @@ object SelfCheck {
/**
* The whole list, in report order.
*
- * @param probe whether to spend the two network round-trips (the backend,
- * then the voice host). **This blocks the calling thread** — up to ~20 s
- * on a black-holed network — so call it off the main thread. With
- * `probe = false` those two rows come back as [Level.NOTE] "检查中…",
- * which is what lets the page paint instantly and fill in behind.
+ * @param probe whether to spend the three network round-trips (the backend,
+ * then the version service, then the voice host). **This blocks the
+ * calling thread** — up to ~30 s on a black-holed network — so call it off
+ * the main thread. The version probe is the one that cannot stretch that
+ * budget: it carries its own 8 s `callTimeout`, so it adds at most 8 s
+ * whatever the socket does. With `probe = false` those three rows come
+ * back as [Level.NOTE] "检查中…", which is what lets the page paint
+ * instantly and fill in behind.
*/
fun run(context: Context, probe: Boolean = true): List<Finding> {
val online = isOnline(context)
@@ -177,6 +183,7 @@ object SelfCheck {
network(online),
brain(context),
backend(context, probe, online),
+ version(context, probe, online),
microphone(context),
notificationAccess(context),
typingChannel(context),
@@ -372,6 +379,115 @@ object SelfCheck {
}
}
+ /**
+ * Whether this copy of the app is the one we think you should be running.
+ *
+ * **The only row here that is about the app rather than the device**, and
+ * the only one that talks to a host the *author* owns rather than one the
+ * user configured. It is also the only thing this app ever reports about
+ * itself: the request carries the version number, the phone model, the
+ * brand, the Android release, the UI language and this install's own random
+ * `device_id` — and nothing else. No conversation, no screen content, no
+ * app list, no crash log, no advertising ID, and no `ANDROID_ID`. The
+ * numbers behind those claims are in `docs/permissions.md`, which is the
+ * file to keep in step with this function.
+ *
+ * ### Why the levels are not all WARN
+ *
+ * A vendor checking for its own updates is one bad decision away from
+ * nagware, so the mapping is deliberate:
+ *
+ * * Answered, and this build is current → [Level.OK].
+ * * **A newer version exists → [Level.NOTE], not WARN.** An outdated app
+ * is not a broken one, and this list's contract is that only FAIL and
+ * WARN may interrupt. Putting up a card every time we ship a patch would
+ * be exactly the failure the [Level] doc is written against.
+ * * The one exception is a *forced* update — `force_update` set in
+ * `version.json`, or this build sitting below `min_supported_version` —
+ * which is [Level.WARN], because the service is saying this build is no
+ * longer supported.
+ * * **Anything undetermined is [Level.NOTE]**: no network, today's quota
+ * spent, connection refused, a 500, a domain that does not resolve. A
+ * statistics endpoint being down is never the user's problem, and
+ * letting it paint this card red would make it one. This row is also
+ * the reason [Level.NOTE] rows must stay out of the startup card.
+ *
+ * Every one of those states still names the build the user is holding, even
+ * the ones where nothing could be checked, because this row is the only
+ * place the app can answer "what version am I on?" — there is no
+ * version number anywhere in Settings.
+ *
+ * **The address is a constant, deliberately.** [VERSION_API_BASE] is written
+ * into this file and cannot be changed without editing the source and
+ * rebuilding: there is no setting, no build property and no `local.properties`
+ * key behind it. That is the point — a check that a user can silently
+ * misconfigure is a check that silently stops working, and this one is meant
+ * to be either on for everyone or off for everyone. The cost is that the
+ * repository has no build-time switch to turn reporting off; the honest
+ * description of that is in `docs/permissions.md`, which is the file to keep
+ * in step with this function.
+ */
+ private fun version(context: Context, probe: Boolean, online: Boolean): Finding {
+ if (!probe || !online) {
+ return Finding(
+ id = "version",
+ title = R.string.check_title_version,
+ level = Level.NOTE,
+ // The offline case gets its own string rather than sharing
+ // `check_detail_skipped_offline` with the model and voice rows:
+ // those two are only ever *skipped*, while this row is the one
+ // place a user can read back which build they are holding, and
+ // a blank network is exactly when they might want to.
+ detail = if (online) R.string.check_detail_checking
+ else R.string.check_detail_version_offline,
+ detailArgs = if (online) emptyList() else listOf(BuildConfig.VERSION_NAME),
+ )
+ }
+ val deviceId = VoiceConfig.hubConfig(context).deviceId
+ return when (val v = probeVersion(VERSION_API_BASE, BuildConfig.VERSION_NAME, deviceId)) {
+ is Verdict.Current -> Finding(
+ id = "version",
+ title = R.string.check_title_version,
+ level = Level.OK,
+ detail = R.string.check_detail_version_current,
+ detailArgs = listOf(BuildConfig.VERSION_NAME),
+ )
+
+ is Verdict.Update -> Finding(
+ id = "version",
+ title = R.string.check_title_version,
+ level = if (v.forced) Level.WARN else Level.NOTE,
+ detail = if (v.forced) R.string.check_detail_version_forced
+ else R.string.check_detail_version_stale,
+ // %1$s is always the release we want you on and %2$s is always
+ // the build you are holding, in both strings -- the two rows are
+ // one word apart and swapping the order in one of them would be
+ // a silent lie about which version is which.
+ detailArgs = listOf(v.latest, BuildConfig.VERSION_NAME),
+ // No published download URL means nowhere to send the user, and
+ // a button that goes nowhere is the small lie this list exists
+ // to avoid -- see Fix.Link.
+ fix = v.url?.let { Fix.Link(it) } ?: Fix.Nothing,
+ )
+
+ is Verdict.QuotaSpent -> Finding(
+ id = "version",
+ title = R.string.check_title_version,
+ level = Level.NOTE,
+ detail = R.string.check_detail_version_quota,
+ detailArgs = listOf(BuildConfig.VERSION_NAME),
+ )
+
+ is Verdict.Unreachable -> Finding(
+ id = "version",
+ title = R.string.check_title_version,
+ level = Level.NOTE,
+ detail = R.string.check_detail_version_unreachable,
+ detailArgs = listOf(v.detail, BuildConfig.VERSION_NAME),
+ )
+ }
+ }
+
/**
* The notification listener, which has the one failure mode in this app the
* Settings app actively lies about.
@@ -910,6 +1026,95 @@ object SelfCheck {
}
}
+ private sealed interface Verdict {
+ /** Reached, answered, and this build is the current one. */
+ object Current : Verdict
+
+ /** Reached and answered: there is a newer release than this build. */
+ data class Update(val latest: String, val forced: Boolean, val url: String?) : Verdict
+
+ /** Reached, but today's allowance is spent. A normal state, not a fault. */
+ object QuotaSpent : Verdict
+
+ /** Could not be determined. Never a fault for the user to act on. */
+ data class Unreachable(val detail: String) : Verdict
+ }
+
+ /**
+ * One GET against the version service — the only outbound call in this app
+ * that is not addressed to a host the user configured.
+ *
+ * Bounded by [VERSION_CALL_MS] through `callTimeout` rather than by the read
+ * timeout [probeBackend] uses, because this call is the least important of
+ * the three probes. `callTimeout` is a ceiling on the whole call — connect,
+ * retries and body — so this row can never add more than its own budget to
+ * the wall-clock of a black-holed network.
+ *
+ * The URL is built through [toHttpUrlOrNull] rather than by string
+ * concatenation because `Build.MODEL` is not URL-safe on the devices this
+ * ships to: it carries spaces and brackets ("SM-T970", and a trailing
+ * "(wifi)" on some clones). Hand-joined, those go out raw and the service
+ * records a truncated model name.
+ */
+ private fun probeVersion(base: String, current: String, deviceId: String): Verdict {
+ val url = base.toHttpUrlOrNull()
+ ?.newBuilder()
+ ?.addPathSegments("api/version")
+ ?.addQueryParameter("current", current)
+ ?.addQueryParameter("platform", "android")
+ ?.addQueryParameter("model", Build.MODEL)
+ ?.addQueryParameter("brand", Build.BRAND)
+ ?.addQueryParameter("os_version", "Android ${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT})")
+ ?.addQueryParameter("device_id", deviceId)
+ ?.addQueryParameter("app_package", BuildConfig.APPLICATION_ID)
+ ?.addQueryParameter("lang", Locale.getDefault().toLanguageTag())
+ ?.build()
+ ?: return Verdict.Unreachable("bad address: $base")
+
+ val http = OkHttpClient.Builder()
+ .connectTimeout(PROBE_CONNECT_S, TimeUnit.SECONDS)
+ .readTimeout(PROBE_READ_S, TimeUnit.SECONDS)
+ .callTimeout(VERSION_CALL_MS, TimeUnit.MILLISECONDS)
+ .build()
+
+ return try {
+ http.newCall(Request.Builder().url(url).get().build()).execute().use { resp ->
+ // The allowance is ten per address per day and 重新检查 spends
+ // one per tap, so a user can exhaust their own quota just by
+ // poking at this page. The service answers 429 with `code: 4290`
+ // to mean "already checked enough today" — read as such, and
+ // never as an error.
+ if (resp.code == 429) return Verdict.QuotaSpent
+
+ val json = runCatching { JSONObject(resp.body?.string().orEmpty()) }.getOrNull()
+ ?: return Verdict.Unreachable("HTTP ${resp.code}")
+ if (json.optInt("code", -1) != 0) {
+ return Verdict.Unreachable("HTTP ${resp.code} code=${json.optInt("code")}")
+ }
+ val data = json.optJSONObject("data")
+ ?: return Verdict.Unreachable("HTTP ${resp.code}: no data")
+ if (!data.optBoolean("has_update", false)) return Verdict.Current
+
+ // `org.json.optString` hands back the four-letter *string*
+ // "null" for a JSON null, and the service sends exactly that
+ // when no download URL is published. So the scheme is what gets
+ // checked, not emptiness: a Fix.Link holding "null" opens a
+ // browser at a broken address.
+ val raw = data.optString("download_url").orEmpty()
+ Verdict.Update(
+ latest = data.optString("latest_version").ifEmpty { "?" },
+ forced = data.optBoolean("force_update", false),
+ url = raw.takeIf { it.startsWith("http://") || it.startsWith("https://") },
+ )
+ }
+ } catch (e: Exception) {
+ // IOException is the expected one (DNS, refused, timeout). Anything
+ // else here is still "we could not talk to this address", which is
+ // the same sentence as far as the user is concerned.
+ Verdict.Unreachable(e.message ?: e.javaClass.simpleName)
+ }
+ }
+
/** @return null when the connection opened, else why it did not. */
private fun tcpProbe(host: String, port: Int): String? = try {
Socket().use { s -> s.connect(InetSocketAddress(host, port), PROBE_CONNECT_MS) }
@@ -965,6 +1170,35 @@ object SelfCheck {
private const val PROBE_CONNECT_S = 6L
private const val PROBE_CONNECT_MS = 6000
private const val PROBE_READ_S = 20L
+
+ /**
+ * Where the version check asks. Hardcoded on purpose — see [version]'s KDoc
+ * for why this one is not a setting.
+ *
+ * HTTPS, so there is nothing to declare in `network_security_config.xml`: that
+ * file exists to punch holes for cleartext HTTP, and a hole for a host we no
+ * longer call is a hole that only makes the app more permissive. If this ever
+ * goes back to a plain-HTTP address, the host has to be added there or every
+ * call dies as `CLEARTEXT communication ... not permitted`.
+ *
+ * The domain resolves to the same host `:8099` used to be reached at. It is
+ * reachable over TLS only once that host serves 443 **and** the domain is
+ * ICP-filed — an unfiled domain on a mainland server is answered with a 403
+ * block page rather than reaching the app at all, which reads here as
+ * 查不到. Until both are true this row reports Unreachable everywhere; that
+ * is the intended failure, not a bug in the check.
+ */
+ private const val VERSION_API_BASE = "https://andee.kuafuai.net"
+
+ /**
+ * The whole-call ceiling on the version probe, in milliseconds.
+ *
+ * Deliberately *not* 20 s like the read timeout beside it: this is the third
+ * probe in [run], the user is not waiting on it, and the deployed service
+ * answers a LAN-adjacent request in tens of milliseconds. Eight seconds is
+ * generous for a healthy call and still bounds what a dead one can cost.
+ */
+ private const val VERSION_CALL_MS = 8000L
private const val MODEL_SAMPLE = 8
private const val DISK_WARN_MB = 500L
private const val DISK_FAIL_MB = 100L
diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml
index abd4128..ebf0037 100644
--- a/app/src/main/res/values-en/strings.xml
+++ b/app/src/main/res/values-en/strings.xml
@@ -388,6 +388,7 @@
<string name="check_title_network">Network</string>
<string name="check_title_brain">Assistant</string>
<string name="check_title_model">Model</string>
+ <string name="check_title_version">Version</string>
<string name="check_title_microphone">Microphone</string>
<string name="check_title_notifications">Notification access</string>
<string name="check_title_typing_channel">Typing channel</string>
@@ -419,6 +420,16 @@
<string name="check_detail_model_balance">The server answered %1$s: most likely the account is out of balance. Top up on the current provider\'s website and try again.</string>
<string name="check_detail_model_name">No model called “%1$s” on this server. It offers: %2$s</string>
<string name="check_detail_model_other">%1$s</string>
+ <!-- The one row that is about the app rather than the device, and the one
+ place this app sends anything outward. %1$s is always the release to
+ move to and %2$s is always the build in hand; the two rows differ by a
+ word, so do not swap the arguments between them. See SelfCheck.version. -->
+ <string name="check_detail_version_current">%1$s is the current release.</string>
+ <string name="check_detail_version_stale">%1$s is available; you are on %2$s. The old one still works — update whenever you like.</string>
+ <string name="check_detail_version_forced">Update to %1$s. The build you are on (%2$s) is no longer supported.</string>
+ <string name="check_detail_version_offline">Offline, so not tested. You are on %1$s.</string>
+ <string name="check_detail_version_quota">Today\'s checks are used up; they reset tomorrow. You are on %1$s.</string>
+ <string name="check_detail_version_unreachable">Could not be checked: %1$s. You are on %2$s.</string>
<string name="check_detail_notif_on">Granted, and the listener is bound.</string>
<string name="check_detail_notif_zombie">Settings says “granted”, but the listener is not bound — notifications are being dropped silently.\nThis one only comes back if you turn it off and then on again; leaving it on does nothing.</string>
<string name="check_detail_notif_off">Off. Call announcements and forwarded notifications never arrive.</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d30f9da..fa07360 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -464,6 +464,7 @@
<string name="check_title_network">网络</string>
<string name="check_title_brain">大脑</string>
<string name="check_title_model">模型连通</string>
+ <string name="check_title_version">版本</string>
<string name="check_title_microphone">麦克风</string>
<string name="check_title_notifications">通知使用权</string>
<string name="check_title_typing_channel">打字通道</string>
@@ -495,6 +496,15 @@
<string name="check_detail_model_balance">服务端返回 %1$s:多半是账户余额不足。去当前服务商的官网充值后再试。</string>
<string name="check_detail_model_name">模型名「%1$s」不在服务端列表里。这台服务上有的:%2$s</string>
<string name="check_detail_model_other">%1$s</string>
+ <!-- 版本这条是全表唯一「关于 App 自己」而不是「关于这台设备」的检查,也是
+ 唯一一次主动往外发东西。%1$s 恒为「该升到的版本」,%2$s 恒为「你手上这个」,
+ 两条文案的参数顺序不许对调。见 SelfCheck.version。 -->
+ <string name="check_detail_version_current">%1$s 已经是最新。</string>
+ <string name="check_detail_version_stale">有新版本 %1$s,你现在是 %2$s。旧的还能用,想换再换。</string>
+ <string name="check_detail_version_forced">请更新到 %1$s —— 你现在这个(%2$s)已经不再支持了。</string>
+ <string name="check_detail_version_offline">没网,先不测。当前 %1$s。</string>
+ <string name="check_detail_version_quota">今天的检查次数用完了,明天恢复。当前 %1$s。</string>
+ <string name="check_detail_version_unreachable">查不到:%1$s。当前是 %2$s。</string>
<string name="check_detail_notif_on">已授权,监听器也连着。</string>
<string name="check_detail_notif_zombie">系统显示「已授权」,但监听器没连上,通知会被静默丢掉。\n这条得关掉再打开一次才行 —— 只打开不生效。</string>
<string name="check_detail_notif_off">没开。来电播报和通知转发都收不到。</string>
diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml
index e269b1d..deec84b 100644
--- a/app/src/main/res/xml/network_security_config.xml
+++ b/app/src/main/res/xml/network_security_config.xml
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
+ <!-- Cleartext hosts have to be named one by one. Android blocks plain HTTP
+ everywhere else, and what it produces ("CLEARTEXT communication to X
+ not permitted by network security policy") surfaces as a version row
+ reading 查不到: an error message about a policy rather than about
+ anything the user did.
+
+ Only one host is listed, and it is not the version service any more.
+ That one moved to https://andee.kuafuai.net, so its cleartext hole was
+ deleted rather than left behind: an exception for a host nobody calls
+ only widens what the app will talk to in the clear. -->
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">124.71.176.202</domain>
</domain-config>
-</network-security-config>
\ No newline at end of file
+</network-security-config>
diff --git a/docs/permissions.md b/docs/permissions.md
index 77eba93..8084b16 100644
--- a/docs/permissions.md
+++ b/docs/permissions.md
@@ -94,9 +94,9 @@ Andee has a vault (`config/Vault.kt`) for the account passwords you enter yourse
## Where your data goes ("do you collect my data?")
-**The conclusion: this project receives nothing about you; but "your data never leaves the device" is false.** Both halves need saying — only stating the first is misleading.
+**The conclusion: no analytics SDK, no crash reporting, no event tracking, no advertising ID; but "this project receives nothing about you" is false too, with exactly one exception — the version check, last row of the table below.** All of it needs saying; stating half of it is misleading.
-**There is no telemetry in this repository.** No analytics SDK, no crash reporting, no event tracking, no device fingerprinting — `firebase` / `analytics` / `sentry` / `crashlytics` are all zero across `app/build.gradle` and `app/src/main/`. If you install it and use it, the authors do not know.
+**First, the part that is not there (grep it yourself):** no analytics SDK, no crash reporting, no event tracking, no advertising ID — `firebase` / `analytics` / `sentry` / `crashlytics` are all zero across `app/build.gradle` and `app/src/main/`. And unless you tap **Check again** on the self-check page, the app sends nothing outward during normal use.
**But data does leave the device, by design:**
@@ -105,9 +105,14 @@ Andee has a vault (`config/Vault.kt`) for the account passwords you enter yourse
| Speech recognition (what you say), speech synthesis (what he says) | **Volcengine (ByteDance) cloud** | `openspeech.bytedance.com` |
| Conversation content, **and every tool result** | The "brain" **you** configured | `brain=local` (the out-of-box default) → `api.deepseek.com`; in hub mode, your own `hub_url` |
| Private notebook (`config/Notebook.kt`: what he remembers about you, what he promised) | **On-device only** | It is `localOnly` and never enters the hub payload |
+| **Version check**: your version number, phone model / brand / OS version, UI language, one random install ID | **A server the maintainers run** (not a third party) | Once on first launch, and once per tap on **Check again**; capped at 10 per IP per day |
The second row deserves spelling out: **a tool result is part of the conversation.** The SMS bodies, contacts, call log, notification content and location he reads, along with his "reading" of the screen, all travel with the conversation to the endpoint you configured.
+**The last row deserves spelling out too, because it is a different kind of thing from the two above it.** Those two go to an endpoint *you* configured; this one comes to us. It carries the version number, the phone model, the brand, the Android release, the UI language, and a random ID this install generated for itself (`body-xxxxxxxx`, new on every reinstall — **not `ANDROID_ID`**). The server necessarily also sees your IP, from which it derives a country / region / city. **It does not carry**: conversation content, screen content, which apps you have installed, contacts, location, crash logs or an advertising ID.
+
+**It cannot be switched off, and that has to be said plainly.** The address is a constant compiled into `device/SelfCheck.kt` (`VERSION_API_BASE` = `https://andee.kuafuai.net`): there is no setting, no build flag, and no `local.properties` key for it. Turning it off means editing that line and rebuilding. The reason it is not configurable is that a check which can be silently misconfigured is a check that silently stops working — this one is meant to be on for everyone or off for everyone. So do not look for a switch in Settings; there is not one.
+
**So "local mode" does not mean "local processing"** — it changes where the brain is, not the fact that data leaves the device. If you genuinely want data to stay in, you have to point `asr_endpoint` / `tts_endpoint` / `llm_base_url` / `hub_url` at a machine you control yourself.
The full allocation of responsibility and the disclaimer are in **[../DISCLAIMER.md](../DISCLAIMER.md)**; prohibited uses are in **[acceptable-use.md](acceptable-use.md)**.
diff --git a/docs/permissions.zh-CN.md b/docs/permissions.zh-CN.md
index ccebca6..099570c 100644
--- a/docs/permissions.zh-CN.md
+++ b/docs/permissions.zh-CN.md
@@ -94,9 +94,9 @@ Andee 有一个保险箱(`config/Vault.kt`),用来存你自己填进去的
## 数据会去哪("你们会不会收集我的数据")
-**结论:本项目收不到你的任何数据;但"数据不出设备"是错的。** 这两句都要说清楚,只讲前一句等于误导。
+**结论:没有统计 SDK、没有崩溃上报、没有埋点、没有广告 ID;但"本项目收不到你的任何数据"也不对 —— 有且只有一处例外,就是下面表里最后那一行「版本自检」。** 这几句都要说清楚,只讲一半等于误导。
-**这个仓库里没有任何遥测。** 没有统计 SDK、没有崩溃上报、没有埋点、没有设备指纹 —— `app/build.gradle` 与 `app/src/main/` 里 `firebase` / `analytics` / `sentry` / `crashlytics` 全部为零。你装了它、用了它,作者不知道。
+**先说不含的那部分(可以自己 grep 验证):** 没有统计 SDK、没有崩溃上报、没有埋点、没有广告 ID —— `app/build.gradle` 与 `app/src/main/` 里 `firebase` / `analytics` / `sentry` / `crashlytics` 全部为零。你不动自检页上的「重新检查」,App 平时也不会往外发任何东西。
**但数据按设计会离开设备:**
@@ -105,9 +105,14 @@ Andee 有一个保险箱(`config/Vault.kt`),用来存你自己填进去的
| 语音识别(你说的话)、语音合成(他说的) | **火山引擎(字节跳动)云端** | `openspeech.bytedance.com` |
| 对话内容,**以及全部工具返回结果** | 你配置的"大脑" | `brain=local`(开箱默认)→ `api.deepseek.com`;hub 模式下走你自己的 `hub_url` |
| 私人笔记本(`config/Notebook.kt`:记住的你、答应过的事) | **只在本机** | 是 `localOnly`,不进 hub 载荷 |
+| **版本自检**:当前版本号、手机型号 / 品牌 / 系统版本、界面语言、一个随机安装 ID | **维护者自己的一台服务器**(不是第三方) | 首次启动一次,以及在自检页点「重新检查」时一次;同一 IP 每天最多 10 次 |
第二行要说透:**工具返回结果就是对话的一部分。** 他读到的短信正文、通讯录、通话记录、通知内容、定位,以及他对屏幕的"理解",都会随对话发到你配的那个端点。
+**最后那一行也要说透,因为它和前两行性质不同:** 前两行发给你自己配的端点,这一行是我们自己收。它带的是版本号、机型、品牌、系统版本、界面语言,以及这个安装自己生成的随机 ID(`body-xxxxxxxx`,重装即换,**不是 `ANDROID_ID`**);服务器还必然看得到你的 IP,并由它解析出国家 / 地区 / 城市。**它不带**:对话内容、屏幕内容、你装了哪些应用、通讯录、定位、崩溃日志、广告 ID。
+
+**关不掉,这一点必须写清楚。** 服务地址是写死在代码里的常量(`device/SelfCheck.kt` 的 `VERSION_API_BASE` = `https://andee.kuafuai.net`),没有设置项、没有编译开关、`local.properties` 里也没有对应键。要停掉它,只能自己改那一行源码再重新编译。这里之所以不做成可开关:一个能被静默配错的检查,就是一个会静默失效的检查;这一行要么对所有人开,要么对所有人关。所以别指望"设置里关掉"——它不存在。
+
**所以"本机模式"不等于"本地处理"** —— 它换的是大脑的目的地,不是"数据留在设备上"这件事。真要数据不出门,你得自己把 `asr_endpoint` / `tts_endpoint` / `llm_base_url` / `hub_url` 全指向你自己控制的机器。
完整的责任划分与免责条款见 **[../DISCLAIMER.zh-CN.md](../DISCLAIMER.zh-CN.md)**;禁止用途见 **[acceptable-use.zh-CN.md](acceptable-use.zh-CN.md)**。