0001-Bug-28051-Build-Orbot-as-a-library.patch 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. From 6a7ccfc48d3ec930390cabfd460730915215f674 Mon Sep 17 00:00:00 2001
  2. From: Matthew Finkel <Matthew.Finkel@gmail.com>
  3. Date: Sat, 24 Nov 2018 04:32:56 +0000
  4. Subject: [PATCH 01/13] Bug 28051 - Build Orbot as a library
  5. ---
  6. app/build.gradle | 31 ++++++++++++++++++++-----------
  7. app/src/main/AndroidManifest.xml | 32 +++++++++++++++++++-------------
  8. build.gradle | 3 ++-
  9. jsocksAndroid/build.gradle | 8 +++++---
  10. orbotservice/build.gradle | 11 +++++++----
  11. 5 files changed, 53 insertions(+), 32 deletions(-)
  12. diff --git a/app/build.gradle b/app/build.gradle
  13. index ba57f72c..3051dd5c 100644
  14. --- a/app/build.gradle
  15. +++ b/app/build.gradle
  16. @@ -1,12 +1,16 @@
  17. -apply plugin: 'com.android.application'
  18. +// Build it as a library, instead of an app
  19. +apply plugin: 'com.android.library'
  20. android {
  21. - compileSdkVersion 27
  22. - buildToolsVersion '27.0.3'
  23. + // Match Fennec's version
  24. + compileSdkVersion 26
  25. + buildToolsVersion '26.0.2'
  26. defaultConfig {
  27. - applicationId "org.torproject.android"
  28. + // Libraries can't have an applicationId
  29. + //applicationId "org.torproject.android"
  30. minSdkVersion 16
  31. - targetSdkVersion 27
  32. + // Match Fennec's version
  33. + targetSdkVersion 26
  34. }
  35. lintOptions {
  36. checkReleaseBuilds false
  37. @@ -17,7 +21,8 @@ android {
  38. buildTypes {
  39. release {
  40. minifyEnabled true
  41. - shrinkResources true
  42. + // Match Fennec
  43. + shrinkResources false
  44. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
  45. }
  46. }
  47. @@ -32,8 +37,10 @@ android {
  48. fullperm {
  49. dimension "free"
  50. minSdkVersion 16
  51. - applicationId 'org.torproject.android'
  52. - targetSdkVersion 27
  53. + // Libraries can't have an applicationId
  54. + //applicationId 'org.torproject.android'
  55. + // Match Fennec's versions
  56. + targetSdkVersion 26
  57. versionCode 16050100
  58. versionName '16.0.5-RC-1-tor-0.3.4.9'
  59. archivesBaseName = "Orbot-$versionName"
  60. @@ -70,9 +77,11 @@ dependencies {
  61. // implementation 'com.github.delight-im:Android-Languages:v1.0.1'
  62. implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  63. implementation project(':orbotservice')
  64. - implementation 'com.android.support:design:27.1.1'
  65. + // Match Fennec's ANDROID_SUPPORT_LIBRARY_VERSION
  66. + implementation 'com.android.support:design:23.4.0'
  67. implementation 'pl.bclogic:pulsator4droid:1.0.3'
  68. - implementation 'com.github.apl-devs:appintro:v4.2.2'
  69. - implementation 'com.github.javiersantos:AppUpdater:2.6.4'
  70. + // These require higher versions of ANDROID_SUPPORT_LIBRARY_VERSION
  71. + //implementation 'com.github.apl-devs:appintro:v4.2.2'
  72. + //implementation 'com.github.javiersantos:AppUpdater:2.6.4'
  73. }
  74. diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
  75. index 56db8266..2cd00888 100644
  76. --- a/app/src/main/AndroidManifest.xml
  77. +++ b/app/src/main/AndroidManifest.xml
  78. @@ -15,15 +15,13 @@
  79. <uses-feature android:name="android.hardware.touchscreen"
  80. android:required="false" />
  81. + <!-- Delete Orbot's name, icon, and label, so they don't conflict with the app -->
  82. + <!-- Fennec enables hardwareAccelerated= -->
  83. <application
  84. - android:name=".OrbotApp"
  85. android:allowBackup="false"
  86. android:allowClearUserData="true"
  87. android:configChanges="locale|orientation|screenSize"
  88. android:description="@string/app_description"
  89. - android:hardwareAccelerated="false"
  90. - android:icon="@drawable/ic_launcher"
  91. - android:label="@string/app_name"
  92. android:theme="@style/DefaultTheme"
  93. tools:replace="android:allowBackup"
  94. >
  95. @@ -31,10 +29,10 @@
  96. android:name=".OrbotMainActivity"
  97. android:excludeFromRecents="true"
  98. android:launchMode="singleTop">
  99. + <!-- When Orbot has android.intent.category.LAUNCHER, then a
  100. + launcher icon is added on the app menu. We don't want this. -->
  101. <intent-filter>
  102. <action android:name="android.intent.action.MAIN" />
  103. -
  104. - <category android:name="android.intent.category.LAUNCHER" />
  105. </intent-filter>
  106. <intent-filter>
  107. <action android:name="android.intent.action.VIEW" />
  108. @@ -57,17 +55,20 @@
  109. </activity>
  110. <!-- This is for ensuring the background service still runs when/if the app is swiped away -->
  111. + <!-- We want the app and background service to die when the user swipes away the app,
  112. + so disable this activity -->
  113. <activity
  114. android:name=".service.util.DummyActivity"
  115. android:allowTaskReparenting="true"
  116. android:alwaysRetainTaskState="false"
  117. android:clearTaskOnLaunch="true"
  118. - android:enabled="true"
  119. + android:enabled="false"
  120. android:excludeFromRecents="true"
  121. android:finishOnTaskLaunch="true"
  122. android:noHistory="true"
  123. android:stateNotNeeded="true"
  124. android:theme="@android:style/Theme.Translucent" />
  125. + <!-- Don't export the VPN functionality, we don't want to use it -->
  126. <activity
  127. android:name=".vpn.VPNEnableActivity"
  128. android:exported="false"
  129. @@ -85,26 +86,29 @@
  130. android:enabled="true"
  131. android:permission="android.permission.BIND_VPN_SERVICE"
  132. android:stopWithTask="false"></service>
  133. + <!-- Disable the VPN functionality, we don't want to use it -->
  134. <service
  135. android:name=".service.vpn.TorVpnService"
  136. - android:enabled="true"
  137. + android:enabled="false"
  138. android:permission="android.permission.BIND_VPN_SERVICE">
  139. <intent-filter>
  140. <action android:name="android.net.VpnService" />
  141. </intent-filter>
  142. </service>
  143. + <!-- Don't let other apps start our Orbot -->
  144. <receiver
  145. android:name=".service.StartTorReceiver"
  146. - android:exported="true">
  147. + android:exported="false">
  148. <intent-filter>
  149. <action android:name="org.torproject.android.intent.action.START" />
  150. </intent-filter>
  151. </receiver>
  152. + <!-- Don't automatically start our Orbot when the device boots -->
  153. <receiver
  154. android:name=".OnBootReceiver"
  155. - android:enabled="true"
  156. - android:exported="true">
  157. + android:enabled="false"
  158. + android:exported="false">
  159. <intent-filter>
  160. <action android:name="android.intent.action.BOOT_COMPLETED" />
  161. @@ -154,7 +158,9 @@
  162. android:value=".OrbotMainActivity" />
  163. </activity>
  164. - <activity android:name=".ui.onboarding.OnboardingActivity"/>
  165. + <!-- Disable the Onboarding activity, because it depends on a library that
  166. + depends on a newer version of the Android Support Library -->
  167. + <!--<activity android:name=".ui.onboarding.OnboardingActivity"/>-->
  168. <activity android:name=".ui.onboarding.BridgeWizardActivity"/>
  169. <provider
  170. @@ -163,4 +169,4 @@
  171. android:exported="false" />
  172. </application>
  173. -</manifest>
  174. \ No newline at end of file
  175. +</manifest>
  176. diff --git a/build.gradle b/build.gradle
  177. index 553079b6..ce06f082 100644
  178. --- a/build.gradle
  179. +++ b/build.gradle
  180. @@ -5,7 +5,8 @@ buildscript {
  181. google()
  182. }
  183. dependencies {
  184. - classpath 'com.android.tools.build:gradle:3.1.4'
  185. + // Match Fennec
  186. + classpath 'com.android.tools.build:gradle:3.0.1'
  187. }
  188. }
  189. diff --git a/jsocksAndroid/build.gradle b/jsocksAndroid/build.gradle
  190. index 7ac21e4e..8f173b5f 100644
  191. --- a/jsocksAndroid/build.gradle
  192. +++ b/jsocksAndroid/build.gradle
  193. @@ -1,12 +1,14 @@
  194. apply plugin: 'com.android.library'
  195. android {
  196. - compileSdkVersion 27
  197. - buildToolsVersion '27.0.3'
  198. + // Match Fennec's version
  199. + compileSdkVersion 26
  200. + buildToolsVersion '26.0.2'
  201. defaultConfig {
  202. minSdkVersion 16
  203. - targetSdkVersion 27
  204. + // Match Fennec's version
  205. + targetSdkVersion 26
  206. }
  207. buildTypes {
  208. diff --git a/orbotservice/build.gradle b/orbotservice/build.gradle
  209. index fb9b6946..e95f76ac 100644
  210. --- a/orbotservice/build.gradle
  211. +++ b/orbotservice/build.gradle
  212. @@ -1,8 +1,9 @@
  213. apply plugin: 'com.android.library'
  214. android {
  215. - compileSdkVersion 27
  216. - buildToolsVersion '27.0.3'
  217. + // Match Fennec's version
  218. + compileSdkVersion 26
  219. + buildToolsVersion '26.0.2'
  220. sourceSets {
  221. main {
  222. @@ -12,7 +13,8 @@ android {
  223. defaultConfig {
  224. minSdkVersion 16
  225. - targetSdkVersion 27
  226. + // Match Fennec's version
  227. + targetSdkVersion 26
  228. versionCode 1
  229. versionName "1.0"
  230. @@ -28,7 +30,8 @@ android {
  231. dependencies {
  232. implementation project(':jsocksAndroid')
  233. implementation 'org.torproject:tor-android-binary:0.3.4.9'
  234. - implementation 'com.android.support:appcompat-v7:27.1.1'
  235. + // Match Fennec's version
  236. + implementation 'com.android.support:appcompat-v7:23.4.0'
  237. implementation 'com.jrummyapps:android-shell:1.0.1'
  238. implementation fileTree(dir: 'libs', include: ['.so'])
  239. testImplementation 'junit:junit:4.12'
  240. --
  241. 2.17.1