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

Commit faf9bdcd authored by Rubin Xu's avatar Rubin Xu
Browse files

Small refactoring to eliminate the need to allocate array.

Change-Id: Ib08a16e40c342b12e4f7106376f46d6279f29f2b
parent 4531e2df
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -887,20 +887,14 @@ final class UserController {
    }

    void updateUserSetupCompleteLocked(int userId) {
        int[] users;
        if (userId != UserHandle.USER_ALL) {
            users = new int[] {userId};
        } else {
            users = new int[mStartedUsers.size()];
            for (int i = mStartedUsers.size() - 1; i >= 0; i--) {
                users[i] = mStartedUsers.keyAt(i);
            }
        }
        final ContentResolver cr = mService.mContext.getContentResolver();
        for (int i = 0; i < users.length; i++) {
        for (int i = mStartedUsers.size() - 1; i >= 0; i--) {
            int startedUser = mStartedUsers.keyAt(i);
            if (startedUser == userId || userId == UserHandle.USER_ALL) {
                final boolean setupComplete =
                    Settings.Secure.getIntForUser(cr, USER_SETUP_COMPLETE, 0, users[i]) != 0;
            mSetupCompletedUsers.put(users[i], setupComplete);
                        Settings.Secure.getIntForUser(cr, USER_SETUP_COMPLETE, 0, startedUser) != 0;
                mSetupCompletedUsers.put(startedUser, setupComplete);
            }
        }
    }