mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-22 21:01:33 +00:00
Wait for root service to bind
This commit is contained in:
parent
37b81ad1f6
commit
78a444d601
@ -111,15 +111,23 @@ class RootUtils(stub: Any?) : RootService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun await() {
|
fun await() {
|
||||||
// We cannot await on the main thread
|
if (!Info.isRooted)
|
||||||
if (Info.isRooted && !ShellUtils.onMainThread())
|
return
|
||||||
|
if (!ShellUtils.onMainThread()) {
|
||||||
acquireSharedInterruptibly(1)
|
acquireSharedInterruptibly(1)
|
||||||
|
} else if (state != 0) {
|
||||||
|
throw IllegalStateException("Cannot await on the main thread")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
var bindTask: Shell.Task? = null
|
var bindTask: Shell.Task? = null
|
||||||
var fs = FileSystemManager.getLocal()
|
var fs: FileSystemManager = FileSystemManager.getLocal()
|
||||||
|
get() {
|
||||||
|
Connection.await()
|
||||||
|
return field
|
||||||
|
}
|
||||||
private set
|
private set
|
||||||
var obj: IRootUtils? = null
|
var obj: IRootUtils? = null
|
||||||
get() {
|
get() {
|
||||||
|
@ -35,7 +35,7 @@ class ModuleViewModel : AsyncLoadViewModel() {
|
|||||||
var loading = true
|
var loading = true
|
||||||
private set(value) = set(value, field, { field = it }, BR.loading)
|
private set(value) = set(value, field, { field = it }, BR.loading)
|
||||||
|
|
||||||
init {
|
private suspend fun init() = withContext(Dispatchers.IO) {
|
||||||
if (Info.env.isActive && LocalModule.loaded()) {
|
if (Info.env.isActive && LocalModule.loaded()) {
|
||||||
items.insertItem(InstallModule)
|
items.insertItem(InstallModule)
|
||||||
.insertList(itemsInstalled)
|
.insertList(itemsInstalled)
|
||||||
@ -44,6 +44,9 @@ class ModuleViewModel : AsyncLoadViewModel() {
|
|||||||
|
|
||||||
override suspend fun doLoadWork() {
|
override suspend fun doLoadWork() {
|
||||||
loading = true
|
loading = true
|
||||||
|
if (items.isEmpty()) {
|
||||||
|
init()
|
||||||
|
}
|
||||||
loadInstalled()
|
loadInstalled()
|
||||||
loading = false
|
loading = false
|
||||||
loadUpdateInfo()
|
loadUpdateInfo()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user