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

Commit a455691c authored by Rubin Xu's avatar Rubin Xu Committed by android-build-merger
Browse files

Small refactoring to eliminate the need to allocate array. am: faf9bdcd

am: ba192fbd

* commit 'ba192fbd':
  Small refactoring to eliminate the need to allocate array.
parents 2d155ee9 ba192fbd
Loading
Loading
Loading
Loading
+7 −13
Original line number Original line Diff line number Diff line
@@ -887,20 +887,14 @@ final class UserController {
    }
    }


    void updateUserSetupCompleteLocked(int userId) {
    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();
        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 =
                final boolean setupComplete =
                    Settings.Secure.getIntForUser(cr, USER_SETUP_COMPLETE, 0, users[i]) != 0;
                        Settings.Secure.getIntForUser(cr, USER_SETUP_COMPLETE, 0, startedUser) != 0;
            mSetupCompletedUsers.put(users[i], setupComplete);
                mSetupCompletedUsers.put(startedUser, setupComplete);
            }
        }
        }
    }
    }