diff --git a/app/metrics.yaml b/app/metrics.yaml index d5027bdc36c..ff5f71befe6 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -431,3 +431,20 @@ pro_tips: The tip code of tip being clicked. Can be one of fresh_look_tip, allow_list_tip, request_desktop_tip. type: string + +preferences: + user_theme: + type: string + description: > + A string that indicates the theme. + Can be one of LIGHT, DARK, or FOLLOW DEVICE. + Default is FOLLOW DEVICE. + bugs: + - https://github.com/mozilla-mobile/focus-android/issues/5519 + data_reviews: + - https://github.com/mozilla-mobile/focus-android/pull/5526 + data_sensitivity: + - interaction + notification_emails: + - android-probes@mozilla.com + expires: "2022-10-01" diff --git a/app/src/main/java/org/mozilla/focus/telemetry/GleanMetricsService.kt b/app/src/main/java/org/mozilla/focus/telemetry/GleanMetricsService.kt index 12d42ef15be..440753164e9 100644 --- a/app/src/main/java/org/mozilla/focus/telemetry/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/focus/telemetry/GleanMetricsService.kt @@ -25,6 +25,7 @@ import org.mozilla.focus.GleanMetrics.GleanBuildInfo import org.mozilla.focus.GleanMetrics.LegacyIds import org.mozilla.focus.GleanMetrics.MozillaProducts import org.mozilla.focus.GleanMetrics.Pings +import org.mozilla.focus.GleanMetrics.Preferences import org.mozilla.focus.GleanMetrics.Shortcuts import org.mozilla.focus.GleanMetrics.TrackingProtection import org.mozilla.focus.ext.components @@ -113,6 +114,25 @@ class GleanMetricsService(context: Context) : MetricsService { TrackingProtection.hasAnalyticsBlocked.set(settings.hasAnalyticsBlocked()) TrackingProtection.hasContentBlocked.set(settings.hasContentBlocked()) TrackingProtection.hasSocialBlocked.set(settings.hasSocialBlocked()) + + // theme telemetry + val currentTheme = + when { + settings.lightThemeSelected -> { + "Light" + } + settings.darkThemeSelected -> { + "Dark" + } + + settings.useDefaultThemeSelected -> { + "Follow device" + } + else -> "" + } + if (currentTheme.isNotEmpty()) { + Preferences.userTheme.set(currentTheme) + } } private fun getDefaultSearchEngineIdentifierForTelemetry(context: Context): String {