Enable new NsdManager backend on U+
Instead of using the old mdnsresponder backend, U+ uses MdnsDiscoveryManager and MdnsAdvertiser. Bug: 272197605 Test: atest NsdManagerTest Change-Id: I53ebf1bbba24972e4db87eb4097497329b05caa9
This commit is contained in:
@@ -21,6 +21,8 @@ import static android.net.nsd.NsdManager.MDNS_DISCOVERY_MANAGER_EVENT;
|
|||||||
import static android.net.nsd.NsdManager.MDNS_SERVICE_EVENT;
|
import static android.net.nsd.NsdManager.MDNS_SERVICE_EVENT;
|
||||||
import static android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY;
|
import static android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY;
|
||||||
|
|
||||||
|
import static com.android.modules.utils.build.SdkLevel.isAtLeastU;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -1265,8 +1267,9 @@ public class NsdService extends INsdManager.Stub {
|
|||||||
* @return true if the MdnsDiscoveryManager feature is enabled.
|
* @return true if the MdnsDiscoveryManager feature is enabled.
|
||||||
*/
|
*/
|
||||||
public boolean isMdnsDiscoveryManagerEnabled(Context context) {
|
public boolean isMdnsDiscoveryManagerEnabled(Context context) {
|
||||||
return DeviceConfigUtils.isFeatureEnabled(context, NAMESPACE_CONNECTIVITY,
|
return isAtLeastU() || DeviceConfigUtils.isFeatureEnabled(context,
|
||||||
MDNS_DISCOVERY_MANAGER_VERSION, false /* defaultEnabled */);
|
NAMESPACE_CONNECTIVITY, MDNS_DISCOVERY_MANAGER_VERSION,
|
||||||
|
false /* defaultEnabled */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1276,8 +1279,8 @@ public class NsdService extends INsdManager.Stub {
|
|||||||
* @return true if the MdnsAdvertiser feature is enabled.
|
* @return true if the MdnsAdvertiser feature is enabled.
|
||||||
*/
|
*/
|
||||||
public boolean isMdnsAdvertiserEnabled(Context context) {
|
public boolean isMdnsAdvertiserEnabled(Context context) {
|
||||||
return DeviceConfigUtils.isFeatureEnabled(context, NAMESPACE_CONNECTIVITY,
|
return isAtLeastU() || DeviceConfigUtils.isFeatureEnabled(context,
|
||||||
MDNS_ADVERTISER_VERSION, false /* defaultEnabled */);
|
NAMESPACE_CONNECTIVITY, MDNS_ADVERTISER_VERSION, false /* defaultEnabled */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user