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 @@ -1671,6 +1671,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 +11 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,11 @@ android.applicationVariants.configureEach { variant -> def normalizedTBPath = rootProject.projectDir.absolutePath.minus("mobile/android/fenix") System.setProperty("nimbusFml", normalizedTBPath + "/mobile/android/fenix/tools/nimbus-fml") def disableTor = false if (project.hasProperty("disableTor")) { disableTor = project.getProperty("disableTor") } project.logger.debug("----------------------------------------------") project.logger.debug("Variant name: " + variant.name) project.logger.debug("Application ID: " + [variant.applicationId, variant.buildType.applicationIdSuffix].findAll().join()) Loading @@ -337,6 +342,9 @@ android.applicationVariants.configureEach { variant -> project.logger.debug("Flavor: " + variant.flavorName) project.logger.debug("Telemetry enabled: " + !isDebugOrDCD) project.logger.debug("nimbusFml: " + System.getProperty("nimbusFml")) project.logger.debug("Tor is disabled: " + disableTor) buildConfigField "boolean", "DISABLE_TOR", "$disableTor" if (useReleaseVersioning) { // The Google Play Store does not allow multiple APKs for the same app that all have the Loading Loading @@ -771,6 +779,9 @@ dependencies { testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:${project.ext.glean_version}" lintChecks project(':tooling-lint') // Tor Expert Bundle implementation files('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 @@ -299,6 +299,8 @@ open class FenixApplication : LocaleAwareApplication(), Provider { CoroutineScope(IO).launch { components.useCases.wallpaperUseCases.fetchCurrentWallpaperUseCase.invoke() } components.torController.start() } @OptIn(DelicateCoroutinesApi::class) // GlobalScope usage Loading Loading @@ -908,7 +910,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { clipboardSuggestionsEnabled.set(settings.shouldShowClipboardSuggestions) searchShortcutsEnabled.set(settings.shouldShowSearchShortcuts) voiceSearchEnabled.set(settings.shouldShowVoiceSearch) openLinksInAppEnabled.set(settings.openLinksInExternalApp) // openLinksInAppEnabled.set(settings.openLinksInExternalApp) signedInSync.set(settings.signedInFxaAccount) val syncedItems = SyncEnginesStorage(applicationContext).getStatus().entries.filter { Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +32 −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 @@ -36,6 +37,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.core.app.NotificationManagerCompat import androidx.core.net.toUri import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.content.ContentProviderCompat.requireContext import androidx.core.text.layoutDirection import androidx.lifecycle.lifecycleScope import androidx.navigation.NavController Loading Loading @@ -163,6 +165,7 @@ import org.mozilla.fenix.tabstray.TabsTrayFragment import org.mozilla.fenix.theme.DefaultThemeManager import org.mozilla.fenix.theme.StatusBarColorManager import org.mozilla.fenix.theme.ThemeManager import org.mozilla.fenix.tor.TorEvents import org.mozilla.fenix.utils.Settings import org.mozilla.fenix.utils.changeAppLauncherIcon import java.lang.ref.WeakReference Loading Loading @@ -853,7 +856,26 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { /** * 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 @@ -1284,11 +1306,11 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { @VisibleForTesting internal fun navigateToHome(navController: NavController) { if (this is ExternalAppBrowserActivity) { return } // if (this is ExternalAppBrowserActivity) { // return // } navController.navigate(NavGraphDirections.actionStartupHome()) navHost.navController.navigate(NavGraphDirections.actionStartupTorbootstrap()) } final override fun attachBaseContext(base: Context) { Loading Loading @@ -1394,14 +1416,17 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { /** * 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.resetAfter(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 @@ -1671,6 +1671,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 +11 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,11 @@ android.applicationVariants.configureEach { variant -> def normalizedTBPath = rootProject.projectDir.absolutePath.minus("mobile/android/fenix") System.setProperty("nimbusFml", normalizedTBPath + "/mobile/android/fenix/tools/nimbus-fml") def disableTor = false if (project.hasProperty("disableTor")) { disableTor = project.getProperty("disableTor") } project.logger.debug("----------------------------------------------") project.logger.debug("Variant name: " + variant.name) project.logger.debug("Application ID: " + [variant.applicationId, variant.buildType.applicationIdSuffix].findAll().join()) Loading @@ -337,6 +342,9 @@ android.applicationVariants.configureEach { variant -> project.logger.debug("Flavor: " + variant.flavorName) project.logger.debug("Telemetry enabled: " + !isDebugOrDCD) project.logger.debug("nimbusFml: " + System.getProperty("nimbusFml")) project.logger.debug("Tor is disabled: " + disableTor) buildConfigField "boolean", "DISABLE_TOR", "$disableTor" if (useReleaseVersioning) { // The Google Play Store does not allow multiple APKs for the same app that all have the Loading Loading @@ -771,6 +779,9 @@ dependencies { testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:${project.ext.glean_version}" lintChecks project(':tooling-lint') // Tor Expert Bundle implementation files('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 @@ -299,6 +299,8 @@ open class FenixApplication : LocaleAwareApplication(), Provider { CoroutineScope(IO).launch { components.useCases.wallpaperUseCases.fetchCurrentWallpaperUseCase.invoke() } components.torController.start() } @OptIn(DelicateCoroutinesApi::class) // GlobalScope usage Loading Loading @@ -908,7 +910,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { clipboardSuggestionsEnabled.set(settings.shouldShowClipboardSuggestions) searchShortcutsEnabled.set(settings.shouldShowSearchShortcuts) voiceSearchEnabled.set(settings.shouldShowVoiceSearch) openLinksInAppEnabled.set(settings.openLinksInExternalApp) // openLinksInAppEnabled.set(settings.openLinksInExternalApp) signedInSync.set(settings.signedInFxaAccount) val syncedItems = SyncEnginesStorage(applicationContext).getStatus().entries.filter { Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +32 −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 @@ -36,6 +37,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.core.app.NotificationManagerCompat import androidx.core.net.toUri import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.content.ContentProviderCompat.requireContext import androidx.core.text.layoutDirection import androidx.lifecycle.lifecycleScope import androidx.navigation.NavController Loading Loading @@ -163,6 +165,7 @@ import org.mozilla.fenix.tabstray.TabsTrayFragment import org.mozilla.fenix.theme.DefaultThemeManager import org.mozilla.fenix.theme.StatusBarColorManager import org.mozilla.fenix.theme.ThemeManager import org.mozilla.fenix.tor.TorEvents import org.mozilla.fenix.utils.Settings import org.mozilla.fenix.utils.changeAppLauncherIcon import java.lang.ref.WeakReference Loading Loading @@ -853,7 +856,26 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { /** * 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 @@ -1284,11 +1306,11 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { @VisibleForTesting internal fun navigateToHome(navController: NavController) { if (this is ExternalAppBrowserActivity) { return } // if (this is ExternalAppBrowserActivity) { // return // } navController.navigate(NavGraphDirections.actionStartupHome()) navHost.navController.navigate(NavGraphDirections.actionStartupTorbootstrap()) } final override fun attachBaseContext(base: Context) { Loading Loading @@ -1394,14 +1416,17 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { /** * 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.resetAfter(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