Bug 1086994 - Enable crash handling in search activity; r=margaret
authorJim Chen <nchen@mozilla.com>
Thu, 23 Oct 2014 16:32:27 -0400
changeset 211988 c16d0c10a89b6be128520c51fa0ffb806eab0d41
parent 211987 c1d9f1ea81e992f6df3fe8937f3166f28d6dc5ba
child 211989 63a25da1a5a085b09a61d9ef9e627d13f814b4cb
push id9537
push usernchen@mozilla.com
push dateThu, 23 Oct 2014 20:34:35 +0000
treeherderfx-team@db5b15cbf5db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1086994
milestone36.0a1
Bug 1086994 - Enable crash handling in search activity; r=margaret
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoAppShell.java
mobile/android/search/java/org/mozilla/search/SearchActivity.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1120,16 +1120,18 @@ public abstract class GeckoApp
      * Called when the activity is first created.
      *
      * Here we initialize all of our profile settings, Firefox Health Report,
      * and other one-shot constructions.
      **/
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
+        GeckoAppShell.ensureCrashHandling();
+
         // Enable Android Strict Mode for developers' local builds (the "default" channel).
         if ("default".equals(AppConstants.MOZ_UPDATE_CHANNEL)) {
             enableStrictMode();
         }
 
         // The clock starts...now. Better hurry!
         mJavaUiStartupTimer = new Telemetry.UptimeTimer("FENNEC_STARTUP_TIME_JAVAUI");
         mGeckoReadyStartupTimer = new Telemetry.UptimeTimer("FENNEC_STARTUP_TIME_GECKOREADY");
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -185,16 +185,21 @@ public class GeckoAppShell
             if (AppConstants.MOZ_CRASHREPORTER && AppConstants.MOZILLA_OFFICIAL) {
                 // Only use Java crash reporter if enabled on official build.
                 return super.reportException(thread, exc);
             }
             return false;
         }
     };
 
+    public static CrashHandler ensureCrashHandling() {
+        // Crash handling is automatically enabled when GeckoAppShell is loaded.
+        return CRASH_HANDLER;
+    }
+
     private static final Queue<GeckoEvent> PENDING_EVENTS = new ConcurrentLinkedQueue<GeckoEvent>();
     private static final Map<String, String> ALERT_COOKIES = new ConcurrentHashMap<String, String>();
 
     private static volatile boolean locationHighAccuracyEnabled;
 
     // Accessed by NotificationHelper. This should be encapsulated.
     /* package */ static NotificationClient notificationClient;
 
--- a/mobile/android/search/java/org/mozilla/search/SearchActivity.java
+++ b/mobile/android/search/java/org/mozilla/search/SearchActivity.java
@@ -1,14 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.search;
 
+import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.LocaleAware;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Telemetry;
 import org.mozilla.gecko.TelemetryContract;
 import org.mozilla.gecko.db.BrowserContract.SearchHistory;
 import org.mozilla.gecko.health.BrowserHealthRecorder;
 import org.mozilla.search.autocomplete.SearchBar;
 import org.mozilla.search.autocomplete.SuggestionsFragment;
@@ -87,16 +88,18 @@ public class SearchActivity extends Loca
     private View animationCard;
 
     // Suggestion card background padding.
     private int cardPaddingX;
     private int cardPaddingY;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        GeckoAppShell.ensureCrashHandling();
+
         super.onCreate(savedInstanceState);
         setContentView(R.layout.search_activity_main);
 
         suggestionsFragment = (SuggestionsFragment) getSupportFragmentManager().findFragmentById(R.id.suggestions);
         postSearchFragment = (PostSearchFragment)  getSupportFragmentManager().findFragmentById(R.id.postsearch);
 
         searchEngineManager = new SearchEngineManager(this);
         searchEngineManager.setChangeCallback(this);