mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
MediaControl registered its AudioPlaybackCallback with a null Handler, binding delivery to the main looper. Both the callback body and the constructor's seed read call AudioManager.isMusicActive, a binder transaction into AudioService, producing two ANR clusters: one in onPlaybackConfigChanged and one in <init>, the latter on the cold-start critical path since MediaControl is constructed during App.onCreate. Registration and seeding now run on a dedicated, injected Handler backed by a "CAPod-MediaControl" HandlerThread, and the callback is delivered on that same looper. Registration happens before seeding so a transition during registration is queued behind the seed instead of being lost. The handler is constructor-injected via a new @AudioCallbackHandler qualifier so unit tests can drive it without Robolectric.