diff --git a/app/src/main/java/com/vanced/manager/core/installer/RootSplitInstallerService.kt b/app/src/main/java/com/vanced/manager/core/installer/RootSplitInstallerService.kt index a16c909b..b1bac8be 100644 --- a/app/src/main/java/com/vanced/manager/core/installer/RootSplitInstallerService.kt +++ b/app/src/main/java/com/vanced/manager/core/installer/RootSplitInstallerService.kt @@ -86,20 +86,16 @@ class RootSplitInstallerService: Service() { sendBroadcast(Intent(HomeFragment.VANCED_INSTALLED)) } } - else - { - sendFailure(listOf("Install Failed").toMutableList(), applicationContext) - } } else { - sendFailure(listOf("modApk Is Null Missing (dark.apk/black.apk) In apks Folder").toMutableList(), applicationContext) + sendFailure(listOf("ModApk_Missing").toMutableList(), applicationContext) } //installSplitApkFiles(fileInfoList) } else { - sendFailure(listOf("Files are missing, Failed Download?").toMutableList(), applicationContext) + sendFailure(listOf("Files_Missing_VA").toMutableList(), applicationContext) } } @@ -224,7 +220,7 @@ class RootSplitInstallerService: Service() { } else { - sendFailure(listOf("Download Went Corrupt, Retry or clear VanM Data").toMutableList(), applicationContext) + sendFailure(listOf("Corrupt_Data").toMutableList(), applicationContext) } @@ -298,7 +294,7 @@ class RootSplitInstallerService: Service() { { return installSplitApkFiles(apkFiles) } - with(localBroadcastManager) {sendFailure(listOf("Failed Uninstall Of Installed Version, Try Manually").toMutableList(), applicationContext)} + with(localBroadcastManager) {sendFailure(listOf("Failed_Uninstall").toMutableList(), applicationContext)} return false } @@ -342,7 +338,7 @@ class RootSplitInstallerService: Service() { return if(Shell.su("chown system:system $path").exec().isSuccess) { true } else { - sendFailure(listOf("Failed To Chown, Try Again").toMutableList(), applicationContext) + sendFailure(listOf("Chown_Fail").toMutableList(), applicationContext) false } @@ -354,7 +350,7 @@ class RootSplitInstallerService: Service() { } } else { - sendFailure(listOf("Input File Missing").toMutableList(), applicationContext) + sendFailure(listOf("IFile_Missing").toMutableList(), applicationContext) return false } } @@ -379,20 +375,19 @@ class RootSplitInstallerService: Service() { private fun checkSHA256(sha256: String, updateFile: File?): Boolean { try { - // get the raw file data of the photo val mInputPFD = contentResolver.openFileDescriptor(updateFile!!.toUri() , "r") val mContentFileDescriptor = mInputPFD!!.fileDescriptor val fIS = FileInputStream(mContentFileDescriptor) - val mGraphicBuffer = ByteArrayOutputStream() + val dataBuffer = ByteArrayOutputStream() val buf = ByteArray(1024) while (true) { val readNum = fIS.read(buf) if (readNum == -1) break - mGraphicBuffer.write(buf, 0, readNum) + dataBuffer.write(buf, 0, readNum) } // Generate the checksum - val sum = generateChecksum(mGraphicBuffer) + val sum = generateChecksum(dataBuffer) return sum == sha256 } catch (e: Exception) { diff --git a/app/src/main/java/com/vanced/manager/utils/AppUtils.kt b/app/src/main/java/com/vanced/manager/utils/AppUtils.kt index 277463b4..5e5b61b7 100644 --- a/app/src/main/java/com/vanced/manager/utils/AppUtils.kt +++ b/app/src/main/java/com/vanced/manager/utils/AppUtils.kt @@ -39,6 +39,12 @@ object AppUtils { status.contains("INSTALL_FAILED_INVALID_APK") -> context.getString(R.string.installation_invalid) status.contains("INSTALL_FAILED_VERSION_DOWNGRADE") -> context.getString(R.string.installation_downgrade) status.contains("INSTALL_PARSE_FAILED_NO_CERTIFICATES") -> context.getString(R.string.installation_signature) + status.contains("Failed_Uninstall") -> "Failed Uninstall Of Installed Version, Try Manually" + status.contains("Chown_Fail") -> "Failed To Chown, Try Again" + status.contains("IFile_Missing") -> "Input File Missing" + status.contains("ModApk_Missing") -> "modApk Is Null Missing (dark.apk/black.apk) In apks Folder" + status.contains("Files_Missing_VA") -> "Files are missing, Failed Download?" + status.contains("Corrupt_Data") -> "Download Went Corrupt, Retry or clear VanM Data" else -> if (MiuiHelper.isMiui()) context.getString(R.string.installation_miui)