Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afcd70ee authored by Eran Messeri's avatar Eran Messeri
Browse files

Prevent use of Enrollment-specific Id on parent

Throw if the caller is trying to call methods related to
Enrollment-specific ID on the parent DevicePolicyManager instance.

This fixes ManagedProfileTest#testParentProfileApiDisabled

Bug: 177439350
Bug: 168627890
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.ManagedProfileTest#testParentProfileApiDisabled
Change-Id: I06610249021639f9319835d28c681bc0cb3d3887
parent 9c21de18
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12847,6 +12847,7 @@ public class DevicePolicyManager {
     * @throws SecurityException if the caller is not a profile owner or device owner.
     */
    @NonNull public String getEnrollmentSpecificId() {
        throwIfParentInstance("getEnrollmentSpecificId");
        if (mService == null) {
            return "";
        }
@@ -12869,6 +12870,7 @@ public class DevicePolicyManager {
     *                     enrolled into.
     */
    public void setOrganizationId(@NonNull String enterpriseId) {
        throwIfParentInstance("setOrganizationId");
        setOrganizationIdForUser(mContext.getPackageName(), enterpriseId, myUserId());
    }