Fix Shizuku connection
This commit is contained in:
parent
955606b51a
commit
ebb70a4d63
|
|
@ -12,19 +12,18 @@ const val TAG = "LSPatch Manager"
|
|||
class LSPApplication : Application() {
|
||||
|
||||
companion object {
|
||||
var shizukuAlive = false
|
||||
var shizukuBinderAvalable = false
|
||||
var shizukuGranted by mutableStateOf(false)
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Shizuku.addBinderReceivedListener {
|
||||
shizukuAlive = true
|
||||
init {
|
||||
Shizuku.addBinderReceivedListenerSticky {
|
||||
shizukuBinderAvalable = true
|
||||
shizukuGranted = Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
Shizuku.addBinderDeadListener {
|
||||
shizukuAlive = false
|
||||
shizukuBinderAvalable = false
|
||||
shizukuGranted = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ private fun ShizukuCard() {
|
|||
|
||||
ElevatedCard(
|
||||
modifier = Modifier.clickable {
|
||||
if (LSPApplication.shizukuAlive && !LSPApplication.shizukuGranted) {
|
||||
if (LSPApplication.shizukuBinderAvalable && !LSPApplication.shizukuGranted) {
|
||||
Shizuku.requestPermission(114514)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,13 +8,7 @@ android {
|
|||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
isDebuggable = true
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
release {
|
||||
isDebuggable = false
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
|
|
@ -25,10 +19,6 @@ android {
|
|||
path("src/main/jni/CMakeLists.txt")
|
||||
}
|
||||
}
|
||||
|
||||
lint {
|
||||
abortOnError = false
|
||||
}
|
||||
}
|
||||
|
||||
androidComponents.onVariants { variant ->
|
||||
|
|
|
|||
Loading…
Reference in New Issue