private boolean hasProfileOwnerOrDeviceOwnerOnCurrentUser ( ) { DevicePolicyManager devicePolicyManager = ( DevicePolicyManager ) context . getSystemService ( Context . DEVICE_POLICY_SERVICE ) ; return devicePolicyManager . getProfileOwner ( ) != null || ( UserHandle . of ( UserHandle . myUserId ( ) ) . isSystem ( ) && devicePolicyManager . getDeviceOwner ( ) != null ) ; }
Returns whether the current user profile has a profile owner or a device owner .