mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
hide some entries if permission is not enough
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.bintianqi.owndroid.dpm
|
||||
|
||||
import android.app.admin.DevicePolicyManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.os.Build.VERSION
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@@ -16,3 +18,7 @@ fun isDeviceOwner(dpm: DevicePolicyManager): Boolean {
|
||||
fun isProfileOwner(dpm: DevicePolicyManager): Boolean {
|
||||
return dpm.isProfileOwnerApp("com.bintianqi.owndroid")
|
||||
}
|
||||
|
||||
fun DevicePolicyManager.isOrgProfile(receiver: ComponentName):Boolean {
|
||||
return VERSION.SDK_INT >= 30 && isProfileOwner(this) && isManagedProfile(receiver) && isOrganizationOwnedDeviceWithManagedProfile
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user