mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-22 11:15:10 +00:00
minor adjustments to root split installer
This commit is contained in:
parent
18b79aace8
commit
64fd410d43
1 changed files with 13 additions and 16 deletions
|
@ -299,22 +299,19 @@ object PackageHelper {
|
||||||
private fun installSplitApkFilesRoot(apkFiles: List<File>?, context: Context) : Boolean {
|
private fun installSplitApkFilesRoot(apkFiles: List<File>?, context: Context) : Boolean {
|
||||||
val filenames = arrayOf("black.apk", "dark.apk", "blue.apk", "pink.apk", "hash.json")
|
val filenames = arrayOf("black.apk", "dark.apk", "blue.apk", "pink.apk", "hash.json")
|
||||||
log(INSTALLER_TAG, "installing split apk files: ${apkFiles?.map { it.name }}")
|
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()
|
val sessionId = Shell.su("pm install-create").exec().out.joinToString(" ").filter { it.isDigit() }.toInt()
|
||||||
apkFiles?.forEach { apkFile ->
|
apkFiles?.filter { !filenames.contains(it.name) }?.forEach { apkFile ->
|
||||||
if (!filenames.any { apkFile.name == it }) {
|
val apkName = apkFile.name
|
||||||
val apkName = apkFile.name
|
log(INSTALLER_TAG, "installing APK: $apkName")
|
||||||
log(INSTALLER_TAG, "installing APK: $apkName")
|
val newPath = "/data/local/tmp/$apkName"
|
||||||
val newPath = "/data/local/tmp/$apkName"
|
// Moving apk to avoid permission denials
|
||||||
|
Shell.su("mv ${apkFile.path} $newPath").exec()
|
||||||
// Moving apk to avoid permission denials
|
val command = Shell.su("pm install-write $sessionId $apkName $newPath").exec()
|
||||||
Shell.su("mv ${apkFile.path} $newPath").exec()
|
Shell.su("rm $newPath").exec()
|
||||||
val command = Shell.su("pm install-write $sessionId $apkName $newPath").exec()
|
if (!command.isSuccess) {
|
||||||
Shell.su("rm $newPath").exec()
|
sendFailure(command.out, context)
|
||||||
if (!command.isSuccess) {
|
sendCloseDialog(context)
|
||||||
sendFailure(command.out, context)
|
return false
|
||||||
sendCloseDialog(context)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log(INSTALLER_TAG, "committing...")
|
log(INSTALLER_TAG, "committing...")
|
||||||
|
|
Loading…
Reference in a new issue