fix: installApk 验证 cp 复制成功且文件大小 > 0 再加入安装列表

This commit is contained in:
sakuradairong
2026-06-08 16:26:21 +08:00
parent bd5f4b92ab
commit fbf3f9d179

View File

@@ -173,8 +173,12 @@ object RestoreOperation {
for (name in apkFiltered) {
val src = File(appDir, name)
val dst = File(installDir, name)
RootShell.exec("cp '${src.absolutePath.shellEscape()}' '${dst.absolutePath.shellEscape()}' && chmod 644 '${dst.absolutePath.shellEscape()}'")
localApks.add(dst)
val copyResult = RootShell.exec("cp '${src.absolutePath.shellEscape()}' '${dst.absolutePath.shellEscape()}' && chmod 644 '${dst.absolutePath.shellEscape()}'")
if (copyResult.isSuccess && BackupOperation.backupPathExists(dst) && BackupOperation.backupFileSize(dst) > 0L) {
localApks.add(dst)
} else {
Log.w(TAG, "installApk: failed to copy APK ${name}, skipping")
}
}
suspend fun doInstall(): Boolean {