Merge changes I53ebf1bb,I8540af27

* changes:
  Enable new NsdManager backend on U+
  Update NsdManagerTest for newer backend usage
This commit is contained in:
Remi NGUYEN VAN
2023-03-09 07:11:08 +00:00
committed by Gerrit Code Review
2 changed files with 69 additions and 14 deletions

View File

@@ -22,6 +22,8 @@ import static android.net.nsd.NsdManager.MDNS_SERVICE_EVENT;
import static android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY;
import static android.provider.DeviceConfig.NAMESPACE_TETHERING;
import static com.android.modules.utils.build.SdkLevel.isAtLeastU;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
@@ -1343,8 +1345,9 @@ public class NsdService extends INsdManager.Stub {
* @return true if the MdnsDiscoveryManager feature is enabled.
*/
public boolean isMdnsDiscoveryManagerEnabled(Context context) {
return DeviceConfigUtils.isFeatureEnabled(context, NAMESPACE_CONNECTIVITY,
MDNS_DISCOVERY_MANAGER_VERSION, false /* defaultEnabled */);
return isAtLeastU() || DeviceConfigUtils.isFeatureEnabled(context,
NAMESPACE_CONNECTIVITY, MDNS_DISCOVERY_MANAGER_VERSION,
false /* defaultEnabled */);
}
/**
@@ -1354,8 +1357,8 @@ public class NsdService extends INsdManager.Stub {
* @return true if the MdnsAdvertiser feature is enabled.
*/
public boolean isMdnsAdvertiserEnabled(Context context) {
return DeviceConfigUtils.isFeatureEnabled(context, NAMESPACE_CONNECTIVITY,
MDNS_ADVERTISER_VERSION, false /* defaultEnabled */);
return isAtLeastU() || DeviceConfigUtils.isFeatureEnabled(context,
NAMESPACE_CONNECTIVITY, MDNS_ADVERTISER_VERSION, false /* defaultEnabled */);
}
/**