michael@0: #filter substitution michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.background.announcements; michael@0: michael@0: import org.mozilla.gecko.background.common.GlobalConstants; michael@0: michael@0: import android.app.AlarmManager; michael@0: michael@0: public class AnnouncementsConstants { michael@0: // Not `final` so we have the option to turn this on at runtime with a magic addon. michael@0: public static boolean DISABLED = false; michael@0: michael@0: public static final long MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000; michael@0: michael@0: public static final String GLOBAL_LOG_TAG = "GeckoAnnounce"; michael@0: public static final String ACTION_ANNOUNCEMENTS_PREF = "@ANDROID_PACKAGE_NAME@.ANNOUNCEMENTS_PREF"; michael@0: michael@0: static final String PREFS_BRANCH = "background"; michael@0: static final String PREF_LAST_FETCH_LOCAL_TIME = "last_fetch"; michael@0: static final String PREF_LAST_FETCH_SERVER_DATE = "last_announce_date"; michael@0: static final String PREF_LAST_LAUNCH = "last_firefox_launch"; michael@0: static final String PREF_ANNOUNCE_SERVER_BASE_URL = "announce_server_base_url"; michael@0: static final String PREF_EARLIEST_NEXT_ANNOUNCE_FETCH = "earliest_next_announce_fetch"; michael@0: static final String PREF_ANNOUNCE_FETCH_INTERVAL_MSEC = "announce_fetch_interval_msec"; michael@0: michael@0: public static String DEFAULT_ANNOUNCE_SERVER_BASE_URL = "https://campaigns.services.mozilla.com/announce/"; michael@0: michael@0: public static final String ANNOUNCE_PROTOCOL_VERSION = "1"; michael@0: public static final String ANNOUNCE_APPLICATION = "android"; michael@0: public static String ANNOUNCE_PATH_SUFFIX = AnnouncementsConstants.ANNOUNCE_PROTOCOL_VERSION + "/" + michael@0: AnnouncementsConstants.ANNOUNCE_APPLICATION + "/"; michael@0: michael@0: public static long DEFAULT_ANNOUNCE_FETCH_INTERVAL_MSEC = AlarmManager.INTERVAL_HALF_DAY; michael@0: public static long DEFAULT_BACKOFF_MSEC = 2 * 24 * 60 * 60 * 1000; // Two days. Used if no Retry-After header. michael@0: public static long MINIMUM_FETCH_INTERVAL_MSEC = 60 * 60 * 1000; // 1 hour. michael@0: michael@0: // Stop reporting idle counts once they hit one year. michael@0: public static long MAX_SANE_IDLE_DAYS = 365; michael@0: michael@0: // Don't track last launch if the timestamp is ridiculously out of range: michael@0: // four years after build. michael@0: public static long LATEST_ACCEPTED_LAUNCH_TIMESTAMP_MSEC = GlobalConstants.BUILD_TIMESTAMP_MSEC + michael@0: 4 * 365 * MILLISECONDS_PER_DAY; michael@0: michael@0: public static String USER_AGENT = "Firefox Announcements " + GlobalConstants.MOZ_APP_VERSION; michael@0: public static String ANNOUNCE_CHANNEL = GlobalConstants.MOZ_UPDATE_CHANNEL.replace("default", GlobalConstants.MOZ_OFFICIAL_BRANDING ? "release" : "dev"); michael@0: }