Data-integrity review: browser visit lost on watcher destroy, export overwrite without truncate, notify drops startOfDay minutes (+2)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 28/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 领域
- mobile, mobile-dev
调研方向
Start with watcher/WebWatcher.kt around onDestroy (410-417): flush the open session via sessionTracker.handleUrl(null, null) before writer.shutdown(), using a Robolectric ServiceController and recording writer to prove it. Then inspect fragments/WebUIFragment.kt writeExport (1070) for the "wt" truncation fix and sendText (167-168) for surrogate-safe chunking. workers/NotifyWorker.kt parseStartOfDayHour (134) needs a LocalTime; the extractor findings at WebWatcher.kt 98/136/140 need a device repro and a privacy decision before changing recording behavior.
由索引模型根据 Issue 内容生成。
描述
Remaining findings from a data-integrity review of aw-android master (aa9cea0). I checked each one against the code. They are not fixed in #407 (DST day window) or #408 (sub-second browser durations), and none of them duplicates an open issue or PR.
1. The browser visit in progress is lost when the accessibility service is destroyed. Two reviewers found this independently. A visit is written only when the URL, browser or window changes. WebWatcher.onDestroy (watcher/WebWatcher.kt:410-417) shuts down writer without first calling sessionTracker.handleUrl(null, null). If the user turns the service off, or the system unbinds it while a page is open, that whole visit is dropped. There is no upper bound on how much is lost: reading one page for 40 minutes loses 40 minutes. Fix: in onDestroy, flush the open session before writer.shutdown(). A test needs a Robolectric ServiceController with a recording writer, because the defect is a missing call that a pure tracker test can't see. A process kill (battery optimisation, app update) loses the visit too. Fixing that would need periodic chunked writes, as MediaPlaybackSegments already does.
2. Saving an export over an existing file can leave the old file's tail behind. WebUIFragment.writeExport (fragments/WebUIFragment.kt:1070) opens the URI with openOutputStream(uri), which means mode "w". Some providers (MediaProvider/FUSE-backed Downloads) don't truncate on "w", so a shorter re-export to the same file ends up with stale bytes after the closing ]. The SAF mirror already uses "wt" for this reason (SyncInterface.kt:605). Fix: openOutputStream(uri, "wt").
3. NotifyWorker drops the minutes of startOfDay. parseStartOfDayHour (workers/NotifyWorker.kt:134) keeps only the hour, so "04:30" becomes 4, while the widget and webui use 04:30. Between 04:00 and 04:30, alerts already query the new day and fire against totals that don't match what the app shows. The fired-key date also changes 30 minutes early. Fix: carry a LocalTime through logicalDayDate, with the logicalDate/logicalDayWindow helpers from #407.
4. Text typed into the address bar may be recorded as page URLs in Chrome, Edge, Samsung Internet and Opera (needs a device repro; privacy). The extractors at watcher/WebWatcher.kt:98, :136 and :140 read url_bar from the event source without ignoreFocused. Brave and the detected Chromium forks pass ignoreFocused = true "to avoid recording typed text" (#307). If typing fires content-changed events whose source includes the focused bar, each partial query becomes a short visit with url="how t". The device test only covers Brave. This changes what gets recorded, so Erik should decide on it.
5. A blob export can split an emoji across a 256K bridge chunk (medium confidence). sendText (WebUIFragment.kt:167-168) slices by UTF-16 code units. A surrogate pair that straddles a chunk boundary is split, and the halves likely reach Java as U+FFFD. Fix: don't end a chunk on a high surrogate.
Checked and found no defect: the usage-stats import cursors, replay and dedupe (read back from the DB, so a kill just replays and merges), timestamp precision, MediaWatcher flushes, the SAF mirror cleanup, and the JSON parse/error paths.
- 主要语言
- Kotlin
- 星标
- 289
- 派生
- 67
- 平均合并
- 8 天 52 分钟
- 30 天内合并 PR
- 8
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ActivityWatch/aw-android 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
ActivityWatch/aw-android#383 · 2 条评论 ·
维护者通常 1 天内回复
-
Web watcher: add support for Brave (`com.brave.browser` missing from KNOWN_BROWSER_PACKAGES)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
ActivityWatch/aw-android#306 · 1 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
AuthSettingsActivity crashes on launch (InflateException: Material attributes under AppCompat theme)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
ActivityWatch/aw-android#210 · 11 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 38/100
ActivityWatch/aw-android#405 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
ActivityWatch/aw-android#402 · 2 条评论 ·
维护者通常 1 天内回复
查看 ActivityWatch/aw-android 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
krelltunez/dayGLANCE#2445 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
-
EANs strippen未关闭good first issue prio:P3
难度 2/5 1-3 小时 新手友好度 72/100
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 72/100
haritpanchal/WakeGuard#16 ·
-
PathSegmentTemplateMatcher accepts conflicting captures for repeated variable names可能已有人在做 @Christiansada 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 64/100
modelcontextprotocol/kotlin-sdk#1217 ·
维护者通常 3 天内回复