Bug 934345 - Move NotificationHelper initialization to GeckoApp since it was being initialized twice when more than one process were active. r=wesj, a=bajaj
authorFederico Paolinelli <fedepaol@gmail.com>
Mon, 11 Nov 2013 11:17:02 -0500
changeset 167529 6ebf8f6c224689277b11c43c05315e04a6bb5c84
parent 167528 af4713bfdd0764c9d029236e0fac78c951b806a4
child 167530 8bd6eb01394e2f5e1f9c3df06c428513884ef817
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, bajaj
bugs934345
milestone27.0a2
Bug 934345 - Move NotificationHelper initialization to GeckoApp since it was being initialized twice when more than one process were active. r=wesj, a=bajaj
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoApplication.java
mobile/android/base/NotificationHelper.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1301,16 +1301,17 @@ abstract public class GeckoApp
                                                             dispatcher,
                                                             osLocale,
                                                             osLocale,    // Placeholder.
                                                             previousSession);
             }
         });
 
         GeckoAppShell.setNotificationClient(makeNotificationClient());
+        NotificationHelper.init(getApplicationContext());
     }
 
     protected void initializeChrome() {
         mDoorHangerPopup = new DoorHangerPopup(this, null);
         mPluginContainer = (AbsoluteLayout) findViewById(R.id.plugin_container);
         mFormAssistPopup = (FormAssistPopup) findViewById(R.id.form_assist_popup);
 
         if (mCameraView == null) {
--- a/mobile/android/base/GeckoApplication.java
+++ b/mobile/android/base/GeckoApplication.java
@@ -93,17 +93,16 @@ public class GeckoApplication extends Ap
     protected boolean needsRestart() {
         return mNeedsRestart;
     }
 
     @Override
     public void onCreate() {
         HardwareUtils.init(getApplicationContext());
         Clipboard.init(getApplicationContext());
-        NotificationHelper.init(getApplicationContext());
         GeckoLoader.loadMozGlue();
         super.onCreate();
     }
 
     public boolean isApplicationInBackground() {
         return mInBackground;
     }
 
--- a/mobile/android/base/NotificationHelper.java
+++ b/mobile/android/base/NotificationHelper.java
@@ -25,17 +25,17 @@ import android.util.Log;
 
 import java.util.Set;
 import java.util.HashSet;
 
 public final class NotificationHelper implements GeckoEventListener {
     public static final String NOTIFICATION_ID = "NotificationHelper_ID";
     private static final String LOGTAG = "GeckoNotificationManager";
     private static final String HELPER_NOTIFICATION = "helperNotif";
-    private static final String HELPER_BROADCAST_ACTION = "helperBroadcastAction";
+    private static final String HELPER_BROADCAST_ACTION = AppConstants.ANDROID_PACKAGE_NAME + ".helperBroadcastAction";
 
     // Attributes mandatory to be used while sending a notification from js.
     private static final String TITLE_ATTR = "title";
     private static final String TEXT_ATTR = "text";
     private static final String ID_ATTR = "id";
     private static final String SMALLICON_ATTR = "smallIcon";
 
     // Attributes that can be used while sending a notification from js.
@@ -64,16 +64,17 @@ public final class NotificationHelper im
     private static NotificationHelper mInstance;
 
     private NotificationHelper() {
     }
 
     public static void init(Context context) {
         if (mInstance != null) {
             Log.w(LOGTAG, "NotificationHelper.init() called twice!");
+            return;
         }
         mInstance = new NotificationHelper();
         mContext = context;
         mClearableNotifications = new HashSet<String>();
         registerEventListener("Notification:Show");
         registerEventListener("Notification:Hide");
         registerReceiver(context);
     }