修复部分设备下闪退问题

修复部分设备下闪退问题
This commit is contained in:
zeus
2025-12-24 13:03:13 +08:00
parent 0dbfefdabe
commit 1a3fb8f70a
9 changed files with 91 additions and 5 deletions
@@ -0,0 +1,72 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.litevpn.fast",
"variantName": "metaRelease",
"elements": [
{
"type": "UNIVERSAL",
"filters": [],
"attributes": [],
"versionCode": 323001,
"versionName": "3.1.0",
"outputFile": "UUVPN-3.1.0-meta-universal-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86"
}
],
"attributes": [],
"versionCode": 323001,
"versionName": "3.1.0",
"outputFile": "UUVPN-3.1.0-meta-x86-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 323001,
"versionName": "3.1.0",
"outputFile": "UUVPN-3.1.0-meta-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 323001,
"versionName": "3.1.0",
"outputFile": "UUVPN-3.1.0-meta-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 323001,
"versionName": "3.1.0",
"outputFile": "UUVPN-3.1.0-meta-arm64-v8a-release.apk"
}
],
"elementType": "File"
}
@@ -241,6 +241,7 @@ class LoginActivity : AppCompatActivity() {
// Handle error response, even if it's 422
try {
val errorResponse = it?.errorBody()?.string() ?: ""
print(errorResponse)
val errorJson = JSONObject(errorResponse)
val message = errorJson.optString("message")
// Process the error message or show it to the user
@@ -80,7 +80,11 @@ class ClashService : BaseService() {
StaticNotificationModule.createNotificationChannel(this)
StaticNotificationModule.notifyLoadingNotification(this)
try {
StaticNotificationModule.notifyLoadingNotification(this)
} catch (e: SecurityException) {
Log.e("Failed to post loading notification: ${e.message}", e)
}
runtime.launch()
}
@@ -112,4 +116,4 @@ class ClashService : BaseService() {
runtime.requestGc()
}
}
}
@@ -5,6 +5,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import com.github.kr328.clash.common.constants.Permissions
import com.github.kr328.clash.common.log.Log
import kotlinx.coroutines.NonCancellable
@@ -44,9 +45,17 @@ abstract class Module<E>(val service: Service) {
}
if (requireSelf) {
service.registerReceiver(receiver, filter, Permissions.RECEIVE_SELF_BROADCASTS, null)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
service.registerReceiver(receiver, filter, Permissions.RECEIVE_SELF_BROADCASTS, null, Context.RECEIVER_EXPORTED)
} else {
service.registerReceiver(receiver, filter, Permissions.RECEIVE_SELF_BROADCASTS, null)
}
} else {
service.registerReceiver(receiver, filter)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
service.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED)
} else {
service.registerReceiver(receiver, filter)
}
}
receivers.add(receiver)
@@ -75,4 +84,4 @@ abstract class Module<E>(val service: Service) {
}
protected abstract suspend fun run()
}
}