Repository navigation
fix(ancs): wait for the app's name before a new app's first popup - #344
Conversation
zackb
left a comment
There was a problem hiding this comment.
I think this is the right approach and better than what currently ships.
I am slightly concerned with the hold condition delaying the the whole on_notification. Would this slow down OTP/GUI broadcast/observe_message_notification, timestamps at emit. If "Messages" never pops up, but its first notification still waits. The PR text says "a notification that would pop up". To make the code match, add should_show_desktop_popup(notification) to the hold condition I think. This respects the "muted" and disabled settings.
| @@ -521,10 +527,16 @@ namespace tether::bluetooth::ancs { | |||
| if (!response.app_id.empty() && !name.empty()) { | |||
There was a problem hiding this comment.
nit: i think this if can be merged? and not write app_names[response.app_id] twice
There was a problem hiding this comment.
Done: one if, app_names written once, and the lock isn't held during emit.
| } | ||
|
|
||
| void HeldPopups::hold(Notification notification, int64_t now) { | ||
| held_.push_back({std::move(notification), now + WAIT_SECONDS}); |
There was a problem hiding this comment.
if the same uid is held twice (replay spams) it will show two popups? I think this should overwrite instead of append. But i could be wrong. g_ancs_popups[uid] on line 493 ish
There was a problem hiding this comment.
Good catch. It now replaces the held entry in place (keeping its deadline), with a test.
The first notification from an app asks the phone for the app's display name,
but the popup was shown at once, with a name guessed from the bundle id
("IAliexpress" for com.alibaba.iAliexpress); the list caught up a moment
later, the popup never did.
A notification that would pop up now waits for its app's name, at most two
seconds (HeldPopups, with unit tests). The answer releases it renamed; a
timeout or an answer with no name releases it with the guess, and the guess is
remembered so that app's later notifications do not wait again. Backlog never
pops up, so the replay at session start is never held. A session that ends
releases what it held.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks! Good call on the hold condition: it now only holds what |
c80517c to
ad72c43
Compare
Problem
The first notification from an app asks the phone for the app's display name, but the popup is shown straight away with a name guessed from the bundle id. So AliExpress (
com.alibaba.iAliexpress) pops up as "IAliexpress". The notification list is fixed up when the name arrives a moment later, but the popup never is.Change
A notification that would pop up waits for its app's name, for up to 2 s (
HeldPopups):Only an app's first notification in a session can wait. The name is cached after that.
Testing
HeldPopups: release by app, expiry and release-all. The suite passes (654).🤖 Generated with Claude Code