Bug 1270191 - Correct my previous patches to more faithfully reproduce the refactored code. r=liuche
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 31 May 2016 17:25:17 -0700
changeset 338673 4b66897490ab2ab196c44ad9485dd529fe96441c
parent 338672 e319bd3db110690e6785fd8e61e869db9ccdf108
child 338674 933c4c92752c3a9f51421d75ec9946642cc49dc2
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1270191
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1270191 - Correct my previous patches to more faithfully reproduce the refactored code. r=liuche The previous code checked: if (env.startsWith("MOZ_DISABLE_SWITCHBOARD=")) { if (!env.endsWith("=")) { So it would not pass with the empty String but my previous revision permitted the empty string. Practically speaking, I don't think it matters because this is only used in remoteautomation.py where the value is 1, but better safe than sorry. MozReview-Commit-ID: DLtmvWlQYs7
mobile/android/base/java/org/mozilla/gecko/telemetry/TelemetryUploadService.java
mobile/android/base/java/org/mozilla/gecko/util/Experiments.java
--- a/mobile/android/base/java/org/mozilla/gecko/telemetry/TelemetryUploadService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/telemetry/TelemetryUploadService.java
@@ -3,16 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.telemetry;
 
 import android.app.IntentService;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
+import android.text.TextUtils;
 import android.util.Log;
 import ch.boye.httpclientandroidlib.HttpHeaders;
 import ch.boye.httpclientandroidlib.HttpResponse;
 import ch.boye.httpclientandroidlib.client.ClientProtocolException;
 import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase;
 import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient;
 import org.mozilla.gecko.GeckoProfile;
 import org.mozilla.gecko.GeckoSharedPrefs;
@@ -60,17 +61,17 @@ public class TelemetryUploadService exte
 
     /**
      * As a sanity check, this method should only be called once.
      */
     public static void setDisabledFromEnvVar(final HashMap<String, String> envVarMap) {
         if (isDisabledByLaunchingIntent != null) {
             throw new IllegalStateException("Disabled state already set");
         }
-        isDisabledByLaunchingIntent = envVarMap.containsKey(ENV_VAR_NAME);
+        isDisabledByLaunchingIntent = !TextUtils.isEmpty(envVarMap.get(ENV_VAR_NAME));
         if (isDisabledByLaunchingIntent) {
             Log.d(LOGTAG, "Telemetry disabled by environment variable: " + ENV_VAR_NAME);
         }
     }
 
     private static boolean isDisabledByLaunchingIntent() {
         if (isDisabledByLaunchingIntent == null) {
             throw new IllegalStateException("Disabled state not yet set.");
--- a/mobile/android/base/java/org/mozilla/gecko/util/Experiments.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/Experiments.java
@@ -62,17 +62,17 @@ public class Experiments {
 
     /**
      * As a sanity check, this method may only be called once.
      */
     public static void setDisabledFromEnvVar(@NonNull final Map<String, String> envVarMap) {
         if (disabled != null) {
             throw new IllegalStateException("Disabled state already set");
         }
-        disabled = envVarMap.containsKey(ENVVAR_DISABLED);
+        disabled = !TextUtils.isEmpty(envVarMap.get(ENVVAR_DISABLED));
         if (disabled) {
             Log.d(LOGTAG, "Switchboard disabled by environment variable: " + ENVVAR_DISABLED);
         }
     }
 
     public static boolean isDisabled() {
         if (disabled == null) {
             throw new IllegalStateException("Disabled state not yet set.");