mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix(deps): Update shizuku to v13 (major) (#256)
* fix(deps): Update shizuku to v13 * fix: Use reflection to fix shizuku * docs: Sync changelog [skip ci] * fix: Ignore shizuku's minSdk We have desugaring enabled * fix: Missing import * fix: Move newProcess declaration --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jobobby04 <jobobby04@users.noreply.github.com> Co-authored-by: Ahmad Ansori Palembani <palembani@gmail.com>
This commit is contained in:
parent
fa0e565fa5
commit
5996a8a863
4 changed files with 13 additions and 4 deletions
|
@ -257,4 +257,7 @@
|
|||
|
||||
</application>
|
||||
|
||||
<uses-sdk tools:overrideLibrary="rikka.shizuku.api"
|
||||
tools:ignore="ManifestOrder" />
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -22,10 +22,12 @@ import kotlinx.coroutines.SupervisorJob
|
|||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.launch
|
||||
import rikka.shizuku.Shizuku
|
||||
import rikka.shizuku.ShizukuRemoteProcess
|
||||
import rikka.sui.Sui
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStream
|
||||
import java.lang.reflect.Method
|
||||
import java.util.*
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
|
@ -69,6 +71,8 @@ class ShizukuInstaller(private val context: Context, val finishedQueue: (Shizuku
|
|||
|
||||
var ready = false
|
||||
|
||||
private val newProcess: Method
|
||||
|
||||
init {
|
||||
Shizuku.addBinderDeadListener(shizukuDeadListener)
|
||||
require(Shizuku.pingBinder() && (context.isPackageInstalled(shizukuPkgName) || Sui.isSui())) {
|
||||
|
@ -82,6 +86,9 @@ class ShizukuInstaller(private val context: Context, val finishedQueue: (Shizuku
|
|||
Shizuku.requestPermission(SHIZUKU_PERMISSION_REQUEST_CODE)
|
||||
false
|
||||
}
|
||||
newProcess = Shizuku::class.java
|
||||
.getDeclaredMethod("newProcess", Array<out String>::class.java, Array<out String>::class.java, String::class.java)
|
||||
newProcess.isAccessible = true
|
||||
}
|
||||
|
||||
@Suppress("BlockingMethodInNonBlockingContext")
|
||||
|
@ -206,8 +213,7 @@ class ShizukuInstaller(private val context: Context, val finishedQueue: (Shizuku
|
|||
}
|
||||
|
||||
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) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue