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:
renovate[bot] 2024-11-20 14:02:15 +07:00 committed by GitHub
parent fa0e565fa5
commit 5996a8a863
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 4 deletions

View file

@ -58,7 +58,7 @@ The format is simplified version of [Keep a Changelog](https://keepachangelog.co
- Update dependency gradle to v8.10.2
- Update dependency androidx.webkit:webkit to v1.12.0
- Update dependency io.mockk:mockk to v1.13.13
- Update shizuku to v12.2.0
- Update shizuku to v13.1.5
- Bump comple sdk to 35
- Update kotlin monorepo to v2.0.21
- Update dependency androidx.work:work-runtime-ktx to v2.10.0

View file

@ -257,4 +257,7 @@
</application>
<uses-sdk tools:overrideLibrary="rikka.shizuku.api"
tools:ignore="ManifestOrder" />
</manifest>

View file

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

View file

@ -5,7 +5,7 @@ flexible-adapter = "c8013533"
fast_adapter = "5.6.0"
moko = "0.24.2"
okhttp = "5.0.0-alpha.14"
shizuku = "12.2.0"
shizuku = "13.1.5"
# FIXME: Uncomment once SQLDelight support KMP AndroidX SQLiteDriver
#sqlite = "2.5.0-alpha04"
sqlite = "2.4.0"