A managed profile or work profile is an Android user with additional special properties around management and visual aesthetic.
The primary goal of a managed profile is to create a segregated and secure space for managed data (such as corporate data) to reside. The administrator of the profile has full control over scope, ingress, and egress of data as well as its lifetime. These policies offer great powers and therefore fall upon the managed profile instead of the device administrator.
Managed profiles use the following data segregation rules.
Applications are scoped with their own segregated data when the same app exists in the primary user and managed profile. Generally, applications act independently of one another and cannot communicate directly with one another across the profile-user boundary.
Accounts in the managed profile are distinctly unique from the primary user. There is no way to access credentials across the profile-user boundary. Only apps in their respective context are able to access their respective accounts.
The administrator controls whether intents are resolved in/out of managed profile or not. Applications from the managed profile are default scoped to stay within the managed profile exception of the Device Policy API.
Enforcement of settings is generally scoped to the managed profile, with exceptions for lockscreen and encryption settings that are still scoped to the device and shared between the primary user and managed profile. Otherwise, a profile owner does not have any device administrator privileges outside the managed profile.
Managed profiles are implemented as a new kind of secondary user, such that:
uid = 100000 * userid + appid
They have separate app data like regular users:
/data/user/<userid>
The UserId is calculated for all system requests using
Binder.getCallingUid()
, and all system state and responses are
separated by userId. You may consider instead using
Binder.getCallingUserHandle
rather than getCallingUid
to avoid confusion between uid and userId.
The AccountManagerService maintains a separate list of accounts for each user. The main differences between a managed profile and a regular secondary user are as follows:
Android device administration includes the following types of device administrators for enterprises:
The majority of the new device administrator APIs added for Android 5.0 are available only to profile or device owners. Traditional device administrators remain but are applicable to the simpler consumer-only case (e.g., find my device).
A Device Policy Client (DPC) app typically functions as the profile owner. The DPC app is typically provided by an enterprise mobility management (EMM) partner, such as Google Apps Device Policy.
The profile owner app creates a managed profile on the device by sending the
ACTION_PROVISION_MANAGED_PROFILE
intent. This profile is
distinguished by the appearance of badged instances of
apps, as well as personal instances. That badge, or Android device
administration icon, identifies which apps are work apps.
The EMM has control only over the managed profile (not personal space) with some exceptions, such as enforcing the lock screen.
The device owner can be set only in an unprovisioned device:
Device owners can conduct some tasks profile owners cannot, such as:
setGlobalSetting
setLockTaskPackages
(the ability to whitelist packages that
can pin themselves to the foreground)DISALLOW_MOUNT_PHYSICAL_MEDIA
(FALSE
by
default). When TRUE
, physical media, both portable and adoptable,
cannot be mounted.Android 5.0 and higher offers a greatly improved DevicePolicyManager with dozens of new APIs to support both corporate-owned and bring your own device (BYOD) administration use cases. Examples include app restrictions, silent installation of certificates, and cross-profile sharing intent access control. Use the sample Device Policy Client (DPC) app BasicManagedProfile.apk as a starting point. For details, refer to Building a Work Policy Controller.