X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FMainWebViewActivity.java;h=bb525e7ae6585344501e510aec836845e3f1191d;hb=dbe9e3b03b125ee631665d0395e235414370d40e;hp=0e81bf4fd4dc03f03ca2d56085ae976885255bcd;hpb=b1bd5ef2e2db36520ab1729d9682cff1e1204404;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 0e81bf4f..bb525e7a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -289,6 +289,9 @@ public class MainWebViewActivity extends AppCompatActivity implements AddDomainD // `privacyBrowserRuntime` is used in `onCreate()`, `onOptionsItemSelected()`, and `applyAppSettings()`. private Runtime privacyBrowserRuntime; + // `proxyThroughOrbot` is used in `onRestart()` and `applyAppSettings()`. + boolean proxyThroughOrbot; + // `incognitoModeEnabled` is used in `onCreate()` and `applyAppSettings()`. private boolean incognitoModeEnabled; @@ -1429,6 +1432,18 @@ public class MainWebViewActivity extends AppCompatActivity implements AddDomainD // Run the default commands. super.onRestart(); + // Make sure Orbot is running if Privacy Browser is proxying through Orbot. + if (proxyThroughOrbot) { + // Request Orbot to start. If Orbot is already running no hard will be caused by this request. + Intent orbotIntent = new Intent("org.torproject.android.intent.action.START"); + + // Send the intent to the Orbot package. + orbotIntent.setPackage("org.torproject.android"); + + // Make it so. + sendBroadcast(orbotIntent); + } + // Apply the app settings if returning from the Settings activity.. if (reapplyAppSettingsOnRestart) { // Apply the app settings. @@ -3050,7 +3065,7 @@ public class MainWebViewActivity extends AppCompatActivity implements AddDomainD String searchCustomURLString = sharedPreferences.getString("search_custom_url", ""); incognitoModeEnabled = sharedPreferences.getBoolean("incognito_mode", false); boolean doNotTrackEnabled = sharedPreferences.getBoolean("do_not_track", false); - boolean proxyThroughOrbot = sharedPreferences.getBoolean("proxy_through_orbot", false); + proxyThroughOrbot = sharedPreferences.getBoolean("proxy_through_orbot", false); fullScreenBrowsingModeEnabled = sharedPreferences.getBoolean("full_screen_browsing_mode", false); hideSystemBarsOnFullscreen = sharedPreferences.getBoolean("hide_system_bars", false); translucentNavigationBarOnFullscreen = sharedPreferences.getBoolean("translucent_navigation_bar", true);