0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-16 07:45:06 +00:00

added a check for session id in root installer

This commit is contained in:
X1nto 2021-03-07 21:59:52 +04:00
parent 85e2d0c5c2
commit f7d90b7c59

View file

@ -299,10 +299,17 @@ 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")
log(INSTALLER_TAG, "installing split apk files: ${apkFiles?.map { it.name }}")
val sessionId = Shell.su("pm install-create -r").exec().out.joinToString(" ").filter { it.isDigit() }.toInt()
val sessionId = Shell.su("pm install-create -r").exec().out.joinToString(" ").filter { it.isDigit() }.toIntOrNull()
if (sessionId == null) {
sendFailure("Session ID is null", context)
sendCloseDialog(context)
return false
}
apkFiles?.filter { !filenames.contains(it.name) }?.forEach { apkFile ->
val apkName = apkFile.name
log(INSTALLER_TAG, "installing APK: $apkName")