Use mAddressMap in cdm getAssociationsByAddress
This CL leverages the mAddressMap which was specifically introduces for the kind of address-based lookup that is needed in the getAssociationsByAddress method. Test: atest CtsCompanionDeviceManagerCoreTestCases Test: atest CtsCompanionDeviceManagerUiAutomationTestCases Change-Id: Ifb00e184bd491e2385214b7c89d64da33dc36ee3
This commit is contained in:
@@ -213,11 +213,9 @@ class AssociationStoreImpl implements AssociationStore {
|
||||
final Set<Integer> ids = mAddressMap.get(address);
|
||||
if (ids == null) return Collections.emptyList();
|
||||
|
||||
final List<AssociationInfo> associations = new ArrayList<>();
|
||||
for (AssociationInfo association : mIdMap.values()) {
|
||||
if (address.equals(association.getDeviceMacAddress())) {
|
||||
associations.add(association);
|
||||
}
|
||||
final List<AssociationInfo> associations = new ArrayList<>(ids.size());
|
||||
for (Integer id : ids) {
|
||||
associations.add(mIdMap.get(id));
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(associations);
|
||||
|
||||
Reference in New Issue
Block a user