Bug 806634 - Part 2: record browser launch after GeckoApp startup. r=mfinkle
authorRichard Newman <rnewman@mozilla.com>
Tue, 30 Oct 2012 13:27:33 -0700
changeset 111946 1aae722faa55a02dd67bbfd1daad3d76369c45aa
parent 111945 df94ebb4b929618642e05e7d5d7bf7c2016670a6
child 111947 fd16afa068b9b3fbb4945dfd98e7d74080fde7cb
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmfinkle
bugs806634
milestone19.0a1
Bug 806634 - Part 2: record browser launch after GeckoApp startup. r=mfinkle
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1,15 +1,16 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * 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.gecko;
 
+import org.mozilla.gecko.background.announcements.AnnouncementsBroadcastService;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.BrowserContract;
 import org.mozilla.gecko.gfx.Layer;
 import org.mozilla.gecko.gfx.LayerView;
 import org.mozilla.gecko.gfx.PluginLayer;
 import org.mozilla.gecko.gfx.PointUtils;
 import org.mozilla.gecko.ui.PanZoomController;
 import org.mozilla.gecko.util.GeckoAsyncTask;
@@ -1780,20 +1781,25 @@ abstract public class GeckoApp
         mJavaUiStartupTimer.stop();
 
         GeckoAppShell.getHandler().postDelayed(new Runnable() {
             public void run() {
                 // Sync settings need Gecko to be loaded, so
                 // no hurry in starting this.
                 checkMigrateSync();
 
+                // Record our launch time for the announcements service
+                // to use in assessing inactivity.
+                final Context context = GeckoApp.mAppContext;
+                AnnouncementsBroadcastService.recordLastLaunch(context);
+
                 // Kick off our background service to fetch product announcements.
                 // We do this by invoking the broadcast receiver, which uses the
                 // system alarm infrastructure to perform tasks at intervals.
-                GeckoPreferences.broadcastAnnouncementsPref(GeckoApp.mAppContext);
+                GeckoPreferences.broadcastAnnouncementsPref(context);
 
                 /*
                   XXXX see bug 635342
                    We want to disable this code if possible.  It is about 145ms in runtime
                 SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE);
                 String localeCode = settings.getString(getPackageName() + ".locale", "");
                 if (localeCode != null && localeCode.length() > 0)
                     GeckoAppShell.setSelectedLocale(localeCode);