Compare commits
3 Commits
fix/system
...
feat/suppo
| Author | SHA1 | Date | |
|---|---|---|---|
| c74bec8bb0 | |||
| 7039e85744 | |||
| e4744e2c62 |
@ -156,7 +156,7 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
|
||||
callBack?.invoke(false)
|
||||
return
|
||||
}
|
||||
if (isXapk) {
|
||||
if (isXapk && !XapkInstaller.isSystemHasFlaw()) {
|
||||
val xapkUnzipVersions = Config.getSettings()?.permissionPopupAppliedVersions?.xapkUnzip
|
||||
if (xapkUnzipVersions?.contains(Build.VERSION.SDK_INT.toString()) == false) {
|
||||
callBack?.invoke(false)
|
||||
|
||||
@ -9,7 +9,6 @@ import android.provider.Settings
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.dialog.ManagerAllFilesPermissionDialogFragment
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.DownloadNotificationHelper
|
||||
import com.gh.common.util.PackageInstaller
|
||||
@ -279,6 +278,16 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统是否存在可以自由读写 `/Android/obb` 文件的漏洞
|
||||
*/
|
||||
fun isSystemHasFlaw(): Boolean {
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.TIRAMISU) return false
|
||||
|
||||
val rootPath = Environment.getExternalStorageDirectory().path
|
||||
return File(rootPath, "Android").list().contentEquals(File(rootPath, "\u200bAndroid").list())
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新当前XAPK安装状态, 主要针对以下出现安装结果回调异常的情况:
|
||||
* 1. 用户触碰安装弹窗(原生Android系统)区域外导致安装取消
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.gh.gamecenter.xapk.data
|
||||
|
||||
import android.os.Build
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import java.io.InputStream
|
||||
@ -34,8 +35,16 @@ data class XApkManifest(
|
||||
@SerializedName("install_location")
|
||||
val installLocation: String,
|
||||
@SerializedName("install_path")
|
||||
val installPath: String
|
||||
)
|
||||
private val _installPath: String,
|
||||
) {
|
||||
fun getInstallPath(): String {
|
||||
return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||
_installPath
|
||||
} else {
|
||||
_installPath.replace("Android", "\u200bAndroid")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class Apk(
|
||||
val file: String,
|
||||
|
||||
@ -38,7 +38,7 @@ class OBBDocOutput(
|
||||
}
|
||||
?.also { doc ->
|
||||
expansions.forEach { expansion ->
|
||||
expansion.installPath
|
||||
expansion.getInstallPath()
|
||||
.let {
|
||||
if (it.startsWith(ANDROID_OBB_SEGMENT)) {// 截取Android/obb后面的路径
|
||||
it.substring(ANDROID_OBB_SEGMENT.length + 1)
|
||||
|
||||
@ -21,7 +21,7 @@ class OBBFileOutput : XApkFileOutput<Unit> {
|
||||
for (expansion in expansions) {
|
||||
val file = File(
|
||||
Environment.getExternalStorageDirectory(),
|
||||
expansion.installPath
|
||||
expansion.getInstallPath()
|
||||
).apply {
|
||||
val parentFile = parentFile
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
|
||||
Reference in New Issue
Block a user