From d42a15c4fd7107af23ecb2a6d796d5e991f5cc0c Mon Sep 17 00:00:00 2001 From: Jeff Boek Date: Mon, 18 Mar 2019 13:30:25 -0700 Subject: [PATCH] For #960 - Adds metrics to measure if Fenix is the default browser --- app/metrics.yaml | 20 +++++++++++++++++++ .../components/metrics/GleanMetricsService.kt | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 app/metrics.yaml diff --git a/app/metrics.yaml b/app/metrics.yaml new file mode 100644 index 000000000000..ae7d23e73c26 --- /dev/null +++ b/app/metrics.yaml @@ -0,0 +1,20 @@ +# This file defines the metrics that are recorded by glean telemetry. They are +# automatically converted to Kotlin code at build time using the `glean_parser` +# PyPI package. + +$schema: moz://mozilla.org/schemas/glean/metrics/1-0-0 + +metrics: + default_browser: + type: boolean + description: > + Is Fenix the default browser? + send_in_pings: + - metrics + bugs: + - 123456789 + data_reviews: + - N/A + notification_emails: + - telemetry-client-dev@mozilla.com + expires: never \ No newline at end of file diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt index bc0996560577..6b6c8a1fba00 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt @@ -5,13 +5,19 @@ package org.mozilla.fenix.components.metrics import android.content.Context import mozilla.components.service.glean.Glean +import mozilla.components.support.utils.Browsers import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.utils.Settings +import org.mozilla.fenix.debug.GleanMetrics.Metrics class GleanMetricsService(private val context: Context) : MetricsService { override fun start() { Glean.initialize(context) Glean.setUploadEnabled(IsGleanEnabled) + + Metrics.apply { + defaultBrowser.set(Browsers.all(context).isDefaultBrowser) + } } override fun track(event: Event) { }