[tor-commits] [tor-browser/tor-browser-60.3.0esr-8.5-1] Revert "28051"

gk at torproject.org gk at torproject.org
Thu Nov 22 21:33:24 UTC 2018


commit 6b9a93c0517d8b11d0e843f7c17abfc9090b7332
Author: Georg Koppen <gk at torproject.org>
Date:   Thu Nov 22 21:31:48 2018 +0000

    Revert "28051"
    
    We are not ready for that yet.
    
    This reverts commit 8e8445c1d47644e6e34fc1b96d6934a9aa13f58b.
---
 build.gradle                                       |  4 --
 mobile/android/app/000-tor-browser-android.js      |  3 ++
 mobile/android/app/build.gradle                    | 11 -----
 mobile/android/base/AndroidManifest.xml.in         |  1 -
 .../base/java/org/mozilla/gecko/BrowserApp.java    | 53 ++++++++++++----------
 .../base/java/org/mozilla/gecko/GeckoApp.java      | 29 ------------
 .../java/org/mozilla/gecko/GeckoApplication.java   |  5 --
 .../java/org/mozilla/gecko/LauncherActivity.java   | 18 --------
 .../gecko/notifications/NotificationClient.java    |  6 +--
 .../gecko/notifications/NotificationHelper.java    |  5 +-
 mobile/android/config/proguard/proguard.cfg        | 15 ------
 .../java/org/mozilla/gecko/util/ProxySelector.java |  4 +-
 12 files changed, 38 insertions(+), 116 deletions(-)

diff --git a/build.gradle b/build.gradle
index 6cf2d4cc0e7a..a080e15b2fac 100644
--- a/build.gradle
+++ b/build.gradle
@@ -32,10 +32,6 @@ allprojects {
                 url repository
             }
         }
-        // These are needed for Orbot's dependencies
-        maven { url "https://raw.githubusercontent.com/guardianproject/gpmaven/master" }
-        maven { url 'https://jitpack.io' }
-        jcenter()
     }
 }
 
diff --git a/mobile/android/app/000-tor-browser-android.js b/mobile/android/app/000-tor-browser-android.js
index e7e337276acb..c329fcdee5f7 100644
--- a/mobile/android/app/000-tor-browser-android.js
+++ b/mobile/android/app/000-tor-browser-android.js
@@ -54,6 +54,9 @@ pref("media.realtime_decoder.enabled", false);
 pref("general.useragent.updates.enabled", false);
 pref("general.useragent.updates.url", "");
 
+// Override this because Orbot uses 9050 as the default
+pref("network.proxy.socks_port", 9050);
+
 // Do not allow the user to install extensions from web
 pref("xpinstall.enabled", false);
 pref("extensions.enabledScopes", 1);
diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle
index d0060901b6b3..7c515bbe65a7 100644
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -225,9 +225,6 @@ dependencies {
     implementation "com.android.support:design:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     implementation "com.android.support:customtabs:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     implementation "com.android.support:palette-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
-    implementation files('Orbot-16.0.5-RC-1-tor-0.3.4.9-fullperm-release.aar')
-    implementation files('orbotservice-release.aar')
-    implementation files('jsocksAndroid-release.aar')
 
     if (mozconfig.substs.MOZ_NATIVE_DEVICES) {
         implementation "com.android.support:mediarouter-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
@@ -265,14 +262,6 @@ dependencies {
 
     // Including the Robotium JAR directly can cause issues with dexing.
     androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.5.4'
-
-    // Orbot
-    implementation 'com.github.delight-im:Android-Languages:v1.0.1'
-    implementation 'pl.bclogic:pulsator4droid:1.0.3'
-
-    // Orbotservice
-    implementation 'org.torproject:tor-android-binary:0.3.4.9'
-    implementation 'com.jrummyapps:android-shell:1.0.1'
 }
 
 // TODO: (bug 1261486): This impl is not robust -
diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in
index 0e5f4edaf814..c4ea9a37683e 100644
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -24,7 +24,6 @@
 #include FennecManifest_permissions.xml.in
 
     <application android:label="@string/moz_app_displayname"
-                 tools:replace="android:label"
                  android:icon="@drawable/icon"
                  android:logo="@drawable/logo"
                  android:name="@MOZ_ANDROID_APPLICATION_CLASS@"
diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
index 42b9ebd0a3f7..5efd83398775 100644
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -181,8 +181,7 @@ import org.mozilla.gecko.widget.GeckoActionProvider;
 import org.mozilla.gecko.widget.SplashScreen;
 import org.mozilla.geckoview.GeckoSession;
 
-import org.torproject.android.OrbotMainActivity;
-import org.torproject.android.service.TorServiceConstants;
+import info.guardianproject.netcipher.proxy.OrbotHelper;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -240,9 +239,6 @@ public class BrowserApp extends GeckoApp
     public static final int ACTIVITY_REQUEST_TRIPLE_READERVIEW = 4001;
     public static final int ACTIVITY_RESULT_TRIPLE_READERVIEW_ADD_BOOKMARK = 4002;
     public static final int ACTIVITY_RESULT_TRIPLE_READERVIEW_IGNORE = 4003;
-    public static final int ACTIVITY_RESULT_ORBOT_LAUNCH = 5001;
-
-    private static boolean mOrbotRun = false;
 
     public static final String ACTION_VIEW_MULTIPLE = AppConstants.ANDROID_PACKAGE_NAME + ".action.VIEW_MULTIPLE";
 
@@ -1286,26 +1282,41 @@ public class BrowserApp extends GeckoApp
 
         @Override
         public void onReceive(Context context, Intent intent) {
-            if (TextUtils.equals(intent.getAction(), TorServiceConstants.ACTION_STATUS)) {
+            if (TextUtils.equals(intent.getAction(), OrbotHelper.ACTION_STATUS)) {
                 GeckoAppShell.setTorStatus(intent);
             }
         }
     };
 
     public void checkStartOrbot() {
-        /* run in thread so Tor status updates will be received while the
-        * Gecko event sync is blocking the main thread */
-        HandlerThread handlerThread = new HandlerThread("torStatusReceiver");
-        handlerThread.start();
-        Looper looper = handlerThread.getLooper();
-        Handler handler = new Handler(looper);
-        registerReceiver(torStatusReceiver, new IntentFilter(TorServiceConstants.ACTION_STATUS),
-            null, handler);
+        if (!OrbotHelper.isOrbotInstalled(this)) {
+            final Intent installOrbotIntent = OrbotHelper.getOrbotInstallIntent(this);
 
-        if (!mOrbotRun) {
-          final String orbotStartAction = "android.intent.action.MAIN";
-          final Intent launchOrbot = new Intent(orbotStartAction, null, this, OrbotMainActivity.class);
-          startActivityForResult(launchOrbot, ACTIVITY_RESULT_ORBOT_LAUNCH, null);
+            AlertDialog.Builder builder = new AlertDialog.Builder(this);
+            builder.setTitle(R.string.install_orbot);
+            builder.setMessage(R.string.you_must_have_orbot);
+            builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
+                @Override
+                public void onClick(DialogInterface dialogInterface, int i) {
+                    startActivity(installOrbotIntent);
+                }
+            });
+            builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
+                @Override
+                public void onClick(DialogInterface dialogInterface, int i) {
+                }
+            });
+            builder.show();
+        } else {
+            /* run in thread so Tor status updates will be received while the
+            * Gecko event sync is blocking the main thread */
+            HandlerThread handlerThread = new HandlerThread("torStatusReceiver");
+            handlerThread.start();
+            Looper looper = handlerThread.getLooper();
+            Handler handler = new Handler(looper);
+            registerReceiver(torStatusReceiver, new IntentFilter(OrbotHelper.ACTION_STATUS),
+                null, handler);
+            OrbotHelper.requestStartTor(this);
         }
     }
 
@@ -3007,12 +3018,6 @@ public class BrowserApp extends GeckoApp
                 TabQueueHelper.processTabQueuePromptResponse(resultCode, this);
                 break;
 
-            case ACTIVITY_RESULT_ORBOT_LAUNCH:
-                final SafeIntent intent = new SafeIntent(getIntent());
-                Log.d(LOGTAG, "onActivityResult: ACTIVITY_RESULT_ORBOT_LAUNCH");
-                mOrbotRun = true;
-                break;
-
             default:
                 for (final BrowserAppDelegate delegate : delegates) {
                     delegate.onActivityResult(this, requestCode, resultCode, data);
diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
index 3741c26fe0e8..802d8adafbeb 100644
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -91,8 +91,6 @@ import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import org.torproject.android.service.TorService;
-
 import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -598,9 +596,6 @@ public abstract class GeckoApp extends GeckoActivity
 
         EventDispatcher.getInstance().dispatch("Browser:Quit", res);
 
-        Intent torService = new Intent(this, TorService.class);
-        stopService(torService);
-
         // We don't call shutdown here because this creates a race condition which
         // can cause the clearing of private data to fail. Instead, we shut down the
         // UI only after we're done sanitizing.
@@ -1217,30 +1212,6 @@ public abstract class GeckoApp extends GeckoActivity
                             }
                         }
                     }
-                } else if (mIsRestoringActivity) {
-                    /* Synchronize Tabs state with Gecko. We're restoring the Activity, this
-                     * mean all of the Chrome state was lost, but the previously created
-                     * Tabs still exist within the Android application, because those are
-                     * static and the application keeps track of those (and only the Activity
-                     * is starting, the application was never destroyed). */
-                    Iterable<Tab> tabs = Tabs.getInstance().getTabsInOrder();
-                    Tab selectedTab = Tabs.getInstance().getSelectedTab();
-                    for (Tab tab : tabs) {
-                        GeckoBundle reloadMessage = new GeckoBundle();
-                        reloadMessage.putString("url", tab.getURL());
-                        reloadMessage.putString("engine", null);
-                        reloadMessage.putInt("parentId", tab.getParentId());
-                        reloadMessage.putBoolean("userEntered", true);
-                        reloadMessage.putBoolean("isPrivate", tab.isPrivate());
-                        reloadMessage.putBoolean("pinned", false);
-                        reloadMessage.putBoolean("desktopMode", tab.getDesktopMode());
-                        reloadMessage.putString("referrerURI", null);
-                        reloadMessage.putInt("tabID", tab.getId());
-                        reloadMessage.putBoolean("newTab", true);
-                        reloadMessage.putBoolean("delayLoad", selectedTab != tab);
-                        reloadMessage.putBoolean("selected", selectedTab == tab);
-                        getAppEventDispatcher().dispatch("Tab:Load", reloadMessage);
-                    }
                 }
 
                 synchronized (GeckoApp.this) {
diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
index b38e7184c798..e896134e0af9 100644
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
@@ -62,8 +62,6 @@ import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.UUID;
 
-import org.torproject.android.service.util.Prefs;
-
 public class GeckoApplication extends Application
                               implements HapticFeedbackDelegate {
     private static final String LOG_TAG = "GeckoApplication";
@@ -321,9 +319,6 @@ public class GeckoApplication extends Application
                 "Profile:Create",
                 null);
 
-        // Give Orbot the base Context
-        Prefs.setContext(context);
-
         super.onCreate();
     }
 
diff --git a/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java b/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
index 4cd94ed538c7..e8f8facc24c6 100644
--- a/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
@@ -45,9 +45,6 @@ import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_FXA_SIGNIN;
 
 import org.mozilla.gecko.deeplink.DeepLinkContract;
 
-import org.torproject.android.OrbotMainActivity;
-import org.torproject.android.service.TorServiceConstants;
-
 /**
  * Activity that receives incoming Intents and dispatches them to the appropriate activities (e.g. browser, custom tabs, web app).
  */
@@ -70,9 +67,6 @@ public class LauncherActivity extends Activity {
         } else if (isWebAppIntent(safeIntent)) {
             dispatchWebAppIntent();
 
-        } else if (TorServiceConstants.TOR_APP_USERNAME.equals(getIntent().getAction())) {
-            dispatchOrbotIntent();
-
         // If it's not a view intent, it won't be a custom tabs intent either. Just launch!
         } else if (!isViewIntentWithURL(safeIntent)) {
             dispatchNormalIntent();
@@ -122,18 +116,6 @@ public class LauncherActivity extends Activity {
         startActivity(intent);
     }
 
-    private void dispatchOrbotIntent() {
-        final String orbotStartAction = "android.intent.action.MAIN";
-        final Intent intent = new Intent(orbotStartAction, null, this, OrbotMainActivity.class);
-
-        //When we launch Orbot, we want a new task.
-        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
-        intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-
-        startActivity(intent);
-    }
-
     private void dispatchUrlIntent(@NonNull String url) {
         Intent intent = new Intent(getIntent());
         intent.setData(Uri.parse(url));
diff --git a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java
index c66d67f32787..d8392a801e13 100644
--- a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java
+++ b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationClient.java
@@ -28,8 +28,6 @@ import org.mozilla.gecko.NotificationListener;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.util.BitmapUtils;
 
-import org.torproject.android.service.util.NotificationBuilderCompat;
-
 /**
  * Client for posting notifications.
  */
@@ -144,7 +142,7 @@ public final class NotificationClient implements NotificationListener {
     private void add(final String name, final String imageUrl, final String host,
                      final String alertTitle, final String alertText,
                      final PendingIntent contentIntent, final PendingIntent deleteIntent) {
-        final NotificationBuilderCompat builder = new NotificationBuilderCompat(mContext)
+        final NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)
                 .setContentTitle(alertTitle)
                 .setContentText(alertText)
                 .setSmallIcon(R.drawable.ic_status_logo)
@@ -152,7 +150,7 @@ public final class NotificationClient implements NotificationListener {
                 .setDeleteIntent(deleteIntent)
                 .setAutoCancel(true)
                 .setDefaults(Notification.DEFAULT_SOUND)
-                .setStyle(new Notification.BigTextStyle()
+                .setStyle(new NotificationCompat.BigTextStyle()
                         .bigText(alertText)
                         .setSummaryText(host));
 
diff --git a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java
index 35366609da49..34ea99882d9a 100644
--- a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java
@@ -32,11 +32,10 @@ import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.graphics.Bitmap;
 import android.net.Uri;
+import android.support.v4.app.NotificationCompat;
 import android.support.v4.util.SimpleArrayMap;
 import android.util.Log;
 
-import org.torproject.android.service.util.NotificationBuilderCompat;
-
 public final class NotificationHelper implements BundleEventListener {
     public static final String HELPER_BROADCAST_ACTION = AppConstants.ANDROID_PACKAGE_NAME + ".helperBroadcastAction";
 
@@ -234,7 +233,7 @@ public final class NotificationHelper implements BundleEventListener {
     private void showNotification(final GeckoBundle message) {
         ThreadUtils.assertOnUiThread();
 
-        final NotificationBuilderCompat builder = new NotificationBuilderCompat(mContext);
+        final NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext);
 
         // These attributes are required
         final String id = message.getString(ID_ATTR);
diff --git a/mobile/android/config/proguard/proguard.cfg b/mobile/android/config/proguard/proguard.cfg
index 3d03e3107c72..0be8a745e44b 100644
--- a/mobile/android/config/proguard/proguard.cfg
+++ b/mobile/android/config/proguard/proguard.cfg
@@ -165,21 +165,6 @@
 # See: http://stackoverflow.com/questions/22441366/note-android-support-v4-text-icucompatics-cant-find-dynamically-referenced-cl
 -dontnote android.support.**
 
-# From https://github.com/square/okhttp/blob/master/okhttp/src/main/resources/META-INF/proguard/okhttp3.pro
-# JSR 305 annotations are for embedding nullability information.
--dontwarn javax.annotation.**
-
-# A resource is loaded with a relative path so the package of this class must be preserved.
--keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
-
-# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
--dontwarn org.codehaus.mojo.animal_sniffer.*
-
-# OkHttp platform used only on JVM and when Conscrypt dependency is available.
--dontwarn okhttp3.internal.platform.ConscryptPlatform
-
-#-keepnames class org.torproject.*
-
 -include "adjust-keeps.cfg"
 
 -include "leakcanary-keeps.cfg"
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java
index 41c2c7e705a1..f05716fe1d09 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java
@@ -30,8 +30,8 @@ import java.util.List;
 
 public class ProxySelector {
     private static final String TOR_PROXY_ADDRESS = "127.0.0.1";
-    private static final int TOR_SOCKS_PROXY_PORT = 9150;
-    private static final int TOR_HTTP_PROXY_PORT = 8218;
+    private static final int TOR_SOCKS_PROXY_PORT = 9050;
+    private static final int TOR_HTTP_PROXY_PORT = 8118;
 
     public static URLConnection openConnectionWithProxy(URI uri) throws IOException {
         java.net.ProxySelector ps = java.net.ProxySelector.getDefault();



More information about the tor-commits mailing list