firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.23k stars 565 forks source link

App Crash due to firebase-messaging's unsolicited directBootAware service #6047

Closed gipartha closed 1 week ago

gipartha commented 1 week ago

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Google Play Console Crash Link here

From the direct boot mode Android documentation, it's clear that this crash can occur only if some component is registering for direct boot mode. No component in our app does this and from the merged manifest we could find that below Firebase components are using the same.

<service
    android:name="com.google.firebase.components.ComponentDiscoveryService"
    android:directBootAware="true"
    android:exported="false" >
    ...
</service>

<service
    android:name="com.google.firebase.messaging.FirebaseMessagingService"
    android:exported="false"
    android:directBootAware="true">
    ...
</service>

<provider
    android:name="com.google.firebase.provider.FirebaseInitProvider"
    android:exported="false"
    android:authorities="com.microsoft.skype.teams.dev.firebaseinitprovider"
    android:initOrder="100"
    android:directBootAware="true" />

Steps to reproduce:

We have been observing this app crash due to IllegalStateException in Play Console: Screenshot 2024-06-19 at 11 30 42 AM Issue is seen across all OS versions. This crash majorly occurs on Oneplus and Huwaie devices more. (Samsung, RealMe also can be found though) And we are unable to repro this issue locally.

Seems like this has been already reported here and closed without any fix from Firebase side. Hence requesting to provide some options to disable the direct boot aware attribute which is enabled by default for the Firebase components mentioned above or a fix which doesn't start our app on direct boot mode due to Firebase component launch.

Relevant Code:

// TODO(you): code here to reproduce the problem
google-oss-bot commented 1 week ago

I found a few problems with this issue:

lehcar09 commented 1 week ago

Hi @gipartha, thanks you for reaching out. The issue you're experiencing is manufacturer/ OEM specific. Unfortunately, without being able to replicate the issue it will be difficult to conduct a deeper investigation.

For now, I suggest try adding the tools:remove the android:directBootAware from ComponentDiscoveryService in the merged manifest as suggested in here.

That said, I'll close this for now. If there are more developers that are encountering this issue and can share an MCVE then we can prioritize a deeper investigation and reopen this thread. Thank you!

gipartha commented 1 week ago

HI As I mentioned earlier it's occurring in all manufacturer devices. Not sure why you need local repro for the issues which are getting reported in the play console.

May I know what you mean by MCVE? Also will you be able to get whether all app developers who use Firebase are facing this issue or not with some telemetry at your end?

The problem with tools:remove is code maintainability: