Expand FcmLifecycleCallbacks try/catch to cover analytics dispatch#8051
Expand FcmLifecycleCallbacks try/catch to cover analytics dispatch#8051jrodiz wants to merge 1 commit intofirebase:mainfrom
Conversation
Move MessagingAnalytics.shouldUploadScionMetrics + logNotificationOpen calls inside the existing try block so that any RuntimeException from the extras Bundle (including malformed Serializable extras delivered to an exported activity) cannot propagate out of Application.dispatchActivityCreated. Fixes firebase#8049.
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
|
/gemini review |
| } | ||
| if (MessagingAnalytics.shouldUploadScionMetrics(analyticsData)) { | ||
| MessagingAnalytics.logNotificationOpen(analyticsData); | ||
| } |
There was a problem hiding this comment.
Maybe a separate try/catch in case previous scenario fails?
There was a problem hiding this comment.
Code Review
This pull request prevents potential application crashes in FcmLifecycleCallbacks by moving the analytics logging logic inside a try-catch block. This ensures that malformed Intent extras do not cause unhandled exceptions during notification open events. I have no feedback to provide.
Move MessagingAnalytics.shouldUploadScionMetrics + logNotificationOpen calls inside the existing try block so that any RuntimeException from the extras Bundle (including malformed Serializable extras delivered to an exported activity) cannot propagate out of Application.dispatchActivityCreated.
private void logNotificationOpen(Intent startingIntent) { Bundle analyticsData = null; try { Bundle extras = startingIntent.getExtras(); if (extras != null) { … } + if (MessagingAnalytics.shouldUploadScionMetrics(analyticsData)) { + MessagingAnalytics.logNotificationOpen(analyticsData); + } } catch (RuntimeException e) { Log.w(TAG, "Failed trying to get analytics data from Intent extras.", e); } - if (MessagingAnalytics.shouldUploadScionMetrics(analyticsData)) { - MessagingAnalytics.logNotificationOpen(analyticsData); - } }Fixes #8049.