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

Commit f574cf56 authored by Tony Mak's avatar Tony Mak Committed by Android (Google) Code Review
Browse files

Merge "setProfileEnabled should be no-op when the profile is already enabled"

parents cee65700 bd4148bb
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -6083,7 +6083,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
            final int userId = UserHandle.getCallingUserId();
            enforceManagedProfile(userId, "enable the profile");

            // Check if the profile is already enabled.
            UserInfo managedProfile = getUserInfo(userId);
            if (managedProfile.isEnabled()) {
                Slog.e(LOG_TAG,
                        "setProfileEnabled is called when the profile is already enabled");
                return;
            }
            long id = mInjector.binderClearCallingIdentity();
            try {
                mUserManager.setUserEnabled(userId);