Bug 1233614 - Remove MOZ_INSTALL_TRACKING branch around Adjust usage. r=mfinkle draft
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 22 Dec 2015 09:47:08 -0800
changeset 317141 d1b1aa228878d18ef01091b0c5b693972237e3c8
parent 317140 4bdaf53ef2ba87709fdd236c3217d72186c3ad69
child 317150 0478b689890586bbed31e97005adf3409d5eab07
push id8647
push usermichael.l.comella@gmail.com
push dateTue, 22 Dec 2015 19:32:37 +0000
reviewersmfinkle
bugs1233614
milestone46.0a1
Bug 1233614 - Remove MOZ_INSTALL_TRACKING branch around Adjust usage. r=mfinkle We already take care of this in AdjustConstants where we return StubAdjustHelper if MOZ_INSTALL_TRACKING is not defined. However, the one downside to this is that we touch SharedPreferences on the main thread in onCreate even if Adjust is disabled. However, our release and beta users already have this problem (since Adjust is enabled) so who cares if our Nightly and Aurora users also have this problem.
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/distribution/ReferrerReceiver.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -694,26 +694,24 @@ public class BrowserApp extends GeckoApp
 
         JavaAddonManager.getInstance().init(appContext);
         mSharedPreferencesHelper = new SharedPreferencesHelper(appContext);
         mOrderedBroadcastHelper = new OrderedBroadcastHelper(appContext);
         mBrowserHealthReporter = new BrowserHealthReporter();
         mReadingListHelper = new ReadingListHelper(appContext, getProfile(), this);
         mAccountsHelper = new AccountsHelper(appContext, getProfile());
 
-        if (AppConstants.MOZ_INSTALL_TRACKING) {
-            final AdjustHelperInterface adjustHelper = AdjustConstants.getAdjustHelper();
-            adjustHelper.onCreate(this, AdjustConstants.MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN);
-
-            // Adjust stores enabled state so this is only necessary because users may have set
-            // their data preferences before this feature was implemented and we need to respect
-            // those before upload can occur in Adjust.onResume.
-            final SharedPreferences prefs = GeckoSharedPrefs.forApp(this);
-            adjustHelper.setEnabled(prefs.getBoolean(GeckoPreferences.PREFS_HEALTHREPORT_UPLOAD_ENABLED, true));
-        }
+        final AdjustHelperInterface adjustHelper = AdjustConstants.getAdjustHelper();
+        adjustHelper.onCreate(this, AdjustConstants.MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN);
+
+        // Adjust stores enabled state so this is only necessary because users may have set
+        // their data preferences before this feature was implemented and we need to respect
+        // those before upload can occur in Adjust.onResume.
+        final SharedPreferences prefs = GeckoSharedPrefs.forApp(this);
+        adjustHelper.setEnabled(prefs.getBoolean(GeckoPreferences.PREFS_HEALTHREPORT_UPLOAD_ENABLED, true));
 
         if (AppConstants.MOZ_ANDROID_BEAM) {
             NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);
             if (nfc != null) {
                 nfc.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
                     @Override
                     public NdefMessage createNdefMessage(NfcEvent event) {
                         Tab tab = Tabs.getInstance().getSelectedTab();
--- a/mobile/android/base/java/org/mozilla/gecko/distribution/ReferrerReceiver.java
+++ b/mobile/android/base/java/org/mozilla/gecko/distribution/ReferrerReceiver.java
@@ -53,23 +53,21 @@ public class ReferrerReceiver extends Br
             // 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 (AppConstants.MOZ_INSTALL_TRACKING) {
-                // 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);
-                }
+            // 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;
         }
 
         if (TextUtils.equals(referrer.campaign, DISTRIBUTION_UTM_CAMPAIGN)) {
             Distribution.onReceivedReferrer(context, referrer);
         } else {
             Log.d(LOGTAG, "Not downloading distribution: non-matching campaign.");