Freigeben über


DevicePolicyManager.SetUserControlDisabledPackages Method

Definition

Called by a device owner or a profile owner or holder of the permission android.Manifest.permission#MANAGE_DEVICE_POLICY_APPS_CONTROL to disable user control over apps.

[Android.Runtime.Register("setUserControlDisabledPackages", "(Landroid/content/ComponentName;Ljava/util/List;)V", "GetSetUserControlDisabledPackages_Landroid_content_ComponentName_Ljava_util_List_Handler", ApiSince=30)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_APPS_CONTROL")]
public virtual void SetUserControlDisabledPackages (Android.Content.ComponentName? admin, System.Collections.Generic.IList<string> packages);
[<Android.Runtime.Register("setUserControlDisabledPackages", "(Landroid/content/ComponentName;Ljava/util/List;)V", "GetSetUserControlDisabledPackages_Landroid_content_ComponentName_Ljava_util_List_Handler", ApiSince=30)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_APPS_CONTROL")>]
abstract member SetUserControlDisabledPackages : Android.Content.ComponentName * System.Collections.Generic.IList<string> -> unit
override this.SetUserControlDisabledPackages : Android.Content.ComponentName * System.Collections.Generic.IList<string> -> unit

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Null if the caller is not a device admin.

packages
IList<String>

The package names for the apps.

Attributes

Remarks

Called by a device owner or a profile owner or holder of the permission android.Manifest.permission#MANAGE_DEVICE_POLICY_APPS_CONTROL to disable user control over apps. User will not be able to clear app data or force-stop packages. When called by a device owner, applies to all users on the device. Packages with user control disabled are exempted from App Standby Buckets.

Starting from Build.VERSION_CODES#UPSIDE_DOWN_CAKE, after the user control disabled packages policy has been set, PolicyUpdateReceiver#onPolicySetResult(Context, String, Bundle, TargetUser, PolicyUpdateResult) will notify the admin on whether the policy was successfully set or not. This callback will contain: <ul> <li> The policy identifier DevicePolicyIdentifiers#USER_CONTROL_DISABLED_PACKAGES_POLICY<li> The TargetUser that this policy relates to <li> The PolicyUpdateResult, which will be PolicyUpdateResult#RESULT_POLICY_SET if the policy was successfully set or the reason the policy failed to be set (e.g. PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY) </ul> If there has been a change to the policy, PolicyUpdateReceiver#onPolicyChanged(Context, String, Bundle, TargetUser, PolicyUpdateResult) will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the PolicyUpdateResult will contain the reason why the policy changed.

Java documentation for android.app.admin.DevicePolicyManager.setUserControlDisabledPackages(android.content.ComponentName, java.util.List<java.lang.String>).

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.

Applies to