diff --git a/app/src/app/java/io/legado/app/help/AppUpdateGitHub.kt b/app/src/app/java/io/legado/app/help/AppUpdateGitHub.kt index 3e8572993..8da8effca 100644 --- a/app/src/app/java/io/legado/app/help/AppUpdateGitHub.kt +++ b/app/src/app/java/io/legado/app/help/AppUpdateGitHub.kt @@ -1,5 +1,6 @@ package io.legado.app.help +import androidx.annotation.Keep import io.legado.app.R import io.legado.app.constant.AppConst import io.legado.app.exception.NoStackTraceException @@ -11,6 +12,7 @@ import io.legado.app.utils.readString import kotlinx.coroutines.CoroutineScope import splitties.init.appCtx +@Keep @Suppress("unused") object AppUpdateGitHub: AppUpdate.AppUpdateInterface { diff --git a/app/src/app/java/io/legado/app/lib/cronet/AbsCallBack.kt b/app/src/app/java/io/legado/app/lib/cronet/AbsCallBack.kt index 073970dfe..31897d3c0 100644 --- a/app/src/app/java/io/legado/app/lib/cronet/AbsCallBack.kt +++ b/app/src/app/java/io/legado/app/lib/cronet/AbsCallBack.kt @@ -1,5 +1,6 @@ package io.legado.app.lib.cronet +import androidx.annotation.Keep import io.legado.app.help.http.okHttpClient import io.legado.app.utils.DebugLog import io.legado.app.utils.asIOException @@ -15,6 +16,7 @@ import java.io.IOException import java.nio.ByteBuffer import java.util.* +@Keep abstract class AbsCallBack( val originalRequest: Request, val mCall: Call, diff --git a/app/src/app/java/io/legado/app/lib/cronet/BodyUploadProvider.kt b/app/src/app/java/io/legado/app/lib/cronet/BodyUploadProvider.kt index c8daf38d3..e62838369 100644 --- a/app/src/app/java/io/legado/app/lib/cronet/BodyUploadProvider.kt +++ b/app/src/app/java/io/legado/app/lib/cronet/BodyUploadProvider.kt @@ -1,5 +1,6 @@ package io.legado.app.lib.cronet +import androidx.annotation.Keep import okhttp3.RequestBody import okio.Buffer import org.chromium.net.UploadDataProvider @@ -7,6 +8,7 @@ import org.chromium.net.UploadDataSink import java.io.IOException import java.nio.ByteBuffer +@Keep class BodyUploadProvider(private val body: RequestBody) : UploadDataProvider(), AutoCloseable { private val buffer = Buffer() diff --git a/app/src/app/java/io/legado/app/lib/cronet/CronetCoroutineInterceptor.kt b/app/src/app/java/io/legado/app/lib/cronet/CronetCoroutineInterceptor.kt index 8701f4c11..5bef442f4 100644 --- a/app/src/app/java/io/legado/app/lib/cronet/CronetCoroutineInterceptor.kt +++ b/app/src/app/java/io/legado/app/lib/cronet/CronetCoroutineInterceptor.kt @@ -1,5 +1,6 @@ package io.legado.app.lib.cronet +import androidx.annotation.Keep import io.legado.app.help.http.cookieJar import io.legado.app.utils.printOnDebug import kotlinx.coroutines.runBlocking @@ -13,6 +14,7 @@ import java.io.IOException import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException +@Keep @Suppress("unused") class CronetCoroutineInterceptor : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { diff --git a/app/src/app/java/io/legado/app/lib/cronet/CronetHelper.kt b/app/src/app/java/io/legado/app/lib/cronet/CronetHelper.kt index 7493a17de..b66b1347f 100644 --- a/app/src/app/java/io/legado/app/lib/cronet/CronetHelper.kt +++ b/app/src/app/java/io/legado/app/lib/cronet/CronetHelper.kt @@ -1,5 +1,8 @@ +@file:Keep + package io.legado.app.lib.cronet +import androidx.annotation.Keep import io.legado.app.constant.AppLog import io.legado.app.help.config.AppConfig import io.legado.app.help.http.okHttpClient @@ -13,7 +16,6 @@ import org.chromium.net.UrlRequest import org.json.JSONObject import splitties.init.appCtx - val cronetEngine: ExperimentalCronetEngine? by lazy { if (!AppConfig.isGooglePlay) { CronetLoader.preDownload() diff --git a/app/src/app/java/io/legado/app/lib/cronet/CronetInterceptor.kt b/app/src/app/java/io/legado/app/lib/cronet/CronetInterceptor.kt index 1d3c7076e..494e46674 100644 --- a/app/src/app/java/io/legado/app/lib/cronet/CronetInterceptor.kt +++ b/app/src/app/java/io/legado/app/lib/cronet/CronetInterceptor.kt @@ -1,13 +1,14 @@ package io.legado.app.lib.cronet import android.os.Build +import androidx.annotation.Keep import io.legado.app.help.http.cookieJar import io.legado.app.utils.printOnDebug import okhttp3.* import okhttp3.internal.http.receiveHeaders import java.io.IOException - +@Keep @Suppress("unused") class CronetInterceptor : Interceptor { @Throws(IOException::class) diff --git a/app/src/app/java/io/legado/app/lib/cronet/CronetLoader.kt b/app/src/app/java/io/legado/app/lib/cronet/CronetLoader.kt index feebe84e1..c87442491 100644 --- a/app/src/app/java/io/legado/app/lib/cronet/CronetLoader.kt +++ b/app/src/app/java/io/legado/app/lib/cronet/CronetLoader.kt @@ -5,6 +5,7 @@ import android.content.Context import android.content.pm.ApplicationInfo import android.os.Build import android.text.TextUtils +import androidx.annotation.Keep import io.legado.app.BuildConfig import io.legado.app.help.config.AppConfig import io.legado.app.help.coroutine.Coroutine @@ -23,7 +24,7 @@ import java.net.URL import java.security.MessageDigest import java.util.* - +@Keep 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 diff --git a/app/src/app/java/io/legado/app/lib/cronet/NewCallBack.kt b/app/src/app/java/io/legado/app/lib/cronet/NewCallBack.kt index 67c518945..06929584b 100644 --- a/app/src/app/java/io/legado/app/lib/cronet/NewCallBack.kt +++ b/app/src/app/java/io/legado/app/lib/cronet/NewCallBack.kt @@ -1,7 +1,7 @@ package io.legado.app.lib.cronet - import android.os.Build +import androidx.annotation.Keep import androidx.annotation.RequiresApi import okhttp3.Call import okhttp3.Request @@ -11,6 +11,7 @@ import java.io.IOException import java.util.concurrent.CompletableFuture import java.util.concurrent.TimeUnit +@Keep @RequiresApi(api = Build.VERSION_CODES.N) class NewCallBack(originalRequest: Request, mCall: Call) : AbsCallBack(originalRequest, mCall) { private val responseFuture = CompletableFuture() diff --git a/app/src/app/java/io/legado/app/lib/cronet/OldCallback.kt b/app/src/app/java/io/legado/app/lib/cronet/OldCallback.kt index c39888403..9cfd277f4 100644 --- a/app/src/app/java/io/legado/app/lib/cronet/OldCallback.kt +++ b/app/src/app/java/io/legado/app/lib/cronet/OldCallback.kt @@ -1,12 +1,14 @@ package io.legado.app.lib.cronet import android.os.ConditionVariable +import androidx.annotation.Keep import okhttp3.Call import okhttp3.Request import okhttp3.Response import org.chromium.net.UrlRequest import java.io.IOException +@Keep class OldCallback(originalRequest: Request, mCall: Call) : AbsCallBack(originalRequest, mCall) { private val mResponseCondition = ConditionVariable()