Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9517f0703 | ||
|
|
72f4586acb | ||
|
|
3d6daccbb1 | ||
|
|
33a8967f30 | ||
|
|
762da4c62f | ||
|
|
8e83272fa7 | ||
|
|
d17d791b3b | ||
|
|
63ae014581 | ||
|
|
95e1eee59f | ||
|
|
98df31c258 | ||
|
|
04092bf8e0 | ||
|
|
5e56bfec89 | ||
|
|
635105ca05 | ||
|
|
d5fd487ff9 | ||
|
|
89c5d94275 | ||
|
|
0b98a2d4e7 | ||
|
|
1bc851dac0 | ||
|
|
37ea3d3f02 | ||
|
|
518e25d205 | ||
|
|
43e2731604 | ||
|
|
84c12e705f | ||
|
|
77ea376b46 | ||
|
|
68f3f8b20d | ||
|
|
7226f8aab4 | ||
|
|
36b46d6f32 | ||
|
|
7687a19cc1 |
@@ -36,6 +36,7 @@ The exclamation mark in the Wi-Fi/cellular icon appears because the system fails
|
|||||||
* Samsung and/or Brevent: [#1410](https://github.com/shadowsocks/shadowsocks-android/issues/1410)
|
* Samsung and/or Brevent: [#1410](https://github.com/shadowsocks/shadowsocks-android/issues/1410)
|
||||||
* Another Samsung: [#1712](https://github.com/shadowsocks/shadowsocks-android/issues/1712)
|
* Another Samsung: [#1712](https://github.com/shadowsocks/shadowsocks-android/issues/1712)
|
||||||
* Don't install this app on SD card because of permission issues: [#1124 (comment)](https://github.com/shadowsocks/shadowsocks-android/issues/1124#issuecomment-307556453)
|
* Don't install this app on SD card because of permission issues: [#1124 (comment)](https://github.com/shadowsocks/shadowsocks-android/issues/1124#issuecomment-307556453)
|
||||||
|
* `INTERACT_ACROSS_USERS` permission missing: [#1184](https://github.com/shadowsocks/shadowsocks-android/issues/1184)
|
||||||
|
|
||||||
### How to pause Shadowsocks service?
|
### How to pause Shadowsocks service?
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -8,8 +8,8 @@ buildscript {
|
|||||||
minSdkVersion = 21
|
minSdkVersion = 21
|
||||||
sdkVersion = 27
|
sdkVersion = 27
|
||||||
buildToolsVersion = '27.0.3'
|
buildToolsVersion = '27.0.3'
|
||||||
supportLibraryVersion = '27.1.0'
|
supportLibraryVersion = '27.1.1'
|
||||||
takisoftFixVersion = '27.1.0.0'
|
takisoftFixVersion = '27.1.1.0'
|
||||||
playServicesVersion = '12.0.1'
|
playServicesVersion = '12.0.1'
|
||||||
junitVersion = '4.12'
|
junitVersion = '4.12'
|
||||||
androidTestVersion = '1.0.1'
|
androidTestVersion = '1.0.1'
|
||||||
@@ -22,7 +22,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
classpath 'com.android.tools.build:gradle:3.1.1'
|
||||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
|
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
|
||||||
classpath 'com.google.gms:google-services:3.2.1'
|
classpath 'com.google.gms:google-services:3.2.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||||
|
|||||||
Submodule core/src/main/jni/shadowsocks-libev updated: a4c9059ffe...a9d56518bb
+12
-12
@@ -30,18 +30,6 @@ MKDIR %TARGET%\arm64-v8a>nul 2>nul
|
|||||||
|
|
||||||
SET CC=%ANDROID_ARM_TOOLCHAIN%\bin\arm-linux-androideabi-gcc.exe
|
SET CC=%ANDROID_ARM_TOOLCHAIN%\bin\arm-linux-androideabi-gcc.exe
|
||||||
|
|
||||||
REM Check environment availability
|
|
||||||
IF NOT EXIST %CC% (
|
|
||||||
ECHO "gcc not found"
|
|
||||||
EXIT 1
|
|
||||||
)
|
|
||||||
|
|
||||||
WHERE python.exe
|
|
||||||
IF "%ERRORLEVEL%" == 1 (
|
|
||||||
ECHO "python not found"
|
|
||||||
EXIT 1
|
|
||||||
)
|
|
||||||
|
|
||||||
IF NOT EXIST %ANDROID_ARM_CC% (
|
IF NOT EXIST %ANDROID_ARM_CC% (
|
||||||
ECHO "Make standalone toolchain for ARM arch"
|
ECHO "Make standalone toolchain for ARM arch"
|
||||||
python.exe %ANDROID_NDK_HOME%\build\tools\make_standalone_toolchain.py --arch arm ^
|
python.exe %ANDROID_NDK_HOME%\build\tools\make_standalone_toolchain.py --arch arm ^
|
||||||
@@ -60,6 +48,18 @@ IF NOT EXIST %ANDROID_X86_CC% (
|
|||||||
--api %MIN_API% --install-dir %ANDROID_X86_TOOLCHAIN%
|
--api %MIN_API% --install-dir %ANDROID_X86_TOOLCHAIN%
|
||||||
)
|
)
|
||||||
|
|
||||||
|
REM Check environment availability
|
||||||
|
IF NOT EXIST %CC% (
|
||||||
|
ECHO "gcc not found"
|
||||||
|
EXIT 1
|
||||||
|
)
|
||||||
|
|
||||||
|
WHERE python.exe
|
||||||
|
IF "%ERRORLEVEL%" == 1 (
|
||||||
|
ECHO "python not found"
|
||||||
|
EXIT 1
|
||||||
|
)
|
||||||
|
|
||||||
IF NOT EXIST %DIR%\go\bin\go.exe (
|
IF NOT EXIST %DIR%\go\bin\go.exe (
|
||||||
ECHO "Build the custom go"
|
ECHO "Build the custom go"
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.github.shadowsocks"
|
applicationId "com.github.shadowsocks"
|
||||||
minSdkVersion rootProject.minSdkVersion
|
minSdkVersion rootProject.minSdkVersion
|
||||||
targetSdkVersion rootProject.sdkVersion
|
targetSdkVersion rootProject.sdkVersion
|
||||||
versionCode 4050500
|
versionCode 4050700
|
||||||
versionName "4.5.5"
|
versionName "4.5.7"
|
||||||
testApplicationId "com.github.shadowsocks.test"
|
testApplicationId "com.github.shadowsocks.test"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
resConfigs "fa", "fr", "ja", "ko", "ru", "zh-rCN", "zh-rTW"
|
resConfigs "fa", "fr", "ja", "ko", "ru", "zh-rCN", "zh-rTW"
|
||||||
@@ -64,7 +64,7 @@ dependencies {
|
|||||||
implementation "com.google.android.gms:play-services-vision:$playServicesVersion"
|
implementation "com.google.android.gms:play-services-vision:$playServicesVersion"
|
||||||
implementation "com.google.firebase:firebase-config:$playServicesVersion"
|
implementation "com.google.firebase:firebase-config:$playServicesVersion"
|
||||||
implementation 'com.j256.ormlite:ormlite-android:5.1'
|
implementation 'com.j256.ormlite:ormlite-android:5.1'
|
||||||
implementation 'com.mikepenz:materialdrawer:6.0.6'
|
implementation 'com.mikepenz:materialdrawer:6.0.7'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||||
implementation "com.takisoft.fix:preference-v7-simplemenu:$takisoftFixVersion"
|
implementation "com.takisoft.fix:preference-v7-simplemenu:$takisoftFixVersion"
|
||||||
implementation 'com.twofortyfouram:android-plugin-api-for-locale:1.0.2'
|
implementation 'com.twofortyfouram:android-plugin-api-for-locale:1.0.2'
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".VpnRequestActivity"
|
android:name=".VpnRequestActivity"
|
||||||
android:theme="@style/Theme.Translucent"
|
android:theme="@style/Theme.AppCompat.Translucent"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:taskAffinity=""
|
android:taskAffinity=""
|
||||||
android:launchMode="singleTask"/>
|
android:launchMode="singleTask"/>
|
||||||
|
|||||||
@@ -5634,9 +5634,7 @@
|
|||||||
(^|\.)blogs\.libraryinformationtechnology\.com$
|
(^|\.)blogs\.libraryinformationtechnology\.com$
|
||||||
(^|\.)blogs\.tampabay\.com$
|
(^|\.)blogs\.tampabay\.com$
|
||||||
(^|\.)blogs\.yahoo\.co\.jp$
|
(^|\.)blogs\.yahoo\.co\.jp$
|
||||||
(^|\.)blogspot\.com$
|
(^|\.)blogspot(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)blogspot\.hk$
|
|
||||||
(^|\.)blogspot\.jp$
|
|
||||||
(^|\.)blogtd\.net$
|
(^|\.)blogtd\.net$
|
||||||
(^|\.)blogtd\.org$
|
(^|\.)blogtd\.org$
|
||||||
(^|\.)bloodshed\.net$
|
(^|\.)bloodshed\.net$
|
||||||
@@ -6875,61 +6873,8 @@
|
|||||||
(^|\.)goodtv\.com\.tw$
|
(^|\.)goodtv\.com\.tw$
|
||||||
(^|\.)goodtv\.tv$
|
(^|\.)goodtv\.tv$
|
||||||
(^|\.)goofind\.com$
|
(^|\.)goofind\.com$
|
||||||
(^|\.)google\.ae$
|
(^|\.)google(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)google\.am$
|
(^|\.)googleapis(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)google\.as$
|
|
||||||
(^|\.)google\.at$
|
|
||||||
(^|\.)google\.az$
|
|
||||||
(^|\.)google\.ba$
|
|
||||||
(^|\.)google\.be$
|
|
||||||
(^|\.)google\.bg$
|
|
||||||
(^|\.)google\.ca$
|
|
||||||
(^|\.)google\.calstate\.edu$
|
|
||||||
(^|\.)google\.cd$
|
|
||||||
(^|\.)google\.ci$
|
|
||||||
(^|\.)google\.co\.id$
|
|
||||||
(^|\.)google\.co\.jp$
|
|
||||||
(^|\.)google\.co\.kr$
|
|
||||||
(^|\.)google\.co\.ma$
|
|
||||||
(^|\.)google\.co\.uk$
|
|
||||||
(^|\.)google\.com$
|
|
||||||
(^|\.)google\.de$
|
|
||||||
(^|\.)google\.dj$
|
|
||||||
(^|\.)google\.dk$
|
|
||||||
(^|\.)google\.es$
|
|
||||||
(^|\.)google\.fi$
|
|
||||||
(^|\.)google\.fm$
|
|
||||||
(^|\.)google\.fr$
|
|
||||||
(^|\.)google\.gg$
|
|
||||||
(^|\.)google\.gl$
|
|
||||||
(^|\.)google\.gr$
|
|
||||||
(^|\.)google\.ie$
|
|
||||||
(^|\.)google\.is$
|
|
||||||
(^|\.)google\.it$
|
|
||||||
(^|\.)google\.jo$
|
|
||||||
(^|\.)google\.kz$
|
|
||||||
(^|\.)google\.lv$
|
|
||||||
(^|\.)google\.mn$
|
|
||||||
(^|\.)google\.ms$
|
|
||||||
(^|\.)google\.nl$
|
|
||||||
(^|\.)google\.no$
|
|
||||||
(^|\.)google\.nu$
|
|
||||||
(^|\.)google\.ro$
|
|
||||||
(^|\.)google\.ru$
|
|
||||||
(^|\.)google\.rw$
|
|
||||||
(^|\.)google\.sc$
|
|
||||||
(^|\.)google\.sh$
|
|
||||||
(^|\.)google\.sk$
|
|
||||||
(^|\.)google\.sm$
|
|
||||||
(^|\.)google\.sn$
|
|
||||||
(^|\.)google\.tk$
|
|
||||||
(^|\.)google\.tm$
|
|
||||||
(^|\.)google\.to$
|
|
||||||
(^|\.)google\.tt$
|
|
||||||
(^|\.)google\.vu$
|
|
||||||
(^|\.)google\.ws$
|
|
||||||
(^|\.)googleapis\.cn$
|
|
||||||
(^|\.)googleapis\.com$
|
|
||||||
(^|\.)googleapps\.com$
|
(^|\.)googleapps\.com$
|
||||||
(^|\.)googlearth\.com$
|
(^|\.)googlearth\.com$
|
||||||
(^|\.)googleartproject\.com$
|
(^|\.)googleartproject\.com$
|
||||||
|
|||||||
@@ -5648,9 +5648,7 @@
|
|||||||
(^|\.)blogs\.libraryinformationtechnology\.com$
|
(^|\.)blogs\.libraryinformationtechnology\.com$
|
||||||
(^|\.)blogs\.tampabay\.com$
|
(^|\.)blogs\.tampabay\.com$
|
||||||
(^|\.)blogs\.yahoo\.co\.jp$
|
(^|\.)blogs\.yahoo\.co\.jp$
|
||||||
(^|\.)blogspot\.com$
|
(^|\.)blogspot(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)blogspot\.hk$
|
|
||||||
(^|\.)blogspot\.jp$
|
|
||||||
(^|\.)blogtd\.net$
|
(^|\.)blogtd\.net$
|
||||||
(^|\.)blogtd\.org$
|
(^|\.)blogtd\.org$
|
||||||
(^|\.)bloodshed\.net$
|
(^|\.)bloodshed\.net$
|
||||||
@@ -6889,61 +6887,8 @@
|
|||||||
(^|\.)goodtv\.com\.tw$
|
(^|\.)goodtv\.com\.tw$
|
||||||
(^|\.)goodtv\.tv$
|
(^|\.)goodtv\.tv$
|
||||||
(^|\.)goofind\.com$
|
(^|\.)goofind\.com$
|
||||||
(^|\.)google\.ae$
|
(^|\.)google(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)google\.am$
|
(^|\.)googleapis(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)google\.as$
|
|
||||||
(^|\.)google\.at$
|
|
||||||
(^|\.)google\.az$
|
|
||||||
(^|\.)google\.ba$
|
|
||||||
(^|\.)google\.be$
|
|
||||||
(^|\.)google\.bg$
|
|
||||||
(^|\.)google\.ca$
|
|
||||||
(^|\.)google\.calstate\.edu$
|
|
||||||
(^|\.)google\.cd$
|
|
||||||
(^|\.)google\.ci$
|
|
||||||
(^|\.)google\.co\.id$
|
|
||||||
(^|\.)google\.co\.jp$
|
|
||||||
(^|\.)google\.co\.kr$
|
|
||||||
(^|\.)google\.co\.ma$
|
|
||||||
(^|\.)google\.co\.uk$
|
|
||||||
(^|\.)google\.com$
|
|
||||||
(^|\.)google\.de$
|
|
||||||
(^|\.)google\.dj$
|
|
||||||
(^|\.)google\.dk$
|
|
||||||
(^|\.)google\.es$
|
|
||||||
(^|\.)google\.fi$
|
|
||||||
(^|\.)google\.fm$
|
|
||||||
(^|\.)google\.fr$
|
|
||||||
(^|\.)google\.gg$
|
|
||||||
(^|\.)google\.gl$
|
|
||||||
(^|\.)google\.gr$
|
|
||||||
(^|\.)google\.ie$
|
|
||||||
(^|\.)google\.is$
|
|
||||||
(^|\.)google\.it$
|
|
||||||
(^|\.)google\.jo$
|
|
||||||
(^|\.)google\.kz$
|
|
||||||
(^|\.)google\.lv$
|
|
||||||
(^|\.)google\.mn$
|
|
||||||
(^|\.)google\.ms$
|
|
||||||
(^|\.)google\.nl$
|
|
||||||
(^|\.)google\.no$
|
|
||||||
(^|\.)google\.nu$
|
|
||||||
(^|\.)google\.ro$
|
|
||||||
(^|\.)google\.ru$
|
|
||||||
(^|\.)google\.rw$
|
|
||||||
(^|\.)google\.sc$
|
|
||||||
(^|\.)google\.sh$
|
|
||||||
(^|\.)google\.sk$
|
|
||||||
(^|\.)google\.sm$
|
|
||||||
(^|\.)google\.sn$
|
|
||||||
(^|\.)google\.tk$
|
|
||||||
(^|\.)google\.tm$
|
|
||||||
(^|\.)google\.to$
|
|
||||||
(^|\.)google\.tt$
|
|
||||||
(^|\.)google\.vu$
|
|
||||||
(^|\.)google\.ws$
|
|
||||||
(^|\.)googleapis\.cn$
|
|
||||||
(^|\.)googleapis\.com$
|
|
||||||
(^|\.)googleapps\.com$
|
(^|\.)googleapps\.com$
|
||||||
(^|\.)googlearth\.com$
|
(^|\.)googlearth\.com$
|
||||||
(^|\.)googleartproject\.com$
|
(^|\.)googleartproject\.com$
|
||||||
|
|||||||
@@ -561,9 +561,7 @@
|
|||||||
(^|\.)blogs\.libraryinformationtechnology\.com$
|
(^|\.)blogs\.libraryinformationtechnology\.com$
|
||||||
(^|\.)blogs\.tampabay\.com$
|
(^|\.)blogs\.tampabay\.com$
|
||||||
(^|\.)blogs\.yahoo\.co\.jp$
|
(^|\.)blogs\.yahoo\.co\.jp$
|
||||||
(^|\.)blogspot\.com$
|
(^|\.)blogspot(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)blogspot\.hk$
|
|
||||||
(^|\.)blogspot\.jp$
|
|
||||||
(^|\.)blogtd\.net$
|
(^|\.)blogtd\.net$
|
||||||
(^|\.)blogtd\.org$
|
(^|\.)blogtd\.org$
|
||||||
(^|\.)bloodshed\.net$
|
(^|\.)bloodshed\.net$
|
||||||
@@ -1802,61 +1800,8 @@
|
|||||||
(^|\.)goodtv\.com\.tw$
|
(^|\.)goodtv\.com\.tw$
|
||||||
(^|\.)goodtv\.tv$
|
(^|\.)goodtv\.tv$
|
||||||
(^|\.)goofind\.com$
|
(^|\.)goofind\.com$
|
||||||
(^|\.)google\.ae$
|
(^|\.)google(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)google\.am$
|
(^|\.)googleapis(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?){1,2}$
|
||||||
(^|\.)google\.as$
|
|
||||||
(^|\.)google\.at$
|
|
||||||
(^|\.)google\.az$
|
|
||||||
(^|\.)google\.ba$
|
|
||||||
(^|\.)google\.be$
|
|
||||||
(^|\.)google\.bg$
|
|
||||||
(^|\.)google\.ca$
|
|
||||||
(^|\.)google\.calstate\.edu$
|
|
||||||
(^|\.)google\.cd$
|
|
||||||
(^|\.)google\.ci$
|
|
||||||
(^|\.)google\.co\.id$
|
|
||||||
(^|\.)google\.co\.jp$
|
|
||||||
(^|\.)google\.co\.kr$
|
|
||||||
(^|\.)google\.co\.ma$
|
|
||||||
(^|\.)google\.co\.uk$
|
|
||||||
(^|\.)google\.com$
|
|
||||||
(^|\.)google\.de$
|
|
||||||
(^|\.)google\.dj$
|
|
||||||
(^|\.)google\.dk$
|
|
||||||
(^|\.)google\.es$
|
|
||||||
(^|\.)google\.fi$
|
|
||||||
(^|\.)google\.fm$
|
|
||||||
(^|\.)google\.fr$
|
|
||||||
(^|\.)google\.gg$
|
|
||||||
(^|\.)google\.gl$
|
|
||||||
(^|\.)google\.gr$
|
|
||||||
(^|\.)google\.ie$
|
|
||||||
(^|\.)google\.is$
|
|
||||||
(^|\.)google\.it$
|
|
||||||
(^|\.)google\.jo$
|
|
||||||
(^|\.)google\.kz$
|
|
||||||
(^|\.)google\.lv$
|
|
||||||
(^|\.)google\.mn$
|
|
||||||
(^|\.)google\.ms$
|
|
||||||
(^|\.)google\.nl$
|
|
||||||
(^|\.)google\.no$
|
|
||||||
(^|\.)google\.nu$
|
|
||||||
(^|\.)google\.ro$
|
|
||||||
(^|\.)google\.ru$
|
|
||||||
(^|\.)google\.rw$
|
|
||||||
(^|\.)google\.sc$
|
|
||||||
(^|\.)google\.sh$
|
|
||||||
(^|\.)google\.sk$
|
|
||||||
(^|\.)google\.sm$
|
|
||||||
(^|\.)google\.sn$
|
|
||||||
(^|\.)google\.tk$
|
|
||||||
(^|\.)google\.tm$
|
|
||||||
(^|\.)google\.to$
|
|
||||||
(^|\.)google\.tt$
|
|
||||||
(^|\.)google\.vu$
|
|
||||||
(^|\.)google\.ws$
|
|
||||||
(^|\.)googleapis\.cn$
|
|
||||||
(^|\.)googleapis\.com$
|
|
||||||
(^|\.)googleapps\.com$
|
(^|\.)googleapps\.com$
|
||||||
(^|\.)googlearth\.com$
|
(^|\.)googlearth\.com$
|
||||||
(^|\.)googleartproject\.com$
|
(^|\.)googleartproject\.com$
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
0.0.0.0/8
|
|
||||||
10.0.0.0/8
|
|
||||||
100.64.0.0/10
|
|
||||||
127.0.0.0/8
|
|
||||||
169.254.0.0/16
|
|
||||||
172.16.0.0/12
|
|
||||||
192.0.0.0/29
|
|
||||||
192.0.2.0/24
|
|
||||||
192.88.99.0/24
|
|
||||||
192.168.0.0/16
|
|
||||||
198.18.0.0/15
|
|
||||||
198.51.100.0/24
|
|
||||||
203.0.113.0/24
|
|
||||||
224.0.0.0/3
|
|
||||||
1.0.1.0/24
|
1.0.1.0/24
|
||||||
1.0.2.0/23
|
1.0.2.0/23
|
||||||
1.0.8.0/21
|
1.0.8.0/21
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class App : Application() {
|
|||||||
app = this
|
app = this
|
||||||
if (!BuildConfig.DEBUG) System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "ERROR")
|
if (!BuildConfig.DEBUG) System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "ERROR")
|
||||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
|
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||||
PreferenceFragmentCompat.registerPreferenceFragment(IconListPreference::class.java,
|
PreferenceFragmentCompat.registerPreferenceFragment(IconListPreference::class.java,
|
||||||
BottomSheetPreferenceDialogFragment::class.java)
|
BottomSheetPreferenceDialogFragment::class.java)
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import android.support.v7.app.AlertDialog
|
|||||||
import android.support.v7.app.AppCompatActivity
|
import android.support.v7.app.AppCompatActivity
|
||||||
import android.support.v7.content.res.AppCompatResources
|
import android.support.v7.content.res.AppCompatResources
|
||||||
import android.support.v7.preference.PreferenceDataStore
|
import android.support.v7.preference.PreferenceDataStore
|
||||||
|
import android.text.format.Formatter
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
@@ -49,7 +50,6 @@ import com.github.shadowsocks.aidl.IShadowsocksService
|
|||||||
import com.github.shadowsocks.aidl.IShadowsocksServiceCallback
|
import com.github.shadowsocks.aidl.IShadowsocksServiceCallback
|
||||||
import com.github.shadowsocks.bg.BaseService
|
import com.github.shadowsocks.bg.BaseService
|
||||||
import com.github.shadowsocks.bg.Executable
|
import com.github.shadowsocks.bg.Executable
|
||||||
import com.github.shadowsocks.bg.TrafficMonitor
|
|
||||||
import com.github.shadowsocks.database.Profile
|
import com.github.shadowsocks.database.Profile
|
||||||
import com.github.shadowsocks.database.ProfileManager
|
import com.github.shadowsocks.database.ProfileManager
|
||||||
import com.github.shadowsocks.preference.DataStore
|
import com.github.shadowsocks.preference.DataStore
|
||||||
@@ -149,10 +149,10 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
|
|||||||
stateListener?.invoke(state)
|
stateListener?.invoke(state)
|
||||||
}
|
}
|
||||||
fun updateTraffic(profileId: Int, txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) {
|
fun updateTraffic(profileId: Int, txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) {
|
||||||
txText.text = TrafficMonitor.formatTraffic(txTotal)
|
txText.text = Formatter.formatFileSize(this, txTotal)
|
||||||
rxText.text = TrafficMonitor.formatTraffic(rxTotal)
|
rxText.text = Formatter.formatFileSize(this, rxTotal)
|
||||||
txRateText.text = getString(R.string.speed, TrafficMonitor.formatTraffic(txRate))
|
txRateText.text = getString(R.string.speed, Formatter.formatFileSize(this, txRate))
|
||||||
rxRateText.text = getString(R.string.speed, TrafficMonitor.formatTraffic(rxRate))
|
rxRateText.text = getString(R.string.speed, Formatter.formatFileSize(this, rxRate))
|
||||||
val child = supportFragmentManager.findFragmentById(R.id.fragment_holder) as ToolbarFragment?
|
val child = supportFragmentManager.findFragmentById(R.id.fragment_holder) as ToolbarFragment?
|
||||||
if (state != BaseService.STOPPING)
|
if (state != BaseService.STOPPING)
|
||||||
child?.onTrafficUpdated(profileId, txRate, rxRate, txTotal, rxTotal)
|
child?.onTrafficUpdated(profileId, txRate, rxRate, txTotal, rxTotal)
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ import android.support.design.widget.Snackbar
|
|||||||
import android.support.v4.app.DialogFragment
|
import android.support.v4.app.DialogFragment
|
||||||
import android.support.v7.widget.*
|
import android.support.v7.widget.*
|
||||||
import android.support.v7.widget.helper.ItemTouchHelper
|
import android.support.v7.widget.helper.ItemTouchHelper
|
||||||
|
import android.text.format.Formatter
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.github.shadowsocks.App.Companion.app
|
import com.github.shadowsocks.App.Companion.app
|
||||||
import com.github.shadowsocks.bg.BaseService
|
import com.github.shadowsocks.bg.BaseService
|
||||||
import com.github.shadowsocks.bg.TrafficMonitor
|
|
||||||
import com.github.shadowsocks.database.Profile
|
import com.github.shadowsocks.database.Profile
|
||||||
import com.github.shadowsocks.database.ProfileManager
|
import com.github.shadowsocks.database.ProfileManager
|
||||||
import com.github.shadowsocks.plugin.PluginConfiguration
|
import com.github.shadowsocks.plugin.PluginConfiguration
|
||||||
@@ -123,7 +123,10 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
|
|||||||
private var adView: AdView? = null
|
private var adView: AdView? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
edit.setOnClickListener { startConfig(item) }
|
edit.setOnClickListener {
|
||||||
|
item = ProfileManager.getProfile(item.id)!!
|
||||||
|
startConfig(item)
|
||||||
|
}
|
||||||
TooltipCompat.setTooltipText(edit, edit.contentDescription)
|
TooltipCompat.setTooltipText(edit, edit.contentDescription)
|
||||||
itemView.setOnClickListener(this)
|
itemView.setOnClickListener(this)
|
||||||
val share = itemView.findViewById<View>(R.id.share)
|
val share = itemView.findViewById<View>(R.id.share)
|
||||||
@@ -156,10 +159,11 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
|
|||||||
text2.visibility = View.VISIBLE
|
text2.visibility = View.VISIBLE
|
||||||
text2.text = t2.joinToString("\n")
|
text2.text = t2.joinToString("\n")
|
||||||
}
|
}
|
||||||
|
val context = requireContext()
|
||||||
if (tx <= 0 && rx <= 0) traffic.visibility = View.GONE else {
|
if (tx <= 0 && rx <= 0) traffic.visibility = View.GONE else {
|
||||||
traffic.visibility = View.VISIBLE
|
traffic.visibility = View.VISIBLE
|
||||||
traffic.text = getString(R.string.traffic,
|
traffic.text = getString(R.string.traffic,
|
||||||
TrafficMonitor.formatTraffic(tx), TrafficMonitor.formatTraffic(rx))
|
Formatter.formatFileSize(context, tx), Formatter.formatFileSize(context, rx))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.id == DataStore.profileId) {
|
if (item.id == DataStore.profileId) {
|
||||||
@@ -176,7 +180,6 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
|
|||||||
val params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
val params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT)
|
ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
params.gravity = Gravity.CENTER_HORIZONTAL
|
params.gravity = Gravity.CENTER_HORIZONTAL
|
||||||
val context = requireContext()
|
|
||||||
adView = AdView(context)
|
adView = AdView(context)
|
||||||
adView.layoutParams = params
|
adView.layoutParams = params
|
||||||
adView.adUnitId = "ca-app-pub-9097031975646651/7760346322"
|
adView.adUnitId = "ca-app-pub-9097031975646651/7760346322"
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ class AclSyncJob(private val route: String) : Job() {
|
|||||||
return when (parts[0]) {
|
return when (parts[0]) {
|
||||||
TAG -> AclSyncJob(parts[1])
|
TAG -> AclSyncJob(parts[1])
|
||||||
else -> {
|
else -> {
|
||||||
Log.w(TAG, "Unknown job tag: " + tag)
|
Log.w(TAG, "Unknown job tag: $tag")
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun schedule(route: String): Int = JobRequest.Builder(TAG + ':' + route)
|
fun schedule(route: String): Int = JobRequest.Builder("$TAG:$route")
|
||||||
.setExecutionWindow(TimeUnit.SECONDS.toMillis(10), TimeUnit.DAYS.toMillis(28))
|
.setExecutionWindow(TimeUnit.SECONDS.toMillis(10), TimeUnit.DAYS.toMillis(28))
|
||||||
.setRequirementsEnforced(true)
|
.setRequirementsEnforced(true)
|
||||||
.setRequiredNetworkType(JobRequest.NetworkType.UNMETERED)
|
.setRequiredNetworkType(JobRequest.NetworkType.UNMETERED)
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ object BaseService {
|
|||||||
@Volatile var state = STOPPED
|
@Volatile var state = STOPPED
|
||||||
@Volatile var plugin = PluginOptions()
|
@Volatile var plugin = PluginOptions()
|
||||||
@Volatile var pluginPath: String? = null
|
@Volatile var pluginPath: String? = null
|
||||||
var sslocalProcess: GuardedProcess? = null
|
val processes = GuardedProcessPool()
|
||||||
|
|
||||||
var timer: Timer? = null
|
var timer: Timer? = null
|
||||||
var trafficMonitorThread: TrafficMonitorThread? = null
|
var trafficMonitorThread: TrafficMonitorThread? = null
|
||||||
@@ -274,7 +274,7 @@ object BaseService {
|
|||||||
|
|
||||||
if (TcpFastOpen.sendEnabled) cmd += "--fast-open"
|
if (TcpFastOpen.sendEnabled) cmd += "--fast-open"
|
||||||
|
|
||||||
data.sslocalProcess = GuardedProcess(cmd).start()
|
data.processes.start(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createNotification(profileName: String): ServiceNotification
|
fun createNotification(profileName: String): ServiceNotification
|
||||||
@@ -285,11 +285,7 @@ object BaseService {
|
|||||||
else startService(Intent(this, javaClass))
|
else startService(Intent(this, javaClass))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun killProcesses() {
|
fun killProcesses() = data.processes.killAll()
|
||||||
val data = data
|
|
||||||
data.sslocalProcess?.destroy()
|
|
||||||
data.sslocalProcess = null
|
|
||||||
}
|
|
||||||
|
|
||||||
fun stopRunner(stopService: Boolean, msg: String? = null) {
|
fun stopRunner(stopService: Boolean, msg: String? = null) {
|
||||||
// channge the state
|
// channge the state
|
||||||
|
|||||||
+51
-38
@@ -31,31 +31,34 @@ import com.github.shadowsocks.utils.thread
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.util.concurrent.Semaphore
|
import java.util.*
|
||||||
|
import java.util.concurrent.ArrayBlockingQueue
|
||||||
|
|
||||||
class GuardedProcess(private val cmd: List<String>) {
|
class GuardedProcessPool {
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "GuardedProcess"
|
private const val TAG = "GuardedProcessPool"
|
||||||
|
private val dummy = IOException()
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var guardThread: Thread
|
private inner class Guard(private val cmd: List<String>, private val onRestartCallback: (() -> Unit)?) {
|
||||||
@Volatile
|
val cmdName = File(cmd.first()).nameWithoutExtension
|
||||||
private var isDestroyed = false
|
val excQueue = ArrayBlockingQueue<IOException>(1) // ArrayBlockingQueue doesn't want null
|
||||||
@Volatile
|
private var pushed = false
|
||||||
private lateinit var process: Process
|
|
||||||
private val name = File(cmd.first()).nameWithoutExtension
|
|
||||||
|
|
||||||
private fun streamLogger(input: InputStream, logger: (String, String) -> Int) = thread("StreamLogger-$name") {
|
private fun streamLogger(input: InputStream, logger: (String, String) -> Int) =
|
||||||
try {
|
thread("StreamLogger-$cmdName") {
|
||||||
input.bufferedReader().useLines { it.forEach { logger(TAG, it) } }
|
try {
|
||||||
} catch (_: IOException) { } // ignore
|
input.bufferedReader().useLines { it.forEach { logger(TAG, it) } }
|
||||||
}
|
} catch (_: IOException) { } // ignore
|
||||||
|
}
|
||||||
|
private fun pushException(ioException: IOException?) {
|
||||||
|
if (pushed) return
|
||||||
|
excQueue.put(ioException ?: dummy)
|
||||||
|
pushed = true
|
||||||
|
}
|
||||||
|
|
||||||
fun start(onRestartCallback: (() -> Unit)? = null): GuardedProcess {
|
fun looper() {
|
||||||
val semaphore = Semaphore(1)
|
var process: Process? = null
|
||||||
semaphore.acquire()
|
|
||||||
var ioException: IOException? = null
|
|
||||||
guardThread = thread("GuardThread-$name") {
|
|
||||||
try {
|
try {
|
||||||
var callback: (() -> Unit)? = null
|
var callback: (() -> Unit)? = null
|
||||||
while (!isDestroyed) {
|
while (!isDestroyed) {
|
||||||
@@ -72,44 +75,54 @@ class GuardedProcess(private val cmd: List<String>) {
|
|||||||
|
|
||||||
if (callback == null) callback = onRestartCallback else callback()
|
if (callback == null) callback = onRestartCallback else callback()
|
||||||
|
|
||||||
semaphore.release()
|
pushException(null)
|
||||||
process.waitFor()
|
process.waitFor()
|
||||||
|
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
if (SystemClock.elapsedRealtime() - startTime < 1000) {
|
if (SystemClock.elapsedRealtime() - startTime < 1000) {
|
||||||
Log.w(TAG, "process exit too fast, stop guard: " + Commandline.toString(cmd))
|
Log.w(TAG, "process exit too fast, stop guard: $cmdName")
|
||||||
isDestroyed = true
|
isDestroyed = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (_: InterruptedException) {
|
} catch (_: InterruptedException) {
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, "thread interrupt, destroy process: " + Commandline.toString(cmd))
|
if (BuildConfig.DEBUG) Log.d(TAG, "thread interrupt, destroy process: $cmdName")
|
||||||
destroyProcess()
|
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
ioException = e
|
pushException(e)
|
||||||
} finally {
|
} finally {
|
||||||
semaphore.release()
|
if (process != null) {
|
||||||
|
if (Build.VERSION.SDK_INT < 24) @Suppress("DEPRECATION") {
|
||||||
|
JniHelper.sigtermCompat(process)
|
||||||
|
JniHelper.waitForCompat(process, 500)
|
||||||
|
}
|
||||||
|
process.destroy()
|
||||||
|
process.waitFor() // ensure the process is destroyed
|
||||||
|
}
|
||||||
|
pushException(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
semaphore.acquire()
|
}
|
||||||
if (ioException != null) throw ioException!!
|
|
||||||
|
private val guardThreads = HashSet<Thread>()
|
||||||
|
@Volatile
|
||||||
|
private var isDestroyed = false
|
||||||
|
|
||||||
|
fun start(cmd: List<String>, onRestartCallback: (() -> Unit)? = null): GuardedProcessPool {
|
||||||
|
val guard = Guard(cmd, onRestartCallback)
|
||||||
|
guardThreads.add(thread("GuardThread-${guard.cmdName}", block = guard::looper))
|
||||||
|
val ioException = guard.excQueue.take()
|
||||||
|
if (ioException !== dummy) throw ioException
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun destroy() {
|
fun killAll() {
|
||||||
isDestroyed = true
|
isDestroyed = true
|
||||||
guardThread.interrupt()
|
guardThreads.forEach { it.interrupt() }
|
||||||
destroyProcess()
|
|
||||||
try {
|
try {
|
||||||
guardThread.join()
|
guardThreads.forEach { it.join() }
|
||||||
} catch (_: InterruptedException) { }
|
} catch (_: InterruptedException) { }
|
||||||
}
|
|
||||||
|
|
||||||
private fun destroyProcess() {
|
guardThreads.clear()
|
||||||
if (Build.VERSION.SDK_INT < 24) @Suppress("DEPRECATION") {
|
isDestroyed = false
|
||||||
JniHelper.sigtermCompat(process)
|
|
||||||
JniHelper.waitForCompat(process, 500)
|
|
||||||
}
|
|
||||||
process.destroy()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,19 +28,9 @@ import org.json.JSONArray
|
|||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.Inet6Address
|
import java.net.Inet6Address
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object also uses WeakMap to simulate the effects of multi-inheritance, but more lightweight.
|
|
||||||
*/
|
|
||||||
object LocalDnsService {
|
object LocalDnsService {
|
||||||
interface Interface : BaseService.Interface {
|
interface Interface : BaseService.Interface {
|
||||||
var overtureProcess: GuardedProcess?
|
|
||||||
get() = overtureProcesses[this]
|
|
||||||
set(value) {
|
|
||||||
if (value == null) overtureProcesses.remove(this) else overtureProcesses[this] = value
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun startNativeProcesses() {
|
override fun startNativeProcesses() {
|
||||||
super.startNativeProcesses()
|
super.startNativeProcesses()
|
||||||
val data = data
|
val data = data
|
||||||
@@ -96,18 +86,10 @@ object LocalDnsService {
|
|||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile.udpdns) overtureProcess = GuardedProcess(buildAdditionalArguments(arrayListOf(
|
if (!profile.udpdns) data.processes.start(buildAdditionalArguments(arrayListOf(
|
||||||
File(app.applicationInfo.nativeLibraryDir, Executable.OVERTURE).absolutePath,
|
File(app.applicationInfo.nativeLibraryDir, Executable.OVERTURE).absolutePath,
|
||||||
"-c", buildOvertureConfig("overture.conf")
|
"-c", buildOvertureConfig("overture.conf")
|
||||||
))).start()
|
)))
|
||||||
}
|
|
||||||
|
|
||||||
override fun killProcesses() {
|
|
||||||
super.killProcesses()
|
|
||||||
overtureProcess?.destroy()
|
|
||||||
overtureProcess = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val overtureProcesses = WeakHashMap<Interface, GuardedProcess>()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import android.os.Build
|
|||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import android.support.v4.app.NotificationCompat
|
import android.support.v4.app.NotificationCompat
|
||||||
import android.support.v4.content.ContextCompat
|
import android.support.v4.content.ContextCompat
|
||||||
|
import android.text.format.Formatter
|
||||||
import com.github.shadowsocks.MainActivity
|
import com.github.shadowsocks.MainActivity
|
||||||
import com.github.shadowsocks.R
|
import com.github.shadowsocks.R
|
||||||
import com.github.shadowsocks.aidl.IShadowsocksServiceCallback
|
import com.github.shadowsocks.aidl.IShadowsocksServiceCallback
|
||||||
@@ -55,11 +56,11 @@ class ServiceNotification(private val service: BaseService.Interface, profileNam
|
|||||||
override fun stateChanged(state: Int, profileName: String?, msg: String?) { } // ignore
|
override fun stateChanged(state: Int, profileName: String?, msg: String?) { } // ignore
|
||||||
override fun trafficUpdated(profileId: Int, txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) {
|
override fun trafficUpdated(profileId: Int, txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) {
|
||||||
service as Context
|
service as Context
|
||||||
val txr = service.getString(R.string.speed, TrafficMonitor.formatTraffic(txRate))
|
val txr = service.getString(R.string.speed, Formatter.formatFileSize(service, txRate))
|
||||||
val rxr = service.getString(R.string.speed, TrafficMonitor.formatTraffic(rxRate))
|
val rxr = service.getString(R.string.speed, Formatter.formatFileSize(service, rxRate))
|
||||||
builder.setContentText("$txr↑\t$rxr↓")
|
builder.setContentText("$txr↑\t$rxr↓")
|
||||||
style.bigText(service.getString(R.string.stat_summary).format(Locale.ENGLISH, txr, rxr,
|
style.bigText(service.getString(R.string.stat_summary).format(Locale.ENGLISH, txr, rxr,
|
||||||
TrafficMonitor.formatTraffic(txTotal), TrafficMonitor.formatTraffic(rxTotal)))
|
Formatter.formatFileSize(service, txTotal), Formatter.formatFileSize(service, rxTotal)))
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
override fun trafficPersisted(profileId: Int) { }
|
override fun trafficPersisted(profileId: Int) { }
|
||||||
|
|||||||
@@ -21,9 +21,6 @@
|
|||||||
package com.github.shadowsocks.bg
|
package com.github.shadowsocks.bg
|
||||||
|
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import com.github.shadowsocks.App.Companion.app
|
|
||||||
import com.github.shadowsocks.R
|
|
||||||
import java.text.DecimalFormat
|
|
||||||
|
|
||||||
object TrafficMonitor {
|
object TrafficMonitor {
|
||||||
// Bytes per second
|
// Bytes per second
|
||||||
@@ -41,19 +38,6 @@ object TrafficMonitor {
|
|||||||
@Volatile
|
@Volatile
|
||||||
private var dirty = true
|
private var dirty = true
|
||||||
|
|
||||||
private val units = arrayOf("KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB", "BB", "NB", "DB", "CB")
|
|
||||||
private val numberFormat = DecimalFormat("@@@")
|
|
||||||
fun formatTraffic(size: Long): String {
|
|
||||||
var n = size.toDouble()
|
|
||||||
var i = -1
|
|
||||||
while (n >= 999.5) {
|
|
||||||
n /= 1024
|
|
||||||
++i
|
|
||||||
}
|
|
||||||
return if (i < 0) "$size ${app.resources.getQuantityString(R.plurals.bytes, size.toInt())}"
|
|
||||||
else "${numberFormat.format(n)} ${units[i]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateRate(): Boolean {
|
fun updateRate(): Boolean {
|
||||||
val now = SystemClock.elapsedRealtime()
|
val now = SystemClock.elapsedRealtime()
|
||||||
val delta = now - timestampLast
|
val delta = now - timestampLast
|
||||||
|
|||||||
@@ -40,18 +40,14 @@ class TransproxyService : Service(), LocalDnsService.Interface {
|
|||||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int =
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int =
|
||||||
super<LocalDnsService.Interface>.onStartCommand(intent, flags, startId)
|
super<LocalDnsService.Interface>.onStartCommand(intent, flags, startId)
|
||||||
|
|
||||||
private var sstunnelProcess: GuardedProcess? = null
|
|
||||||
private var redsocksProcess: GuardedProcess? = null
|
|
||||||
|
|
||||||
private fun startDNSTunnel() {
|
private fun startDNSTunnel() {
|
||||||
val cmd = arrayListOf(File(applicationInfo.nativeLibraryDir, Executable.SS_TUNNEL).absolutePath,
|
data.processes.start(listOf(File(applicationInfo.nativeLibraryDir, Executable.SS_TUNNEL).absolutePath,
|
||||||
"-t", "10",
|
"-t", "10",
|
||||||
"-b", "127.0.0.1",
|
"-b", "127.0.0.1",
|
||||||
"-u",
|
"-u",
|
||||||
"-l", DataStore.portLocalDns.toString(), // ss-tunnel listens on the same port as overture
|
"-l", DataStore.portLocalDns.toString(), // ss-tunnel listens on the same port as overture
|
||||||
"-L", data.profile!!.remoteDns.split(",").first().trim() + ":53",
|
"-L", data.profile!!.remoteDns.split(",").first().trim() + ":53",
|
||||||
"-c", data.shadowsocksConfigFile!!.absolutePath) // config is already built by BaseService.Interface
|
"-c", data.shadowsocksConfigFile!!.absolutePath)) // config is already built by BaseService.Interface
|
||||||
sstunnelProcess = GuardedProcess(cmd).start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startRedsocksDaemon() {
|
private fun startRedsocksDaemon() {
|
||||||
@@ -70,10 +66,8 @@ redsocks {
|
|||||||
type = socks5;
|
type = socks5;
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
redsocksProcess = GuardedProcess(arrayListOf(
|
data.processes.start(listOf(
|
||||||
File(applicationInfo.nativeLibraryDir, Executable.REDSOCKS).absolutePath,
|
File(applicationInfo.nativeLibraryDir, Executable.REDSOCKS).absolutePath, "-c", "redsocks.conf"))
|
||||||
"-c", "redsocks.conf")
|
|
||||||
).start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun startNativeProcesses() {
|
override fun startNativeProcesses() {
|
||||||
@@ -81,12 +75,4 @@ redsocks {
|
|||||||
super.startNativeProcesses()
|
super.startNativeProcesses()
|
||||||
if (data.profile!!.udpdns) startDNSTunnel()
|
if (data.profile!!.udpdns) startDNSTunnel()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun killProcesses() {
|
|
||||||
super.killProcesses()
|
|
||||||
sstunnelProcess?.destroy()
|
|
||||||
sstunnelProcess = null
|
|
||||||
redsocksProcess?.destroy()
|
|
||||||
redsocksProcess = null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
|
|||||||
|
|
||||||
private var conn: ParcelFileDescriptor? = null
|
private var conn: ParcelFileDescriptor? = null
|
||||||
private var worker: ProtectWorker? = null
|
private var worker: ProtectWorker? = null
|
||||||
private var tun2socksProcess: GuardedProcess? = null
|
|
||||||
private var underlyingNetwork: Network? = null
|
private var underlyingNetwork: Network? = null
|
||||||
@TargetApi(28)
|
@TargetApi(28)
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -155,8 +154,6 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
|
|||||||
worker?.stopThread()
|
worker?.stopThread()
|
||||||
worker = null
|
worker = null
|
||||||
super.killProcesses()
|
super.killProcesses()
|
||||||
tun2socksProcess?.destroy()
|
|
||||||
tun2socksProcess = null
|
|
||||||
conn?.close()
|
conn?.close()
|
||||||
conn = null
|
conn = null
|
||||||
}
|
}
|
||||||
@@ -256,7 +253,7 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
|
|||||||
cmd += "--dnsgw"
|
cmd += "--dnsgw"
|
||||||
cmd += "127.0.0.1:${DataStore.portLocalDns}"
|
cmd += "127.0.0.1:${DataStore.portLocalDns}"
|
||||||
}
|
}
|
||||||
tun2socksProcess = GuardedProcess(cmd).start { sendFd(fd) }
|
data.processes.start(cmd) { sendFd(fd) }
|
||||||
return fd
|
return fd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:padding="16dp">
|
||||||
<Spinner android:id="@+id/template_selector"
|
<Spinner android:id="@+id/template_selector"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -20,10 +20,6 @@
|
|||||||
<string name="traffic">%s↑\t%s↓</string>
|
<string name="traffic">%s↑\t%s↓</string>
|
||||||
<string name="stat_summary">Sent: \t\t\t\t\t%3$s\t↑\t%1$s\nReceived: \t%4$s\t↓\t%2$s</string>
|
<string name="stat_summary">Sent: \t\t\t\t\t%3$s\t↑\t%1$s\nReceived: \t%4$s\t↓\t%2$s</string>
|
||||||
<string name="speed">%s/s</string>
|
<string name="speed">%s/s</string>
|
||||||
<plurals name="bytes">
|
|
||||||
<item quantity="one">Byte</item>
|
|
||||||
<item quantity="other">Bytes</item>
|
|
||||||
</plurals>
|
|
||||||
<string name="connection_test_pending">Check Connectivity</string>
|
<string name="connection_test_pending">Check Connectivity</string>
|
||||||
<string name="connection_test_testing">Testing…</string>
|
<string name="connection_test_testing">Testing…</string>
|
||||||
<string name="connection_test_available">Success: %dms latency</string>
|
<string name="connection_test_available">Success: %dms latency</string>
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="Theme.Translucent" parent="Theme.AppCompat.Dialog">
|
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
|
||||||
<item name="android:windowFrame">@null</item>
|
|
||||||
<item name="android:windowContentOverlay">@null</item>
|
|
||||||
<item name="android:windowAnimationStyle">@null</item>
|
|
||||||
<item name="android:backgroundDimEnabled">false</item>
|
|
||||||
<item name="android:windowIsTranslucent">true</item>
|
|
||||||
<item name="android:windowNoTitle">true</item>
|
|
||||||
<item name="android:windowCloseOnTouchOutside">false</item>
|
|
||||||
</style>
|
|
||||||
<style name="StyledScrollerTextAppearance" parent="@android:style/TextAppearance">
|
<style name="StyledScrollerTextAppearance" parent="@android:style/TextAppearance">
|
||||||
<item name="android:textSize">24sp</item>
|
<item name="android:textSize">24sp</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
* 0.1.1:
|
||||||
|
* Rewritten in Kotlin;
|
||||||
|
* Fix assert not working;
|
||||||
|
* Min API 21;
|
||||||
|
* Update support library version to 27.1.1.
|
||||||
* 0.0.4:
|
* 0.0.4:
|
||||||
* Enlarge text size of number pickers;
|
* Enlarge text size of number pickers;
|
||||||
* Update support library version to 26.0.0.
|
* Update support library version to 26.0.0.
|
||||||
|
|||||||
+2
-2
@@ -10,8 +10,8 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion rootProject.minSdkVersion
|
minSdkVersion rootProject.minSdkVersion
|
||||||
targetSdkVersion rootProject.sdkVersion
|
targetSdkVersion rootProject.sdkVersion
|
||||||
versionCode 5
|
versionCode 6
|
||||||
versionName "0.1.0"
|
versionName "0.1.1"
|
||||||
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -153,7 +153,8 @@ This corresponds to `com.github.shadowsocks.plugin.NativePluginProvider` in the
|
|||||||
...
|
...
|
||||||
<provider android:name=".BinaryProvider"
|
<provider android:name=".BinaryProvider"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:authorities="$FULLY_QUALIFIED_NAME_OF_YOUR_CONTENTPROVIDER">
|
android:authorities="$FULLY_QUALIFIED_NAME_OF_YOUR_CONTENTPROVIDER"
|
||||||
|
tools:ignore="ExportedContentProvider">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.github.shadowsocks.plugin.ACTION_NATIVE_PLUGIN"/>
|
<action android:name="com.github.shadowsocks.plugin.ACTION_NATIVE_PLUGIN"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|||||||
@@ -11,4 +11,15 @@
|
|||||||
<item name="preferenceCategory_marginBottom">8dp</item>
|
<item name="preferenceCategory_marginBottom">8dp</item>
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.Dialog">
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:windowFrame">@null</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<item name="android:windowAnimationStyle">@null</item>
|
||||||
|
<item name="android:backgroundDimEnabled">false</item>
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowCloseOnTouchOutside">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user