Bug 1137259 - Don't send Campaign:Set for distribution referrer intents. r=mfinkle, a=lsblakk
authorRichard Newman <rnewman@mozilla.com>
Thu, 26 Feb 2015 09:32:15 -0800
changeset 250094 432de8008403
parent 250093 5a0ed5076b4f
child 250095 7ede0abc5a1c
push id4501
push userryanvm@gmail.com
push date2015-02-27 20:57 +0000
treeherdermozilla-beta@2aa1ca037446 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lsblakk
bugs1137259
milestone37.0
Bug 1137259 - Don't send Campaign:Set for distribution referrer intents. r=mfinkle, a=lsblakk
mobile/android/base/distribution/ReferrerReceiver.java
--- a/mobile/android/base/distribution/ReferrerReceiver.java
+++ b/mobile/android/base/distribution/ReferrerReceiver.java
@@ -40,27 +40,29 @@ public class ReferrerReceiver extends Br
     @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"));
 
-        // Track the referrer object for distribution handling.
+        if (!TextUtils.equals(referrer.source, MOZILLA_UTM_SOURCE)) {
+            return;
+        }
+
         if (TextUtils.equals(referrer.campaign, DISTRIBUTION_UTM_CAMPAIGN)) {
             Distribution.onReceivedReferrer(context, referrer);
         } else {
             Log.d(LOGTAG, "Not downloading distribution: non-matching campaign.");
-        }
-
-        // If this is a Mozilla campaign, pass the campaign along to Gecko.
-        if (TextUtils.equals(referrer.source, MOZILLA_UTM_SOURCE)) {
+            // If this is a Mozilla campaign, pass the campaign along to Gecko.
+            // It'll pretend to be a "playstore" distribution for BLP purposes.
             propagateMozillaCampaign(referrer);
         }
 
         // Broadcast a secondary, local intent to allow test code to respond.
         final Intent receivedIntent = new Intent(ACTION_REFERRER_RECEIVED);
         LocalBroadcastManager.getInstance(context).sendBroadcast(receivedIntent);
     }