commit a3f5f005f6b53636bbc34ed2bdb1590d1c177394 parent 46590a0b226f2badfb4386890e968856388bcb49 Author: Harrison Oglesby <oglesby.harrison@gmail.com> Date: Mon, 17 Nov 2025 22:38:28 +0000 Bug 1998028 - Part 2: Remove old breadcrumbs from SettingsSearchItem r=android-reviewers,petru Differential Revision: https://phabricator.services.mozilla.com/D272342 Diffstat:
7 files changed, 1 insertion(+), 51 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/DefaultFenixSettingsIndexer.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/DefaultFenixSettingsIndexer.kt @@ -19,7 +19,6 @@ import java.io.IOException */ class DefaultFenixSettingsIndexer(private val context: Context) : SettingsIndexer { private val settings: MutableList<SettingsSearchItem> = mutableListOf() - private val breadcrumbs: MutableList<String> = mutableListOf() /** * Index all settings. @@ -28,9 +27,7 @@ class DefaultFenixSettingsIndexer(private val context: Context) : SettingsIndexe settings.clear() for (preferenceFileInformation in preferenceFileInformationList) { - breadcrumbs.clear() val settingFileParser = getXmlParserForFile(preferenceFileInformation.xmlResourceId) - breadcrumbs.add(context.getString(preferenceFileInformation.topBreadcrumbResourceId)) if (settingFileParser != null) { parseXmlFile(settingFileParser, preferenceFileInformation) } @@ -82,7 +79,6 @@ class DefaultFenixSettingsIndexer(private val context: Context) : SettingsIndexe XmlResourceParser.START_TAG -> { when (parser.name) { PREFERENCE_CATEGORY_TAG -> { - addCategoryToBreadcrumbs(parser) categoryItem = createCategoryItem( parser, preferenceFileInformation, @@ -129,9 +125,6 @@ class DefaultFenixSettingsIndexer(private val context: Context) : SettingsIndexe PREFERENCE_CATEGORY_TAG -> { categoryItem = null categoryItemAdded = false - if (breadcrumbs.isNotEmpty()) { - breadcrumbs.removeLastOrNull() - } } } } @@ -145,24 +138,6 @@ class DefaultFenixSettingsIndexer(private val context: Context) : SettingsIndexe } } - private fun addCategoryToBreadcrumbs( - parser: XmlResourceParser, - ) { - for (i in 0 until parser.attributeCount) { - val attributeName = parser.getAttributeName(i) - val attributeValue = parser.getAttributeValue(i) - - when (attributeName) { - TITLE_ATTRIBUTE_NAME -> { - val categoryName = getStringResource(attributeValue.substring(1)) - if (categoryName.isNotBlank()) { - breadcrumbs.add(categoryName) - } - } - } - } - } - private fun createSettingsSearchItemFromAttributes( parser: XmlResourceParser, preferenceFileInformation: PreferenceFileInformation, @@ -208,7 +183,6 @@ class DefaultFenixSettingsIndexer(private val context: Context) : SettingsIndexe preferenceKey = key, title = title, summary = summary, - breadcrumbs = breadcrumbs.toList(), categoryHeader = categoryHeader, preferenceFileInformation = preferenceFileInformation, ) @@ -253,7 +227,6 @@ class DefaultFenixSettingsIndexer(private val context: Context) : SettingsIndexe preferenceKey = key ?: "", title = title ?: "", summary = summary, - breadcrumbs = breadcrumbs.toList(), categoryHeader = categoryHeader, preferenceFileInformation = preferenceFileInformation, ) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/FenixRecentSettingsSearchesRepository.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/FenixRecentSettingsSearchesRepository.kt @@ -38,7 +38,6 @@ class FenixRecentSettingsSearchesRepository( preferenceKey = protoItem.preferenceKey, title = protoItem.title, summary = protoItem.summary, - breadcrumbs = protoItem.breadcrumbsList, categoryHeader = "", preferenceFileInformation = prefInfo, ) @@ -60,7 +59,6 @@ class FenixRecentSettingsSearchesRepository( .setPreferenceKey(item.preferenceKey) .setTitle(item.title) .setSummary(item.summary) - .addAllBreadcrumbs(item.breadcrumbs) .setXmlResourceId(item.preferenceFileInformation.xmlResourceId) .build() currentItems.add(0, newProtoItem) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchItem.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchItem.kt @@ -10,10 +10,6 @@ package org.mozilla.fenix.settings.settingssearch * @property title Title [String] of the settings item. * @property summary Summary [String] of the settings item. * @property preferenceKey Preference key [String] of the settings item. - * @property breadcrumbs Breadcrumbs [List] of [String]s that leads to the settings item. - * [0] is the section on the main Settings page - * [1] is the subPage title, if any - * [2] is the subPage section, if any * @property categoryHeader Category header [String] of the settings item. * @property preferenceFileInformation Preference file information [PreferenceFileInformation] of the settings item. */ @@ -21,7 +17,6 @@ data class SettingsSearchItem( val title: String, val summary: String, val preferenceKey: String, - val breadcrumbs: List<String>, val categoryHeader: String, val preferenceFileInformation: PreferenceFileInformation, ) { @@ -32,7 +27,6 @@ data class SettingsSearchItem( * @param title New title [String]. * @param summary New summary [String]. * @param preferenceKey New preference key [String]. - * @param breadcrumbs New breadcrumbs [List] of [String]s. * @param categoryHeader New category header [String]. * @param preferenceFileInformation New preference file information [PreferenceFileInformation]. * @return New [SettingsSearchItem] with the given parameters replaced. @@ -41,7 +35,6 @@ data class SettingsSearchItem( title: String? = null, summary: String? = null, preferenceKey: String? = null, - breadcrumbs: List<String>? = null, categoryHeader: String? = null, preferenceFileInformation: PreferenceFileInformation? = null, ): SettingsSearchItem { @@ -49,7 +42,6 @@ data class SettingsSearchItem( title = title ?: this.title, summary = summary ?: this.summary, preferenceKey = preferenceKey ?: this.preferenceKey, - breadcrumbs = breadcrumbs ?: this.breadcrumbs, categoryHeader = categoryHeader ?: this.categoryHeader, preferenceFileInformation = preferenceFileInformation ?: this.preferenceFileInformation, ) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchResultItem.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchResultItem.kt @@ -156,7 +156,6 @@ private class SettingsSearchResultItemParameterProvider : PreviewParameterProvid title = "Search Engine", summary = "Set your preferred search engine for browsing.", preferenceKey = "search_engine_main", - breadcrumbs = listOf("Search", "Default Search Engine"), categoryHeader = "General", preferenceFileInformation = PreferenceFileInformation.SearchSettingsPreferences, ), @@ -164,7 +163,6 @@ private class SettingsSearchResultItemParameterProvider : PreviewParameterProvid title = "Advanced Settings", summary = "", // Empty or blank summary preferenceKey = "advanced_stuff", - breadcrumbs = listOf("Developer", "Experiments"), categoryHeader = "Advanced", preferenceFileInformation = PreferenceFileInformation.GeneralPreferences, ), 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 @@ -286,7 +286,6 @@ private fun SettingsSearchScreenWithRecentsPreview() { "Search engine", "Choose your default", "search_engine", - listOf("General"), categoryHeader = "General", PreferenceFileInformation.SearchSettingsPreferences, ), @@ -294,7 +293,6 @@ private fun SettingsSearchScreenWithRecentsPreview() { "Delete browsing data", "Clear history, cookies, and more", "delete_browsing_data", - listOf("Privacy"), categoryHeader = "Privacy", PreferenceFileInformation.PrivateBrowsingPreferences, ), @@ -323,7 +321,6 @@ private fun SettingsSearchScreenWithResultsPreview() { "Search engine", "Choose your default", "search_engine", - listOf("General"), categoryHeader = "General", PreferenceFileInformation.SearchSettingsPreferences, ), @@ -331,7 +328,6 @@ private fun SettingsSearchScreenWithResultsPreview() { "Homepage", "Choose your homepage", "home_page", - listOf("General"), categoryHeader = "General", PreferenceFileInformation.SearchSettingsPreferences, ), @@ -339,7 +335,6 @@ private fun SettingsSearchScreenWithResultsPreview() { "Tracking Protection", "Strict, Standard, or Custom", "tracking_protection", - listOf("Privacy"), categoryHeader = "Privacy", PreferenceFileInformation.GeneralPreferences, ), @@ -347,7 +342,6 @@ private fun SettingsSearchScreenWithResultsPreview() { "Delete browsing data", "Clear history, cookies, and more", "delete_browsing_data", - listOf("Privacy"), categoryHeader = "Privacy", PreferenceFileInformation.GeneralPreferences, ), @@ -355,7 +349,6 @@ private fun SettingsSearchScreenWithResultsPreview() { "HTTPS-Only Mode", "Enable in all tabs", "https_only_mode", - listOf("Privacy", "Advanced"), categoryHeader = "Privacy", PreferenceFileInformation.GeneralPreferences, ), diff --git a/mobile/android/fenix/app/src/main/proto/recent_settings_searches.proto b/mobile/android/fenix/app/src/main/proto/recent_settings_searches.proto @@ -19,6 +19,5 @@ message RecentSettingsSearchItem { string preference_key = 1; string title = 2; string summary = 3; - repeated string breadcrumbs = 4; - int32 xml_resource_id = 5; // We only need the ID to reconstruct the full object + int32 xml_resource_id = 4; // We only need the ID to reconstruct the full object } diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchMiddlewareTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchMiddlewareTest.kt @@ -131,7 +131,6 @@ val testList = listOf( title = "Search Engine", summary = "Set your preferred search engine for browsing.", preferenceKey = "search_engine_main", - breadcrumbs = listOf("Search", "Default Search Engine"), categoryHeader = "General", preferenceFileInformation = PreferenceFileInformation.SearchSettingsPreferences, ), @@ -139,7 +138,6 @@ val testList = listOf( title = "Advanced Settings", summary = "", // Empty or blank summary preferenceKey = "advanced_stuff", - breadcrumbs = listOf("Developer", "Experiments"), categoryHeader = "Advanced", preferenceFileInformation = PreferenceFileInformation.GeneralPreferences, ), @@ -147,7 +145,6 @@ val testList = listOf( title = "Do not collect usage data", summary = "", // Empty or blank summary preferenceKey = "do_not_collect_data", - breadcrumbs = listOf("Privacy", "Usage Data"), categoryHeader = "Privacy", preferenceFileInformation = PreferenceFileInformation.GeneralPreferences, ),