Skip to content

Commit

Permalink
Try this Shizuku fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jobobby04 committed Oct 27, 2024
1 parent 106f63a commit 3de4711
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import logcat.LogPriority
import rikka.shizuku.Shizuku
import rikka.shizuku.ShizukuRemoteProcess
import tachiyomi.core.common.util.system.logcat
import tachiyomi.i18n.MR
import java.io.BufferedReader
import java.io.InputStream
import java.lang.reflect.Method

class ShizukuInstaller(private val service: Service) : Installer(service) {

Expand Down Expand Up @@ -93,9 +95,9 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
super.onDestroy()
}

private val newProcess: Method
private fun exec(command: String, stdin: InputStream? = null): ShellResult {
@Suppress("DEPRECATION")
val process = Shizuku.newProcess(arrayOf("sh", "-c", command), null, null)
val process = newProcess.invoke(null, arrayOf("sh", "-c", command), null, null) as ShizukuRemoteProcess
if (stdin != null) {
process.outputStream.use { stdin.copyTo(it) }
}
Expand All @@ -122,6 +124,9 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
service.stopSelf()
false
}
newProcess = Shizuku::class.java
.getDeclaredMethod("newProcess", Array::class.java, Array::class.java, String::class.java)
newProcess.isAccessible = 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 @@ -4,7 +4,7 @@ leakcanary = "2.14"
moko = "0.24.2"
okhttp_version = "5.0.0-alpha.14"
richtext = "0.20.0"
shizuku_version = "13.1.0"
shizuku_version = "13.1.5"
sqldelight = "2.0.2"
sqlite = "2.4.0"
voyager = "1.0.0"
Expand Down

0 comments on commit 3de4711

Please sign in to comment.