Fix isFeatureEnabled namespace and overload usage

From service-connectivity, NAMESPACE_TETHERING must be used, as
NAMESPACE_CONNECTIVITY is used for the NetworkStack module. Also the
isFeatureEnabled with module name must be used, otherwise the "android"
package version is queried instead of the tethering module version.

BpfNetMaps is using flag value 1 to workaround this issue.
flags in NsdService, AutomaticOnOffKeepaliveTracker, and ConnectivityFlags
were not pushed currently.
So, this change has no effect to devices.

Bug: 279108992
Test: TH
(cherry picked from https://android-review.googlesource.com/q/commit:278db58bf536551158e8082d3e7572650a908b05)
Merged-In: I2b4b6a13c048c20beef52b1f43b9e21aca0c637a
Change-Id: I2b4b6a13c048c20beef52b1f43b9e21aca0c637a
This commit is contained in:
Motomu Utsumi
2023-04-21 12:35:22 +09:00
committed by Cherrypicker Worker
parent fc6693065b
commit 6f4d8066b9
6 changed files with 15 additions and 15 deletions

View File

@@ -19,7 +19,6 @@ package com.android.server;
import static android.net.ConnectivityManager.NETID_UNSET;
import static android.net.nsd.NsdManager.MDNS_DISCOVERY_MANAGER_EVENT;
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;
@@ -1352,8 +1351,8 @@ public class NsdService extends INsdManager.Stub {
* @return true if the MdnsDiscoveryManager feature is enabled.
*/
public boolean isMdnsDiscoveryManagerEnabled(Context context) {
return isAtLeastU() || DeviceConfigUtils.isFeatureEnabled(context,
NAMESPACE_CONNECTIVITY, MDNS_DISCOVERY_MANAGER_VERSION,
return isAtLeastU() || DeviceConfigUtils.isFeatureEnabled(context, NAMESPACE_TETHERING,
MDNS_DISCOVERY_MANAGER_VERSION, DeviceConfigUtils.TETHERING_MODULE_NAME,
false /* defaultEnabled */);
}
@@ -1364,8 +1363,9 @@ public class NsdService extends INsdManager.Stub {
* @return true if the MdnsAdvertiser feature is enabled.
*/
public boolean isMdnsAdvertiserEnabled(Context context) {
return isAtLeastU() || DeviceConfigUtils.isFeatureEnabled(context,
NAMESPACE_CONNECTIVITY, MDNS_ADVERTISER_VERSION, false /* defaultEnabled */);
return isAtLeastU() || DeviceConfigUtils.isFeatureEnabled(context, NAMESPACE_TETHERING,
MDNS_ADVERTISER_VERSION, DeviceConfigUtils.TETHERING_MODULE_NAME,
false /* defaultEnabled */);
}
/**