0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-25 20:55:12 +00:00

minor adjustments to root split installer

This commit is contained in:
X1nto 2021-02-22 20:41:34 +04:00
parent 18b79aace8
commit 64fd410d43

View file

@ -299,13 +299,11 @@ object PackageHelper {
private fun installSplitApkFilesRoot(apkFiles: List<File>?, context: Context) : Boolean {
val filenames = arrayOf("black.apk", "dark.apk", "blue.apk", "pink.apk", "hash.json")
log(INSTALLER_TAG, "installing split apk files: ${apkFiles?.map { it.name }}")
val sessionId = Shell.su("pm install-create -r -t").exec().out.joinToString(" ").filter { it.isDigit() }.toInt()
apkFiles?.forEach { apkFile ->
if (!filenames.any { apkFile.name == it }) {
val sessionId = Shell.su("pm install-create").exec().out.joinToString(" ").filter { it.isDigit() }.toInt()
apkFiles?.filter { !filenames.contains(it.name) }?.forEach { apkFile ->
val apkName = apkFile.name
log(INSTALLER_TAG, "installing APK: $apkName")
val newPath = "/data/local/tmp/$apkName"
// Moving apk to avoid permission denials
Shell.su("mv ${apkFile.path} $newPath").exec()
val command = Shell.su("pm install-write $sessionId $apkName $newPath").exec()
@ -316,7 +314,6 @@ object PackageHelper {
return false
}
}
}
log(INSTALLER_TAG, "committing...")
val installResult = Shell.su("pm install-commit $sessionId").exec()
if (installResult.isSuccess) {