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

Commit eb841fc3 authored by Ayush Sharma's avatar Ayush Sharma
Browse files

Avoid hardcoding SYSTEM_USER to support HSUM

In case of headless system user mode, first human user would not be
SYSTEM_USER(user 0), so avoid harcoding for SYSTEM_USER.

Bug: 265281464
Test: atest android.devicepolicy.cts.ManagedSubscriptionsPolicyTest
Change-Id: I261867048a2a5b44d19ba5b34537b8d5201e4534
parent 89945f54
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22741,9 +22741,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                "This policy can only be set by a profile owner on an organization-owned "
                        + "device.");
        int parentUserId = getProfileParentId(caller.getUserId());
        synchronized (getLockObject()) {
            final ActiveAdmin admin = getProfileOwnerLocked(caller.getUserId());
            if (hasUserSetupCompleted(UserHandle.USER_SYSTEM) && !isAdminTestOnlyLocked(
            if (hasUserSetupCompleted(parentUserId) && !isAdminTestOnlyLocked(
                    admin.info.getComponent(), caller.getUserId())) {
                throw new IllegalStateException("Not allowed to apply this policy after setup");
            }
@@ -22765,7 +22766,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        if (policyType == ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS) {
            final long id = mInjector.binderClearCallingIdentity();
            try {
                int parentUserId = getProfileParentId(caller.getUserId());
                installOemDefaultDialerAndSmsApp(caller.getUserId());
                updateTelephonyCrossProfileIntentFilters(parentUserId, caller.getUserId(), true);
            } finally {