From 75ffacbf1b2a5ff13e082a8405da5117a005fbde Mon Sep 17 00:00:00 2001 From: mike a Date: Fri, 17 Nov 2023 15:27:23 -0800 Subject: [PATCH] =?UTF-8?q?Bug=201862096=20=E2=80=93=C2=A0add=20toolbar=20?= =?UTF-8?q?related=20telemetry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/lib/crash/docs/metrics.md | 4 +-- .../components/service/nimbus/docs/metrics.md | 4 +-- fenix/app/metrics.yaml | 33 +++++++++++++++++++ .../fenix/browser/ToolbarGestureHandler.kt | 3 ++ .../org/mozilla/fenix/home/HomeMenuView.kt | 12 +++++++ .../fenix/search/SearchDialogFragment.kt | 3 ++ 6 files changed, 55 insertions(+), 4 deletions(-) diff --git a/android-components/components/lib/crash/docs/metrics.md b/android-components/components/lib/crash/docs/metrics.md index e1bd6ffff4b1..5b51f9c8ce29 100644 --- a/android-components/components/lib/crash/docs/metrics.md +++ b/android-components/components/lib/crash/docs/metrics.md @@ -1,4 +1,4 @@ - + # Metrics @@ -62,5 +62,5 @@ In addition to those built-in metrics, the following metrics are added to the pi Data categories are [defined here](https://wiki.mozilla.org/Firefox/Data_Collection). - + diff --git a/android-components/components/service/nimbus/docs/metrics.md b/android-components/components/service/nimbus/docs/metrics.md index 2a518f3e58b7..4a490068bd80 100644 --- a/android-components/components/service/nimbus/docs/metrics.md +++ b/android-components/components/service/nimbus/docs/metrics.md @@ -1,4 +1,4 @@ - + # Metrics @@ -30,5 +30,5 @@ In addition to those built-in metrics, the following metrics are added to the pi Data categories are [defined here](https://wiki.mozilla.org/Firefox/Data_Collection). - + diff --git a/fenix/app/metrics.yaml b/fenix/app/metrics.yaml index 5b7e4b72b7bc..8776af862fba 100644 --- a/fenix/app/metrics.yaml +++ b/fenix/app/metrics.yaml @@ -468,6 +468,39 @@ events: notification_emails: - android-probes@mozilla.com expires: never + browser_toolbar_qr_scan_tapped: + type: event + description: | + An event that indicates that a user has tapped + QR scan button on browser toolbar. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1862096 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1862096 + data_sensitivity: + - interaction + notification_emails: + - android-probes@mozilla.com + expires: never + metadata: + tags: + - Toolbar + toolbar_tab_swipe: + type: event + description: | + A user swiped the toolbar to change the current tab. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1862096 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1862096 + data_sensitivity: + - interaction + notification_emails: + - android-probes@mozilla.com + expires: never + metadata: + tags: + - Toolbar tab_view_changed: type: event description: | diff --git a/fenix/app/src/main/java/org/mozilla/fenix/browser/ToolbarGestureHandler.kt b/fenix/app/src/main/java/org/mozilla/fenix/browser/ToolbarGestureHandler.kt index 98fd2148326a..f809d9f2c349 100644 --- a/fenix/app/src/main/java/org/mozilla/fenix/browser/ToolbarGestureHandler.kt +++ b/fenix/app/src/main/java/org/mozilla/fenix/browser/ToolbarGestureHandler.kt @@ -25,6 +25,8 @@ import mozilla.components.feature.tabs.TabsUseCases import mozilla.components.support.ktx.android.view.getRectWithViewLocation import mozilla.components.support.utils.ext.bottom import mozilla.components.support.utils.ext.mandatorySystemGestureInsets +import mozilla.telemetry.glean.private.NoExtras +import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.R import org.mozilla.fenix.ext.getRectWithScreenLocation import org.mozilla.fenix.ext.getWindowInsets @@ -260,6 +262,7 @@ class ToolbarGestureHandler( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { tabPreview.isVisible = false + Events.toolbarTabSwipe.record(NoExtras()) } }, ) diff --git a/fenix/app/src/main/java/org/mozilla/fenix/home/HomeMenuView.kt b/fenix/app/src/main/java/org/mozilla/fenix/home/HomeMenuView.kt index 81c28352ec34..6a2dfedf7900 100644 --- a/fenix/app/src/main/java/org/mozilla/fenix/home/HomeMenuView.kt +++ b/fenix/app/src/main/java/org/mozilla/fenix/home/HomeMenuView.kt @@ -76,6 +76,18 @@ class HomeMenuView( ThemeManager.resolveAttribute(R.attr.textPrimary, context), ), ) + + menuButton.get()?.register( + object : mozilla.components.concept.menu.MenuButton.Observer { + override fun onShow() { + // MenuButton used in [HomeMenuView] doesn't emit toolbar facts. + // A wrapper is responsible for that, but we are using the button + // directly, hence recording the event directly. + // Should investigate further: https://bugzilla.mozilla.org/show_bug.cgi?id=1868207 + Events.toolbarMenuVisible.record(NoExtras()) + } + }, + ) } /** diff --git a/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt b/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt index 82181df20420..84d527b1b5ad 100644 --- a/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt +++ b/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt @@ -74,6 +74,7 @@ import mozilla.components.ui.autocomplete.InlineAutocompleteEditText import mozilla.components.ui.widgets.withCenterAlignedButtons import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.GleanMetrics.Awesomebar +import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.VoiceSearch import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R @@ -863,6 +864,8 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler { return } + Events.browserToolbarQrScanTapped.record(NoExtras()) + view?.hideKeyboard() toolbarView.view.clearFocus()