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

Commit 79ed3b79 authored by Felipe Leme's avatar Felipe Leme
Browse files

Improved UMS getEarliestCreatedFullUser() and onPullAtom()

They're calling getUsers with resolveNullNames=false, which avoid
extra object allocation.

Test: no, thanks
Bug: 407597096
Flag: EXEMPT refactor

Change-Id: I502f0b037e2d44ec6c90e7736a2950bc0dbfa221
parent 200ec468
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -5003,11 +5003,9 @@ public class UserManagerService extends IUserManager.Stub {

    /** Returns the oldest Full Admin user, or null is if there none. */
    private @Nullable UserInfo getEarliestCreatedFullUser() {
        // TODO(b/407597096): it could call with resolveNullNames=false, but that method was added
        // in a "pure refactoring" CL
        final List<UserInfo> users = getUsersInternal(/* excludePartial= */ true,
        List<UserInfo> users = getUsersInternal(/* excludePartial= */ true,
                /* excludeDying= */ true, /* excludePreCreated= */ true,
                /* resolveNullNames= */ true);
                /* resolveNullNames= */ false);
        UserInfo earliestUser = null;
        long earliestCreationTime = Long.MAX_VALUE;
        for (int i = 0; i < users.size(); i++) {
@@ -6281,11 +6279,9 @@ public class UserManagerService extends IUserManager.Stub {
    /** Writes a UserInfo pulled atom for each user on the device. */
    private int onPullAtom(int atomTag, List<StatsEvent> data) {
        if (atomTag == FrameworkStatsLog.USER_INFO) {
            // TODO(b/407597096): it could call with resolveNullNames=false, but that method was
            // added in a "pure refactoring" CL
            final List<UserInfo> users = getUsersInternal(/* excludePartial= */ true,
                    /* excludeDying= */ true, /* excludePreCreated= */ true,
                    /* resolveNullNames= */ true);
                    /* resolveNullNames= */ false);
            final int size = users.size();
            if (size > 1) {
                for (int idx = 0; idx < size; idx++) {