Rename getAllInterfaceOffloadServiceInfos to notifyOffloadStart
This renaming is to align the DiscoveryManager design and reflect its real usage. Bug: 410734687 Test: atest ConnectivityCoverageTests NsdManagerTest Flag: EXEMPT rename method only Change-Id: I0d198aa0752ef51353e4164b612b6ff268ace16a
This commit is contained in:
parent
f1ae69a950
commit
20556631d8
3 changed files with 9 additions and 8 deletions
|
|
@ -2242,7 +2242,7 @@ public class NsdService extends INsdManager.Stub {
|
|||
final String targetInterface = offloadEngineInfo.mInterfaceName;
|
||||
final IOffloadEngine offloadEngine = offloadEngineInfo.mOffloadEngine;
|
||||
final List<MdnsAdvertiser.OffloadServiceInfoWrapper> offloadWrappers =
|
||||
mAdvertiser.getAllInterfaceOffloadServiceInfos(targetInterface);
|
||||
mAdvertiser.notifyOffloadStart(targetInterface);
|
||||
for (MdnsAdvertiser.OffloadServiceInfoWrapper wrapper : offloadWrappers) {
|
||||
try {
|
||||
offloadEngine.onOffloadServiceUpdated(wrapper.mOffloadServiceInfo);
|
||||
|
|
|
|||
|
|
@ -153,13 +153,14 @@ public class MdnsAdvertiser {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the current status of the OffloadServiceInfos per interface.
|
||||
* Notifies the Advertiser that an offload operation is starting for a specific network
|
||||
* interface.
|
||||
*
|
||||
* @param interfaceName the target interfaceName
|
||||
* @return the list of current offloaded services.
|
||||
*/
|
||||
@NonNull
|
||||
public List<OffloadServiceInfoWrapper> getAllInterfaceOffloadServiceInfos(
|
||||
@NonNull String interfaceName) {
|
||||
public List<OffloadServiceInfoWrapper> notifyOffloadStart(@NonNull String interfaceName) {
|
||||
return mInterfaceOffloadServices.getOrDefault(interfaceName, Collections.emptyList());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2127,7 +2127,7 @@ public class NsdServiceTest {
|
|||
"Android.local", new byte[] { 0x1, 0x2, 0x3 }, 1 /* priority */,
|
||||
OFFLOAD_TYPE_REPLY);
|
||||
doReturn(List.of(new MdnsAdvertiser.OffloadServiceInfoWrapper(123, advertingInfo)))
|
||||
.when(mAdvertiser).getAllInterfaceOffloadServiceInfos(interfaceName);
|
||||
.when(mAdvertiser).notifyOffloadStart(interfaceName);
|
||||
final FilterRepliesInfo filerRepliesInfo = new FilterRepliesInfo(
|
||||
"_testService", "_testType", List.of("_sub1", "_sub2"), "Android.local");
|
||||
final OffloadServiceInfo discoveryInfo =
|
||||
|
|
@ -2137,7 +2137,7 @@ public class NsdServiceTest {
|
|||
final OffloadEngine offloadEngine = registerOffloadEngine(interfaceName);
|
||||
// Verify that the OffloadServiceInfo retrieves from the advertiser and discoveryManager and
|
||||
// then sends it to the OffloadEngine.
|
||||
verify(mAdvertiser).getAllInterfaceOffloadServiceInfos(interfaceName);
|
||||
verify(mAdvertiser).notifyOffloadStart(interfaceName);
|
||||
verify(mDiscoveryManager).notifyOffloadStart(eq(interfaceName));
|
||||
verify(offloadEngine).onOffloadServiceUpdated(advertingInfo);
|
||||
verify(offloadEngine).onOffloadServiceUpdated(discoveryInfo);
|
||||
|
|
@ -2165,11 +2165,11 @@ public class NsdServiceTest {
|
|||
"Android.local", new byte[] { 0x1, 0x2, 0x3 }, 1 /* priority */,
|
||||
OFFLOAD_TYPE_REPLY);
|
||||
doReturn(Collections.emptyList()).when(mAdvertiser)
|
||||
.getAllInterfaceOffloadServiceInfos(anyString());
|
||||
.notifyOffloadStart(anyString());
|
||||
final OffloadEngine offloadEngine = registerOffloadEngine(interfaceName);
|
||||
// Verify that the OffloadServiceInfo retrieves from the advertiser and that no info is
|
||||
// sent to the OffloadEngine.
|
||||
verify(mAdvertiser).getAllInterfaceOffloadServiceInfos(interfaceName);
|
||||
verify(mAdvertiser).notifyOffloadStart(interfaceName);
|
||||
verify(offloadEngine, never()).onOffloadServiceUpdated(any());
|
||||
verifyOffloadServiceUpdatedAndRemoved(
|
||||
interfaceName, info, mOffloadCallback, offloadEngine);
|
||||
|
|
|
|||
Loading…
Reference in a new issue