From 42ce2f3be79078a780f80aa6b3d5bdcf7d685737 Mon Sep 17 00:00:00 2001 From: Matthew Finkel Date: Sat, 24 Nov 2018 04:32:56 +0000 Subject: [PATCH 01/12] Bug 28051 - Build Orbot as a library --- app/build.gradle | 31 ++++++++++++++++++++----------- app/src/main/AndroidManifest.xml | 30 ++++++++++++++++++------------ app/src/minimalperm/AndroidManifest.xml | 26 +++++++++++++++----------- build.gradle | 3 ++- jsocksAndroid/build.gradle | 8 +++++--- orbotservice/build.gradle | 11 +++++++---- 6 files changed, 67 insertions(+), 42 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..32c312a6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,15 +15,13 @@ + + @@ -31,10 +29,10 @@ android:name=".OrbotMainActivity" android:excludeFromRecents="true" android:launchMode="singleTop"> + - - @@ -57,17 +55,20 @@ + + + + + android:exported="false"> + + android:enabled="false" + android:exported="false"> @@ -154,7 +158,9 @@ android:value=".OrbotMainActivity" /> - + + + + + - - @@ -54,17 +52,20 @@ + + + + + android:exported="false"> + + android:enabled="false" + android:exported="false"> 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.13.6