Move mDNS code to service-connectivity-t
Instead of using a separate service-mdns library, move the code to service-connectivity-t. service-connectivity-t is chosen because it has access to hidden API of classes that were made updatable in T, such as NsdServiceInfo and NsdManager. mdns code can be there as it is only loaded on T+. Bug: 241738458 Test: atest Change-Id: I7eb6c9ab8bf0e0a614ea2994c6ed80a1a780241f
This commit is contained in:
@@ -52,6 +52,7 @@ java_library {
|
||||
"framework-connectivity-t-pre-jarjar",
|
||||
// TODO: use framework-tethering-pre-jarjar when it is separated from framework-tethering
|
||||
"framework-tethering.impl",
|
||||
"framework-wifi",
|
||||
"service-connectivity-pre-jarjar",
|
||||
"service-nearby-pre-jarjar",
|
||||
"ServiceConnectivityResources",
|
||||
|
||||
@@ -195,27 +195,6 @@ java_library {
|
||||
],
|
||||
}
|
||||
|
||||
// TODO: Remove this temporary library and put code into module when test coverage is enough.
|
||||
java_library {
|
||||
name: "service-mdns",
|
||||
sdk_version: "system_server_current",
|
||||
min_sdk_version: "30",
|
||||
srcs: [
|
||||
"mdns/**/*.java",
|
||||
],
|
||||
libs: [
|
||||
"framework-annotations-lib",
|
||||
"framework-connectivity-pre-jarjar",
|
||||
"framework-connectivity-t-pre-jarjar",
|
||||
"framework-tethering",
|
||||
"framework-wifi",
|
||||
"service-connectivity-pre-jarjar",
|
||||
],
|
||||
visibility: [
|
||||
"//packages/modules/Connectivity/tests:__subpackages__",
|
||||
],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "service-connectivity-protos",
|
||||
sdk_version: "system_current",
|
||||
|
||||
@@ -73,8 +73,6 @@ filegroup {
|
||||
"java/com/android/server/connectivity/NetdEventListenerServiceTest.java",
|
||||
"java/com/android/server/connectivity/VpnTest.java",
|
||||
"java/com/android/server/net/ipmemorystore/*.java",
|
||||
"java/com/android/server/connectivity/mdns/**/*.java",
|
||||
"java/com/android/server/connectivity/mdns/**/*.kt",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -149,7 +147,6 @@ android_test {
|
||||
static_libs: [
|
||||
"services.core",
|
||||
"services.net",
|
||||
"service-mdns",
|
||||
],
|
||||
jni_libs: [
|
||||
"libandroid_net_connectivity_com_android_net_module_util_jni",
|
||||
|
||||
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.any;
|
||||
import static org.mockito.Mockito.doCallRealMethod;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -89,7 +90,15 @@ public class MdnsSocketProviderTest {
|
||||
public void setUp() throws IOException {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mockService(mContext, ConnectivityManager.class, Context.CONNECTIVITY_SERVICE, mCm);
|
||||
if (mContext.getSystemService(ConnectivityManager.class) == null) {
|
||||
// Test is using mockito-extended
|
||||
doCallRealMethod().when(mContext).getSystemService(ConnectivityManager.class);
|
||||
}
|
||||
mockService(mContext, TetheringManager.class, Context.TETHERING_SERVICE, mTm);
|
||||
if (mContext.getSystemService(TetheringManager.class) == null) {
|
||||
// Test is using mockito-extended
|
||||
doCallRealMethod().when(mContext).getSystemService(TetheringManager.class);
|
||||
}
|
||||
doReturn(true).when(mDeps).canScanOnInterface(any());
|
||||
doReturn(mTestNetworkIfaceWrapper).when(mDeps).getNetworkInterfaceByName(TEST_IFACE_NAME);
|
||||
doReturn(mLocalOnlyIfaceWrapper).when(mDeps)
|
||||
|
||||
Reference in New Issue
Block a user