Bug 1274956 - Pre: Make it easier to test Adjust locally. r=mcomella
authorNick Alexander <nalexander@mozilla.com>
Mon, 23 May 2016 13:42:09 +0200
changeset 298240 ac75f8f4c01d67d54cc0d2cef39f1204ebcfa20f
parent 298239 60435b82caee3a0c05466ff2249a574df57214e6
child 298241 ae06aaa4f0cf8e468f79ed9bc44b36fabf419259
push id19327
push users.kaspari@gmail.com
push dateMon, 23 May 2016 18:39:45 +0000
treeherderfx-team@ac75f8f4c01d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1274956
milestone49.0a1
Bug 1274956 - Pre: Make it easier to test Adjust locally. r=mcomella This does a few things. First, it makes non-official builds use the Adjust sandbox. Second, I observe that the fake sandbox key no longer sends anything, so it's no longer valuable; this patch instead requires an Adjust token if install tracking is enabled, since we can't provide a default any more. Third, it removes a spurious default in configure.in; without this default, builders can easily enable Adjust locally using the following in their mozconfig: ac_add_options --with-adjust-sdk-keyfile=/path/to/adjust-sdk.keyfile export MOZ_INSTALL_TRACKING=1 With the default, the "export" had no impact, because it was overwritten immediately. MozReview-Commit-ID: Cn62fmrgwJL
mobile/android/base/java/org/mozilla/gecko/adjust/AdjustHelper.java
old-configure.in
--- a/mobile/android/base/java/org/mozilla/gecko/adjust/AdjustHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/adjust/AdjustHelper.java
@@ -8,31 +8,34 @@ package org.mozilla.gecko.adjust;
 import android.content.Context;
 import android.content.Intent;
 
 import com.adjust.sdk.Adjust;
 import com.adjust.sdk.AdjustConfig;
 import com.adjust.sdk.AdjustReferrerReceiver;
 import com.adjust.sdk.LogLevel;
 
+import org.mozilla.gecko.AppConstants;
+
 public class AdjustHelper implements AdjustHelperInterface {
     public void onCreate(final Context context, final String maybeAppToken) {
         final String environment;
-        final String appToken;
         final LogLevel logLevel;
-        if (maybeAppToken != null) {
+        if (AppConstants.MOZILLA_OFFICIAL) {
             environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
-            appToken = maybeAppToken;
             logLevel = LogLevel.WARN;
         } else {
             environment = AdjustConfig.ENVIRONMENT_SANDBOX;
-            appToken = "ABCDEFGHIJKL";
             logLevel = LogLevel.VERBOSE;
         }
-        AdjustConfig config = new AdjustConfig(context, appToken, environment);
+        if (maybeAppToken == null) {
+            // We've got install tracking turned on -- we better have a token!
+            throw new IllegalArgumentException("maybeAppToken must not be null");
+        }
+        AdjustConfig config = new AdjustConfig(context, maybeAppToken, environment);
         config.setLogLevel(logLevel);
         Adjust.onCreate(config);
     }
 
     public void onPause() {
         Adjust.onPause();
     }
 
--- a/old-configure.in
+++ b/old-configure.in
@@ -3476,17 +3476,19 @@ dnl ====================================
 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
 fi
 
 dnl ========================================================
 dnl = Include install tracking on Android
 dnl ========================================================
 if test -n "$MOZ_INSTALL_TRACKING"; then
-    AC_DEFINE(MOZ_INSTALL_TRACKING)
+    if test -z "$MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN"; then
+        AC_MSG_ERROR([Must specify --with-adjust-sdk-keyfile when MOZ_INSTALL_TRACKING is defined!])
+    fi
 fi
 
 dnl ========================================================
 dnl = Enable IPDL's "expensive" unit tests
 dnl ========================================================
 MOZ_IPDL_TESTS=
 
 MOZ_ARG_ENABLE_BOOL(ipdl-tests,