Bug 1373818 - Allow Adjust campaign ID to behave as OTA distribution. r=rnewman, a=jcristau
authorMichael Kaply <mozilla@kaply.com>
Fri, 16 Jun 2017 16:17:14 -0500
changeset 414043 607eded6754de946540987b648a04acc30d865f0
parent 414042 911dc640c42c34843b8fd797169e0ef7b995f0e0
child 414044 32f08d453cfa224e1d667880edc9461afaa3a5ec
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, jcristau
bugs1373818
milestone55.0
Bug 1373818 - Allow Adjust campaign ID to behave as OTA distribution. r=rnewman, a=jcristau MozReview-Commit-ID: 8MEQ84PuH7i
mobile/android/base/java/org/mozilla/gecko/distribution/ReferrerReceiver.java
--- a/mobile/android/base/java/org/mozilla/gecko/distribution/ReferrerReceiver.java
+++ b/mobile/android/base/java/org/mozilla/gecko/distribution/ReferrerReceiver.java
@@ -34,32 +34,40 @@ public class ReferrerReceiver extends Br
      *
      * If the install intent has a source different than this one, it is a
      * referral from an advertising network.  We may track these campaigns using
      * third-party tracking and metrics systems.
      */
     private static final String MOZILLA_UTM_SOURCE = "mozilla";
 
     /**
+     * If the install intent has this source, it is a referrer intent using our
+     * Adjust ID. It's treated as OTA and tracked using Adjust and
+     * Mozilla's metrics systems.
+     */
+    private static final String MOZILLA_ADJUST_SOURCE = "xodfft";
+
+    /**
      * If the install intent has this campaign, we'll load the specified distribution.
      */
     private static final String DISTRIBUTION_UTM_CAMPAIGN = "distribution";
 
     @Override
     public void onReceive(Context context, Intent intent) {
         Log.v(LOGTAG, "Received intent " + intent);
         if (!ACTION_INSTALL_REFERRER.equals(intent.getAction())) {
             // This should never happen.
             return;
         }
 
         // Track the referrer object for distribution handling.
         ReferrerDescriptor referrer = new ReferrerDescriptor(intent.getStringExtra("referrer"));
 
-        if (!TextUtils.equals(referrer.source, MOZILLA_UTM_SOURCE)) {
+        if (!TextUtils.equals(referrer.source, MOZILLA_UTM_SOURCE) &&
+            !TextUtils.equals(referrer.source, MOZILLA_ADJUST_SOURCE)) {
             // Allow the Adjust handler to process the intent.
             try {
                 AdjustConstants.getAdjustHelper().onReceive(context, intent);
             } catch (Exception e) {
                 Log.e(LOGTAG, "Got exception in Adjust's onReceive; ignoring referrer intent.", e);
             }
             return;
         }