mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-26 05:05:15 +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,13 +299,11 @@ 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
|
// Moving apk to avoid permission denials
|
||||||
Shell.su("mv ${apkFile.path} $newPath").exec()
|
Shell.su("mv ${apkFile.path} $newPath").exec()
|
||||||
val command = Shell.su("pm install-write $sessionId $apkName $newPath").exec()
|
val command = Shell.su("pm install-write $sessionId $apkName $newPath").exec()
|
||||||
|
@ -316,7 +314,6 @@ object PackageHelper {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
log(INSTALLER_TAG, "committing...")
|
log(INSTALLER_TAG, "committing...")
|
||||||
val installResult = Shell.su("pm install-commit $sessionId").exec()
|
val installResult = Shell.su("pm install-commit $sessionId").exec()
|
||||||
if (installResult.isSuccess) {
|
if (installResult.isSuccess) {
|
||||||
|
|
Loading…
Reference in a new issue