Skip to content

RecorderThread: Work around Android binder BR_FROZEN_REPLY error#823

Merged
chenxiaolong merged 1 commit intomasterfrom
horrible-hack
Feb 27, 2026
Merged

RecorderThread: Work around Android binder BR_FROZEN_REPLY error#823
chenxiaolong merged 1 commit intomasterfrom
horrible-hack

Conversation

@chenxiaolong
Copy link
Owner

@chenxiaolong chenxiaolong commented Feb 27, 2026

For whatever reason, when calling DocumentsContract.createDocument() for a URI served by local storage (com.android.externalstorage), the binder call will fail with:

W/libbinder.IPCThreadState(27223): Transaction failed because process frozen.
I/binder  (27302): 27302:27223 dead process or thread
E/libbinder.IPCThreadState(27223): Binder transaction failure. id: 3705901, cmd: BR_FROZEN_REPLY (29202), error: 0 (Success)
D/ActivityThread(27223): Too many transaction errors, throttling freezer binder callback.
E/JavaBinder(27223): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 736)

This seems to happen more frequently when ending a call immediately after connection or when receiving a call from a private number. There is likely a horrible race condition somewhere in Android as these are calls that any app is allowed to perform at any time. BCR isn't doing anything out of the ordinary here.

After some experimentation, it looks like this can be worked around by making binder calls to com.android.externalstorage sooner. This commit adds a dumb query for the name of the output directory before the call recording begins. This appears to be sufficient even after letting the call stay active for several minutes and dumpsys activity processes showing com.android.externalstorage as being frozen again.

Fixes: #638
Fixes: #732
Fixes: #819

For whatever reason, when calling DocumentsContract.createDocument()
for a URI served by local storage (com.android.externalstorage), the
binder call will fail with:

    W/libbinder.IPCThreadState(27223): Transaction failed because process frozen.
    I/binder  (27302): 27302:27223 dead process or thread
    E/libbinder.IPCThreadState(27223): Binder transaction failure. id: 3705901, cmd: BR_FROZEN_REPLY (29202), error: 0 (Success)
    D/ActivityThread(27223): Too many transaction errors, throttling freezer binder callback.
    E/JavaBinder(27223): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 736)

This seems to happen more frequently when ending a call immediately
after connection or when receiving a call from a private number. There
is likely a horrible race condition somewhere in Android as these are
calls that any app is allowed to perform at any time. BCR isn't doing
anything out of the ordinary here.

After some experimentation, it looks like this can be worked around by
making binder calls to com.android.externalstorage sooner. This commit
adds a dumb query for the name of the output directory before the call
recording begins. This appears to be sufficient even after letting the
call stay active for several minutes and `dumpsys activity processes`
showing com.android.externalstorage as being frozen again.

Fixes: #638
Fixes: #732
Fixes: #819

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong chenxiaolong merged commit d341873 into master Feb 27, 2026
1 check passed
chenxiaolong added a commit that referenced this pull request Feb 27, 2026
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong chenxiaolong deleted the horrible-hack branch February 27, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant