WebWatcher: keyboard events still split visits in detected browsers (browserIsActiveWindow checks only the hard-coded list)

Đang mở Phù hợp với người mới
#435 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@TimeToBuildBob đang làm issue này rồi.

Từ ngày 4/12/2026.

  • #437 của @TimeToBuildBob — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, kotlin
Lĩnh vực
mobile

Hướng nghiên cứu

Đọc watcher/WebWatcher.kt:318-325 và so sánh browserIsActiveWindow với isKnownBrowser cũng như bước kiểm tra trình duyệt được phát hiện đang hoạt động quanh các dòng 229-230. Dùng bài kiểm thử sự kiện bàn phím Robolectric được cung cấp làm điểm bắt đầu; issue cho biết test harness là WebWatcherDestroyTest. Hoàn tất khi bài kiểm thử chạy qua và các sự kiện bàn phím không còn chia lượt truy cập đối với các trình duyệt đang hoạt động đã được phát hiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

browserIsActiveWindow() (watcher/WebWatcher.kt:318-325) checks only KNOWN_BROWSER_PACKAGES. Visits are also opened for runtime-detected browsers (detectedBrowsers + probeMemory.isActive, lines 229-230). So for Vivaldi, DuckDuckGo, Kiwi and other detected browsers, any keyboard or overlay event from another window ends the visit (lines 239-242). That is the split #342 fixed, and the fix only applies to the hard-coded list.

This is deterministic and doesn't depend on any event's source node.

Failing test (Robolectric, same harness as WebWatcherDestroyTest; full file available on request):

    fun `keyboard event does not end a visit in a detected browser`() {
        val vivaldi = "com.vivaldi.browser"
        val writer = installRecordingWriter()
        setField("probeMemory", BrowserProbeMemory(null) {})
        setField("detectedBrowsers", mapOf(vivaldi to 1L))
        tracker().handleUrl("example.org", vivaldi)
        setField("lastWindowId", browserWindow)

        activeRoot(vivaldi)
        service.onAccessibilityEvent(event(keyboard, keyboardWindow))

        assertEquals("A keyboard event must not split a detected browser's visit", 0, writer.submitted)
        assertEquals(vivaldi, tracker().currentBrowser)
        assertEquals("example.org", tracker().handleUrl(null, null)?.url)
    }

Today one visit is written and the session is closed.

Fix direction: in browserIsActiveWindow, treat the active root's package as a browser if it is in KNOWN_BROWSER_PACKAGES or is an active detected browser, using the same predicate as isKnownBrowser.

Priority: medium (split visits for every detected browser while typing). This repo only has a priority: high label, so no priority label is set.

fingerprint: watcher/WebWatcher.kt — browserIsActiveWindow ignores detected browsers; keyboard events split their visits

Confirmed by code read on master 3b820d61, and independently re-checked. The test has not been run (no JDK on my host).

Ngôn ngữ chính
Kotlin
Star
291
Fork
73
Merge trung bình
4 ngày 5 giờ
Pull request đã merge (30 ngày)
27

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ActivityWatch/aw-android

Tất cả issue của ActivityWatch/aw-android

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.