Disable provisioning in COMP mode

Restrict adding a managed profile when the device has a device owner.

This mode is no longer supported, in favour of Corporate Owned,
Personally Enabled mode (Organization-Owned device with Managed Profile).

The restriction on adding managed profiles is now added by default when
a device owner is set, and is removed when the device owner is removed,
to avoid other system copoments from creating a managed profile when
there's a device owner.

Additionally, the method for checking whether pre-provisioning
conditions are met has been modified to return an error if the
restriction is set.

Bug: 145271440
Test: atest FrameworksServicesTests:DevicePolicyManagerTest

Change-Id: Ife25f4e2faffe84d85ab7786407c14997b4cf069
3 files changed