This commit is contained in:
Horis 2024-06-27 20:33:10 +08:00
parent 636c369351
commit c2b0c200fb
2 changed files with 9 additions and 0 deletions

View File

@ -36,7 +36,9 @@ import io.legado.app.utils.ChineseUtils
import io.legado.app.utils.LogUtils
import io.legado.app.utils.defaultSharedPreferences
import io.legado.app.utils.getPrefBoolean
import io.legado.app.utils.isDebuggable
import kotlinx.coroutines.launch
import org.chromium.base.ThreadUtils
import splitties.init.appCtx
import splitties.systemservices.notificationManager
import java.net.URL
@ -51,6 +53,9 @@ class App : Application() {
super.onCreate()
LogUtils.d("App", "onCreate")
LogUtils.logDeviceInfo()
if (isDebuggable) {
ThreadUtils.setThreadAssertsDisabledForTesting(true)
}
oldConfig = Configuration(resources.configuration)
CrashHandler(this)
//预下载Cronet so

View File

@ -17,6 +17,7 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.SharedPreferences
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.content.res.Configuration
@ -384,3 +385,6 @@ val Context.channel: String
}
return ""
}
val Context.isDebuggable: Boolean
get() = applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0