Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +25 −3 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ import org.mozilla.fenix.tabhistory.TabHistoryDialogFragment import org.mozilla.fenix.tabstray.TabsTrayFragment import org.mozilla.fenix.theme.DefaultThemeManager import org.mozilla.fenix.theme.ThemeManager import org.mozilla.fenix.tor.TorEvents import org.mozilla.fenix.utils.Settings import java.lang.ref.WeakReference import java.util.Locale Loading Loading @@ -686,6 +687,24 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { * Handles intents received when the activity is open. */ final override fun onNewIntent(intent: Intent?) { if (intent?.action == ACTION_MAIN || components.torController.isConnected) { 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?) { /* no-op */ } }) return } } private fun onNewIntentInternal(intent: Intent?) { super.onNewIntent(intent) intent?.let { handleNewIntent(it) Loading Loading @@ -1298,14 +1317,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.isConnected) } } Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt +19 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ package org.mozilla.fenix import android.app.Activity import android.content.Intent import android.content.Intent.ACTION_MAIN import android.content.pm.PackageManager import android.os.Build import android.os.Bundle Loading @@ -26,6 +27,7 @@ import org.mozilla.fenix.ext.settings import org.mozilla.fenix.perf.MarkersActivityLifecycleCallbacks import org.mozilla.fenix.perf.StartupTimeline import org.mozilla.fenix.shortcut.NewTabShortcutIntentProcessor import org.mozilla.fenix.tor.TorEvents /** * Processes incoming intents and sends them to the corresponding activity. Loading @@ -47,7 +49,23 @@ class IntentReceiverActivity : Activity() { // the HomeActivity. val intent = intent?.let { Intent(it) } ?: Intent() intent.sanitize().stripUnwantedFlags() if (intent.action == ACTION_MAIN || components.torController.isConnected) { processIntent(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) processIntent(intent) } override fun onTorConnecting() { /* no-op */ } override fun onTorStopped() { /* no-op */ } override fun onTorStatusUpdate(entry: String?, status: String?) { /* no-op */ } }) // In the meantime, open the HomeActivity so the user can get connected. processIntent(Intent()) } components.core.engine.profiler?.addMarker( MarkersActivityLifecycleCallbacks.MARKER_NAME, Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt +1 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,7 @@ class Core( cookieBannerHandlingGlobalRules = context.settings().shouldEnableCookieBannerGlobalRules, cookieBannerHandlingGlobalRulesSubFrames = context.settings().shouldEnableCookieBannerGlobalRulesSubFrame, emailTrackerBlockingPrivateBrowsing = false, torSecurityLevel = context.settings().torSecurityLevel().intRepresentation, spoofEnglish = context.settings().spoofEnglish, ) Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt +2 −0 Original line number Diff line number Diff line Loading @@ -539,6 +539,8 @@ class DefaultSessionControlController( } override fun handleOpenSecurityLevelSettingsClicked() { val directions = HomeFragmentDirections.actionGlobalTorSecurityLevelFragment() navController.nav(R.id.homeFragment, directions) } override fun handleDonateClicked() { Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt +0 −1 Original line number Diff line number Diff line Loading @@ -298,7 +298,6 @@ class SessionControlInteractor( TorBootstrapInteractor, WallpaperInteractor { override fun onCollectionAddTabTapped(collection: TabCollection) { controller.handleCollectionAddTabTapped(collection) } Loading Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +25 −3 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ import org.mozilla.fenix.tabhistory.TabHistoryDialogFragment import org.mozilla.fenix.tabstray.TabsTrayFragment import org.mozilla.fenix.theme.DefaultThemeManager import org.mozilla.fenix.theme.ThemeManager import org.mozilla.fenix.tor.TorEvents import org.mozilla.fenix.utils.Settings import java.lang.ref.WeakReference import java.util.Locale Loading Loading @@ -686,6 +687,24 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { * Handles intents received when the activity is open. */ final override fun onNewIntent(intent: Intent?) { if (intent?.action == ACTION_MAIN || components.torController.isConnected) { 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?) { /* no-op */ } }) return } } private fun onNewIntentInternal(intent: Intent?) { super.onNewIntent(intent) intent?.let { handleNewIntent(it) Loading Loading @@ -1298,14 +1317,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.isConnected) } } Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt +19 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ package org.mozilla.fenix import android.app.Activity import android.content.Intent import android.content.Intent.ACTION_MAIN import android.content.pm.PackageManager import android.os.Build import android.os.Bundle Loading @@ -26,6 +27,7 @@ import org.mozilla.fenix.ext.settings import org.mozilla.fenix.perf.MarkersActivityLifecycleCallbacks import org.mozilla.fenix.perf.StartupTimeline import org.mozilla.fenix.shortcut.NewTabShortcutIntentProcessor import org.mozilla.fenix.tor.TorEvents /** * Processes incoming intents and sends them to the corresponding activity. Loading @@ -47,7 +49,23 @@ class IntentReceiverActivity : Activity() { // the HomeActivity. val intent = intent?.let { Intent(it) } ?: Intent() intent.sanitize().stripUnwantedFlags() if (intent.action == ACTION_MAIN || components.torController.isConnected) { processIntent(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) processIntent(intent) } override fun onTorConnecting() { /* no-op */ } override fun onTorStopped() { /* no-op */ } override fun onTorStatusUpdate(entry: String?, status: String?) { /* no-op */ } }) // In the meantime, open the HomeActivity so the user can get connected. processIntent(Intent()) } components.core.engine.profiler?.addMarker( MarkersActivityLifecycleCallbacks.MARKER_NAME, Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt +1 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,7 @@ class Core( cookieBannerHandlingGlobalRules = context.settings().shouldEnableCookieBannerGlobalRules, cookieBannerHandlingGlobalRulesSubFrames = context.settings().shouldEnableCookieBannerGlobalRulesSubFrame, emailTrackerBlockingPrivateBrowsing = false, torSecurityLevel = context.settings().torSecurityLevel().intRepresentation, spoofEnglish = context.settings().spoofEnglish, ) Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt +2 −0 Original line number Diff line number Diff line Loading @@ -539,6 +539,8 @@ class DefaultSessionControlController( } override fun handleOpenSecurityLevelSettingsClicked() { val directions = HomeFragmentDirections.actionGlobalTorSecurityLevelFragment() navController.nav(R.id.homeFragment, directions) } override fun handleDonateClicked() { Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt +0 −1 Original line number Diff line number Diff line Loading @@ -298,7 +298,6 @@ class SessionControlInteractor( TorBootstrapInteractor, WallpaperInteractor { override fun onCollectionAddTabTapped(collection: TabCollection) { controller.handleCollectionAddTabTapped(collection) } Loading