GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit fa7c5374 authored by sisbell's avatar sisbell Committed by Georg Koppen
Browse files

Bug 27977: Build Orbot with rbm/tor-browser-build

parent b7b96411
......@@ -101,6 +101,10 @@ mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig
export ASAN_OPTIONS="detect_leaks=0"
[% END -%]
[% IF c("var/android") %]
cp $rootdir/[% c('input_files_by_name/orbot') %]/* mobile/android/app
[% END %]
eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] $(cat browser/config/version.txt))
if [ -z $MOZ_BUILD_DATE ]
then
......
......@@ -23,7 +23,7 @@ var:
container:
use_container: 1
# this should be updated when the list of gradle dependencies is changed
gradle_dependencies_version: 2
gradle_dependencies_version: 3
targets:
release:
......@@ -132,3 +132,6 @@ input_files:
name: gradle-dependencies
exec: '[% INCLUDE "fetch-gradle-dependencies" %]'
enable: '[% c("var/android") %]'
- project: orbot
name: orbot
enable: '[% c("var/android") %]'
From 6a7ccfc48d3ec930390cabfd460730915215f674 Mon Sep 17 00:00:00 2001
From: Matthew Finkel <Matthew.Finkel@gmail.com>
Date: Sat, 24 Nov 2018 04:32:56 +0000
Subject: [PATCH 01/13] Bug 28051 - Build Orbot as a library
---
app/build.gradle | 31 ++++++++++++++++++++-----------
app/src/main/AndroidManifest.xml | 32 +++++++++++++++++++-------------
build.gradle | 3 ++-
jsocksAndroid/build.gradle | 8 +++++---
orbotservice/build.gradle | 11 +++++++----
5 files changed, 53 insertions(+), 32 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index ba57f72c..3051dd5c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,12 +1,16 @@
-apply plugin: 'com.android.application'
+// Build it as a library, instead of an app
+apply plugin: 'com.android.library'
android {
- compileSdkVersion 27
- buildToolsVersion '27.0.3'
+ // Match Fennec's version
+ compileSdkVersion 26
+ buildToolsVersion '26.0.2'
defaultConfig {
- applicationId "org.torproject.android"
+ // Libraries can't have an applicationId
+ //applicationId "org.torproject.android"
minSdkVersion 16
- targetSdkVersion 27
+ // Match Fennec's version
+ targetSdkVersion 26
}
lintOptions {
checkReleaseBuilds false
@@ -17,7 +21,8 @@ android {
buildTypes {
release {
minifyEnabled true
- shrinkResources true
+ // Match Fennec
+ shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
@@ -32,8 +37,10 @@ android {
fullperm {
dimension "free"
minSdkVersion 16
- applicationId 'org.torproject.android'
- targetSdkVersion 27
+ // Libraries can't have an applicationId
+ //applicationId 'org.torproject.android'
+ // Match Fennec's versions
+ targetSdkVersion 26
versionCode 16050100
versionName '16.0.5-RC-1-tor-0.3.4.9'
archivesBaseName = "Orbot-$versionName"
@@ -70,9 +77,11 @@ dependencies {
// implementation 'com.github.delight-im:Android-Languages:v1.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation project(':orbotservice')
- implementation 'com.android.support:design:27.1.1'
+ // Match Fennec's ANDROID_SUPPORT_LIBRARY_VERSION
+ implementation 'com.android.support:design:23.4.0'
implementation 'pl.bclogic:pulsator4droid:1.0.3'
- implementation 'com.github.apl-devs:appintro:v4.2.2'
- implementation 'com.github.javiersantos:AppUpdater:2.6.4'
+ // These require higher versions of ANDROID_SUPPORT_LIBRARY_VERSION
+ //implementation 'com.github.apl-devs:appintro:v4.2.2'
+ //implementation 'com.github.javiersantos:AppUpdater:2.6.4'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 56db8266..2cd00888 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -15,15 +15,13 @@
<uses-feature android:name="android.hardware.touchscreen"
android:required="false" />
+ <!-- Delete Orbot's name, icon, and label, so they don't conflict with the app -->
+ <!-- Fennec enables hardwareAccelerated= -->
<application
- android:name=".OrbotApp"
android:allowBackup="false"
android:allowClearUserData="true"
android:configChanges="locale|orientation|screenSize"
android:description="@string/app_description"
- android:hardwareAccelerated="false"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
android:theme="@style/DefaultTheme"
tools:replace="android:allowBackup"
>
@@ -31,10 +29,10 @@
android:name=".OrbotMainActivity"
android:excludeFromRecents="true"
android:launchMode="singleTop">
+ <!-- When Orbot has android.intent.category.LAUNCHER, then a
+ launcher icon is added on the app menu. We don't want this. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
@@ -57,17 +55,20 @@
</activity>
<!-- This is for ensuring the background service still runs when/if the app is swiped away -->
+ <!-- We want the app and background service to die when the user swipes away the app,
+ so disable this activity -->
<activity
android:name=".service.util.DummyActivity"
android:allowTaskReparenting="true"
android:alwaysRetainTaskState="false"
android:clearTaskOnLaunch="true"
- android:enabled="true"
+ android:enabled="false"
android:excludeFromRecents="true"
android:finishOnTaskLaunch="true"
android:noHistory="true"
android:stateNotNeeded="true"
android:theme="@android:style/Theme.Translucent" />
+ <!-- Don't export the VPN functionality, we don't want to use it -->
<activity
android:name=".vpn.VPNEnableActivity"
android:exported="false"
@@ -85,26 +86,29 @@
android:enabled="true"
android:permission="android.permission.BIND_VPN_SERVICE"
android:stopWithTask="false"></service>
+ <!-- Disable the VPN functionality, we don't want to use it -->
<service
android:name=".service.vpn.TorVpnService"
- android:enabled="true"
+ android:enabled="false"
android:permission="android.permission.BIND_VPN_SERVICE">
<intent-filter>
<action android:name="android.net.VpnService" />
</intent-filter>
</service>
+ <!-- Don't let other apps start our Orbot -->
<receiver
android:name=".service.StartTorReceiver"
- android:exported="true">
+ android:exported="false">
<intent-filter>
<action android:name="org.torproject.android.intent.action.START" />
</intent-filter>
</receiver>
+ <!-- Don't automatically start our Orbot when the device boots -->
<receiver
android:name=".OnBootReceiver"
- android:enabled="true"
- android:exported="true">
+ android:enabled="false"
+ android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
@@ -154,7 +158,9 @@
android:value=".OrbotMainActivity" />
</activity>
- <activity android:name=".ui.onboarding.OnboardingActivity"/>
+ <!-- Disable the Onboarding activity, because it depends on a library that
+ depends on a newer version of the Android Support Library -->
+ <!--<activity android:name=".ui.onboarding.OnboardingActivity"/>-->
<activity android:name=".ui.onboarding.BridgeWizardActivity"/>
<provider
@@ -163,4 +169,4 @@
android:exported="false" />
</application>
-</manifest>
\ No newline at end of file
+</manifest>
diff --git a/build.gradle b/build.gradle
index 553079b6..ce06f082 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,8 @@ buildscript {
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.4'
+ // Match Fennec
+ classpath 'com.android.tools.build:gradle:3.0.1'
}
}
diff --git a/jsocksAndroid/build.gradle b/jsocksAndroid/build.gradle
index 7ac21e4e..8f173b5f 100644
--- a/jsocksAndroid/build.gradle
+++ b/jsocksAndroid/build.gradle
@@ -1,12 +1,14 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 27
- buildToolsVersion '27.0.3'
+ // Match Fennec's version
+ compileSdkVersion 26
+ buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 16
- targetSdkVersion 27
+ // Match Fennec's version
+ targetSdkVersion 26
}
buildTypes {
diff --git a/orbotservice/build.gradle b/orbotservice/build.gradle
index fb9b6946..e95f76ac 100644
--- a/orbotservice/build.gradle
+++ b/orbotservice/build.gradle
@@ -1,8 +1,9 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 27
- buildToolsVersion '27.0.3'
+ // Match Fennec's version
+ compileSdkVersion 26
+ buildToolsVersion '26.0.2'
sourceSets {
main {
@@ -12,7 +13,8 @@ android {
defaultConfig {
minSdkVersion 16
- targetSdkVersion 27
+ // Match Fennec's version
+ targetSdkVersion 26
versionCode 1
versionName "1.0"
@@ -28,7 +30,8 @@ android {
dependencies {
implementation project(':jsocksAndroid')
implementation 'org.torproject:tor-android-binary:0.3.4.9'
- implementation 'com.android.support:appcompat-v7:27.1.1'
+ // Match Fennec's version
+ implementation 'com.android.support:appcompat-v7:23.4.0'
implementation 'com.jrummyapps:android-shell:1.0.1'
implementation fileTree(dir: 'libs', include: ['.so'])
testImplementation 'junit:junit:4.12'
--
2.17.1
From 4a5480df8f23ccc96af794a2194d6a6c33513dc7 Mon Sep 17 00:00:00 2001
From: Matthew Finkel <Matthew.Finkel@gmail.com>
Date: Sat, 24 Nov 2018 04:34:52 +0000
Subject: [PATCH 02/13] Bug 28051 - Exclude the AppUpdater
---
app/src/main/java/org/torproject/android/OrbotApp.java | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotApp.java b/app/src/main/java/org/torproject/android/OrbotApp.java
index 7279c8e2..291b0456 100644
--- a/app/src/main/java/org/torproject/android/OrbotApp.java
+++ b/app/src/main/java/org/torproject/android/OrbotApp.java
@@ -18,10 +18,6 @@ import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.widget.RemoteViews;
-import com.github.javiersantos.appupdater.AppUpdater;
-import com.github.javiersantos.appupdater.enums.Display;
-import com.github.javiersantos.appupdater.enums.UpdateFrom;
-
import org.torproject.android.service.OrbotConstants;
import org.torproject.android.service.TorEventHandler;
import org.torproject.android.service.TorService;
@@ -49,11 +45,6 @@ public class OrbotApp extends Application implements OrbotConstants
//Language.setFromPreference(this, "pref_default_locale");
- //check for updates via github, since it is unlikely to be blocked; notify the user of places where upgrades can be found
- new AppUpdater(this)
- .setUpdateFrom(UpdateFrom.JSON)
- .setUpdateJSON("https://raw.githubusercontent.com/n8fr8/orbot/master/update.json")
- .setDisplay(Display.NOTIFICATION).start();
}
@Override
--
2.17.1
From 1b6c2cf4b610787e17ad746f7a69f947f717b938 Mon Sep 17 00:00:00 2001
From: Matthew Finkel <Matthew.Finkel@gmail.com>
Date: Sat, 24 Nov 2018 04:36:56 +0000
Subject: [PATCH 03/13] Bug 28051 - Delete the Onboarding activity
It depends on a library that depends on a newer version of
the Android Support Library
---
.../torproject/android/OrbotMainActivity.java | 13 +-
.../ui/onboarding/OnboardingActivity.java | 147 ------------------
2 files changed, 1 insertion(+), 159 deletions(-)
delete mode 100644 app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index e18711b1..7ad979ff 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -29,7 +29,6 @@ import org.torproject.android.settings.SettingsPreferences;
import org.torproject.android.ui.AppManagerActivity;
import org.torproject.android.ui.Rotate3dAnimation;
import org.torproject.android.ui.onboarding.BridgeWizardActivity;
-import org.torproject.android.ui.onboarding.OnboardingActivity;
import org.torproject.android.ui.hiddenservices.ClientCookiesActivity;
import org.torproject.android.ui.hiddenservices.HiddenServicesActivity;
import org.torproject.android.ui.hiddenservices.backup.BackupUtils;
@@ -197,16 +196,6 @@ public class OrbotMainActivity extends AppCompatActivity
new IntentFilter(TorServiceConstants.LOCAL_ACTION_LOG));
boolean showFirstTime = mPrefs.getBoolean("connect_first_time", true);
-
- if (showFirstTime)
- {
- Editor pEdit = mPrefs.edit();
- pEdit.putBoolean("connect_first_time", false);
- pEdit.commit();
- startActivity(new Intent(this,OnboardingActivity.class));
- }
-
-
}
private void sendIntentToService(final String action) {
@@ -870,7 +859,7 @@ public class OrbotMainActivity extends AppCompatActivity
@Override
public void onClick(DialogInterface dialog, int which) {
- startActivity(OnboardingActivity.getInstallIntent(TorServiceConstants.BROWSER_APP_USERNAME,OrbotMainActivity.this));
+ dialog.cancel();
}
diff --git a/app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java b/app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java
deleted file mode 100644
index a8bad692..00000000
--- a/app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.torproject.android.ui.onboarding;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.net.Uri;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.View;
-
-import com.github.paolorotolo.appintro.AppIntro;
-
-import org.torproject.android.R;
-import org.torproject.android.settings.LocaleHelper;
-import org.torproject.android.ui.AppManagerActivity;
-import org.torproject.android.ui.hiddenservices.permissions.PermissionManager;
-import org.torproject.android.vpn.VPNEnableActivity;
-
-import java.util.List;
-
-public class OnboardingActivity extends AppIntro {
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // Instead of fragments, you can also use our default slide
- // Just set a title, description, background and image. AppIntro will do the rest.
- CustomSlideBigText welcome = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
- welcome.setTitle(getString(R.string.hello));
- welcome.setSubTitle(getString(R.string.welcome));
- addSlide(welcome);
-
- CustomSlideBigText intro2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
- intro2.setTitle(getString(R.string.browser_the_internet));
- intro2.setSubTitle(getString(R.string.no_tracking));
- addSlide(intro2);
-
- CustomSlideBigText cs2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
- cs2.setTitle(getString(R.string.bridges_sometimes));
- cs2.showButton(getString(R.string.action_more), new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- startActivity(new Intent(OnboardingActivity.this,BridgeWizardActivity.class));
- }
- });
- addSlide(cs2);
-
- if (PermissionManager.isLollipopOrHigher()) {
-
- CustomSlideBigText cs3 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
- cs3.setTitle(getString(R.string.vpn_setup));
- cs3.setSubTitle(getString(R.string.vpn_setup_sub));
- cs3.showButton(getString(R.string.action_vpn_choose), new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- startActivity(new Intent(OnboardingActivity.this, VPNEnableActivity.class));
- startActivityForResult(new Intent(OnboardingActivity.this, AppManagerActivity.class), 9999);
-
- }
- });
- addSlide(cs3);
-
- }
-
- // OPTIONAL METHODS
- // Override bar/separator color.
- setBarColor(getResources().getColor(R.color.dark_purple));
- setSeparatorColor(getResources().getColor(R.color.panel_background_main));
-
- // Hide Skip/Done button.
- showSkipButton(false);
- setProgressButtonEnabled(true);
- }
-
- @Override
- public void onSkipPressed(Fragment currentFragment) {
- super.onSkipPressed(currentFragment);
- // Do something when users tap on Skip button.
- }
-
- @Override
- public void onDonePressed(Fragment currentFragment) {
- super.onDonePressed(currentFragment);
- // Do something when users tap on Done button.
- finish();
- }
-
- @Override
- public void onSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
- super.onSlideChanged(oldFragment, newFragment);
- // Do something when the slide changes.
- }
-
-
- @Override
- protected void attachBaseContext(Context base) {
- super.attachBaseContext(LocaleHelper.onAttach(base));
- }
-
- public static boolean isAppInstalled(PackageManager pm, String packageName) {
- try {
- pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
- return true;
- } catch (PackageManager.NameNotFoundException e) {
- return false;
- }
- }
-
- public static Intent getInstallIntent(String packageName, Context context) {
- final Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setData(Uri.parse(MARKET_URI + packageName));
-
- PackageManager pm = context.getPackageManager();
- List<ResolveInfo> resInfos = pm.queryIntentActivities(intent, 0);
-
- String foundPackageName = null;
- for (ResolveInfo r : resInfos) {
- Log.i("Install", "market: " + r.activityInfo.packageName);
- if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME)
- || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) {
- foundPackageName = r.activityInfo.packageName;
- break;
- }
- }
-
- if (foundPackageName == null) {
- intent.setData(Uri.parse(FDROID_APP_URI + packageName));
- } else {
- intent.setPackage(foundPackageName);
- }
- return intent;
- }
-
- final static String MARKET_URI = "market://details?id=";
- final static String FDROID_APP_URI = "https://f-droid.org/repository/browse/?fdid=";
- final static String PLAY_APP_URI = "https://play.google.com/store/apps/details?id=";
- final static String FDROID_URI = "https://f-droid.org/repository/browse/?fdfilter=info.guardianproject";
- final static String PLAY_URI = "https://play.google.com/store/apps/developer?id=The+Guardian+Project";
-
- private final static String FDROID_PACKAGE_NAME = "org.fdroid.fdroid";
- private final static String PLAY_PACKAGE_NAME = "com.android.vending";
-}
\ No newline at end of file
--
2.17.1
From b8ce28e8487772deaa9655245c3b43055e32937d Mon Sep 17 00:00:00 2001
From: Matthew Finkel <Matthew.Finkel@gmail.com>
Date: Sat, 24 Nov 2018 04:40:57 +0000
Subject: [PATCH 04/13] Bug 28051 - Rename the Hidden Service content provider
---
app/src/main/AndroidManifest.xml | 13 ++++++++-----
.../org/torproject/android/OrbotMainActivity.java | 2 +-
.../ui/hiddenservices/ClientCookiesActivity.java | 2 +-
.../ui/hiddenservices/HiddenServicesActivity.java | 2 +-
.../adapters/ClientCookiesAdapter.java | 2 +-
.../hiddenservices/adapters/OnionListAdapter.java | 2 +-
.../ui/hiddenservices/backup/BackupUtils.java | 4 ++--
.../hiddenservices/dialogs/AddCookieDialog.java | 2 +-
.../dialogs/CookieDeleteDialog.java | 2 +-
.../ui/hiddenservices/dialogs/HSCookieDialog.java | 2 +-
.../ui/hiddenservices/dialogs/HSDataDialog.java | 2 +-
.../ui/hiddenservices/dialogs/HSDeleteDialog.java | 2 +-
.../providers/CookieContentProvider.java | 4 ++--
.../providers/HSContentProvider.java | 4 ++--
app/src/minimalperm/AndroidManifest.xml | 15 +++++++++------
.../torproject/android/service/TorService.java | 6 ++++--
16 files changed, 37 insertions(+), 29 deletions(-)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2cd00888..3c6262c2 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -135,13 +135,15 @@
android:value=".OrbotMainActivity" />
</activity>
+ <!-- Modify the Content Provider name so it doesn't collide with Orbot (when Orbot is installed, too).
+ TBA fails while starting when this happens -->
<provider
- android:name=".ui.hiddenservices.providers.HSContentProvider"
- android:authorities="org.torproject.android.ui.hiddenservices.providers"
+ android:name="org.torproject.torbrowser.ui.hiddenservices.providers.HSContentProvider"
+ android:authorities="org.torproject.torbrowser.ui.hiddenservices.providers"
android:exported="false" />
<provider
android:name="android.support.v4.content.FileProvider"
- android:authorities="org.torproject.android.ui.hiddenservices.storage"
+ android:authorities="org.torproject.torbrowser.ui.hiddenservices.storage"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
@@ -163,9 +165,10 @@
<!--<activity android:name=".ui.onboarding.OnboardingActivity"/>-->
<activity android:name=".ui.onboarding.BridgeWizardActivity"/>
+ <!-- Modify the Content Provider name -->
<provider
- android:name=".ui.hiddenservices.providers.CookieContentProvider"
- android:authorities="org.torproject.android.ui.hiddenservices.providers.cookie"
+ android:name="org.torproject.torbrowser.ui.hiddenservices.providers.CookieContentProvider"
+ android:authorities="org.torproject.torbrowser.ui.hiddenservices.providers.cookie"
android:exported="false" />
</application>
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index 7ad979ff..ff5dd120 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -33,7 +33,7 @@ import org.torproject.android.ui.hiddenservices.ClientCookiesActivity;
import org.torproject.android.ui.hiddenservices.HiddenServicesActivity;