Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | #filter substitution |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | package org.mozilla.gecko.background.announcements; |
michael@0 | 7 | |
michael@0 | 8 | import org.mozilla.gecko.background.common.GlobalConstants; |
michael@0 | 9 | |
michael@0 | 10 | import android.app.AlarmManager; |
michael@0 | 11 | |
michael@0 | 12 | public class AnnouncementsConstants { |
michael@0 | 13 | // Not `final` so we have the option to turn this on at runtime with a magic addon. |
michael@0 | 14 | public static boolean DISABLED = false; |
michael@0 | 15 | |
michael@0 | 16 | public static final long MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000; |
michael@0 | 17 | |
michael@0 | 18 | public static final String GLOBAL_LOG_TAG = "GeckoAnnounce"; |
michael@0 | 19 | public static final String ACTION_ANNOUNCEMENTS_PREF = "@ANDROID_PACKAGE_NAME@.ANNOUNCEMENTS_PREF"; |
michael@0 | 20 | |
michael@0 | 21 | static final String PREFS_BRANCH = "background"; |
michael@0 | 22 | static final String PREF_LAST_FETCH_LOCAL_TIME = "last_fetch"; |
michael@0 | 23 | static final String PREF_LAST_FETCH_SERVER_DATE = "last_announce_date"; |
michael@0 | 24 | static final String PREF_LAST_LAUNCH = "last_firefox_launch"; |
michael@0 | 25 | static final String PREF_ANNOUNCE_SERVER_BASE_URL = "announce_server_base_url"; |
michael@0 | 26 | static final String PREF_EARLIEST_NEXT_ANNOUNCE_FETCH = "earliest_next_announce_fetch"; |
michael@0 | 27 | static final String PREF_ANNOUNCE_FETCH_INTERVAL_MSEC = "announce_fetch_interval_msec"; |
michael@0 | 28 | |
michael@0 | 29 | public static String DEFAULT_ANNOUNCE_SERVER_BASE_URL = "https://campaigns.services.mozilla.com/announce/"; |
michael@0 | 30 | |
michael@0 | 31 | public static final String ANNOUNCE_PROTOCOL_VERSION = "1"; |
michael@0 | 32 | public static final String ANNOUNCE_APPLICATION = "android"; |
michael@0 | 33 | public static String ANNOUNCE_PATH_SUFFIX = AnnouncementsConstants.ANNOUNCE_PROTOCOL_VERSION + "/" + |
michael@0 | 34 | AnnouncementsConstants.ANNOUNCE_APPLICATION + "/"; |
michael@0 | 35 | |
michael@0 | 36 | public static long DEFAULT_ANNOUNCE_FETCH_INTERVAL_MSEC = AlarmManager.INTERVAL_HALF_DAY; |
michael@0 | 37 | public static long DEFAULT_BACKOFF_MSEC = 2 * 24 * 60 * 60 * 1000; // Two days. Used if no Retry-After header. |
michael@0 | 38 | public static long MINIMUM_FETCH_INTERVAL_MSEC = 60 * 60 * 1000; // 1 hour. |
michael@0 | 39 | |
michael@0 | 40 | // Stop reporting idle counts once they hit one year. |
michael@0 | 41 | public static long MAX_SANE_IDLE_DAYS = 365; |
michael@0 | 42 | |
michael@0 | 43 | // Don't track last launch if the timestamp is ridiculously out of range: |
michael@0 | 44 | // four years after build. |
michael@0 | 45 | public static long LATEST_ACCEPTED_LAUNCH_TIMESTAMP_MSEC = GlobalConstants.BUILD_TIMESTAMP_MSEC + |
michael@0 | 46 | 4 * 365 * MILLISECONDS_PER_DAY; |
michael@0 | 47 | |
michael@0 | 48 | public static String USER_AGENT = "Firefox Announcements " + GlobalConstants.MOZ_APP_VERSION; |
michael@0 | 49 | public static String ANNOUNCE_CHANNEL = GlobalConstants.MOZ_UPDATE_CHANNEL.replace("default", GlobalConstants.MOZ_OFFICIAL_BRANDING ? "release" : "dev"); |
michael@0 | 50 | } |