Try this Shizuku fix

This commit is contained in:
Jobobby04 2024-10-27 13:34:33 -04:00
parent 106f63a657
commit 3de4711e03
2 changed files with 8 additions and 3 deletions

View File

@ -14,10 +14,12 @@ import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import logcat.LogPriority import logcat.LogPriority
import rikka.shizuku.Shizuku import rikka.shizuku.Shizuku
import rikka.shizuku.ShizukuRemoteProcess
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import java.io.BufferedReader import java.io.BufferedReader
import java.io.InputStream import java.io.InputStream
import java.lang.reflect.Method
class ShizukuInstaller(private val service: Service) : Installer(service) { class ShizukuInstaller(private val service: Service) : Installer(service) {
@ -93,9 +95,9 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
super.onDestroy() super.onDestroy()
} }
private val newProcess: Method
private fun exec(command: String, stdin: InputStream? = null): ShellResult { private fun exec(command: String, stdin: InputStream? = null): ShellResult {
@Suppress("DEPRECATION") val process = newProcess.invoke(null, arrayOf("sh", "-c", command), null, null) as ShizukuRemoteProcess
val process = Shizuku.newProcess(arrayOf("sh", "-c", command), null, null)
if (stdin != null) { if (stdin != null) {
process.outputStream.use { stdin.copyTo(it) } process.outputStream.use { stdin.copyTo(it) }
} }
@ -122,6 +124,9 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
service.stopSelf() service.stopSelf()
false false
} }
newProcess = Shizuku::class.java
.getDeclaredMethod("newProcess", Array::class.java, Array::class.java, String::class.java)
newProcess.isAccessible = true
} }
} }

View File

@ -4,7 +4,7 @@ leakcanary = "2.14"
moko = "0.24.2" moko = "0.24.2"
okhttp_version = "5.0.0-alpha.14" okhttp_version = "5.0.0-alpha.14"
richtext = "0.20.0" richtext = "0.20.0"
shizuku_version = "13.1.0" shizuku_version = "13.1.5"
sqldelight = "2.0.2" sqldelight = "2.0.2"
sqlite = "2.4.0" sqlite = "2.4.0"
voyager = "1.0.0" voyager = "1.0.0"