tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit ef3214d2d9d9a52cba43d823e25d7f517b1b4a99
parent 371f2666ef4df17d576e17f378f461fd566ca0ef
Author: Ryan VanderMeulen <rvandermeulen@mozilla.com>
Date:   Sat,  6 Dec 2025 16:45:08 +0000

Bug 2003775 - Fix some new errors. r=android-reviewers,mcarare

Differential Revision: https://phabricator.services.mozilla.com/D274967

Diffstat:
Mmobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt | 2+-
Mmobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineView.kt | 2+-
Mmobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/permission/GeckoSitePermissionsStorage.kt | 12++++--------
Mmobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/theme/AcornColors.kt | 4+---
Mmobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/webpush/WebPush.kt | 4+++-
Mmobile/android/android-components/components/feature/accounts/src/main/java/mozilla/components/feature/accounts/FxaWebChannelFeature.kt | 2+-
Mmobile/android/android-components/components/feature/addons/src/main/java/mozilla/components/feature/addons/update/GlobalAddonDependencyProvider.kt | 1-
Mmobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt | 2+-
Mmobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadMiddleware.kt | 3---
Mmobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/provider/FileProvider.kt | 1-
Mmobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/provider/FileProvider.kt | 1-
Mmobile/android/android-components/components/service/firefox-accounts/src/main/java/mozilla/components/service/fxa/manager/State.kt | 2+-
Mmobile/android/android-components/samples/glean/src/main/java/org/mozilla/samples/glean/GleanApplication.kt | 4++--
Mmobile/android/android-components/samples/glean/src/main/java/org/mozilla/samples/glean/MainActivity.kt | 4++--
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/efficiency/factory/steps/NoOpsSteps.kt | 2+-
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/efficiency/factory/steps/VerifySteps.kt | 2+-
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt | 6++----
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt | 4++--
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarMenuBuilder.kt | 6+++---
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/compose/snackbar/Snackbar.kt | 8+++-----
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/messaging/MessageNotificationWorker.kt | 2+-
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/FenixSearchMiddleware.kt | 2+-
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt | 2+-
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/TextPercentageSeekBarPreference.kt | 37++++++++++++-------------------------
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/ext/TabsTrayState.kt | 4++--
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/ui/fab/TabManagerFloatingToolbar.kt | 4++--
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/termsofuse/ui/TermsOfUseBottomSheet.kt | 12+++---------
Mmobile/android/fenix/app/src/test/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMiddlewareTest.kt | 2+-
Mmobile/android/fenix/app/src/test/java/org/mozilla/fenix/helpers/FenixGleanTestRule.kt | 10++++------
Mmobile/android/fenix/app/src/test/java/org/mozilla/fenix/perf/PerformanceInflaterTest.kt | 6++----
Mmobile/android/focus-android/app/src/main/java/org/mozilla/focus/activity/MainActivity.kt | 4+---
Mmobile/android/focus-android/app/src/main/java/org/mozilla/focus/cookiebannerreducer/CookieBannerReducerMiddleware.kt | 4+---
Mmobile/android/focus-android/app/src/main/java/org/mozilla/focus/locale/screen/LanguageMiddleware.kt | 4+---
Mmobile/android/focus-android/quality/detekt-baseline.xml | 1+
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt | 10+++++-----
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeolocationTest.kt | 8++++----
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/InteractiveWidgetTest.kt | 3++-
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt | 12++++++------
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/PanZoomControllerTest.kt | 4++--
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt | 6++----
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TextInputDelegateTest.kt | 8++++----
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebExtensionTest.kt | 6+++---
Mmobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebNotificationTest.kt | 4++--
43 files changed, 92 insertions(+), 135 deletions(-)

diff --git a/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt b/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt @@ -720,7 +720,7 @@ class GeckoEngine( override fun registerActivityDelegate( activityDelegate: ActivityDelegate, ) { - /** + /* * Having the activity delegate on the engine can cause issues with resolving multiple requests to the delegate * from different sessions. Ideally, this should be moved to the [EngineView]. * diff --git a/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineView.kt b/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineView.kt @@ -102,7 +102,7 @@ class GeckoEngineView @JvmOverloads constructor( init { addView(geckoView) - /** + /* * With the current design, we have a [NestedGeckoView] inside this * [GeckoEngineView]. In our supported embedders, we wrap this with the * AndroidX `SwipeRefreshLayout` to enable features like Pull-To-Refresh: diff --git a/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/permission/GeckoSitePermissionsStorage.kt b/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/permission/GeckoSitePermissionsStorage.kt @@ -294,10 +294,8 @@ class GeckoSitePermissionsStorage( val geckoLocalDeviceAccess = geckoPermissionByType[PERMISSION_LOCAL_DEVICE_ACCESS]?.firstOrNull() val geckoLocalNetworkAccess = geckoPermissionByType[PERMISSION_LOCAL_NETWORK_ACCESS]?.firstOrNull() - /** - * We only consider permissions from geckoView, when the values default value - * has been changed otherwise we favor the values [onDiskPermissions]. - */ + // We only consider permissions from GeckoView when the values default value + // has been changed. Otherwise we favor the values [onDiskPermissions]. if (geckoNotification != null && geckoNotification.value != VALUE_PROMPT) { combinedPermissions = combinedPermissions.copy( notification = geckoNotification.value.toStatus(), @@ -340,10 +338,8 @@ class GeckoSitePermissionsStorage( ) } - /** - * Autoplay permissions don't have initial values, so when the value is changed on - * the gecko storage we trust it. - */ + // Autoplay permissions don't have initial values, so when the value is changed on + // the gecko storage we trust it. if (geckoAudible != null && geckoAudible.value != VALUE_PROMPT) { combinedPermissions = combinedPermissions.copy( autoplayAudible = geckoAudible.value.toAutoPlayStatus(), diff --git a/mobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/theme/AcornColors.kt b/mobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/theme/AcornColors.kt @@ -659,9 +659,7 @@ fun acornPrivateColorScheme(): ColorScheme = privateColorPalette.toM3ColorScheme surfaceContainerLowest = PhotonColors.Ink90, ) -/** - * M3 color scheme extensions - */ +// M3 color scheme extensions /** * @see AcornColors.information diff --git a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/webpush/WebPush.kt b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/webpush/WebPush.kt @@ -60,7 +60,9 @@ data class WebPushSubscription( if (appServerKey != null) { if (other.appServerKey == null) return false if (!appServerKey.contentEquals(other.appServerKey)) return false - } else if (other.appServerKey != null) return false + } else if (other.appServerKey != null) { + return false + } if (!publicKey.contentEquals(other.publicKey)) return false if (!authSecret.contentEquals(other.authSecret)) return false diff --git a/mobile/android/android-components/components/feature/accounts/src/main/java/mozilla/components/feature/accounts/FxaWebChannelFeature.kt b/mobile/android/android-components/components/feature/accounts/src/main/java/mozilla/components/feature/accounts/FxaWebChannelFeature.kt @@ -105,7 +105,6 @@ class FxaWebChannelFeature( scope?.cancel() } - @Suppress("MaxLineLength", "") /** * Communication channel is established from fxa-web-content to this class via webextension, as follows: * [fxa-web-content] <--js events--> [fxawebchannel.js webextension] <--port messages--> [FxaWebChannelFeature] @@ -123,6 +122,7 @@ class FxaWebChannelFeature( * oauth-login ------> authentication completed within fxa web content, this class receives OAuth code & state * ``` */ + @Suppress("MaxLineLength") private class WebChannelViewContentMessageHandler( private val accountManager: FxaAccountManager, private val serverConfig: ServerConfig, diff --git a/mobile/android/android-components/components/feature/addons/src/main/java/mozilla/components/feature/addons/update/GlobalAddonDependencyProvider.kt b/mobile/android/android-components/components/feature/addons/src/main/java/mozilla/components/feature/addons/update/GlobalAddonDependencyProvider.kt @@ -10,7 +10,6 @@ import mozilla.components.feature.addons.AddonManager /** * Provides global access to the dependencies needed for updating add-ons. */ -/** @suppress */ object GlobalAddonDependencyProvider { @VisibleForTesting internal var addonManager: AddonManager? = null diff --git a/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt b/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt @@ -701,7 +701,7 @@ abstract class AbstractFetchDownloadService : Service() { // If we are resuming a download and the response does not contain a CONTENT_RANGE // we cannot be sure that the request will properly be handled - if (response.status != PARTIAL_CONTENT_STATUS && response.status != OK_STATUS || + if ((response.status != PARTIAL_CONTENT_STATUS && response.status != OK_STATUS) || (isResumingDownload && !response.headers.contains(CONTENT_RANGE)) ) { response.close() diff --git a/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadMiddleware.kt b/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadMiddleware.kt @@ -208,9 +208,6 @@ class DownloadMiddleware( @VisibleForTesting internal fun startForegroundService(intent: Intent) { - /** - * @see [StartForegroundService] - */ startForegroundService { ContextCompat.startForegroundService(applicationContext, intent) } diff --git a/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/provider/FileProvider.kt b/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/provider/FileProvider.kt @@ -14,5 +14,4 @@ package mozilla.components.feature.downloads.provider * As a convention try to use unique names like using the name of the component as a prefix of the * name of the file, like component_xxx_file_paths.xml. */ -/** @suppress */ class FileProvider : androidx.core.content.FileProvider() diff --git a/mobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/provider/FileProvider.kt b/mobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/provider/FileProvider.kt @@ -14,5 +14,4 @@ package mozilla.components.feature.prompts.provider * As a convention try to use unique names like using the name of the component as a prefix of the * name of the file, like component_xxx_file_paths.xml. */ -/** @suppress */ class FileProvider : androidx.core.content.FileProvider() diff --git a/mobile/android/android-components/components/service/firefox-accounts/src/main/java/mozilla/components/service/fxa/manager/State.kt b/mobile/android/android-components/components/service/firefox-accounts/src/main/java/mozilla/components/service/fxa/manager/State.kt @@ -8,7 +8,7 @@ import mozilla.components.concept.sync.AuthType import mozilla.components.concept.sync.FxAEntryPoint import mozilla.components.service.fxa.FxaAuthData -/** +/* * This file is the "heart" of the accounts system. It's a finite state machine. * Described below are all of the possible states, transitions between them and events which can * trigger these transitions. diff --git a/mobile/android/android-components/samples/glean/src/main/java/org/mozilla/samples/glean/GleanApplication.kt b/mobile/android/android-components/samples/glean/src/main/java/org/mozilla/samples/glean/GleanApplication.kt @@ -58,9 +58,9 @@ class GleanApplication : Application() { buildInfo = GleanBuildInfo.buildInfo, ) - /** Begin Nimbus component specific code. Note: this is not relevant to Glean */ + // Begin Nimbus component specific code. Note: this is not relevant to Glean initNimbus(isFirstRun) - /** End Nimbus specific code. */ + // End Nimbus specific code. Test.timespan.start() diff --git a/mobile/android/android-components/samples/glean/src/main/java/org/mozilla/samples/glean/MainActivity.kt b/mobile/android/android-components/samples/glean/src/main/java/org/mozilla/samples/glean/MainActivity.kt @@ -63,7 +63,7 @@ open class MainActivity : AppCompatActivity(), NimbusInterface.Observer { setupNimbusExperiments() } - /** Begin Nimbus component specific functions */ + // Begin Nimbus component specific functions /** * This sets up the update receiver and sets the onClickListener for the "Update Experiments" @@ -121,5 +121,5 @@ open class MainActivity : AppCompatActivity(), NimbusInterface.Observer { binding.textViewExperimentStatus.text = text } - /** End Nimbus component functions */ + // End Nimbus component functions } diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/efficiency/factory/steps/NoOpsSteps.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/efficiency/factory/steps/NoOpsSteps.kt @@ -6,7 +6,7 @@ package org.mozilla.fenix.ui.efficiency.factory.steps import org.mozilla.fenix.ui.efficiency.factory.logging.StepDescriptor -/** +/* * Collection of minimal [TestStep]s used for dry-run or synthetic tests. * * These steps allow developers to validate logging and control flow diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/efficiency/factory/steps/VerifySteps.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/efficiency/factory/steps/VerifySteps.kt @@ -8,7 +8,7 @@ import org.mozilla.fenix.ui.efficiency.factory.logging.StepDescriptor import org.mozilla.fenix.ui.efficiency.helpers.BasePage import org.mozilla.fenix.ui.efficiency.helpers.PageContext -/** +/* * NOTE: This is for demo/explanation purposes only and can be * replaced with current custom commands, one that start with 'moz', * e.g. mozVerifyElementsByGroup. diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt @@ -82,13 +82,11 @@ class NotificationRobot { fun verifyPrivateTabsNotification() { when (Build.VERSION.SDK_INT) { // For API 34 the notification is slightly different - Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> - { + Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> { verifySystemNotificationExists(getStringResource(R.string.notification_erase_title_android_14)) verifySystemNotificationExists(getStringResource(R.string.notification_erase_text_android_14)) } - else -> - { + else -> { verifySystemNotificationExists("$appName (Private)") verifySystemNotificationExists("Close private tabs") } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt @@ -137,7 +137,7 @@ class AddonPermissionsDetailsFragment : Fragment() { onUpdatePermissionsSuccess(it) }, onError = { - /** No-Op **/ + // No-Op }, ) } @@ -155,7 +155,7 @@ class AddonPermissionsDetailsFragment : Fragment() { onUpdatePermissionsSuccess(it) }, onError = { - /** No-Op **/ + // No-Op }, ) } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarMenuBuilder.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarMenuBuilder.kt @@ -64,9 +64,9 @@ internal class ToolbarMenuBuilder( @Suppress("ComplexCondition") private fun ToolbarMenu.Item.performHapticIfNeeded(view: View) { - if (this is ToolbarMenu.Item.Reload && this.bypassCache || - this is ToolbarMenu.Item.Back && this.viewHistory || - this is ToolbarMenu.Item.Forward && this.viewHistory + if ((this is ToolbarMenu.Item.Reload && this.bypassCache) || + (this is ToolbarMenu.Item.Back && this.viewHistory) || + (this is ToolbarMenu.Item.Forward && this.viewHistory) ) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/compose/snackbar/Snackbar.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/compose/snackbar/Snackbar.kt @@ -154,11 +154,9 @@ class Snackbar private constructor( var fallback: ViewGroup? = null do { - /** - * A [ConstraintLayout] parent overcomes the issue with snackbars internally - * positioning themselves above the OS navigation bar or IMEs when using edge-to-edge - * https://github.com/material-components/material-components-android/issues/3446 - */ + // A [ConstraintLayout] parent overcomes the issue with snackbars internally + // positioning themselves above the OS navigation bar or IMEs when using edge-to-edge + // https://github.com/material-components/material-components-android/issues/3446 if (currentView is ConstraintLayout && currentView.id == R.id.dynamicSnackbarContainer) { return currentView } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/messaging/MessageNotificationWorker.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/messaging/MessageNotificationWorker.kt @@ -51,7 +51,7 @@ const val DISMISSED_MESSAGE_ID = "dismissedMessageId" * or during the next scheduled sync interval. * * **Six seconds will cover 99% of users** based on Nimbus research. - * @see `https://sql.telemetry.mozilla.org/queries/91863/source?p_days=30#227434`. + * @see https://sql.telemetry.mozilla.org/queries/91863/source?p_days=30#227434. */ private const val NIMBUS_FETCH_OPERATION_TIMEOUT_MILLIS: Long = 6000 diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/FenixSearchMiddleware.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/FenixSearchMiddleware.kt @@ -235,7 +235,7 @@ class FenixSearchMiddleware( (searchStartedForCurrentUrl || FxNimbus.features.searchSuggestionsOnHomepage.value().enabled) } val shouldShowSearchSuggestions = with(context.state) { - (url != query && query.isNotBlank() || showSearchShortcuts) + ((url != query && query.isNotBlank()) || showSearchShortcuts) } val shouldShowSuggestions = shouldShowTrendingSearches || shouldShowSearchSuggestions diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt @@ -569,7 +569,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler { * query as consumeFrom may run several times on fragment start due to state updates. * */ - flow.map { state -> state.url != state.query && state.query.isNotBlank() || state.showSearchShortcuts } + flow.map { state -> (state.url != state.query && state.query.isNotBlank()) || state.showSearchShortcuts } .distinctUntilChanged() .collect { shouldShowAwesomebar -> binding.awesomeBar.visibility = if (shouldShowAwesomebar) { diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/TextPercentageSeekBarPreference.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/TextPercentageSeekBarPreference.kt @@ -171,23 +171,18 @@ class TextPercentageSeekBarPreference @JvmOverloads constructor( } /** - * Returns the amount of increment change via each arrow key click. This value is derived from - * user's specified increment value if it's not zero. Otherwise, the default value is picked - * from the default mKeyProgressIncrement value in [android.widget.AbsSeekBar]. - * @return The amount of increment on the [SeekBar] performed after each user's arrow - * key press + * The amount of increment change applied to the [SeekBar] for each arrow key press. + * + * If the user-specified increment is non-zero, that value is used. Otherwise, the default + * increment comes from [android.widget.AbsSeekBar]'s `mKeyProgressIncrement`. + * + * When set, the value is clamped to the range `0..(mMax - mMin)` and its absolute value is used. */ var seekBarIncrement: Int get() = mSeekBarIncrement - - /** - * Sets the increment amount on the [SeekBar] for each arrow key press. - * @param seekBarIncrement The amount to increment or decrement when the user presses an - * arrow key. - */ - set(seekBarIncrement) { - if (seekBarIncrement != mSeekBarIncrement) { - mSeekBarIncrement = min(mMax - mMin, abs(seekBarIncrement)) + set(value) { + if (value != mSeekBarIncrement) { + mSeekBarIncrement = min(mMax - mMin, abs(value)) notifyChanged() } } @@ -209,20 +204,12 @@ class TextPercentageSeekBarPreference @JvmOverloads constructor( } /** - * Gets whether the current [SeekBar] value is displayed to the user. - * @return Whether the current [SeekBar] value is displayed to the user - * @see .setShowSeekBarValue + * Whether the current [SeekBar] value is displayed to the user. */ var showSeekBarValue: Boolean get() = mShowSeekBarValue - - /** - * Sets whether the current [SeekBar] value is displayed to the user. - * @param showSeekBarValue Whether the current [SeekBar] value is displayed to the user - * @see .getShowSeekBarValue - */ - set(showSeekBarValue) { - mShowSeekBarValue = showSeekBarValue + set(value) { + mShowSeekBarValue = value notifyChanged() } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/ext/TabsTrayState.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/ext/TabsTrayState.kt @@ -164,8 +164,8 @@ private fun generateTabPageBannerMenuItems( onClick = onAccountSettingsClick, ) return when { - selectedPage == Page.NormalTabs && normalTabCount == 0 || - selectedPage == Page.PrivateTabs && privateTabCount == 0 -> listOf( + (selectedPage == Page.NormalTabs && normalTabCount == 0) || + (selectedPage == Page.PrivateTabs && privateTabCount == 0) -> listOf( tabSettingsItem, recentlyClosedTabsItem, ) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/ui/fab/TabManagerFloatingToolbar.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/ui/fab/TabManagerFloatingToolbar.kt @@ -394,8 +394,8 @@ private fun generateMenuItems( onClick = onAccountSettingsClick, ) return when { - selectedPage == Page.NormalTabs && normalTabCount == 0 || - selectedPage == Page.PrivateTabs && privateTabCount == 0 -> listOf( + (selectedPage == Page.NormalTabs && normalTabCount == 0) || + (selectedPage == Page.PrivateTabs && privateTabCount == 0) -> listOf( recentlyClosedTabsItem, tabSettingsItem, ) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/termsofuse/ui/TermsOfUseBottomSheet.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/termsofuse/ui/TermsOfUseBottomSheet.kt @@ -292,9 +292,7 @@ private fun TermsOfUseBottomSheetMobilePortraitNoHandlePreview() { } @OptIn(ExperimentalMaterial3Api::class) -/** - * Preview copied from [androidx.compose.ui.tooling.preview.PreviewScreenSizes]. - */ +// Preview copied from [androidx.compose.ui.tooling.preview.PreviewScreenSizes]. @Preview( name = "Phone - Landscape", device = "spec:width=411dp,height=891dp,orientation=landscape,dpi=420", @@ -313,9 +311,7 @@ private fun TermsOfUseBottomSheetMobileLandscapePreview() { } @OptIn(ExperimentalMaterial3Api::class) -/** - * Preview copied from [androidx.compose.ui.tooling.preview.PreviewScreenSizes]. - */ +// Preview copied from [androidx.compose.ui.tooling.preview.PreviewScreenSizes]. @Preview( name = "Tablet - Portrait", device = "spec:width=1280dp,height=800dp,dpi=240,orientation=portrait", @@ -334,9 +330,7 @@ private fun TermsOfUseBottomSheetTabletPortraitPreview() { } @OptIn(ExperimentalMaterial3Api::class) -/** - * Preview copied from [androidx.compose.ui.tooling.preview.PreviewScreenSizes]. - */ +// Preview copied from [androidx.compose.ui.tooling.preview.PreviewScreenSizes]. @Preview(name = "Tablet - Landscape", device = TABLET, showSystemUi = true) @Composable private fun TermsOfUseBottomSheetTabletLandscapePreview() { diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMiddlewareTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMiddlewareTest.kt @@ -2814,7 +2814,7 @@ class BrowserToolbarMiddlewareTest { val toolbarStore = buildStore(middleware) mainLooperRule.idle() - val editButton = toolbarStore.state.displayState.browserActionsEnd [0] as ActionButtonRes + val editButton = toolbarStore.state.displayState.browserActionsEnd[0] as ActionButtonRes assertEquals(expectedEditBookmarkButton(Source.AddressBar), editButton) } diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/helpers/FenixGleanTestRule.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/helpers/FenixGleanTestRule.kt @@ -43,12 +43,10 @@ class FenixGleanTestRule( // in tests without this line. Let's simply put it here. WorkManagerTestInitHelper.initializeTestWorkManager(context) - /** - * Always skip the first metrics ping, which would otherwise be overdue. - * Tests should explicitly destroy Glean and recreate it to test the metrics ping scheduler. - * This is the same as `delayMetricsPing` from `TestUtils.kt`, - * but now part of the publicly available test rule. - */ + // Always skip the first metrics ping, which would otherwise be overdue. + // Tests should explicitly destroy Glean and recreate it to test the metrics ping scheduler. + // This is the same as `delayMetricsPing` from `TestUtils.kt`, + // but now part of the publicly available test rule. // // Set the current system time to a known datetime. // val fakeNow = Calendar.getInstance() diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/perf/PerformanceInflaterTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/perf/PerformanceInflaterTest.kt @@ -31,10 +31,8 @@ class PerformanceInflaterTest { "fragment_browser", "fragment_add_on_internal_settings", "activity_privacy_content_display", - /** - * activity_home.xml contains FragmentContainerView which needs to be - * put inside FragmentActivity in order to get inflated - */ + // activity_home.xml contains FragmentContainerView which needs to be + // put inside FragmentActivity in order to get inflated "activity_home", ) diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/activity/MainActivity.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/activity/MainActivity.kt @@ -67,9 +67,7 @@ import org.mozilla.focus.utils.ViewUtils private const val REQUEST_TIME_OUT = 2000L @Suppress("LargeClass") -/** - * The main entry point for the app. - */ +// The main entry point for the app. open class MainActivity : EdgeToEdgeActivity() { private var isToolbarInflated = false private val intentProcessor by lazy { diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/cookiebannerreducer/CookieBannerReducerMiddleware.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/cookiebannerreducer/CookieBannerReducerMiddleware.kt @@ -40,9 +40,7 @@ class CookieBannerReducerMiddleware( ) { when (action) { is CookieBannerReducerAction.InitCookieBannerReducer -> { - /** - * The initial CookieBannerReducerState when the user enters first in the screen - */ + // The initial CookieBannerReducerState when the user enters first in the screen initCookieBannerReducer(context) } diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/locale/screen/LanguageMiddleware.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/locale/screen/LanguageMiddleware.kt @@ -48,9 +48,7 @@ class LanguageMiddleware( next(action) } is LanguageScreenAction.InitLanguages -> { - /** - * The initial LanguageScreenState when the user enters first in the screen - */ + // The initial LanguageScreenState when the user enters first in the screen context.dispatch( LanguageScreenAction.UpdateLanguages( storage.languages, diff --git a/mobile/android/focus-android/quality/detekt-baseline.xml b/mobile/android/focus-android/quality/detekt-baseline.xml @@ -62,6 +62,7 @@ <ID>UndocumentedPublicClass:IntentProcessor.kt$IntentProcessor.Result$None : Result</ID> <ID>UndocumentedPublicClass:IntentProcessor.kt$IntentProcessor.Result$Tab : Result</ID> <ID>UndocumentedPublicClass:LocaleDescriptor.kt$LocaleDescriptor : Comparable</ID> + <ID>UndocumentedPublicClass:MainActivity.kt$MainActivity : EdgeToEdgeActivity</ID> <ID>UndocumentedPublicClass:ManualAddSearchEnginePreference.kt$ManualAddSearchEnginePreference : Preference</ID> <ID>UndocumentedPublicClass:ManualAddSearchEngineSettingsFragment.kt$ManualAddSearchEngineSettingsFragment : BaseSettingsFragment</ID> <ID>UndocumentedPublicClass:MozillaPreference.kt$MozillaPreference : Preference</ID> diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt @@ -1430,13 +1430,13 @@ class AccessibilityTest : BaseSessionTest() { } } - val ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE = AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE - val ACTION_SET_TEXT = AccessibilityNodeInfo.ACTION_SET_TEXT - - args.putCharSequence(ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, value) + args.putCharSequence( + AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, + value, + ) assertThat( "Can perform auto-fill", - provider.performAction(id, ACTION_SET_TEXT, args), + provider.performAction(id, AccessibilityNodeInfo.ACTION_SET_TEXT, args), equalTo(true), ) } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeolocationTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeolocationTest.kt @@ -33,9 +33,9 @@ import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.TimeoutMillis @RunWith(AndroidJUnit4::class) @LargeTest class GeolocationTest : BaseSessionTest() { - private val LOGTAG = "GeolocationTest" private val activityRule = ActivityScenarioRule(GeckoViewTestActivity::class.java) private val context = InstrumentationRegistry.getInstrumentation().targetContext + private val logTag = "GeolocationTest" private lateinit var locManager: LocationManager private lateinit var mockGpsProvider: MockLocationProvider private lateinit var mockNetworkProvider: MockLocationProvider @@ -237,7 +237,7 @@ class GeolocationTest : BaseSessionTest() { ProcessLifecycleOwner.get().lifecycle.addObserver( object : DefaultLifecycleObserver { override fun onResume(owner: LifecycleOwner) { - Log.i(LOGTAG, "onResume Event") + Log.i(logTag, "onResume Event") actualResumeCount++ super.onResume(owner) try { @@ -271,14 +271,14 @@ class GeolocationTest : BaseSessionTest() { } override fun onPause(owner: LifecycleOwner) { - Log.i(LOGTAG, "onPause Event") + Log.i(logTag, "onPause Event") actualPauseCount++ super.onPause(owner) try { mockGpsProvider.setMockLocation(afterPauseLat, afterPauseLon) mockGpsProvider.postLocation() } catch (e: Exception) { - Log.w(LOGTAG, "onPause was called too late.") + Log.w(logTag, "onPause was called too late.") // Potential situation where onPause is called too late } } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/InteractiveWidgetTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/InteractiveWidgetTest.kt @@ -64,7 +64,8 @@ class InteractiveWidgetTest : BaseSessionTest() { activityRule.scenario.onActivity { activity -> activity.view.releaseSession() } - } catch (e: Exception) {} + } catch (e: Exception) { + } } private fun ensureKeyboardOpen() { diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt @@ -729,10 +729,10 @@ class NavigationDelegateTest : BaseSessionTest() { mainSession.waitForPageStop() // load insecure subdomain url to see if it gets upgraded to https - val http_uri = "http://test1.example.com/" - val https_uri = "https://test1.example.com/" + val httpUri = "http://test1.example.com/" + val httpsUri = "https://test1.example.com/" - mainSession.loadUri(http_uri) + mainSession.loadUri(httpUri) mainSession.waitForPageStop() mainSession.forCallbacksDuringWait(object : NavigationDelegate { @@ -744,15 +744,15 @@ class NavigationDelegateTest : BaseSessionTest() { assertThat( "URI should be HTTP then redirected to HTTPS", request.uri, - equalTo(forEachCall(http_uri, https_uri)), + equalTo(forEachCall(httpUri, httpsUri)), ) return null } }) // load subdomain that will trigger the cert error - val no_cert_uri = "https://nocert.example.com/" - mainSession.loadUri(no_cert_uri) + val noCertUri = "https://nocert.example.com/" + mainSession.loadUri(noCertUri) mainSession.waitForPageStop() mainSession.forCallbacksDuringWait(object : NavigationDelegate { diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/PanZoomControllerTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/PanZoomControllerTest.kt @@ -28,8 +28,8 @@ import kotlin.math.roundToInt @MediumTest class PanZoomControllerTest : BaseSessionTest() { private val errorEpsilon = 3.0 + private val logTag = "PanZoomControllerTest" private val scrollWaitTimeout = 10000.0 // 10 seconds - private val LOGTAG = "PanZoomControllerTest" private fun setupDocument(documentPath: String) { mainSession.loadTestPath(documentPath) @@ -839,7 +839,7 @@ class PanZoomControllerTest : BaseSessionTest() { object : GeckoSession.CompositorScrollDelegate { override fun onScrollChanged(session: GeckoSession, update: ScrollPositionUpdate) { var scrollY = update.scrollY - Log.d(LOGTAG, "test scroll delegate onScrollChanged, scrollY = " + scrollY) + Log.d(logTag, "test scroll delegate onScrollChanged, scrollY = " + scrollY) wasNotified = true assertThat( "notified scrollY is correct", diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt @@ -273,10 +273,8 @@ class RuntimeSettingsTest : BaseSessionTest() { val sanitizedDefaultLargeKeepaliveFactor = 1 - /** - * Setting an invalid factor will cause an exception to be throw in debug build. - * otherwise, the factor will be reset to default when an invalid factor is given. - */ + // Setting an invalid factor will cause an exception to be throw in debug build. + // otherwise, the factor will be reset to default when an invalid factor is given. try { settings.setLargeKeepaliveFactor(128) prefValue = (sessionRule.getPrefs(largeKeepaliveFactorPref)[0] as Int) diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TextInputDelegateTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TextInputDelegateTest.kt @@ -627,7 +627,7 @@ class TextInputDelegateTest : BaseSessionTest() { ic, "foobarfoo", 5, - /* checkGecko */ + // checkGecko false, ) } @@ -733,7 +733,7 @@ class TextInputDelegateTest : BaseSessionTest() { ic, "frabar", 6, - /* checkGecko */ + // checkGecko false, ) @@ -923,7 +923,7 @@ class TextInputDelegateTest : BaseSessionTest() { "Can set large initial text", ic, content, - /* checkGecko */ + // checkGecko false, ) } @@ -1520,7 +1520,7 @@ class TextInputDelegateTest : BaseSessionTest() { ic, 0, 0, - /* checkGecko */ + // checkGecko false, ) diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebExtensionTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebExtensionTest.kt @@ -2081,7 +2081,7 @@ class WebExtensionTest : BaseSessionTest() { "browser", ) - val TEST_SINCE_VALUE = 59294 + val testSinceValue = 59294 sessionRule.addExternalDelegateUntilTestEnd( WebExtension.BrowsingDataDelegate::class, @@ -2091,7 +2091,7 @@ class WebExtensionTest : BaseSessionTest() { override fun onGetSettings(): GeckoResult<WebExtension.BrowsingDataDelegate.Settings>? { return GeckoResult.fromValue( WebExtension.BrowsingDataDelegate.Settings( - TEST_SINCE_VALUE, + testSinceValue, CACHE or COOKIES or DOWNLOADS or HISTORY or LOCAL_STORAGE, CACHE or COOKIES or HISTORY, ), @@ -2323,7 +2323,7 @@ class WebExtensionTest : BaseSessionTest() { assertThat( "Since should be correct", options.getInt("since"), - equalTo(TEST_SINCE_VALUE), + equalTo(testSinceValue), ) for (key in listOf("cache", "cookies", "history")) { assertThat( diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebNotificationTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebNotificationTest.kt @@ -406,7 +406,7 @@ class WebNotificationTest : BaseSessionTest() { val parcel = Parcel.obtain() notification.writeToParcel( parcel, - /* ignored */ + // ignored -1, ) @@ -450,7 +450,7 @@ class WebNotificationTest : BaseSessionTest() { val parcel = Parcel.obtain() notification.writeToParcel( parcel, - /* ignored */ + // ignored -1, ) parcel.setDataPosition(0)