commit a951a95550078a6934da619c5034cf47b58f098d
parent f7cbb58a1121b969a70cd0db672b3c5a14622f79
Author: Harrison Oglesby <oglesby.harrison@gmail.com>
Date: Wed, 12 Nov 2025 19:02:09 +0000
Bug 1992006 - Telemetry for Settings Search r=android-reviewers,Roger
Differential Revision: https://phabricator.services.mozilla.com/D271516
Diffstat:
3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/mobile/android/fenix/app/metrics.yaml b/mobile/android/fenix/app/metrics.yaml
@@ -5426,6 +5426,48 @@ settings:
metadata:
tags:
- Settings
+settings_search:
+ opened:
+ type: event
+ description: |
+ A user has opened the settings search screen.
+ bugs:
+ - https://bugzilla.mozilla.org/show_bug.cgi?id=1992006
+ data_reviews:
+ - https://phabricator.services.mozilla.com/D271516
+ data_sensitivity:
+ - interaction
+ notification_emails:
+ - android-probes@mozilla.com
+ expires: never
+ metadata:
+ tags:
+ - Settings
+ search_result_clicked:
+ type: event
+ description: |
+ A user has clicked on a search result in the settings search screen.
+ extra_keys:
+ item_preference_key:
+ description: |
+ The preference key of the setting clicked on.
+ type: string
+ is_recent_search:
+ description: |
+ If the result item was in the recent searches category.
+ type: boolean
+ bugs:
+ - https://bugzilla.mozilla.org/show_bug.cgi?id=1992006
+ data_reviews:
+ - https://phabricator.services.mozilla.com/D271516
+ data_sensitivity:
+ - interaction
+ notification_emails:
+ - android-probes@mozilla.com
+ expires: never
+ metadata:
+ tags:
+ - Settings
history:
opened:
type: event
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt
@@ -47,6 +47,7 @@ import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.GleanMetrics.Addons
import org.mozilla.fenix.GleanMetrics.CookieBanners
import org.mozilla.fenix.GleanMetrics.Events
+import org.mozilla.fenix.GleanMetrics.SettingsSearch
import org.mozilla.fenix.GleanMetrics.TrackingProtection
import org.mozilla.fenix.GleanMetrics.Translations
import org.mozilla.fenix.R
@@ -225,6 +226,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
title = toolbarTitle,
iconResId = R.drawable.ic_search,
onClick = {
+ SettingsSearch.opened.record()
findNavController().navigate(R.id.action_settingsFragment_to_settingsSearchFragment)
},
)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchScreen.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchScreen.kt
@@ -30,6 +30,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import mozilla.components.compose.base.button.TextButton
import mozilla.components.lib.state.ext.observeAsComposableState
+import org.mozilla.fenix.GleanMetrics.SettingsSearch
import org.mozilla.fenix.R
import org.mozilla.fenix.theme.FirefoxTheme
@@ -89,6 +90,7 @@ fun SettingsSearchScreen(
SearchResults(
store = store,
searchItems = state.searchResults,
+ isRecentSearch = false,
modifier = Modifier
.padding(top = topPadding)
.fillMaxSize(),
@@ -120,6 +122,7 @@ private fun SettingsSearchMessageContent(
private fun SearchResults(
store: SettingsSearchStore,
searchItems: List<SettingsSearchItem>,
+ isRecentSearch: Boolean,
modifier: Modifier = Modifier,
) {
val state by store.observeAsComposableState { it }
@@ -136,6 +139,12 @@ private fun SearchResults(
item = searchItem,
query = state.searchQuery,
onClick = {
+ SettingsSearch.searchResultClicked.record(
+ SettingsSearch.SearchResultClickedExtra(
+ itemPreferenceKey = searchItem.preferenceKey,
+ isRecentSearch = isRecentSearch,
+ ),
+ )
store.dispatch(
SettingsSearchAction.ResultItemClicked(
searchItem,
@@ -175,7 +184,12 @@ private fun RecentSearchesContent(
},
)
}
- SearchResults(store, recentSearches, Modifier)
+ SearchResults(
+ store = store,
+ searchItems = recentSearches,
+ isRecentSearch = true,
+ modifier = Modifier,
+ )
}
}