Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [4.0.2-dev.2](https://github.com/ReVanced/revanced-library/compare/v4.0.2-dev.1...v4.0.2-dev.2) (2026-04-09)


### Performance Improvements

* Build patched DEX files and resources before opening APK for writing to reduce memory usage on one spot ([369eb03](https://github.com/ReVanced/revanced-library/commit/369eb0392f539187dce0b0c246d5ca72e0d80c99))

## [4.0.2-dev.1](https://github.com/ReVanced/revanced-library/compare/v4.0.1...v4.0.2-dev.1) (2026-04-04)


### Bug Fixes

* Ensure stdout/stderr is captured to avoid empty command output ([#117](https://github.com/ReVanced/revanced-library/issues/117)) ([429a5f0](https://github.com/ReVanced/revanced-library/commit/429a5f0adb50d88ddcc450e5e22e25063ddad067))

## [4.0.1](https://github.com/ReVanced/revanced-library/compare/v4.0.0...v4.0.1) (2026-02-25)


Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 4.0.1
version = 4.0.2-dev.2
#Gradle
org.gradle.jvmargs = -Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options="-Xmx2048M"
org.gradle.caching = true
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jadb = "1.2.1.1"
kotlin = "2.3.10"
kotlinx-coroutines = "1.10.2"
kotlinx-serialization = "1.10.0"
libsu = "5.2.2"
libsu = "6.0.0"
revanced-patcher = "22.0.0"
bouncy-castle = "1.83"
sigstore = "2.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,19 @@ class LocalShellCommandRunner internal constructor(
RootService.bind(intent, this)
}

override fun runCommand(command: String) = shell.newJob().add(command).exec().let {
object : RunResult {
override val exitCode = it.code
override val output by lazy { it.out.joinToString("\n") }
override val error by lazy { it.err.joinToString("\n") }
override fun runCommand(command: String): RunResult {
val stdout = mutableListOf<String>()
val stderr = mutableListOf<String>()
val result = shell.newJob().add(command).to(stdout, stderr).exec()

return object : RunResult {
override val exitCode = result.code
override val output: String by lazy {
stdout.joinToString("\n")
}
override val error: String by lazy {
stderr.joinToString("\n")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ object ApkUtils {
* @param apkFile The file to apply the patched files to.
*/
fun PatchesResult.applyTo(apkFile: File) {
// Resolve before opening the APK file, since these are lazy properties and require some memory.
val dexFiles = dexFiles
val resources = resources

ZFile.openReadWrite(apkFile, zFileOptions).use { targetApkZFile ->
dexFiles.forEach { dexFile ->
targetApkZFile.add(dexFile.name, dexFile.stream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ abstract class RootInstaller internal constructor(
/**
* Runs a command on the device.
*/
protected operator fun String.invoke() = shellCommandRunner("su -c \'$this\'")
protected operator fun String.invoke() = shellCommandRunner(this)

/**
* Moves the given file to the given [targetFilePath].
Expand All @@ -127,7 +127,7 @@ abstract class RootInstaller internal constructor(
}
}

internal class FailedToFindInstalledPackageException internal constructor(packageName: String) : Exception("Failed to find installed package \"$packageName\" because no activity was found")
internal class FailedToFindInstalledPackageException internal constructor(packageName: String) : Exception("Failed to resolve installed APK path for package \"$packageName\"")

internal class PackageNameRequiredException internal constructor() : Exception("Package name is required")
internal class NoRootPermissionException internal constructor() : Exception("No root permission")
Expand Down
Loading