6.6.2 - Alpha - 整合 ApkSigner 库源代码到本地
This commit is contained in:
@@ -200,18 +200,21 @@ dependencies /* Unclassified */ {
|
||||
|
||||
// Jieba Analysis (zh-CN: 结巴分词)
|
||||
// implementation("com.huaban:jieba-analysis:1.0.2")
|
||||
implementation(project(":jieba-analysis"))
|
||||
implementation(project(":modules:jieba-analysis"))
|
||||
|
||||
// Tiny Sign
|
||||
implementation(files("$rootDir/libs/tiny-sign-0.9.jar"))
|
||||
|
||||
// ApkSigner
|
||||
implementation("com.github.TimScriptov:apksigner:1.2.0")
|
||||
|
||||
// Room
|
||||
implementation("androidx.room:room-runtime:2.6.1")
|
||||
implementation("androidx.room:room-ktx:2.6.1")
|
||||
ksp("androidx.room:room-compiler:2.6.1")
|
||||
|
||||
// ApkSig
|
||||
// implementation("com.android.tools.build:apksig:8.7.3")
|
||||
|
||||
// ApkSigner
|
||||
implementation(project(":modules:apksigner"))
|
||||
}
|
||||
|
||||
dependencies /* MIME */ {
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.isVisible
|
||||
import com.afollestad.materialdialogs.DialogAction
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.android.apksig.ApkVerifier
|
||||
import com.jaredrummler.apkparser.ApkParser
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -193,6 +194,17 @@ object ApkInfoDialogManager {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getApkSignatureInfo(apkFilePath: String): String? = runCatching {
|
||||
ApkVerifier.Builder(File(apkFilePath)).build().verify().run {
|
||||
listOfNotNull(
|
||||
"V1".takeIf { isVerifiedUsingV1Scheme },
|
||||
"V2".takeIf { isVerifiedUsingV2Scheme },
|
||||
"V3".takeIf { isVerifiedUsingV3Scheme },
|
||||
"V4".takeIf { isVerifiedUsingV4Scheme },
|
||||
).takeUnless { it.isEmpty() }?.joinToString(" + ")
|
||||
}
|
||||
}.getOrNull()
|
||||
|
||||
private data class ApkInfo(
|
||||
val label: String?,
|
||||
val packageName: String?,
|
||||
|
||||
Reference in New Issue
Block a user