Bug 792992 - Delay update service start. r=rnewman, a=lmandel
authorEugen Sawin <esawin@mozilla.com>
Mon, 09 Feb 2015 20:41:43 +0100
changeset 250254 7113cd46019c
parent 250253 ae511f0dda0f
child 250255 bd0696c04755
push id4527
push userryanvm@gmail.com
push date2015-03-05 16:09 +0000
treeherdermozilla-beta@00bad6e2ffbc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, lmandel
bugs792992
milestone37.0
Bug 792992 - Delay update service start. r=rnewman, a=lmandel
mobile/android/base/GeckoApp.java
mobile/android/base/updater/UpdateServiceHelper.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1580,31 +1580,31 @@ public abstract class GeckoApp
         mContactService = new ContactService(EventDispatcher.getInstance(), this);
 
         mPromptService = new PromptService(this);
 
         mTextSelection = new TextSelection((TextSelectionHandle) findViewById(R.id.anchor_handle),
                                            (TextSelectionHandle) findViewById(R.id.caret_handle),
                                            (TextSelectionHandle) findViewById(R.id.focus_handle));
 
-        UpdateServiceHelper.registerForUpdates(GeckoApp.this);
-
         // Trigger the completion of the telemetry timer that wraps activity startup,
         // then grab the duration to give to FHR.
         mJavaUiStartupTimer.stop();
         final long javaDuration = mJavaUiStartupTimer.getElapsed();
 
         ThreadUtils.getBackgroundHandler().postDelayed(new Runnable() {
             @Override
             public void run() {
                 final HealthRecorder rec = mHealthRecorder;
                 if (rec != null) {
                     rec.recordJavaStartupTime(javaDuration);
                 }
 
+                UpdateServiceHelper.registerForUpdates(GeckoApp.this);
+
                 // Kick off our background services. We do this by invoking the broadcast
                 // receiver, which uses the system alarm infrastructure to perform tasks at
                 // intervals.
                 GeckoPreferences.broadcastHealthReportUploadPref(GeckoApp.this);
                 if (!GeckoThread.checkLaunchState(GeckoThread.LaunchState.Launched)) {
                     return;
                 }
             }
--- a/mobile/android/base/updater/UpdateServiceHelper.java
+++ b/mobile/android/base/updater/UpdateServiceHelper.java
@@ -163,16 +163,20 @@ public class UpdateServiceHelper {
         if (context == null) {
             return;
         }
 
         context.startService(createIntent(context, ACTION_APPLY_UPDATE));
     }
 
     public static void registerForUpdates(final Context context) {
+        if (!isUpdaterEnabled()) {
+             return;
+        }
+
         final HashMap<String, Object> prefs = new HashMap<String, Object>();
 
         PrefsHelper.getPrefs(Pref.names, new PrefsHelper.PrefHandlerBase() {
             @Override public void prefValue(String pref, String value) {
                 prefs.put(pref, value);
             }
 
             @Override public void finish() {