Share via


DevicePolicyManager.SetCrossProfilePackages Method

Definition

Sets the set of admin-allowlisted package names that are allowed to request user consent for cross-profile communication.

[Android.Runtime.Register("setCrossProfilePackages", "(Landroid/content/ComponentName;Ljava/util/Set;)V", "GetSetCrossProfilePackages_Landroid_content_ComponentName_Ljava_util_Set_Handler", ApiSince=30)]
public virtual void SetCrossProfilePackages (Android.Content.ComponentName admin, System.Collections.Generic.ICollection<string> packageNames);
[<Android.Runtime.Register("setCrossProfilePackages", "(Landroid/content/ComponentName;Ljava/util/Set;)V", "GetSetCrossProfilePackages_Landroid_content_ComponentName_Ljava_util_Set_Handler", ApiSince=30)>]
abstract member SetCrossProfilePackages : Android.Content.ComponentName * System.Collections.Generic.ICollection<string> -> unit
override this.SetCrossProfilePackages : Android.Content.ComponentName * System.Collections.Generic.ICollection<string> -> unit

Parameters

admin
ComponentName

the DeviceAdminReceiver this request is associated with

packageNames
ICollection<String>

the new cross-profile package names

Attributes

Remarks

Sets the set of admin-allowlisted package names that are allowed to request user consent for cross-profile communication.

Assumes that the caller is a profile owner and is the given admin.

Previous calls are overridden by each subsequent call to this method.

Note that other apps may be able to request user consent for cross-profile communication if they have been explicitly allowlisted by the OEM.

When previously-set cross-profile packages are missing from packageNames, the app-op for INTERACT_ACROSS_PROFILES will be reset for those packages. This will not occur for packages that are allowlisted by the OEM.

Java documentation for android.app.admin.DevicePolicyManager.setCrossProfilePackages(android.content.ComponentName, java.util.Set<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