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

Commit 10178629 authored by Felipe Leme's avatar Felipe Leme
Browse files

Improved logs on UMS.removeUserWithProfilesUnchecked()

Test: adb logcat UserManagerService *:s # while removing current user
Bug: 408021585
Flag: EXEMPT logging changes only

Change-Id: I497ecc76d0283b9919ba7dd1f22c1093d27b6297
parent 0d451afe
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -6824,11 +6824,12 @@ public class UserManagerService extends IUserManager.Stub {
        if (!isProfile) {
            Pair<Integer, Integer> currentAndTargetUserIds = getCurrentAndTargetUserIds();
            if (userId == currentAndTargetUserIds.first) {
                Slog.w(LOG_TAG, "Current user cannot be removed.");
                Slogf.w(LOG_TAG, "Current user (%d) cannot be removed.", userId);
                return false;
            }
            if (userId == currentAndTargetUserIds.second) {
                Slog.w(LOG_TAG, "Target user of an ongoing user switch cannot be removed.");
                Slogf.w(LOG_TAG, "Target user (%d) of an ongoing user switch (from user %d) cannot "
                        + "be removed.", userId, currentAndTargetUserIds.first);
                return false;
            }
            for (int i = profileIds.size() - 1; i >= 0; i--) {
@@ -6837,16 +6838,16 @@ public class UserManagerService extends IUserManager.Stub {
                    //Remove the associated profiles first and then remove the user
                    continue;
                }
                Slog.i(LOG_TAG, "removing profile:" + profileId
                        + " associated with user:" + userId);
                Slogf.i(LOG_TAG, "removing profile: %d associated with user: %d",
                        profileId, userId);
                if (!removeUserUnchecked(profileId)) {
                    // If the profile was not immediately removed, make sure it is marked as
                    // ephemeral. Don't mark as disabled since, per UserInfo.FLAG_DISABLED
                    // documentation, an ephemeral user should only be marked as disabled
                    // when its removal is in progress.
                    Slog.i(LOG_TAG, "Unable to immediately remove profile " + profileId
                            + "associated with user " + userId + ". User is set as ephemeral "
                            + "and will be removed on user switch or reboot.");
                    Slogf.i(LOG_TAG, "Unable to immediately remove profile %d associated with user "
                            + "%d. User is set as ephemeral and will be removed on user switch or "
                            + "reboot.", profileId, userId);
                    synchronized (mPackagesLock) {
                        UserData profileData = getUserDataNoChecks(userId);
                        profileData.info.flags |= UserInfo.FLAG_EPHEMERAL;