|
@@ -1,4 +1,4 @@
|
|
|
-package io.legado.app.help.http.cronet
|
|
|
|
|
|
|
+package io.legado.app.lib.cronet
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
import android.annotation.SuppressLint
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
@@ -8,6 +8,7 @@ import android.text.TextUtils
|
|
|
import io.legado.app.BuildConfig
|
|
import io.legado.app.BuildConfig
|
|
|
import io.legado.app.help.config.AppConfig
|
|
import io.legado.app.help.config.AppConfig
|
|
|
import io.legado.app.help.coroutine.Coroutine
|
|
import io.legado.app.help.coroutine.Coroutine
|
|
|
|
|
+import io.legado.app.help.http.cronet.CronetLoaderInterface
|
|
|
import io.legado.app.utils.DebugLog
|
|
import io.legado.app.utils.DebugLog
|
|
|
import io.legado.app.utils.printOnDebug
|
|
import io.legado.app.utils.printOnDebug
|
|
|
|
|
|
|
@@ -23,7 +24,7 @@ import java.security.MessageDigest
|
|
|
import java.util.*
|
|
import java.util.*
|
|
|
|
|
|
|
|
|
|
|
|
|
-object CronetLoader : CronetEngine.Builder.LibraryLoader() {
|
|
|
|
|
|
|
+object CronetLoader : CronetEngine.Builder.LibraryLoader(), CronetLoaderInterface {
|
|
|
//https://storage.googleapis.com/chromium-cronet/android/92.0.4515.159/Release/cronet/libs/arm64-v8a/libcronet.92.0.4515.159.so
|
|
//https://storage.googleapis.com/chromium-cronet/android/92.0.4515.159/Release/cronet/libs/arm64-v8a/libcronet.92.0.4515.159.so
|
|
|
|
|
|
|
|
private const val soVersion = BuildConfig.Cronet_Version
|
|
private const val soVersion = BuildConfig.Cronet_Version
|
|
@@ -55,7 +56,7 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader() {
|
|
|
/**
|
|
/**
|
|
|
* 判断Cronet是否安装完成
|
|
* 判断Cronet是否安装完成
|
|
|
*/
|
|
*/
|
|
|
- fun install(): Boolean {
|
|
|
|
|
|
|
+ override fun install(): Boolean {
|
|
|
synchronized(this) {
|
|
synchronized(this) {
|
|
|
if (cacheInstall) {
|
|
if (cacheInstall) {
|
|
|
return true
|
|
return true
|
|
@@ -77,7 +78,7 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader() {
|
|
|
/**
|
|
/**
|
|
|
* 预加载Cronet
|
|
* 预加载Cronet
|
|
|
*/
|
|
*/
|
|
|
- fun preDownload() {
|
|
|
|
|
|
|
+ override fun preDownload() {
|
|
|
if (AppConfig.isGooglePlay) {
|
|
if (AppConfig.isGooglePlay) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -288,7 +289,7 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader() {
|
|
|
cacheInstall = false
|
|
cacheInstall = false
|
|
|
val parentFile = downloadTempFile.parentFile
|
|
val parentFile = downloadTempFile.parentFile
|
|
|
@Suppress("SameParameterValue")
|
|
@Suppress("SameParameterValue")
|
|
|
- deleteHistoryFile(parentFile!!, null)
|
|
|
|
|
|
|
+ (deleteHistoryFile(parentFile!!, null))
|
|
|
}
|
|
}
|
|
|
// executor.execute {
|
|
// executor.execute {
|
|
|
//
|
|
//
|