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.
--- 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.");