Bug 1461772 - Submit display version as a property of the fennec core ping r=gsvelto draft
authorWilliam Lachance <wlachance@mozilla.com>
Tue, 15 May 2018 15:11:35 -0400
changeset 795926 986add321c25e233702f1540127c19babd365797
parent 795256 cf3ee14023483cbbb57129479537c713e22c1980
push id110120
push userwlachance@mozilla.com
push dateWed, 16 May 2018 19:33:54 +0000
reviewersgsvelto
bugs1461772
milestone62.0a1
Bug 1461772 - Submit display version as a property of the fennec core ping r=gsvelto MozReview-Commit-ID: BFwgwOOo83s
mobile/android/base/AppConstants.java.in
mobile/android/base/generate_build_config.py
mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryCorePingBuilder.java
toolkit/components/telemetry/docs/data/core-ping.rst
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -87,16 +87,17 @@ public class AppConstants {
     // For the benefit of future archaeologists:
     // GRE_BUILDID is exactly the same as MOZ_APP_BUILDID unless you're running
     // on XULRunner, which is never the case on Android.
     public static final String MOZ_APP_BUILDID = "@MOZ_BUILDID@";
     public static final String MOZ_APP_ID = "@MOZ_APP_ID@";
     public static final String MOZ_APP_NAME = "@MOZ_APP_NAME@";
     public static final String MOZ_APP_VENDOR = "@MOZ_APP_VENDOR@";
     public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
+    public static final String MOZ_APP_VERSION_DISPLAY = "@MOZ_APP_VERSION_DISPLAY@";
     public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
     public static final String MOZ_APP_UA_NAME = "@MOZ_APP_UA_NAME@";
 
     // MOZILLA_VERSION is already quoted when it gets substituted in. If we
     // add additional quotes we end up with ""x.y"", which is a syntax error.
     public static final String MOZILLA_VERSION = @MOZILLA_VERSION@;
 
     public static final String MOZ_MOZILLA_API_KEY = "@MOZ_MOZILLA_API_KEY@";
--- a/mobile/android/base/generate_build_config.py
+++ b/mobile/android/base/generate_build_config.py
@@ -77,16 +77,17 @@ def _defines():
                 'MOZ_ANDROID_BROWSER_INTENT_CLASS',
                 'MOZ_APP_BASENAME',
                 'MOZ_APP_DISPLAYNAME',
                 'MOZ_APP_ID',
                 'MOZ_APP_NAME',
                 'MOZ_APP_UA_NAME',
                 'MOZ_APP_VENDOR',
                 'MOZ_APP_VERSION',
+                'MOZ_APP_VERSION_DISPLAY',
                 'MOZ_CHILD_PROCESS_NAME',
                 'MOZ_MOZILLA_API_KEY',
                 'MOZ_UPDATE_CHANNEL',
                 'OMNIJAR_NAME',
                 'OS_TARGET',
                 'TARGET_XPCOM_ABI'):
         DEFINES[var] = CONFIG[var]
 
--- a/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryCorePingBuilder.java
+++ b/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryCorePingBuilder.java
@@ -12,16 +12,17 @@ import android.content.SharedPreferences
 import android.os.Build;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.WorkerThread;
 import android.text.TextUtils;
 
 import android.util.Log;
 
+import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.GeckoApp;
 import org.mozilla.gecko.GeckoProfile;
 import org.mozilla.gecko.GeckoSharedPrefs;
 import org.mozilla.gecko.Locales;
 import org.mozilla.gecko.mma.MmaDelegate;
 import org.mozilla.gecko.search.SearchEngine;
 import org.mozilla.gecko.sync.ExtendedJSONObject;
 import org.mozilla.gecko.telemetry.TelemetryOutgoingPing;
@@ -57,16 +58,17 @@ public class TelemetryCorePingBuilder ex
 
     private static final String DEFAULT_BROWSER = "defaultBrowser";
     private static final String ARCHITECTURE = "arch";
     private static final String CAMPAIGN_ID = "campaignId";
     private static final String CLIENT_ID = "clientId";
     private static final String DEFAULT_SEARCH_ENGINE = "defaultSearch";
     private static final String DEVICE = "device";
     private static final String DISTRIBUTION_ID = "distributionId";
+    private static final String DISPLAY_VERSION = "displayVersion";
     private static final String EXPERIMENTS = "experiments";
     private static final String LOCALE = "locale";
     private static final String OS_ATTR = "os";
     private static final String OS_VERSION = "osversion";
     private static final String PING_CREATION_DATE = "created";
     private static final String PROFILE_CREATION_DATE = "profileDate";
     private static final String SEARCH_COUNTS = "searches";
     private static final String SEQ = "seq";
@@ -96,16 +98,17 @@ public class TelemetryCorePingBuilder ex
 
         payload.put(DEFAULT_BROWSER, MmaDelegate.isDefaultBrowser(context));
         payload.put(ARCHITECTURE, HardwareUtils.getRealAbi());
         payload.put(DEVICE, deviceDescriptor);
         payload.put(LOCALE, Locales.getLanguageTag(Locale.getDefault()));
         payload.put(OS_VERSION, Integer.toString(Build.VERSION.SDK_INT)); // A String for cross-platform reasons.
         payload.put(PING_CREATION_DATE, pingCreationDateFormat.format(nowCalendar.getTime()));
         payload.put(TIMEZONE_OFFSET, DateUtil.getTimezoneOffsetInMinutesForGivenDate(nowCalendar));
+        payload.put(DISPLAY_VERSION, AppConstants.MOZ_APP_VERSION_DISPLAY);
         payload.putArray(EXPERIMENTS, Experiments.getActiveExperiments(context));
         synchronized (this) {
             SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
             final int count = prefs.getInt(GeckoApp.PREFS_FLASH_USAGE, 0);
             payload.put(FLASH_USAGE, count);
             prefs.edit().putInt(GeckoApp.PREFS_FLASH_USAGE, 0).apply();
         }
     }
--- a/toolkit/components/telemetry/docs/data/core-ping.rst
+++ b/toolkit/components/telemetry/docs/data/core-ping.rst
@@ -37,16 +37,17 @@ Structure:
       "device": <string>, // Build.MANUFACTURER + " - " + Build.MODEL
                           // where manufacturer is truncated to 12 characters
                           // & model is truncated to 19 characters
       "arch": <string>, // e.g. "arm", "x86"
       "profileDate": <pos integer>, // Profile creation date in days since
                                     // UNIX epoch.
       "defaultSearch": <string>, // Identifier of the default search engine,
                                  // e.g. "yahoo".
+      "displayVersion": <string>, // Version displayed to user, e.g. 57.0b3 (optional)
       "distributionId": <string>, // Distribution identifier (optional)
       "campaignId": <string>, // Adjust's campaign identifier (optional)
       "created": <string>, // date the ping was created
                            // in local time, "yyyy-mm-dd"
       "tz": <integer>, // timezone offset (in minutes) of the
                        // device when the ping was created
       "sessions": <integer>, // number of sessions since last upload
       "durations": <integer>, // combined duration, in seconds, of all
@@ -191,18 +192,22 @@ HTTP "Date" header
 This header is used to track the submission date of the core ping in the format
 specified by
 `rfc 2616 sec 14.18 <https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18>`_,
 et al (e.g. "Tue, 01 Feb 2011 14:00:00 GMT").
 
 
 Version history
 ---------------
-* v10: added ``defaultBrowser`` to know if the user has set Firefox as default browser
-* v9: changed ``arch`` to contain device arch rather than the one we built against & ``accessibilityServices``
+* v9:
+ - Apr 2017: changed ``arch`` to contain device arch rather than the one we
+   built against & ``accessibilityServices``
+ - Dec 2017: added ``defaultBrowser`` to know if the user has set Firefox as
+   default browser (Dec 2017)
+ - May 2018: added (optional) ``displayVersion`` to distinguish Firefox beta versions easily
 * v8: added ``flashUsage``
 * v7: added ``sessionCount`` & ``sessionDuration``  & ``campaignId``
 * v6: added ``searches``
 * v5: added ``created`` & ``tz``
 * v4: ``profileDate`` will return package install time when times.json is not available
 * v3: added ``defaultSearch``
 * v2: added ``distributionId``
 * v1: initial version - shipped in `Fennec 45 <https://bugzilla.mozilla.org/show_bug.cgi?id=1205835>`_.