Bug 1371402 - Disable processing of background telemetry if it's disabled in the preferences r=nalexander

MozReview-Commit-ID: ANGu2MhQto0

--HG--
extra : rebase_source : 42779c16fc6035b25141c7ef86ef42c48ad28ebe
This commit is contained in:
Grigory Kruglov 2017-06-08 18:16:18 -04:00
Родитель ee45418920
Коммит 4d610b5cf3
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,7 @@ import android.util.Log;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.Experiments;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.switchboard.SwitchBoard;
import org.mozilla.gecko.sync.telemetry.TelemetryContract;
import org.mozilla.gecko.telemetry.pingbuilders.TelemetrySyncEventPingBuilder;
@ -87,6 +88,15 @@ public class TelemetryBackgroundReceiver extends BroadcastReceiver {
public void onReceive(final Context context, final Intent intent) {
Log.i(LOG_TAG, "Handling background telemetry broadcast");
// Do not process incoming background telemetry if user disabled telemetry in preferences.
// Background telemetry is opt-out by default. We're using the old FHR pref as that's our
// single opt-out telemetry preference flag.
// Only Sync users are emitting background telemetry.
if (!GeckoPreferences.getBooleanPref(context, GeckoPreferences.PREFS_HEALTHREPORT_UPLOAD_ENABLED, false)) {
Log.i(LOG_TAG, "Telemetry is disabled via preferences, dropping background telemetry.");
return;
}
// This is our kill-switch for background telemetry (or a functionality throttle).
if (!SwitchBoard.isInExperiment(context, Experiments.ENABLE_PROCESSING_BACKGROUND_TELEMETRY)) {
Log.i(LOG_TAG, "Background telemetry processing disabled via switchboard.");