Compare commits

...

2 Commits

Author SHA1 Message Date
Jobobby04 a443629234 Fix reflection 2024-10-27 14:07:28 -04:00
Jobobby04 3de4711e03 Try this Shizuku fix 2024-10-27 13:34:33 -04:00
2 changed files with 8 additions and 3 deletions
@@ -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<out String>::class.java, Array<out String>::class.java, String::class.java)
newProcess.isAccessible = true
} }
} }
+1 -1
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"