Bug 1086994 - Enable crash handling in search activity. r=margaret, a=lsblakk
☠☠ backed out by dd2f144cdf44 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Thu, 23 Oct 2014 16:32:27 -0400
changeset 233901 63bc93801615b4fc9a09df28937f8d731f8a4631
parent 233900 7c69d2736309a7de7d72f57077bcd2075f2604cb
child 233902 0268d5d015030c0f672b35f4ddc374747670d88e
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, lsblakk
bugs1086994
milestone35.0a2
Bug 1086994 - Enable crash handling in search activity. r=margaret, a=lsblakk
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
@@ -1114,16 +1114,17 @@ 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.registerGlobalExceptionHandler();
+        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");
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -124,16 +124,21 @@ public class GeckoAppShell
 
     // We have static members only.
     private GeckoAppShell() { }
 
     private static Thread.UncaughtExceptionHandler systemUncaughtHandler;
     private static boolean restartScheduled;
     private static GeckoEditableListener editableListener;
 
+    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);