From b4e7d6440bb7cc1e034d15bfb8370fe6d0d78c40 Mon Sep 17 00:00:00 2001 From: mcarare Date: Tue, 24 Nov 2020 13:35:26 +0200 Subject: [PATCH] For #15369: Add synced tabs usage metrics. --- .../main/java/org/mozilla/fenix/components/metrics/Event.kt | 2 ++ .../mozilla/fenix/components/metrics/GleanMetricsService.kt | 6 ++++++ .../java/org/mozilla/fenix/tabtray/TabTrayController.kt | 1 + 3 files changed, 9 insertions(+) diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt index 87d10a519ac6..4a6422cc045e 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt @@ -183,6 +183,8 @@ sealed class Event { object TabSettingsOpened : Event() + object SyncedTabOpened : Event() + // Interaction events with extras data class TopSiteSwipeCarousel(val page: Int) : Event() { 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 82e462d7bb57..9c041177f526 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 @@ -659,6 +659,12 @@ private val Event.wrapper: EventWrapper<*>? { ProgressiveWebApp.backgroundKeys.valueOf(it) } ) + Event.SyncedTabOpened -> EventWrapper( + { Metrics.syncedTabsOpenedCount.add(1) } + ).also { + Metrics.hasOpenedSyncedTabs.set(true) + } + Event.MasterPasswordMigrationDisplayed -> EventWrapper( { MasterPassword.displayed.record(it) } ) diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayController.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayController.kt index bb3a4f56b464..cd59ec1bc794 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayController.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayController.kt @@ -205,6 +205,7 @@ class DefaultTabTrayController( newTab = true, from = BrowserDirection.FromTabTray ) + metrics.track(Event.SyncedTabOpened) } @OptIn(ExperimentalCoroutinesApi::class)