Bug 895931 - Firefox for Android often warns about max sane launch timestamps. r=nalexander, a=lsblakk
authorRichard Newman <rnewman@mozilla.com>
Fri, 19 Jul 2013 13:59:42 -0700
changeset 143126 5c46eea500a8e179d267c2c6077c03d895af4c27
parent 143125 6bb15bfb88871d631d410f9013ddd3ddb1b5f19d
child 143127 65afba378972d51505a7eb6f74e71ef444b4422e
push id2663
push userryanvm@gmail.com
push dateMon, 22 Jul 2013 21:30:20 +0000
treeherdermozilla-beta@65afba378972 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, lsblakk
bugs895931
milestone23.0
Bug 895931 - Firefox for Android often warns about max sane launch timestamps. r=nalexander, a=lsblakk
mobile/android/base/background/announcements/AnnouncementsBroadcastService.java
mobile/android/base/background/announcements/AnnouncementsConstants.java.in
mobile/android/base/background/announcements/AnnouncementsFetcher.java
mobile/android/base/background/common/GlobalConstants.java.in
--- a/mobile/android/base/background/announcements/AnnouncementsBroadcastService.java
+++ b/mobile/android/base/background/announcements/AnnouncementsBroadcastService.java
@@ -66,25 +66,25 @@ public class AnnouncementsBroadcastServi
     // or it's thirty years in the future (previous timestamp was saved as 0).
     //
     // We should try to do something vaguely sane in these situations.
     long previous = preferences.getLong(AnnouncementsConstants.PREF_LAST_LAUNCH, -1);
     if (previous == -1) {
       Logger.debug(LOG_TAG, "No previous launch recorded.");
     }
 
-    if (now < GlobalConstants.BUILD_TIMESTAMP) {
+    if (now < GlobalConstants.BUILD_TIMESTAMP_MSEC) {
       Logger.warn(LOG_TAG, "Current time " + now + " is older than build date " +
-                           GlobalConstants.BUILD_TIMESTAMP + ". Ignoring until clock is corrected.");
+                           GlobalConstants.BUILD_TIMESTAMP_MSEC + ". Ignoring until clock is corrected.");
       return;
     }
 
-    if (now > AnnouncementsConstants.LATEST_ACCEPTED_LAUNCH_TIMESTAMP) {
+    if (now > AnnouncementsConstants.LATEST_ACCEPTED_LAUNCH_TIMESTAMP_MSEC) {
       Logger.warn(LOG_TAG, "Launch time " + now + " is later than max sane launch timestamp " +
-                           AnnouncementsConstants.LATEST_ACCEPTED_LAUNCH_TIMESTAMP +
+                           AnnouncementsConstants.LATEST_ACCEPTED_LAUNCH_TIMESTAMP_MSEC +
                            ". Ignoring until clock is corrected.");
       return;
     }
 
     if (previous > now) {
       Logger.debug(LOG_TAG, "Previous launch " + previous + " later than current time " +
                             now + ", but new time is sane. Accepting new time.");
     }
--- a/mobile/android/base/background/announcements/AnnouncementsConstants.java.in
+++ b/mobile/android/base/background/announcements/AnnouncementsConstants.java.in
@@ -37,14 +37,14 @@ public class AnnouncementsConstants {
   public static long DEFAULT_BACKOFF_MSEC = 2 * 24 * 60 * 60 * 1000;   // Two days. Used if no Retry-After header.
   public static long MINIMUM_FETCH_INTERVAL_MSEC = 60 * 60 * 1000;     // 1 hour.
 
   // Stop reporting idle counts once they hit one year.
   public static long MAX_SANE_IDLE_DAYS = 365;
 
   // Don't track last launch if the timestamp is ridiculously out of range:
   // four years after build.
-  public static long LATEST_ACCEPTED_LAUNCH_TIMESTAMP = GlobalConstants.BUILD_TIMESTAMP +
-                                                        4 * 365 * MILLISECONDS_PER_DAY;
+  public static long LATEST_ACCEPTED_LAUNCH_TIMESTAMP_MSEC = GlobalConstants.BUILD_TIMESTAMP_MSEC +
+                                                             4 * 365 * MILLISECONDS_PER_DAY;
 
   public static String ANNOUNCE_USER_AGENT = "Firefox Announcements " + GlobalConstants.MOZ_APP_VERSION;
   public static String ANNOUNCE_CHANNEL = GlobalConstants.MOZ_UPDATE_CHANNEL.replace("default", GlobalConstants.MOZ_OFFICIAL_BRANDING ? "release" : "dev");
 }
--- a/mobile/android/base/background/announcements/AnnouncementsFetcher.java
+++ b/mobile/android/base/background/announcements/AnnouncementsFetcher.java
@@ -66,17 +66,17 @@ public class AnnouncementsFetcher {
    *          Milliseconds since epoch for which idle time should be calculated.
    * @return number of idle days, or -1 if out of range.
    */
   protected static int getIdleDays(final long lastLaunch, final long now) {
     if (lastLaunch <= 0) {
       return -1;
     }
 
-    if (now < GlobalConstants.BUILD_TIMESTAMP) {
+    if (now < GlobalConstants.BUILD_TIMESTAMP_MSEC) {
       Logger.warn(LOG_TAG, "Current time " + now + " earlier than build date. Not calculating idle.");
       return -1;
     }
 
     if (now < lastLaunch) {
       Logger.warn(LOG_TAG, "Current time " + now + " earlier than last launch! Not calculating idle.");
       return -1;
     }
--- a/mobile/android/base/background/common/GlobalConstants.java.in
+++ b/mobile/android/base/background/common/GlobalConstants.java.in
@@ -17,17 +17,18 @@ public class GlobalConstants {
   // Otherwise, it means 'dev'.
   public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
 #ifdef MOZ_OFFICIAL_BRANDING
   public static final boolean MOZ_OFFICIAL_BRANDING = true;
 #else
   public static final boolean MOZ_OFFICIAL_BRANDING = false;
 #endif
 
-  public static final long BUILD_TIMESTAMP = @MOZ_BUILD_TIMESTAMP@;
+  public static final long BUILD_TIMESTAMP_SECONDS = @MOZ_BUILD_TIMESTAMP@;
+  public static final long BUILD_TIMESTAMP_MSEC = 1000 * @MOZ_BUILD_TIMESTAMP@;
 
   public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
   public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
   public static final String BROWSER_INTENT_PACKAGE = "@ANDROID_PACKAGE_NAME@";
   public static final String BROWSER_INTENT_CLASS = BROWSER_INTENT_PACKAGE + ".App";
 
   /**
    * Bug 800244: this signing-level permission protects broadcast intents that