Skip to content

Commit

Permalink
fix: some issue on android 12
Browse files Browse the repository at this point in the history
  • Loading branch information
HMBSbige committed Aug 16, 2022
1 parent afe775a commit bfeaf99
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ android {
}

kotlinOptions.jvmTarget = javaVersion
packagingOptions {
jniLibs {
excludes += ['**/*.kotlin_*']
}
resources {
excludes += ['**/*.kotlin_*']
}
}

packagingOptions.exclude '**/*.kotlin_*'
}

dependencies {
Expand All @@ -40,11 +47,11 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.evernote:android-job:1.4.2'
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'com.github.devv911:android-job:1.4.5'
implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation "com.github.clans:fab:1.6.4"
implementation "com.github.jorgecastilloprz:fabprogresscircle:1.01"
implementation "com.google.android.gms:play-services-analytics:17.0.1"
implementation 'com.google.android.gms:play-services-analytics:18.0.1'
implementation 'com.j256.ormlite:ormlite-android:5.6'
implementation 'com.mikepenz:iconics-core:5.3.0'
implementation 'com.mikepenz:materialdrawer:8.4.3'
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,5 @@

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
</manifest>
17 changes: 14 additions & 3 deletions app/src/main/java/com/bige0/shadowsocksr/GuardedProcess.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,26 @@ class GuardedProcess(private val cmd: List<String>)
}
}
}

}
}
catch (ignored: Exception)
{
VayLog.i(TAG, "thread interrupt, destroy process: $cmd")
if (process != null)

if (process == null)
{
return
}

if (process!!.javaClass.name.equals("java.lang.UNIXProcess"))
{
val fPid = process!!.javaClass.getDeclaredField("pid").apply { isAccessible = true }
val pid = fPid.getInt(process)
android.os.Process.killProcess(pid)
}
else
{
process!!.destroy()
process!!.destroy() // wtf??? not work >= android S
}
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.google.android.gms.analytics.*
import com.google.android.gms.common.api.*
import com.google.android.gms.tagmanager.*
import com.j256.ormlite.logger.*
import com.j256.ormlite.logger.Logger
import java.io.*
import java.util.*
import java.util.concurrent.*
Expand Down Expand Up @@ -85,7 +84,7 @@ class ShadowsocksApplication : Application()
fun track(t: Throwable)
{
val builders = HitBuilders.ExceptionBuilder()
.setDescription(StandardExceptionParser(this, null).getDescription(Thread.currentThread().name, t))
.setDescription(StandardExceptionParser(this, emptyList()).getDescription(Thread.currentThread().name, t))
.setFatal(false)
.build()
tracker.send(builders)
Expand Down Expand Up @@ -221,11 +220,11 @@ class ShadowsocksApplication : Application()
container.registerFunctionCallMacroCallback(SIG_FUNC) { functionName, _ ->
if (SIG_FUNC == functionName)
{
Utils.getSignature(applicationContext)
Utils.getSignature(applicationContext) ?: ""
}
else
{
null
""
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
buildscript {
ext {
javaVersion = JavaVersion.VERSION_1_8
kotlinVersion = '1.6.10'
kotlinVersion = '1.7.10'
minSdkVersion = 21
sdkVersion = 31
compileSdkVersion = 31
Expand All @@ -13,10 +13,9 @@ buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -28,7 +27,8 @@ allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://jitpack.io' }
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip

3 comments on commit bfeaf99

@110560
Copy link

@110560 110560 commented on bfeaf99 Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnePlus 8T
Android 版本11

版本号
Hydrogen OS 11.0.12.12KB05

型号 KB2000
开关打开之后无法用

@110560
Copy link

@110560 110560 commented on bfeaf99 Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIUI 测试正常。

@Ikongsing
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

安卓12绝大部分时候连不上,有假连现象,使用国内wifi全局模式,查询ip网页打不开,连接断不开得问题依然存在,3.7版本貌似可以上网,但是连接好像也有问题

Please sign in to comment.