diff --git a/toolkit/components/telemetry/TelemetryHistograms.h b/toolkit/components/telemetry/TelemetryHistograms.h index dc123213b419..4cf95b19c457 100644 --- a/toolkit/components/telemetry/TelemetryHistograms.h +++ b/toolkit/components/telemetry/TelemetryHistograms.h @@ -318,6 +318,7 @@ HISTOGRAM_BOOLEAN(UPDATER_UPDATES_ENABLED, "Updater: Whether or not updates are HISTOGRAM_BOOLEAN(UPDATER_UPDATES_AUTOMATIC, "Updater: Whether or not updates are automatic") HISTOGRAM_BOOLEAN(UPDATER_SERVICE_ENABLED, "Updater: Whether or not the MozillaMaintenance service is enabled") HISTOGRAM(UPDATER_SERVICE_ERRORS, 1, 30, 31, LINEAR, "Updater: The number of MozillaMaintenance service errors that have occurred") +HISTOGRAM_BOOLEAN(UPDATER_SERVICE_INSTALLED, "Updater: Whether or not the MozillaMaintenance service is installed") /** * Thunderbird-specific telemetry. diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index b9a3438fb291..4b7234c03325 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -1609,6 +1609,7 @@ UpdateService.prototype = { "UPDATER_SERVICE_ENABLED"); this._sendIntPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ERRORS, "UPDATER_SERVICE_ERRORS"); + this._sendServiceInstalledTelemetryPing(); #endif update.statusText = gUpdateBundle.GetStringFromName("installSuccess"); @@ -1666,6 +1667,33 @@ UpdateService.prototype = { } }, +#ifdef XP_WIN + /** + * Submit a telemetry ping with a boolean value which indicates if the service + * is installed. + */ + _sendServiceInstalledTelemetryPing: function AUS__svcInstallTelemetryPing() { + let installed = 0; + try { + let wrk = Components.classes["@mozilla.org/windows-registry-key;1"] + .createInstance(Components.interfaces.nsIWindowsRegKey); + wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE, + "SOFTWARE\\Mozilla\\MaintenanceService", + wrk.ACCESS_READ | wrk.WOW64_64); + installed = wrk.readIntValue("Installed"); + wrk.close(); + } catch(e) { + } + try { + let h = Services.telemetry.getHistogramById("UPDATER_SERVICE_INSTALLED"); + h.add(installed); + } catch(e) { + // Don't allow any exception to be propagated. + Components.utils.reportError(e); + } + }, +#endif + /** * Submit a telemetry ping with the int value of a pref for a histogram *