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