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

Commit bd4148bb authored by Tony Mak's avatar Tony Mak
Browse files

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

Just printing log if we encounter this situation, we may consider to
throw exception if we provide API to check is profile enabled later.

Bug: 29069975

Change-Id: I819be0f97b038dbdd6c6cea81c42ff73be60027b
parent 0239f4d1
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);