Bug 1267419 - Use application context for showing notifications; r=me, a=sylvestre
☠☠ backed out by 59db6ee36a99 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Tue, 26 Apr 2016 15:34:16 -0400
changeset 333139 125947b0ec85f5d8f5c1ba5849bd096e57437a15
parent 333138 5f53adc1bdfa4180c3740402b16e90edffd47fd3
child 333140 61314f00fede1a8e67a27e8169df43af2cf8eddf
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme, sylvestre
bugs1267419
milestone48.0a2
Bug 1267419 - Use application context for showing notifications; r=me, a=sylvestre Use the application context for showing alert notifications, so we don't rely on GeckoApp activity being created. r=me for trivial change.
mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
@@ -907,17 +907,17 @@ public class GeckoAppShell
         // Put the strings into the intent as an URI "alert:?name=<alertName>&app=<appName>&cookie=<cookie>"
         Uri.Builder b = new Uri.Builder();
         Uri dataUri = b.scheme("alert").path(Integer.toString(notificationID))
                                        .appendQueryParameter("name", aAlertName)
                                        .appendQueryParameter("cookie", aAlertCookie)
                                        .build();
         notificationIntent.setData(dataUri);
         PendingIntent contentIntent = PendingIntent.getActivity(
-                getContext(), 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+                getApplicationContext(), 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
 
         ALERT_COOKIES.put(aAlertName, aAlertCookie);
         callObserver(aAlertName, "alertshow", aAlertCookie);
 
         notificationClient.add(notificationID, aImageUrl, aHost, aAlertTitle, aAlertText, contentIntent);
     }
 
     @WrapForJNI