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

Commit 952b686e authored by lijilou's avatar lijilou Committed by Anna Bauza
Browse files

UserManagerService:getUserDataLU method should called by mUsersLock

lock.

Bug: 335096825
Change-Id: I86b36197d3220fcf7db0c01645497a11d38e7285
parent 2ad6d539
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -1677,26 +1677,27 @@ public class UserManagerService extends IUserManager.Stub {
    public void setUserAdmin(@UserIdInt int userId) {
        checkManageUserAndAcrossUsersFullPermission("set user admin");
        mUserJourneyLogger.logUserJourneyBegin(userId, USER_JOURNEY_GRANT_ADMIN);
        UserInfo info;
        UserData user;
        synchronized (mPackagesLock) {
            synchronized (mUsersLock) {
                info = getUserInfoLU(userId);
            }
            if (info == null) {
                user = getUserDataLU(userId);
                if (user == null) {
                    // Exit if no user found with that id,
                    mUserJourneyLogger.logNullUserJourneyError(USER_JOURNEY_GRANT_ADMIN,
                        getCurrentUserId(), userId, /* userType */ "", /* userFlags */ -1);
                    return;
            } else if (info.isAdmin()) {
                } else if (user.info.isAdmin()) {
                    // Exit if the user is already an Admin.
                mUserJourneyLogger.logUserJourneyFinishWithError(getCurrentUserId(), info,
                        USER_JOURNEY_GRANT_ADMIN, ERROR_CODE_USER_ALREADY_AN_ADMIN);
                    mUserJourneyLogger.logUserJourneyFinishWithError(getCurrentUserId(),
                        user.info, USER_JOURNEY_GRANT_ADMIN,
                        ERROR_CODE_USER_ALREADY_AN_ADMIN);
                    return;
                }
            info.flags ^= UserInfo.FLAG_ADMIN;
            writeUserLP(getUserDataLU(info.id));
                user.info.flags ^= UserInfo.FLAG_ADMIN;
                writeUserLP(user);
            }
        mUserJourneyLogger.logUserJourneyFinishWithError(getCurrentUserId(), info,
        }
        mUserJourneyLogger.logUserJourneyFinishWithError(getCurrentUserId(), user.info,
                USER_JOURNEY_GRANT_ADMIN, ERROR_CODE_UNSPECIFIED);
    }