Removing unnecessary call to ArraySet#toArray

Iterating over ArraySet using iterators is still more efficient than
first calling ArraySet#toArray and then iterating over the array.

Test: Minor optimization. make and existing tests should suffice.

Change-Id: Ifc282bfca98cf89b047dddddd78a6de020f27381
This commit is contained in:
Suprabh Shukla
2017-02-17 16:09:47 -08:00
parent 2e7d6d64b9
commit 3dea1c7972

View File

@@ -2893,7 +2893,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
private void ensureUnknownSourcesRestrictionForProfileOwners() {
synchronized (this) {
for (int userId : mOwners.getProfileOwnerKeys().toArray(new Integer[0])) {
for (int userId : mOwners.getProfileOwnerKeys()) {
if (!mUserManager.isManagedProfile(userId) ||
Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.UNKNOWN_SOURCES_DEFAULT_REVERSED, 0, userId) == 0) {