DevicePolicyManager.GetUserRestrictions(ComponentName) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Called by an admin to get user restrictions set by themselves with
#addUserRestriction(ComponentName, String)
.
[Android.Runtime.Register("getUserRestrictions", "(Landroid/content/ComponentName;)Landroid/os/Bundle;", "GetGetUserRestrictions_Landroid_content_ComponentName_Handler", ApiSince=24)]
public virtual Android.OS.Bundle GetUserRestrictions (Android.Content.ComponentName admin);
[<Android.Runtime.Register("getUserRestrictions", "(Landroid/content/ComponentName;)Landroid/os/Bundle;", "GetGetUserRestrictions_Landroid_content_ComponentName_Handler", ApiSince=24)>]
abstract member GetUserRestrictions : Android.Content.ComponentName -> Android.OS.Bundle
override this.GetUserRestrictions : Android.Content.ComponentName -> Android.OS.Bundle
Parameters
- admin
- ComponentName
Which DeviceAdminReceiver
this request is associated with.
Returns
a Bundle
whose keys are the user restrictions, and the values a
boolean
indicating whether the restriction is set.
- Attributes
Remarks
Called by an admin to get user restrictions set by themselves with #addUserRestriction(ComponentName, String)
.
The target user may have more restrictions set by the system or other admin. To get all the user restrictions currently set, use UserManager#getUserRestrictions()
.
The profile owner of an organization-owned managed profile may invoke this method on the DevicePolicyManager
instance it obtained from #getParentProfileInstance(ComponentName)
, for retrieving device-wide restrictions it previously set with #addUserRestriction(ComponentName, String)
.
For callers targeting Android android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE
or above, this API will return the local restrictions set on the calling user, or on the parent profile if called from the DevicePolicyManager
instance obtained from #getParentProfileInstance(ComponentName)
. To get global restrictions set by admin, call #getUserRestrictionsGlobally()
instead.
Note that this is different that the returned restrictions for callers targeting pre Android android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE
, were this API returns all local/global restrictions set by the admin on the calling user using #addUserRestriction(ComponentName, String)
or the parent user if called on the DevicePolicyManager
instance it obtained from #getParentProfileInstance
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.