Repository navigation
feat(android): browser autodetect (rebased from #311) - #372
Conversation
Treat every app that opens generic https links as a browser and try the Chromium and then the Gecko URL bar on it. The list is refreshed on package install/remove, so events from non-browser apps still cost only a set lookup. Link: ActivityWatch#306 Git-Session-Id: 8f3abcba-eb82-5e1d-8b22-3d4382a852ad
…f non-browsers exponentially up to 30 minutes Git-Session-Id: 8f3abcba-eb82-5e1d-8b22-3d4382a852ad
…ent's package Git-Session-Id: 8f3abcba-eb82-5e1d-8b22-3d4382a852ad
Git-Session-Id: 8f3abcba-eb82-5e1d-8b22-3d4382a852ad
[Medium impact] Adds browser detection and probing logic to the web watcher. Fix the missed URL retry before merging so first visits in newly detected browsers are not silently lost. Findings
SummaryAdds automatic discovery and URL tracking for browsers without dedicated readers.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Service starts or package changes] --> B[Find generic HTTPS handlers]
B --> C[Exclude built-in browsers and this app]
C --> D[Publish package versions]
E[Browser accessibility event] --> F{Probe due?}
D --> F
F -->|No| G[Skip event]
F -->|Yes| H[Try saved style or both readers]
H -->|URL found| I[Save style and update browser session]
H -->|No URL| J[Save backoff deadline]
J --> F
Reviews (1) · Last reviewed commit: "perf(web-watcher): detect browsers off t..." · Reviewed by Greptile |
Git-Session-Id: b74bbd85-3466-50df-bd8c-5592bea685c6
🤖 AI code reviewAdds PackageManager-based browser autodetection for browsers not in KNOWN_BROWSER_PACKAGES. New BrowserDetection.kt filters resolved HTTPS handlers; new BrowserProbeMemory.kt persists per-package/versionCode probe state (Chromium/Gecko style, failure backoff) as JSON in SharedPreferences. WebWatcher.kt integrates detection on a single-thread executor, re-runs on package broadcasts, probes unknown browsers via probeMemory, and schedules a follow-up probe when a package is backed off. Adds unit tests for detection, probe memory, and Robolectric retry behavior. Needs a look — P2 onlyConfidence 4/5 1 finding ·
|
| commit | score | findings | engine | when |
|---|---|---|---|---|
5bb0361c9393 |
5/5 | 0 | llm | 2026-10-19 11:43 UTC |
Reviewed 5bb0361c9393 · openrouter/deepseek/deepseek-v4-flash-0731 · llm engine · 160s · about this reviewer
Maintainer commands
@TimeToBuildBob review (own line) — fresh review · @TimeToBuildBob fix — a worker acts on the findings. Once per comment; 👀 = received.
Rebased and conflict-resolved version of #311 by @GRbit.
With #307 (Brave) and #312 (Vanadium/IronFox/Fennec) merged, the built-in extractors now cover those browsers. This PR adds discovery and tracking for browsers not in
KNOWN_BROWSER_PACKAGES— e.g. Cromite, Mull, DuckDuckGo — usingPackageManagerto find installed generic HTTPS handlers.What this does
BrowserDetection.kt: queries installed generic HTTPS handlers and filters out known-browser packages, yielding a set of candidates for autodetectBrowserProbeMemory.kt: per-package/versionCode memory that learns which URL bar style (Chromium or Gecko) worked, with exponential backoff (up to 30 min) for packages that never produce a URLWebWatcher.kt: integrates detection and probe memory;refreshDetectedBrowsers()runs off the main thread and re-runs on package install/remove/change broadcastsConflict resolution (over #311 → master)
The only conflicting file was
WebWatcher.kt(mechanical):Handler/Looper/SystemClock/Executorswith the PR's broadcast/PackageManager importsextractChromiumUrl/extractGeckoUrl— dropped the duplicate copies the cherry-pick introducedonDestroy(): kept master'smainHandler.removeCallbacksAndMessages(null)+writer.shutdown()alongside the PR'sunregisterReceiver(...)One substantive fix applied during rebase: the
CHROMIUMprobe path inin detectedBrowsersnow usesrootInActiveWindowwithignoreFocused = true(same ascom.brave.browser). Page events in Chromium forks don't include the toolbar, and a focused address bar shows typed text — using root + ignoreFocused avoids recording incomplete/search text as a URL.Note
The manual test in the original PR (Fennec, IronFox, Vanadium) no longer exercises autodetect — those packages are now in
KNOWN_BROWSER_PACKAGESand routed to dedicated extractors. To test autodetect, use a browser that's still unlisted: Cromite, Mull, or DuckDuckGo for Android.Co-authored-by: Pavel Griaznov grbitt@gmail.com