Loading mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt +2 −0 Original line number Diff line number Diff line Loading @@ -2211,6 +2211,8 @@ class GeckoEngine( installedExtension.registerTabHandler(webExtensionTabHandler, defaultSettings) onSuccess(installedExtension) } fun getTorIntegrationController() = runtime.getTorIntegrationController() } internal fun ContentBlockingController.LogEntry.BlockingData.hasBlockedCookies(): Boolean { Loading mobile/android/fenix/app/build.gradle +9 −0 Original line number Diff line number Diff line import com.android.build.api.variant.BuildConfigField import com.android.build.api.variant.FilterConfiguration import java.time.format.DateTimeFormatter Loading Loading @@ -280,11 +281,16 @@ androidComponents { System.setProperty("nimbusFml", gradle.mozconfig.substs.NIMBUS_FML) } def disableTor = providers.gradleProperty("disableTor").getOrElse(false) project.logger.debug("----------------------------------------------") project.logger.debug("Variant name: " + variant.name) project.logger.debug("Build type: " + buildType) project.logger.debug("Flavor: " + variant.flavorName) project.logger.debug("nimbusFml: " + providers.gradleProperty("nimbusFml").getOrNull()) project.logger.debug("Tor is disabled: " + disableTor) variant.buildConfigFields.put("DISABLE_TOR", new BuildConfigField("boolean", "$disableTor", null)) // This list must stay in sync with the build types that set USE_RELEASE_VERSIONING=true in // their buildConfigField. The legacy variant API exposed buildConfigFields on the build type Loading Loading @@ -683,6 +689,9 @@ dependencies { androidTestUtil libs.androidx.test.orchestrator lintChecks project(':components:tooling-lint') // Tor Expert Bundle implementation files(gradle.mozconfig.substs.TOR_EXPERT_BUNDLE_AAR) } protobuf { Loading mobile/android/fenix/app/src/main/assets/common/torrc-defaults 0 → 100644 +9 −0 Original line number Diff line number Diff line ## torrc-defaults for Tor Browser for Android AvoidDiskWrites 1 # (stderr|stdout|syslog|file FILENAME). Log notice stdout CookieAuthentication 1 DormantCanceledByStartup 1 ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit,webtunnel exec ./libLyrebird.so ClientTransportPlugin snowflake exec ./libLyrebird.so ClientTransportPlugin conjure exec ./libConjure.so -registerURL https://registration.refraction.network/api mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +3 −1 Original line number Diff line number Diff line Loading @@ -415,6 +415,8 @@ open class FenixApplication : Application(), Provider, ThemeProvider { CoroutineScope(IO).launch { components.useCases.wallpaperUseCases.fetchCurrentWallpaperUseCase.invoke() } components.torController.start() } @OptIn(DelicateCoroutinesApi::class) // GlobalScope usage Loading Loading @@ -1125,7 +1127,7 @@ open class FenixApplication : Application(), Provider, ThemeProvider { googleLensEnabled.set( settings.googleLensIntegrationEnabled && settings.googleLensIntegrationUserEnabled, ) openLinksInAppEnabled.set(settings.openLinksInExternalApp) // openLinksInAppEnabled.set(settings.openLinksInExternalApp) signedInSync.set(settings.signedInFxaAccount) isolatedContentProcessesEnabled.set(settings.isIsolatedProcessEnabled) appZygoteIsolatedContentProcessesEnabled.set(settings.isAppZygoteEnabled) Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +31 −7 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ package org.mozilla.fenix import android.annotation.SuppressLint import android.app.assist.AssistContent import android.app.PendingIntent import android.content.ComponentName Loading Loading @@ -193,6 +194,7 @@ import org.mozilla.fenix.theme.TabStripStatusBarView import org.mozilla.fenix.theme.ThemeManager import org.mozilla.fenix.translations.TranslationsAIControllableFeatureRegistrar import org.mozilla.fenix.translations.TranslationsEnabledSettings import org.mozilla.fenix.tor.TorEvents import org.mozilla.fenix.utils.AccessibilityUtils.announcePrivateModeForAccessibility import org.mozilla.fenix.utils.Settings import org.mozilla.fenix.utils.changeAppLauncherIcon Loading Loading @@ -1002,7 +1004,26 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, Crash /** * Handles intents received when the activity is open. */ @SuppressLint("MissingSuperCall") // super.onNewIntent is called in [onNewIntentInternal(intent)] final override fun onNewIntent(intent: Intent) { if (intent.action == ACTION_MAIN || components.torController.isBootstrapped) { onNewIntentInternal(intent) } else { // Wait until Tor is connected to handle intents from external apps for links, search, etc. components.torController.registerTorListener(object : TorEvents { override fun onTorConnected() { components.torController.unregisterTorListener(this) onNewIntentInternal(intent) } override fun onTorConnecting() { /* no-op */ } override fun onTorStopped() { /* no-op */ } override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) { /* no-op */ } }) return } } private fun onNewIntentInternal(intent: Intent) { super.onNewIntent(intent) handleNewIntent(intent) startupPathProvider.onIntentReceived(intent) Loading Loading @@ -1478,11 +1499,11 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, Crash @VisibleForTesting internal fun navigateToHome(navController: NavController) { if (this is ExternalAppBrowserActivity) { return } // if (this is ExternalAppBrowserActivity) { // return // } navController.navigate(NavGraphDirections.actionStartupHome()) navController.navigate(NavGraphDirections.actionStartupTorbootstrap()) } @VisibleForTesting Loading Loading @@ -1632,14 +1653,17 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, Crash /** * Indicates if the user should be redirected to the [BrowserFragment] or to the [HomeFragment], * links from an external apps should always opened in the [BrowserFragment]. * links from an external apps should always opened in the [BrowserFragment], * unless Tor is not yet connected. */ @VisibleForTesting internal fun shouldStartOnHome(intent: Intent? = this.intent): Boolean { return components.strictMode.allowViolation(StrictMode::allowThreadDiskReads) { // We only want to open on home when users tap the app, // we want to ignore other cases when the app gets open by users clicking on links. getSettings().shouldStartOnHome() && intent?.action == ACTION_MAIN // we want to ignore other cases when the app gets open by users clicking on links, // unless Tor is not yet connected. getSettings().shouldStartOnHome() && (intent?.action == ACTION_MAIN || !components.torController.isBootstrapped) } } Loading Loading
mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt +2 −0 Original line number Diff line number Diff line Loading @@ -2211,6 +2211,8 @@ class GeckoEngine( installedExtension.registerTabHandler(webExtensionTabHandler, defaultSettings) onSuccess(installedExtension) } fun getTorIntegrationController() = runtime.getTorIntegrationController() } internal fun ContentBlockingController.LogEntry.BlockingData.hasBlockedCookies(): Boolean { Loading
mobile/android/fenix/app/build.gradle +9 −0 Original line number Diff line number Diff line import com.android.build.api.variant.BuildConfigField import com.android.build.api.variant.FilterConfiguration import java.time.format.DateTimeFormatter Loading Loading @@ -280,11 +281,16 @@ androidComponents { System.setProperty("nimbusFml", gradle.mozconfig.substs.NIMBUS_FML) } def disableTor = providers.gradleProperty("disableTor").getOrElse(false) project.logger.debug("----------------------------------------------") project.logger.debug("Variant name: " + variant.name) project.logger.debug("Build type: " + buildType) project.logger.debug("Flavor: " + variant.flavorName) project.logger.debug("nimbusFml: " + providers.gradleProperty("nimbusFml").getOrNull()) project.logger.debug("Tor is disabled: " + disableTor) variant.buildConfigFields.put("DISABLE_TOR", new BuildConfigField("boolean", "$disableTor", null)) // This list must stay in sync with the build types that set USE_RELEASE_VERSIONING=true in // their buildConfigField. The legacy variant API exposed buildConfigFields on the build type Loading Loading @@ -683,6 +689,9 @@ dependencies { androidTestUtil libs.androidx.test.orchestrator lintChecks project(':components:tooling-lint') // Tor Expert Bundle implementation files(gradle.mozconfig.substs.TOR_EXPERT_BUNDLE_AAR) } protobuf { Loading
mobile/android/fenix/app/src/main/assets/common/torrc-defaults 0 → 100644 +9 −0 Original line number Diff line number Diff line ## torrc-defaults for Tor Browser for Android AvoidDiskWrites 1 # (stderr|stdout|syslog|file FILENAME). Log notice stdout CookieAuthentication 1 DormantCanceledByStartup 1 ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit,webtunnel exec ./libLyrebird.so ClientTransportPlugin snowflake exec ./libLyrebird.so ClientTransportPlugin conjure exec ./libConjure.so -registerURL https://registration.refraction.network/api
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +3 −1 Original line number Diff line number Diff line Loading @@ -415,6 +415,8 @@ open class FenixApplication : Application(), Provider, ThemeProvider { CoroutineScope(IO).launch { components.useCases.wallpaperUseCases.fetchCurrentWallpaperUseCase.invoke() } components.torController.start() } @OptIn(DelicateCoroutinesApi::class) // GlobalScope usage Loading Loading @@ -1125,7 +1127,7 @@ open class FenixApplication : Application(), Provider, ThemeProvider { googleLensEnabled.set( settings.googleLensIntegrationEnabled && settings.googleLensIntegrationUserEnabled, ) openLinksInAppEnabled.set(settings.openLinksInExternalApp) // openLinksInAppEnabled.set(settings.openLinksInExternalApp) signedInSync.set(settings.signedInFxaAccount) isolatedContentProcessesEnabled.set(settings.isIsolatedProcessEnabled) appZygoteIsolatedContentProcessesEnabled.set(settings.isAppZygoteEnabled) Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +31 −7 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ package org.mozilla.fenix import android.annotation.SuppressLint import android.app.assist.AssistContent import android.app.PendingIntent import android.content.ComponentName Loading Loading @@ -193,6 +194,7 @@ import org.mozilla.fenix.theme.TabStripStatusBarView import org.mozilla.fenix.theme.ThemeManager import org.mozilla.fenix.translations.TranslationsAIControllableFeatureRegistrar import org.mozilla.fenix.translations.TranslationsEnabledSettings import org.mozilla.fenix.tor.TorEvents import org.mozilla.fenix.utils.AccessibilityUtils.announcePrivateModeForAccessibility import org.mozilla.fenix.utils.Settings import org.mozilla.fenix.utils.changeAppLauncherIcon Loading Loading @@ -1002,7 +1004,26 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, Crash /** * Handles intents received when the activity is open. */ @SuppressLint("MissingSuperCall") // super.onNewIntent is called in [onNewIntentInternal(intent)] final override fun onNewIntent(intent: Intent) { if (intent.action == ACTION_MAIN || components.torController.isBootstrapped) { onNewIntentInternal(intent) } else { // Wait until Tor is connected to handle intents from external apps for links, search, etc. components.torController.registerTorListener(object : TorEvents { override fun onTorConnected() { components.torController.unregisterTorListener(this) onNewIntentInternal(intent) } override fun onTorConnecting() { /* no-op */ } override fun onTorStopped() { /* no-op */ } override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) { /* no-op */ } }) return } } private fun onNewIntentInternal(intent: Intent) { super.onNewIntent(intent) handleNewIntent(intent) startupPathProvider.onIntentReceived(intent) Loading Loading @@ -1478,11 +1499,11 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, Crash @VisibleForTesting internal fun navigateToHome(navController: NavController) { if (this is ExternalAppBrowserActivity) { return } // if (this is ExternalAppBrowserActivity) { // return // } navController.navigate(NavGraphDirections.actionStartupHome()) navController.navigate(NavGraphDirections.actionStartupTorbootstrap()) } @VisibleForTesting Loading Loading @@ -1632,14 +1653,17 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, Crash /** * Indicates if the user should be redirected to the [BrowserFragment] or to the [HomeFragment], * links from an external apps should always opened in the [BrowserFragment]. * links from an external apps should always opened in the [BrowserFragment], * unless Tor is not yet connected. */ @VisibleForTesting internal fun shouldStartOnHome(intent: Intent? = this.intent): Boolean { return components.strictMode.allowViolation(StrictMode::allowThreadDiskReads) { // We only want to open on home when users tap the app, // we want to ignore other cases when the app gets open by users clicking on links. getSettings().shouldStartOnHome() && intent?.action == ACTION_MAIN // we want to ignore other cases when the app gets open by users clicking on links, // unless Tor is not yet connected. getSettings().shouldStartOnHome() && (intent?.action == ACTION_MAIN || !components.torController.isBootstrapped) } } Loading