Bug 864395 - Associate the send perf data setting with telemetry. r=fabrice
☠☠ backed out by c023a60a68a8 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Mon, 28 Apr 2014 11:59:00 -0400
changeset 181326 eba1f5d0a90839eb400970690562e8110149dcfb
parent 181325 3fd0c28ee6d70d1139c57cd801026e2ffe49ece4
child 181327 469b786fd5f17474b6584e2d50015216a6fb787e
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersfabrice
bugs864395
milestone32.0a1
Bug 864395 - Associate the send perf data setting with telemetry. r=fabrice
b2g/chrome/content/settings.js
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -627,16 +627,43 @@ SettingsListener.observe('apz.displaypor
     Services.prefs.setCharPref('apz.y_skate_size_multiplier', '1.5');
     break;
   case 'no-checkerboard':
     Services.prefs.setBoolPref('apz.allow-checkerboarding', false);
     break;
   }
 });
 
+// =================== Telemetry  ======================
+(function setupTelemetrySettings() {
+  let gaiaSettingName = 'debug.performance_data.shared';
+  let geckoPrefName = 'toolkit.telemetry.enabled';
+  SettingsListener.observe(gaiaSettingName, null, function(value) {
+    if (value !== null) {
+      // Gaia setting has been set; update Gecko pref to that.
+      Services.prefs.setBoolPref(geckoPrefName, value);
+      return;
+    }
+    // Gaia setting has not been set; set the gaia setting to default.
+#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
+    let prefValue = true;
+#else
+    let prefValue = false;
+#endif
+    try {
+      prefValue = Services.prefs.getBoolPref(geckoPrefName);
+    } catch (e) {
+      // Pref not set; use default value.
+    }
+    let setting = {};
+    setting[gaiaSettingName] = prefValue;
+    window.navigator.mozSettings.createLock().set(setting);
+  });
+})();
+
 // =================== Various simple mapping  ======================
 let settingsToObserve = {
   'ril.mms.retrieval_mode': {
     prefName: 'dom.mms.retrieval_mode',
     defaultValue: 'manual'
   },
   'ril.sms.strict7BitEncoding.enabled': {
     prefName: 'dom.sms.strict7BitEncoding',