mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
Fix Dhizuku initialization error (#186)
This commit is contained in:
@@ -13,13 +13,8 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
object Privilege {
|
object Privilege {
|
||||||
fun initialize(context: Context) {
|
fun initialize(context: Context) {
|
||||||
if (SP.dhizuku) {
|
if (SP.dhizuku) {
|
||||||
Dhizuku.init(context)
|
if (Dhizuku.init(context)) try {
|
||||||
val hasPermission = try {
|
if (Dhizuku.isPermissionGranted()) {
|
||||||
Dhizuku.isPermissionGranted()
|
|
||||||
} catch(_: Exception) {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
if (hasPermission) {
|
|
||||||
val dhizukuDpm = binderWrapperDevicePolicyManager(context)
|
val dhizukuDpm = binderWrapperDevicePolicyManager(context)
|
||||||
if (dhizukuDpm != null) {
|
if (dhizukuDpm != null) {
|
||||||
DPM = dhizukuDpm
|
DPM = dhizukuDpm
|
||||||
@@ -28,6 +23,9 @@ object Privilege {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch(_: Exception) {
|
||||||
|
false
|
||||||
|
}
|
||||||
dhizukuErrorStatus.value = 2
|
dhizukuErrorStatus.value = 2
|
||||||
}
|
}
|
||||||
DPM = context.getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager
|
DPM = context.getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager
|
||||||
|
|||||||
Reference in New Issue
Block a user