Bug 1550291 - Add new "Crash handler" notification channel; r=JanH, a=RyanVM
authorPetru Lingurar <petru.lingurar@softvision.ro>
Fri, 07 Jun 2019 08:01:46 +0000
changeset 536940 a74afc1a7a210a327a623a075c5c206ef08e60ed
parent 536939 3a6ccd26874306b6d9cf9c3c32290fa98dbf247d
child 536941 22cfa63e856377c0b7f502d194d4b17dc0c3acc9
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJanH, RyanVM
bugs1550291
milestone68.0
Bug 1550291 - Add new "Crash handler" notification channel; r=JanH, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D33028
mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/strings.xml.in
--- a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java
@@ -115,16 +115,20 @@ public final class NotificationHelper im
         /**
          * Leanplum notification channel - use only when <code>AppConstants.MOZ_ANDROID_MMA</code> is true.
          */
         LP_DEFAULT,
         /**
          * HTML5 web site notifications
          */
         SITE_NOTIFICATIONS,
+        /**
+         * Crash handler notification used on Android Q+
+         */
+        CRASH_HANDLER,
     }
 
     // Holds the mapping between the Channel enum used by the rest of our codebase and the
     // channel ID used for communication with the system NotificationManager.
     // How to determine the initialCapacity: Count all channels (including the Updater, which is
     // only added further down in initNotificationChannels), multiply by 4/3 for a maximum load
     // factor of 75 % and round up to the next multiple of two.
     private final Map<Channel, String> mDefinedNotificationChannels = new HashMap<Channel, String>(16) {{
@@ -145,16 +149,19 @@ public final class NotificationHelper im
             put(Channel.LP_DEFAULT, LP_DEFAULT_CHANNEL_TAG);
         }
 
         final String SYNCED_TABS_CHANNEL_TAG = "synced-tabs-notification-channel";
         put(Channel.SYNCED_TABS, SYNCED_TABS_CHANNEL_TAG);
 
         final String SITE_NOTIFICATIONS_CHANNEL_TAG = "site-notifications";
         put(Channel.SITE_NOTIFICATIONS, SITE_NOTIFICATIONS_CHANNEL_TAG);
+
+        final String CRASH_HANDLER_CHANNEL_TAG = "crash-handler";
+        put(Channel.CRASH_HANDLER, CRASH_HANDLER_CHANNEL_TAG);
     }};
 
     // These are channels we no longer require and want to retire from Android's settings UI.
     private final List<String> mDeprecatedNotificationChannels = new ArrayList<>(Arrays.asList(
             "default-notification-channel",
             null
     ));
 
@@ -270,16 +277,23 @@ public final class NotificationHelper im
 
                 case SITE_NOTIFICATIONS: {
                     channel = new NotificationChannel(mDefinedNotificationChannels.get(definedChannel),
                             mContext.getString(R.string.site_notifications_channel),
                             NotificationManager.IMPORTANCE_DEFAULT);
                 }
                 break;
 
+                case CRASH_HANDLER: {
+                    channel = new NotificationChannel(mDefinedNotificationChannels.get(definedChannel),
+                            mContext.getString(R.string.crash_handler_notifications_channel),
+                            NotificationManager.IMPORTANCE_HIGH);
+                }
+                break;
+
                 case DEFAULT:
                 default: {
                     channel = new NotificationChannel(mDefinedNotificationChannels.get(definedChannel),
                             mContext.getString(R.string.default_notification_channel2),
                             NotificationManager.IMPORTANCE_LOW);
                 }
                 break;
             }
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -927,8 +927,9 @@ Picture-in-picture mini window -->
 <!ENTITY media_notification_channel2 "Sound and video">
 <!-- These push notifications come without a specific channel and/or name from Leanplum -->
 <!ENTITY leanplum_default_notifications_channel2 "&vendorShortName; tips and tricks">
 <!ENTITY updater_notification_channel "App updates">
 <!ENTITY synced_tabs_notification_channel "Synced tabs">
 <!-- LOCALIZATION NOTE (site_notifications_channel): This is for system notifications displayed by
 web sites through the HTML Notifications API. -->
 <!ENTITY site_notifications_channel "Site notifications">
+<!ENTITY crash_handler_notifications_channel "&brandShortName; Crash Reporter">
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -662,9 +662,10 @@
   <string name="default_notification_channel2">&default_notification_channel2;</string>
   <string name="mls_notification_channel">&mls_notification_channel;</string>
   <string name="media_notification_channel2">&media_notification_channel2;</string>
   <string name="download_notification_channel">&download_notification_channel;</string>
   <string name="leanplum_default_notifications_channel2">&leanplum_default_notifications_channel2;</string>
   <string name="updater_notification_channel">&updater_notification_channel;</string>
   <string name="synced_tabs_notification_channel">&synced_tabs_notification_channel;</string>
   <string name="site_notifications_channel">&site_notifications_channel;</string>
+  <string name="crash_handler_notifications_channel">&crash_handler_notifications_channel;</string>
 </resources>