From 3dea1c7972ba350716b2f9b95de95ed4b2f3ea90 Mon Sep 17 00:00:00 2001 From: Suprabh Shukla Date: Fri, 17 Feb 2017 16:09:47 -0800 Subject: [PATCH] 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 --- .../android/server/devicepolicy/DevicePolicyManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 16b926aa4d7bd..776bb6fe9f444 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -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) {