Part 4a: Remove ensureCrashHandling. r=jchen draft
authorNick Alexander <nalexander@mozilla.com>
Fri, 18 Nov 2016 17:35:32 -0800
changeset 445770 6b981856ee6b30aa622d9378e5acc33b6802da55
parent 445769 9ea074a7313f7cf210ff55cd4365ba0ebb2dffbe
child 445771 646e4054a4391f5709d5fa8725121a78f4ac92f7
push id37604
push usernalexander@mozilla.com
push dateWed, 30 Nov 2016 07:13:23 +0000
reviewersjchen
milestone53.0a1
Part 4a: Remove ensureCrashHandling. r=jchen Once upon a time, this might have done something, but now it's just cruft. This patch series will simplify crash handler registration by addressing crash handling per-process. MozReview-Commit-ID: 5sIdeDCfC1e
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/GeckoService.java
mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoServiceChildProcess.java
mobile/android/search/java/org/mozilla/search/SearchActivity.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -1091,18 +1091,16 @@ 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();
         }
 
         if (!HardwareUtils.isSupportedSystem()) {
             // This build does not support the Android version of the device: Show an error and finish the app.
             mIsAbortingAppLaunch = true;
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
@@ -82,17 +82,16 @@ public class GeckoService extends Servic
             Log.d(LOGTAG, "Unregistered listener");
         }
         EventDispatcher.getInstance().unregisterGeckoThreadListener(EVENT_LISTENER,
                 "Gecko:ScheduleRun");
     }
 
     @Override // Service
     public void onCreate() {
-        GeckoAppShell.ensureCrashHandling();
         GeckoThread.onResume();
         super.onCreate();
 
         if (DEBUG) {
             Log.d(LOGTAG, "Created");
         }
     }
 
@@ -214,17 +213,16 @@ public class GeckoService extends Servic
             }
             return;
         }
 
         Handler handler = new Handler(Looper.getMainLooper());
         handler.post(new Runnable() {
             @Override
             public void run() {
-                GeckoAppShell.ensureCrashHandling();
                 GeckoAppShell.setApplicationContext(context);
                 GeckoThread.onResume();
 
                 GeckoThread.init(profile, args, null, false);
                 GeckoThread.launch();
 
                 if (DEBUG) {
                     Log.v(LOGTAG, "warmed up (launched)");
--- a/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
@@ -21,18 +21,16 @@ import org.mozilla.gecko.tabqueue.TabQue
 /**
  * Activity that receives incoming Intents and dispatches them to the appropriate activities (e.g. browser, custom tabs, web app).
  */
 public class LauncherActivity extends Activity {
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        GeckoAppShell.ensureCrashHandling();
-
         final SafeIntent safeIntent = new SafeIntent(getIntent());
 
         // If it's not a view intent, it won't be a custom tabs intent either. Just launch!
         if (!isViewIntentWithURL(safeIntent)) {
             dispatchNormalIntent();
 
         // Is this a custom tabs intent, and are custom tabs enabled?
         } else if (AppConstants.MOZ_ANDROID_CUSTOM_TABS && isCustomTabsIntent(safeIntent)
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -174,21 +174,16 @@ 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 volatile boolean locationHighAccuracyEnabled;
 
     // See also HardwareUtils.LOW_MEMORY_THRESHOLD_MB.
     private static final int HIGH_MEMORY_DEVICE_THRESHOLD_MB = 768;
 
     static private int sDensityDpi;
     static private int sScreenDepth;
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoServiceChildProcess.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoServiceChildProcess.java
@@ -67,17 +67,16 @@ public class GeckoServiceChildProcess ex
                 return;
             }
             serviceStarted = true;
             final int crashReporterFd = crashReporterPfd != null ? crashReporterPfd.detachFd() : -1;
             final int ipcFd = ipcPfd != null ? ipcPfd.detachFd() : -1;
             ThreadUtils.postToUiThread(new Runnable() {
                 @Override
                 public void run() {
-                    GeckoAppShell.ensureCrashHandling();
                     GeckoAppShell.setApplicationContext(getApplicationContext());
                     if (GeckoThread.initChildProcess(null, args, crashReporterFd, ipcFd, false)) {
                         GeckoThread.launch();
                     }
                 }
             });
         }
     };
--- a/mobile/android/search/java/org/mozilla/search/SearchActivity.java
+++ b/mobile/android/search/java/org/mozilla/search/SearchActivity.java
@@ -101,18 +101,16 @@ public class SearchActivity extends Loca
     private static class AsyncQueryHandlerImpl extends AsyncQueryHandler {
         public AsyncQueryHandlerImpl(final ContentResolver that) {
             super(that);
         }
     }
 
     @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, Distribution.init(getApplicationContext()));
         searchEngineManager.setChangeCallback(this);