Skip to content

fix(invite): resolve invite channels off the main thread - #1594

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/invite-controller-anr
Sep 28, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/invite-controller-anr

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

InternalInviteController resolved its invite channels in the constructor. Hilt builds it on the main thread when MainActivity is injected, and loading the SMS and WhatsApp labels and icons reads those apps' APKs. On 2026.9.1 that produced three Bugsnag ANRs on OPPO and Xiaomi devices, each with the main thread in ResolveInfo.loadLabel / getApplicationLabel under resolveChannels.

channels now starts empty and fills in from the IO dispatcher. refresh() takes the same path. The invite sheet already collects channels as state, so a sheet opened in the first moments after launch shows the options once they resolve.

InternalInviteControllerTest covers both halves: construction doesn't touch PackageManager, and the channels (SMS, More) arrive once the dispatcher runs. Making refresh() synchronous again fails the first test.

InternalInviteController called resolveChannels() in its constructor, and
Hilt builds it on the main thread when MainActivity is injected. Loading the
SMS and WhatsApp labels and icons reads those apps' APKs, which ANR'd on
2026.9.1 (three Bugsnag events on OPPO and Xiaomi devices, all stuck in
ResolveInfo.loadLabel / getApplicationLabel under resolveChannels).

Channels now start empty and resolve on the IO dispatcher. refresh() uses the
same path.
@bmc08gt bmc08gt self-assigned this Sep 28, 2026
@github-actions github-actions Bot added the type: fix Bug fix label Sep 28, 2026
@bmc08gt
bmc08gt merged commit a0d82e1 into code/cash Sep 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant