Update user restriction APIs to be called on parent instance
In the new COPE mode, some user restrictions should be applied globally
when called by the Work Profile PO.
Previously, the APIs addUserRestriction, clearUserRestriction and
getUserRestrictions did not support explicitly querying the parent
profile. This CL allows the WP DPC to now call these methods,
allowing the WP DPC to apply some restrictions globally.
This CL also introduces the enforcingUserId parameter to
setDevicePolicyUserRestriction. This new paramter is used as the
key of mDevicePolicyGlobalUserRestrictions and
mDevicePolicyLocalUserRestrictions.
Bug: 138709470
Test: Manual testing with testdpc
atest com.android.server.devicepolicy.DevicePolicyManagerTest
atest com.android.cts.devicepolicy.UserRestrictionsTest
atest com.android.server.pm.UserRestrictionsUtilsTest
atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testUserRestrictionsSetOnParentAreNotPersisted
atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testDevicePolicyManagerParentSupport
Change-Id: Idfafd100bfcb250998a8628aba4cc378f1fc2c84
7 files changed