Repository navigation
Conversation
|
This was referenced Oct 8, 2026
0xbrayo
force-pushed
the
fix/unlock-event-duplicates
branch
from
October 8, 2026 19:37
6e4dd4b to
8ea40d1
Compare
Member
Author
Unlocks were re-read from the start of the last stored session, so every run re-sent all unlocks since then. The server only merges a heartbeat into the newest event in a bucket, so all but the last were inserted again and unlock counts grew with every ingest run.
0xbrayo
force-pushed
the
fix/unlock-event-duplicates
branch
from
October 11, 2026 13:13
8ea40d1 to
f0ecdd5
Compare
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #333.
SessionEventWatcherused the start of the last stored session as the lower bound for both the session query and the unlock (KEYGUARD_HIDDEN) query. Every run therefore re-sent every unlock since that session started.Unlocks are sent as heartbeats with
pulsetime = 0. The server only merges a heartbeat into the newest event in the bucket, and refuses to merge one older than it, so on each run only the newest unlock merged and every older one in the window was inserted again. Runs happen hourly, on every app open and on widget refresh, so unlock counts kept inflating.Change
getLastEventTime()takes the bucket id.aw-watcher-android-unlock; sessions keep their own cursor.A fresh unlock bucket still starts from 0, which is correct because nothing has been stored there yet.
Testing
./gradlew :mobile:testStandardDebugUnitTestpasses.SessionEventWatcher, which needs a liveRustInterfaceandUsageStatsManager, so this has no new unit test.Tested on an emulator
Setup: arm64 emulator (API 37, 16 KB pages), debug builds of both versions.
master(26fdffa) with aw-server-rust 70ba50d.test/all-fixes, all of Correctness and performance issues in watchers, sync and workers #333's PRs combined, so this fix is not exercised in isolation.Data was read back through the app's REST API, and imports were triggered with the app's exported
LOG_DATAalarm action while another app stayed in front.The test enabled the swipe lock screen, then did 5 lock/unlock cycles with Settings in front. Each unlock was kept under a second, so no session was recorded between them. It then ran 4 imports. Android's own usage stats confirmed the
KEYGUARD_HIDDENevents.