Commits:
-
4ba775a2
by Beatriz Rizental at 2026-08-24T15:13:56-03:00
fixup! TB 34403: [android] Disable Normal mode by default.
Bug 44210: Drop disableNormalModeByDefault setting. This setting is not
useful, because it (1) is not changeable by the user and (2) it just adds
complexity to the original patch to disable normal mode.
-
f6924714
by Beatriz Rizental at 2026-08-24T15:13:57-03:00
fixup! TB 34403: [android] Disable Normal mode by default.
Bug 44210: [EXTRA] Drop test changes from original patch. These test
changes justse rebase conflicts. We are not running these tests yet.
Let's drop it for now and deal with it when we decide to run the tests
-- if we do.
10 changed files:
Changes:
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/bookmarks/BookmarksScreen.kt
| ... |
... |
@@ -82,7 +82,6 @@ import androidx.compose.ui.text.style.TextAlign |
|
82
|
82
|
import androidx.compose.ui.text.style.TextOverflow
|
|
83
|
83
|
import androidx.compose.ui.unit.dp
|
|
84
|
84
|
import androidx.core.graphics.toColorInt
|
|
85
|
|
-import androidx.compose.ui.platform.LocalContext
|
|
86
|
85
|
import androidx.navigation.NavHostController
|
|
87
|
86
|
import androidx.navigation.compose.NavHost
|
|
88
|
87
|
import androidx.navigation.compose.composable
|
| ... |
... |
@@ -128,7 +127,6 @@ import org.mozilla.fenix.components.components |
|
128
|
127
|
import org.mozilla.fenix.compose.Favicon
|
|
129
|
128
|
import org.mozilla.fenix.compose.list.SelectableFaviconListItem
|
|
130
|
129
|
import org.mozilla.fenix.compose.list.SelectableIconListItem
|
|
131
|
|
-import org.mozilla.fenix.ext.components
|
|
132
|
130
|
import org.mozilla.fenix.ext.getRootView
|
|
133
|
131
|
import org.mozilla.fenix.ext.components
|
|
134
|
132
|
import org.mozilla.fenix.search.SearchFragmentAction.SuggestionClicked
|
| ... |
... |
@@ -1129,15 +1127,11 @@ private fun BookmarkListOverflowMenu( |
|
1129
|
1127
|
onDismissRequest: () -> Unit,
|
|
1130
|
1128
|
store: BookmarksStore,
|
|
1131
|
1129
|
) {
|
|
1132
|
|
- val menuItems = listOfNotNull(
|
|
|
1130
|
+ val menuItems = listOf(
|
|
1133
|
1131
|
MenuItem.TextItem(
|
|
1134
|
1132
|
text = Text.Resource(R.string.bookmark_menu_select_all_bookmarks),
|
|
1135
|
1133
|
onClick = { store.dispatch(BookmarksListMenuAction.SelectAll) },
|
|
1136
|
1134
|
),
|
|
1137
|
|
- MenuItem.TextItem(
|
|
1138
|
|
- text = Text.Resource(R.string.bookmark_menu_open_in_new_tab_button),
|
|
1139
|
|
- onClick = { store.dispatch(BookmarksListMenuAction.MultiSelect.OpenInNormalTabsClicked) },
|
|
1140
|
|
- ).takeIf { !LocalContext.current.components.settings.shouldDisableNormalMode },
|
|
1141
|
1135
|
MenuItem.TextItem(
|
|
1142
|
1136
|
text = Text.Resource(R.string.bookmark_menu_open_in_private_tab_button),
|
|
1143
|
1137
|
onClick = { store.dispatch(BookmarksListMenuAction.MultiSelect.OpenInPrivateTabsClicked) },
|
| ... |
... |
@@ -1198,7 +1192,7 @@ private fun BookmarkListItemMenu( |
|
1198
|
1192
|
bookmark: BookmarkItem.Bookmark,
|
|
1199
|
1193
|
store: BookmarksStore,
|
|
1200
|
1194
|
) {
|
|
1201
|
|
- val menuItems = listOfNotNull(
|
|
|
1195
|
+ val menuItems = listOf(
|
|
1202
|
1196
|
MenuItem.TextItem(
|
|
1203
|
1197
|
text = Text.Resource(R.string.bookmark_menu_select_button),
|
|
1204
|
1198
|
onClick = { store.dispatch(BookmarksListMenuAction.Bookmark.SelectClicked(bookmark)) },
|
| ... |
... |
@@ -1217,10 +1211,6 @@ private fun BookmarkListItemMenu( |
|
1217
|
1211
|
text = Text.Resource(R.string.bookmark_menu_share_button),
|
|
1218
|
1212
|
onClick = { store.dispatch(BookmarksListMenuAction.Bookmark.ShareClicked(bookmark)) },
|
|
1219
|
1213
|
),
|
|
1220
|
|
- MenuItem.TextItem(
|
|
1221
|
|
- text = Text.Resource(R.string.bookmark_menu_open_in_new_tab_button),
|
|
1222
|
|
- onClick = { store.dispatch(BookmarksListMenuAction.Bookmark.OpenInNormalTabClicked(bookmark)) },
|
|
1223
|
|
- ).takeIf { !LocalContext.current.components.settings.shouldDisableNormalMode },
|
|
1224
|
1214
|
MenuItem.TextItem(
|
|
1225
|
1215
|
text = Text.Resource(R.string.bookmark_menu_open_in_private_tab_button),
|
|
1226
|
1216
|
onClick = { store.dispatch(BookmarksListMenuAction.Bookmark.OpenInPrivateTabClicked(bookmark)) },
|
| ... |
... |
@@ -1245,7 +1235,7 @@ private fun BookmarkListFolderMenu( |
|
1245
|
1235
|
folder: BookmarkItem.Folder,
|
|
1246
|
1236
|
store: BookmarksStore,
|
|
1247
|
1237
|
) {
|
|
1248
|
|
- val menuItems = listOfNotNull(
|
|
|
1238
|
+ val menuItems = listOf(
|
|
1249
|
1239
|
MenuItem.TextItem(
|
|
1250
|
1240
|
text = Text.Resource(R.string.bookmark_menu_select_button),
|
|
1251
|
1241
|
onClick = { store.dispatch(BookmarksListMenuAction.Folder.SelectClicked(folder)) },
|
| ... |
... |
@@ -1260,10 +1250,6 @@ private fun BookmarkListFolderMenu( |
|
1260
|
1250
|
store.dispatch(BookmarksListMenuAction.Folder.MoveClicked(folder))
|
|
1261
|
1251
|
},
|
|
1262
|
1252
|
),
|
|
1263
|
|
- MenuItem.TextItem(
|
|
1264
|
|
- text = Text.Resource(R.string.bookmark_menu_open_all_in_tabs_button),
|
|
1265
|
|
- onClick = { store.dispatch(BookmarksListMenuAction.Folder.OpenAllInNormalTabClicked(folder)) },
|
|
1266
|
|
- ).takeIf { !LocalContext.current.components.settings.shouldDisableNormalMode },
|
|
1267
|
1253
|
MenuItem.TextItem(
|
|
1268
|
1254
|
text = Text.Resource(R.string.bookmark_menu_open_all_in_private_tabs_button),
|
|
1269
|
1255
|
onClick = { store.dispatch(BookmarksListMenuAction.Folder.OpenAllInPrivateTabClicked(folder)) },
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/browsingmode/BrowsingModeManager.kt
| ... |
... |
@@ -74,17 +74,7 @@ class DefaultBrowsingModeManager( |
|
74
|
74
|
* Returns the [BrowsingMode] set by the [intent] or the last known [BrowsingMode].
|
|
75
|
75
|
*/
|
|
76
|
76
|
private fun getModeFromIntentOrLastKnown(intent: Intent?): BrowsingMode {
|
|
77
|
|
- if (settings.shouldDisableNormalMode) {
|
|
78
|
|
- return BrowsingMode.Private
|
|
79
|
|
- }
|
|
80
|
|
-
|
|
81
|
|
- intent?.toSafeIntent()?.let {
|
|
82
|
|
- if (it.hasExtra(PRIVATE_BROWSING_MODE)) {
|
|
83
|
|
- val startPrivateMode = it.getBooleanExtra(PRIVATE_BROWSING_MODE, false)
|
|
84
|
|
- return BrowsingMode.fromBoolean(isPrivate = startPrivateMode)
|
|
85
|
|
- }
|
|
86
|
|
- }
|
|
87
|
|
-
|
|
88
|
|
- return settings.lastKnownMode
|
|
|
77
|
+ // tor-browser#44210: Hard-code always on PBM.
|
|
|
78
|
+ return BrowsingMode.Private
|
|
89
|
79
|
}
|
|
90
|
80
|
} |
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/search/ApplicationSearchMiddleware.kt
| ... |
... |
@@ -18,7 +18,6 @@ import mozilla.components.browser.state.state.BrowserState |
|
18
|
18
|
import mozilla.components.feature.search.ext.createApplicationSearchEngine
|
|
19
|
19
|
import mozilla.components.lib.state.Middleware
|
|
20
|
20
|
import mozilla.components.lib.state.Store
|
|
21
|
|
-import org.mozilla.fenix.ext.components
|
|
22
|
21
|
import org.mozilla.fenix.R
|
|
23
|
22
|
import mozilla.components.ui.icons.R as iconsR
|
|
24
|
23
|
|
| ... |
... |
@@ -35,7 +34,7 @@ const val TABS_SEARCH_ENGINE_ID = "tabs_search_engine_id" |
|
35
|
34
|
* @param scope [CoroutineScope] used to launch coroutines.
|
|
36
|
35
|
*/
|
|
37
|
36
|
class ApplicationSearchMiddleware(
|
|
38
|
|
- private val context: Context,
|
|
|
37
|
+ context: Context,
|
|
39
|
38
|
private val stringProvider: (Int) -> String = { context.getString(it) },
|
|
40
|
39
|
private val bitmapProvider: (Int) -> Bitmap = { getDrawable(context, it)?.toBitmap()!! },
|
|
41
|
40
|
private val scope: CoroutineScope = CoroutineScope(Dispatchers.IO),
|
| ... |
... |
@@ -55,7 +54,7 @@ class ApplicationSearchMiddleware( |
|
55
|
54
|
private fun loadSearchEngines(
|
|
56
|
55
|
store: Store<BrowserState, BrowserAction>,
|
|
57
|
56
|
) = scope.launch {
|
|
58
|
|
- val searchEngines = listOfNotNull(
|
|
|
57
|
+ val searchEngines = listOf(
|
|
59
|
58
|
createApplicationSearchEngine(
|
|
60
|
59
|
id = BOOKMARKS_SEARCH_ENGINE_ID,
|
|
61
|
60
|
name = stringProvider(R.string.library_bookmarks),
|
| ... |
... |
@@ -68,12 +67,6 @@ class ApplicationSearchMiddleware( |
|
68
|
67
|
url = "",
|
|
69
|
68
|
icon = bitmapProvider(iconsR.drawable.mozac_ic_tab_tray_24),
|
|
70
|
69
|
),
|
|
71
|
|
- createApplicationSearchEngine(
|
|
72
|
|
- id = HISTORY_SEARCH_ENGINE_ID,
|
|
73
|
|
- name = stringProvider(R.string.library_history),
|
|
74
|
|
- url = "",
|
|
75
|
|
- icon = bitmapProvider(iconsR.drawable.mozac_ic_history_24),
|
|
76
|
|
- ).takeIf { !context.components.settings.shouldDisableNormalMode },
|
|
77
|
70
|
)
|
|
78
|
71
|
|
|
79
|
72
|
store.dispatch(SearchAction.ApplicationSearchEnginesLoaded(searchEngines))
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/HttpsOnlyFragment.kt
| ... |
... |
@@ -62,7 +62,7 @@ class HttpsOnlyFragment : Fragment(), SystemInsetsPaddedFragment { |
|
62
|
62
|
updateEngineHttpsOnlyMode()
|
|
63
|
63
|
}
|
|
64
|
64
|
|
|
65
|
|
- binding.httpsOnlyModes.isGone = requireContext().components.settings.shouldDisableNormalMode
|
|
|
65
|
+ binding.httpsOnlyModes.isGone = true
|
|
66
|
66
|
|
|
67
|
67
|
return binding.root
|
|
68
|
68
|
}
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt
| ... |
... |
@@ -331,15 +331,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragment, |
|
331
|
331
|
getString(R.string.delete_browsing_data_quit_off)
|
|
332
|
332
|
}
|
|
333
|
333
|
// Hide "Delete browsing data on quit" when in Private Browsing-only mode
|
|
334
|
|
- deleteBrowsingDataPreference.isVisible =
|
|
335
|
|
- !deleteBrowsingDataPreference.context.components.settings.shouldDisableNormalMode
|
|
336
|
|
-
|
|
337
|
|
-
|
|
338
|
|
- if (!settings.shouldDisableNormalMode) {
|
|
339
|
|
- val tabSettingsPreference =
|
|
340
|
|
- requirePreference<Preference>(R.string.pref_key_tabs)
|
|
341
|
|
- tabSettingsPreference.summary = context?.components?.settings?.getTabTimeoutString()
|
|
342
|
|
- }
|
|
|
334
|
+ deleteBrowsingDataPreference.isVisible = false
|
|
343
|
335
|
|
|
344
|
336
|
// val autofillPreference = requirePreference<Preference>(R.string.pref_key_credit_cards)
|
|
345
|
337
|
// autofillPreference.title = if (settings.addressFeature) {
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/TabsSettingsFragment.kt
| ... |
... |
@@ -49,11 +49,11 @@ class TabsSettingsFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragm |
|
49
|
49
|
setPreferencesFromResource(R.xml.tabs_preferences, rootKey)
|
|
50
|
50
|
|
|
51
|
51
|
findPreference<RadioButtonPreference>(getString(R.string.pref_key_close_tabs_manually))?.parent?.apply {
|
|
52
|
|
- isVisible = !context.components.settings.shouldDisableNormalMode
|
|
|
52
|
+ isVisible = false
|
|
53
|
53
|
}
|
|
54
|
54
|
|
|
55
|
55
|
findPreference<PreferenceCategory>(getString(R.string.pref_key_inactive_tabs_category))?.apply {
|
|
56
|
|
- isVisible = !context.components.settings.shouldDisableNormalMode
|
|
|
56
|
+ isVisible = false
|
|
57
|
57
|
}
|
|
58
|
58
|
|
|
59
|
59
|
startForResult = registerForActivityResult(
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/search/SearchEngineFragment.kt
| ... |
... |
@@ -49,7 +49,7 @@ class SearchEngineFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragm |
|
49
|
49
|
}
|
|
50
|
50
|
|
|
51
|
51
|
findPreference<CheckBoxPreference>(getString(R.string.pref_key_show_search_suggestions_in_private))?.apply {
|
|
52
|
|
- isVisible = !context.components.settings.shouldDisableNormalMode
|
|
|
52
|
+ isVisible = false
|
|
53
|
53
|
}
|
|
54
|
54
|
|
|
55
|
55
|
view?.hideKeyboard()
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
| ... |
... |
@@ -881,14 +881,9 @@ class Settings( |
|
881
|
881
|
default = 1f,
|
|
882
|
882
|
)
|
|
883
|
883
|
|
|
884
|
|
- val shouldDisableNormalMode by booleanPreference(
|
|
885
|
|
- appContext.getPreferenceKey(R.string.pref_key_disable_normal_mode),
|
|
886
|
|
- true
|
|
887
|
|
- )
|
|
888
|
|
-
|
|
889
|
884
|
val shouldShowHistorySuggestions by booleanPreference(
|
|
890
|
885
|
appContext.getPreferenceKey(R.string.pref_key_search_browsing_history),
|
|
891
|
|
- default = !shouldDisableNormalMode,
|
|
|
886
|
+ default = false,
|
|
892
|
887
|
)
|
|
893
|
888
|
|
|
894
|
889
|
val shouldShowBookmarkSuggestions by booleanPreference(
|
| ... |
... |
@@ -1463,7 +1458,7 @@ class Settings( |
|
1463
|
1458
|
get() {
|
|
1464
|
1459
|
val lastKnownModeWasPrivate = preferences.getBoolean(
|
|
1465
|
1460
|
appContext.getPreferenceKey(R.string.pref_key_last_known_mode_private),
|
|
1466
|
|
- shouldDisableNormalMode,
|
|
|
1461
|
+ true,
|
|
1467
|
1462
|
)
|
|
1468
|
1463
|
|
|
1469
|
1464
|
return if (lastKnownModeWasPrivate) {
|
| ... |
... |
@@ -1705,7 +1700,7 @@ class Settings( |
|
1705
|
1700
|
|
|
1706
|
1701
|
var shouldShowSearchSuggestionsInPrivate by booleanPreference(
|
|
1707
|
1702
|
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions_in_private),
|
|
1708
|
|
- default = shouldDisableNormalMode,
|
|
|
1703
|
+ default = true,
|
|
1709
|
1704
|
)
|
|
1710
|
1705
|
|
|
1711
|
1706
|
/**
|
mobile/android/fenix/app/src/main/res/values/preference_keys.xml
| ... |
... |
@@ -48,7 +48,6 @@ |
|
48
|
48
|
<string name="pref_key_delete_permissions_now" translatable="false">pref_key_delete_permissions_now</string>
|
|
49
|
49
|
<string name="pref_key_delete_downloads_now" translatable="false">pref_key_delete_downloads_now</string>
|
|
50
|
50
|
<string name="pref_key_delete_browsing_data_on_quit_categories" translatable="false">pref_key_delete_browsing_data_on_quit_categories</string>
|
|
51
|
|
- <string name="pref_key_disable_normal_mode" translatable="false">pref_key_disable_normal_mode</string>
|
|
52
|
51
|
<string name="pref_key_last_known_mode_private" translatable="false">pref_key_last_known_mode_private</string>
|
|
53
|
52
|
<string name="pref_key_addons" translatable="false">pref_key_addons</string>
|
|
54
|
53
|
<string name="pref_key_install_local_addon" translatable="false">pref_key_install_local_addon</string>
|
mobile/android/fenix/app/src/test/java/org/mozilla/fenix/utils/SettingsTest.kt
| ... |
... |
@@ -66,13 +66,13 @@ class SettingsTest { |
|
66
|
66
|
fun launchLinksInPrivateTab() {
|
|
67
|
67
|
// When just created
|
|
68
|
68
|
// Then
|
|
69
|
|
- assertTrue(settings.openLinksInAPrivateTab)
|
|
|
69
|
+ assertFalse(settings.openLinksInAPrivateTab)
|
|
70
|
70
|
|
|
71
|
71
|
// When
|
|
72
|
|
- settings.openLinksInAPrivateTab = false
|
|
|
72
|
+ settings.openLinksInAPrivateTab = true
|
|
73
|
73
|
|
|
74
|
74
|
// Then
|
|
75
|
|
- assertFalse(settings.openLinksInAPrivateTab)
|
|
|
75
|
+ assertTrue(settings.openLinksInAPrivateTab)
|
|
76
|
76
|
}
|
|
77
|
77
|
|
|
78
|
78
|
@Test
|
|