diff options
Diffstat (limited to 'common/device/com/android/net/module/util/DeviceConfigUtils.java')
-rw-r--r-- | common/device/com/android/net/module/util/DeviceConfigUtils.java | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/common/device/com/android/net/module/util/DeviceConfigUtils.java b/common/device/com/android/net/module/util/DeviceConfigUtils.java index caa2b055..fb130f67 100644 --- a/common/device/com/android/net/module/util/DeviceConfigUtils.java +++ b/common/device/com/android/net/module/util/DeviceConfigUtils.java @@ -17,6 +17,7 @@ package com.android.net.module.util; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; +import static android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY; import static android.provider.DeviceConfig.NAMESPACE_TETHERING; import static com.android.net.module.util.FeatureVersions.CONNECTIVITY_MODULE_ID; @@ -335,23 +336,45 @@ public final class DeviceConfigUtils { } /** - * Check whether one specific experimental feature in tethering module from {@link DeviceConfig} - * is not disabled. Feature can be disabled by setting a non-zero value in the property. - * If the feature is enabled by default and disabled by flag push (kill switch), this method - * should be used. - * If the feature is disabled by default and enabled by flag push, - * {@link #isTetheringFeatureEnabled} should be used. + * Check whether one specific experimental feature in specific namespace from + * {@link DeviceConfig} is not disabled. Feature can be disabled by setting a non-zero + * value in the property. If the feature is enabled by default and disabled by flag push + * (kill switch), this method should be used. If the feature is disabled by default and + * enabled by flag push, {@link #isFeatureEnabled} should be used. * + * @param namespace The namespace containing the property to look up. * @param name The name of the property to look up. * @return true if this feature is enabled, or false if disabled. */ - public static boolean isTetheringFeatureNotChickenedOut(String name) { - final int propertyVersion = getDeviceConfigPropertyInt(NAMESPACE_TETHERING, name, + private static boolean isFeatureNotChickenedOut(String namespace, String name) { + final int propertyVersion = getDeviceConfigPropertyInt(namespace, name, 0 /* default value */); return propertyVersion == 0; } /** + * Check whether one specific experimental feature in Tethering module from {@link DeviceConfig} + * is not disabled. + * + * @param name The name of the property in tethering module to look up. + * @return true if this feature is enabled, or false if disabled. + */ + public static boolean isTetheringFeatureNotChickenedOut(String name) { + return isFeatureNotChickenedOut(NAMESPACE_TETHERING, name); + } + + /** + * Check whether one specific experimental feature in NetworkStack module from + * {@link DeviceConfig} is not disabled. + * + * @param name The name of the property in NetworkStack module to look up. + * @return true if this feature is enabled, or false if disabled. + */ + public static boolean isNetworkStackFeatureNotChickenedOut(String name) { + return isFeatureNotChickenedOut(NAMESPACE_CONNECTIVITY, name); + } + + /** * Gets boolean config from resources. */ public static boolean getResBooleanConfig(@NonNull final Context context, |