-
Notifications
You must be signed in to change notification settings - Fork 668
Description
[REQUIRED] Step 2: Describe your environment
- Android Studio version: Ladybug 2024.2.1
- Firebase Component: Analytics (via measurementdynamite dynamite module)
- Component version: Firebase BOM 33.0.0 / measurementdynamite@[email protected]
- Platform: Android TV (minSdk 24, targetSdk 35)
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
Firebase Analytics causes ANRs on Android TV devices when the measurementdynamite module performs a synchronous binder IPC call to Google Play Services on the main thread.
Impact: 100 ANR events affecting 57 users in the last 7 days.
What happens:
- App logs an analytics event via FirebaseAnalytics.logEvent()
- Event is dispatched to measurementdynamite dynamite module
- Module's internal Handler (m7.fx.handleMessage) processes event on the main thread
- Handler chain calls m7.ge.m() which makes a synchronous binder transaction
- Main thread blocks in IPCThreadState::waitForResponse() waiting for Google Play Services
- If Play Services is slow to respond (busy, restarting, memory pressure), ANR occurs
ANR Stack Trace (main thread):
main (native):tid=1 systid=3300
#00 pc 0x71258 libc.so (__ioctl + 8)
#1 pc 0x3f2cb libc.so (ioctl + 26)
#2 pc 0x39c1b libbinder.so (android::IPCThreadState::talkWithDriver(bool) + 238)
#3 pc 0x3a855 libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*) + 32)
#4 pc 0x3a62b libbinder.so (android::IPCThreadState::transact(...) + 126)
#5 pc 0x35327 libbinder.so (android::BpBinder::transact(...) + 98)
#6 pc 0xc7ecf libandroid_runtime.so (android_os_BinderProxy_transact(...) + 82)
at android.os.BinderProxy.transactNative(Native method)
at android.os.BinderProxy.transact(BinderProxy.java:540)
at m7.ge.m(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):187)
at m7.gb.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):14)
at m7.gd.b(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):7)
at m7.fu.c(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):7)
at m7.fx.handleMessage(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):265)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7848)
Why this is not controllable by app developers:
The blocking code is inside Google's measurementdynamite dynamite module (loaded from Google Play Services), not the Firebase SDK embedded in the app. Updating Firebase SDK version does not change this behavior.
Expected behavior:
Firebase Analytics should not perform synchronous binder IPC on the main thread. Event processing should be fully asynchronous to prevent ANRs.
Suggested fix:
Move the binder transaction in m7.ge.m() off the main thread or use asynchronous binder mechanisms.
Relevant Code:
// Standard Firebase Analytics usage - nothing unusual
FirebaseAnalytics.getInstance(context).logEvent("event_name", bundle)
// The ANR occurs inside the dynamite module, not in app code.
// App has no control over how measurementdynamite processes events.