-
Notifications
You must be signed in to change notification settings - Fork 616
Finish message broadcast after sending Intent to bound Service. #3919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
gsakakihara
commented
Jul 19, 2022
- Changed to finish the message broadcast as soon as the Intent is sent to the FirebaseMessagingService when binding to the Service. This should reduce the chance that the BroadcastReceiver ANRs in certain circumstances.
- Acquired a WakeLock when using bindService() to send an Intent to FirebaseMessagingService to prevent the device from sleeping while processing the Intent now that the broadcast is finished before the Service has finished handling it.
- Holding the WakeLock for up to 60 seconds for high priority messages to match the behavior for high priority messages when using startService().
- Holding the WakeLock for up to 9 seconds for normal priority messages to match the previous behavior where the broadcast was not forced to finish for 9 seconds.
* Changed to finish the message broadcast as soon as the Intent is sent to the FirebaseMessagingService when binding to the Service. This should reduce the chance that the BroadcastReceiver ANRs in certain circumstances. * Acquired a WakeLock when using bindService() to send an Intent to FirebaseMessagingService to prevent the device from sleeping while processing the Intent now that the broadcast is finished before the Service has finished handling it. - Holding the WakeLock for up to 60 seconds for high priority messages to match the behavior for high priority messages when using startService(). - Holding the WakeLock for up to 9 seconds for normal priority messages to match the previous behavior where the broadcast was not forced to finish for 9 seconds.
Coverage Report 1Affected Products
Test Logs
Notes |
Size Report 1Affected Products
Test Logs
Notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!! 🚢🚢🚢
* Acquired the WakeLock in sendWakefulServiceIntent() before sending the Intent to the Service to avoid a race condition where the service could finish handling the Intent and call completeWakefulIntent() (trying to release the WakeLock) before the WakeLock was acquired.
#3052 No, that one was happening during Application initialization, before the FCM SDK has a chance to do anything. #2014 That issue has a lot of different reports that seem to have a number of causes. This would not help the original report for example (the ANR happened during FirebaseAppImpl.getInstance(), which is also before the FCM SDK does anything), but might improve some of the other reports. It's difficult to tell without more information. |
* Changed to finish the message broadcast as soon as the Intent is sent to the FirebaseMessagingService when binding to the Service. This should reduce the chance that the BroadcastReceiver ANRs in certain circumstances. * Acquired a WakeLock when using bindService() to send an Intent to FirebaseMessagingService to prevent the device from sleeping while processing the Intent now that the broadcast is finished before the Service has finished handling it. - Holding the WakeLock for up to 60 seconds for high priority messages to match the behavior for high priority messages when using startService(). - Holding the WakeLock for up to 9 seconds for normal priority messages to match the previous behavior where the broadcast was not forced to finish for 9 seconds.