123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- From e9d07a68a445b644106780a4759cf41657762c91 Mon Sep 17 00:00:00 2001
- From: Matthew Finkel <Matthew.Finkel@gmail.com>
- Date: Sat, 24 Nov 2018 04:52:26 +0000
- Subject: [PATCH 09/13] Bug 28051 - Change Orbot's behavior for Tor Browser
- ---
- .../torproject/android/OrbotMainActivity.java | 10 +++++++++-
- app/src/main/res/menu/orbot_main.xml | 2 +-
- .../torproject/android/service/TorService.java | 17 ++++++++++++-----
- .../android/service/TorServiceConstants.java | 11 ++++++-----
- 4 files changed, 28 insertions(+), 12 deletions(-)
- diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
- index 044b957f..e011817e 100644
- --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
- +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
- @@ -552,7 +552,9 @@ public class OrbotMainActivity extends AppCompatActivity
- * still exists
- **/
- private void doExit() {
- - stopTor();
- + // Don't stop Tor when we exit Orbot. Let Fennec take care of
- + // that when we really exit the app.
- + //stopTor();
-
- // Kill all the wizard activities
- setResult(RESULT_CLOSE_ALL);
- @@ -1122,6 +1124,11 @@ public class OrbotMainActivity extends AppCompatActivity
-
- mTxtOrbotLog.append(torServiceMsg + '\n');
-
- + // Return to the browser when we reach 100% bootstrapped
- + if (torServiceMsg.contains(TorServiceConstants.TOR_CONTROL_PORT_MSG_BOOTSTRAP_DONE)) {
- + finish();
- + }
- +
- }
-
- if (torStatus == null || newTorStatus.equals(torStatus)) {
- @@ -1384,6 +1391,7 @@ public class OrbotMainActivity extends AppCompatActivity
- iv.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- + // This should never be false, because we are the browser now.
- if (!appInstalledOrNot(TorServiceConstants.BROWSER_APP_USERNAME))
- promptInstallOrfox();
- else
- diff --git a/app/src/main/res/menu/orbot_main.xml b/app/src/main/res/menu/orbot_main.xml
- index cb25b9e0..1231da8e 100644
- --- a/app/src/main/res/menu/orbot_main.xml
- +++ b/app/src/main/res/menu/orbot_main.xml
- @@ -87,7 +87,7 @@
- />
-
- <item android:id="@+id/menu_exit"
- - android:title="@string/menu_exit"
- + android:title="@string/button_close"
- android:icon="@drawable/ic_menu_exit"
- yourapp:showAsAction="never"
-
- diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorService.java b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
- index a12a97bd..189ee6ab 100644
- --- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java
- +++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
- @@ -285,6 +285,10 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
- //Reusable code.
- PackageManager pm = getPackageManager();
- Intent intent = pm.getLaunchIntentForPackage(getPackageName());
- + // Add these so Fennec's LauncherActivity can correctly route the request
- + // to Orbot when the user taps the Notification
- + intent.setAction(TorServiceConstants.TOR_APP_USERNAME);
- + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- PendingIntent pendIntent = PendingIntent.getActivity(TorService.this, 0, intent, 0);
-
- if (mNotifyBuilder == null)
- @@ -413,9 +417,9 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
- @Override
- public void onTaskRemoved(Intent rootIntent){
- Log.d(OrbotConstants.TAG,"task removed");
- - Intent intent = new Intent( this, DummyActivity.class );
- - intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
- - startActivity( intent );
- + // Don't prevent being killed. If the user swiped away the
- + // app, then we should die.
- + stopTor();
- }
-
- @Override
- @@ -656,12 +660,14 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
- }
-
- extraLines.append("SOCKSPort ").append(socksPortPref).append(isolate).append('\n');
- - extraLines.append("SafeSocks 0").append('\n');
- + // We don't want this disabled.
- + //extraLines.append("SafeSocks 0").append('\n');
- extraLines.append("TestSocks 0").append('\n');
- if (Prefs.openProxyOnAllInterfaces())
- extraLines.append("SocksListenAddress 0.0.0.0").append('\n');
-
- - extraLines.append("HTTPTunnelPort ").append(mPortHTTP).append(isolate).append('\n');
- + // We don't want/need this either
- + //extraLines.append("HTTPTunnelPort ").append(mPortHTTP).append(isolate).append('\n');
-
-
- if(prefs.getBoolean(OrbotConstants.PREF_CONNECTION_PADDING, false))
- @@ -869,6 +875,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
-
- String torCmdString = fileTor.getCanonicalPath()
- + " DataDirectory " + appCacheHome.getCanonicalPath()
- + + " SocksPort " + TorServiceConstants.SOCKS_PROXY_PORT_DEFAULT
- + " --defaults-torrc " + torrcPath
- + " -f " + torrcPath + ".custom";
-
- diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorServiceConstants.java b/orbotservice/src/main/java/org/torproject/android/service/TorServiceConstants.java
- index 4b62a6a8..44743156 100644
- --- a/orbotservice/src/main/java/org/torproject/android/service/TorServiceConstants.java
- +++ b/orbotservice/src/main/java/org/torproject/android/service/TorServiceConstants.java
- @@ -8,7 +8,7 @@ import android.content.Intent;
- public interface TorServiceConstants {
-
- String TOR_APP_USERNAME = "org.torproject.android";
- - String BROWSER_APP_USERNAME = "info.guardianproject.orfox";
- + String BROWSER_APP_USERNAME = "org.torproject.torbrowser_alpha";
-
- String DIRECTORY_TOR_BINARY = "bin";
- String DIRECTORY_TOR_DATA = "data";
- @@ -52,15 +52,16 @@ public interface TorServiceConstants {
-
- String IP_LOCALHOST = "127.0.0.1";
- int UPDATE_TIMEOUT = 1000;
- - int TOR_TRANSPROXY_PORT_DEFAULT = 9040;
- + int TOR_TRANSPROXY_PORT_DEFAULT = 9140;
-
- int STANDARD_DNS_PORT = 53;
- int TOR_DNS_PORT_DEFAULT = 5400;
- String TOR_VPN_DNS_LISTEN_ADDRESS = "127.0.0.1";
-
- - int CONTROL_PORT_DEFAULT = 9051;
- - int HTTP_PROXY_PORT_DEFAULT = 8118; // like Privoxy!
- - int SOCKS_PROXY_PORT_DEFAULT = 9050;
- + // Not used, but we'll change this for consistency
- + int CONTROL_PORT_DEFAULT = 9151;
- + int HTTP_PROXY_PORT_DEFAULT = 8218; // like Privoxy!
- + int SOCKS_PROXY_PORT_DEFAULT = 9150;
-
-
- //path to check Tor against
- --
- 2.17.1
|