Bug 895931 - Firefox for Android often warns about max sane launch timestamps. r=nalexander
authorRichard Newman <rnewman@mozilla.com>
Fri, 19 Jul 2013 13:59:42 -0700
changeset 139310 145bfcabd9a4004b162a7cf3d524968b19468afc
parent 139309 a70028dc9b0b5bffabd278d65de779ea350ca800
child 139311 244ff7612e87b252b4e3594afa34a94910382a5a
push id31324
push usernalexander@mozilla.com
push dateFri, 19 Jul 2013 21:00:48 +0000
treeherdermozilla-inbound@145bfcabd9a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs895931
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 895931 - Firefox for Android often warns about max sane launch timestamps. r=nalexander
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