bug 1406391 - Lock toolkit.telemetry.enabled based on channel r?froydnj
In Unified Telemetry toolkit.telemetry.enabled controls whether we send base
collection data or extended collection. The difference is mostly in volume, not
in kind (though extended collection has a little stricter testing and monitoring
requirements).
Since the Preferences UI change in Firefox 56, users no longer have the ability
to change toolkit.telemetry.enabled. This is a good thing as for pre-release
users very few disabled extended collection, and even fewer release users
enabled it. This provides uniform collection based on channel which should
eventually net us some efficiencies.
Until then we need to align our use of the toolkit.telemetry.enabled pref with
the UI change that has already shipped. This is accomplished by locking t.t.e
to 'true' on pre-release channels and locking it to 'false' on everything else.
This doesn't apply to Android as it doesn't (yet) use Unified Telemetry. t.t.e
means something rather different there.
MozReview-Commit-ID: EOpWm8b0jWA
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -4850,16 +4850,17 @@ pref_InitInitialObjects()
}
}
}
rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST);
NS_ENSURE_SUCCESS(
rv, Err("pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST) failed"));
+#ifdef MOZ_WIDGET_ANDROID
// Set up the correct default for toolkit.telemetry.enabled. If this build
// has MOZ_TELEMETRY_ON_BY_DEFAULT *or* we're on the beta channel, telemetry
// is on by default, otherwise not. This is necessary so that beta users who
// are testing final release builds don't flipflop defaults.
if (Preferences::GetDefaultType(kTelemetryPref) ==
nsIPrefBranch::PREF_INVALID) {
bool prerelease = false;
#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
@@ -4868,16 +4869,29 @@ pref_InitInitialObjects()
nsAutoCString prefValue;
Preferences::GetDefaultCString(kChannelPref, prefValue);
if (prefValue.EqualsLiteral("beta")) {
prerelease = true;
}
#endif
PREF_SetBoolPref(kTelemetryPref, prerelease, true);
}
+#else
+ // For platforms with Unified Telemetry (here meaning not-Android),
+ // toolkit.telemetry.enabled determines whether we send "extended" data.
+ // We only want extended data from pre-release channels due to size.
+ if (!strcmp(NS_STRINGIFY(MOZ_UPDATE_CHANNEL), "nightly") ||
+ !strcmp(NS_STRINGIFY(MOZ_UPDATE_CHANNEL), "aurora") ||
+ !strcmp(NS_STRINGIFY(MOZ_UPDATE_CHANNEL), "beta")) {
+ PREF_SetBoolPref(kTelemetryPref, true, true);
+ } else {
+ PREF_SetBoolPref(kTelemetryPref, false, true);
+ }
+ PREF_LockPref(kTelemetryPref, true);
+#endif // MOZ_WIDGET_ANDROID
NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
nullptr,
NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID);
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
NS_ENSURE_SUCCESS(rv, Err("GetObserverService() failed (2)"));