|
|
@@ -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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|