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