mobile/android/base/background/announcements/AnnouncementsConstants.java.in

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/background/announcements/AnnouncementsConstants.java.in	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +#filter substitution
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +package org.mozilla.gecko.background.announcements;
    1.10 +
    1.11 +import org.mozilla.gecko.background.common.GlobalConstants;
    1.12 +
    1.13 +import android.app.AlarmManager;
    1.14 +
    1.15 +public class AnnouncementsConstants {
    1.16 +  // Not `final` so we have the option to turn this on at runtime with a magic addon.
    1.17 +  public static boolean DISABLED = false;
    1.18 +
    1.19 +  public static final long MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
    1.20 +
    1.21 +  public static final String GLOBAL_LOG_TAG = "GeckoAnnounce";
    1.22 +  public static final String ACTION_ANNOUNCEMENTS_PREF = "@ANDROID_PACKAGE_NAME@.ANNOUNCEMENTS_PREF";
    1.23 +
    1.24 +  static final String PREFS_BRANCH = "background";
    1.25 +  static final String PREF_LAST_FETCH_LOCAL_TIME  = "last_fetch";
    1.26 +  static final String PREF_LAST_FETCH_SERVER_DATE = "last_announce_date";
    1.27 +  static final String PREF_LAST_LAUNCH = "last_firefox_launch";
    1.28 +  static final String PREF_ANNOUNCE_SERVER_BASE_URL  = "announce_server_base_url";
    1.29 +  static final String PREF_EARLIEST_NEXT_ANNOUNCE_FETCH = "earliest_next_announce_fetch";
    1.30 +  static final String PREF_ANNOUNCE_FETCH_INTERVAL_MSEC = "announce_fetch_interval_msec";
    1.31 +
    1.32 +  public static String DEFAULT_ANNOUNCE_SERVER_BASE_URL = "https://campaigns.services.mozilla.com/announce/";
    1.33 +
    1.34 +  public static final String ANNOUNCE_PROTOCOL_VERSION = "1";
    1.35 +  public static final String ANNOUNCE_APPLICATION = "android";
    1.36 +  public static String ANNOUNCE_PATH_SUFFIX = AnnouncementsConstants.ANNOUNCE_PROTOCOL_VERSION + "/" +
    1.37 +                                              AnnouncementsConstants.ANNOUNCE_APPLICATION + "/";
    1.38 +
    1.39 +  public static long DEFAULT_ANNOUNCE_FETCH_INTERVAL_MSEC = AlarmManager.INTERVAL_HALF_DAY;
    1.40 +  public static long DEFAULT_BACKOFF_MSEC = 2 * 24 * 60 * 60 * 1000;   // Two days. Used if no Retry-After header.
    1.41 +  public static long MINIMUM_FETCH_INTERVAL_MSEC = 60 * 60 * 1000;     // 1 hour.
    1.42 +
    1.43 +  // Stop reporting idle counts once they hit one year.
    1.44 +  public static long MAX_SANE_IDLE_DAYS = 365;
    1.45 +
    1.46 +  // Don't track last launch if the timestamp is ridiculously out of range:
    1.47 +  // four years after build.
    1.48 +  public static long LATEST_ACCEPTED_LAUNCH_TIMESTAMP_MSEC = GlobalConstants.BUILD_TIMESTAMP_MSEC +
    1.49 +                                                             4 * 365 * MILLISECONDS_PER_DAY;
    1.50 +
    1.51 +  public static String USER_AGENT = "Firefox Announcements " + GlobalConstants.MOZ_APP_VERSION;
    1.52 +  public static String ANNOUNCE_CHANNEL = GlobalConstants.MOZ_UPDATE_CHANNEL.replace("default", GlobalConstants.MOZ_OFFICIAL_BRANDING ? "release" : "dev");
    1.53 +}

mercurial