Loading Android.bp +13 −3 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ // Common defaults to define SDK level java_defaults { name: "NetworkStackDevApiLevel", min_sdk_version: "29", sdk_version: "system_current", } Loading Loading @@ -113,6 +114,7 @@ android_library { ":statslog-networkstack-java-gen" ], manifest: "AndroidManifestBase.xml", enabled: false, // Disabled in mainline-prod } // For API stable, first build the dependencies using jarjar compat rules, then build the sources Loading Loading @@ -145,6 +147,7 @@ filegroup { "//packages/modules/NetworkStack/tests/unit", "//packages/modules/NetworkStack/tests/integration", "//frameworks/base/packages/Tethering/tests/integration", "//packages/modules/Connectivity/Tethering/tests/integration", ] } Loading Loading @@ -178,6 +181,7 @@ android_app { // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces // the default CaptivePortalLogin. required: ["PlatformNetworkPermissionConfig", "PlatformCaptivePortalLogin"], enabled: false, // Disabled in mainline-prod } // Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top Loading @@ -185,7 +189,8 @@ android_library { name: "NetworkStackNextManifestBase", defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"], static_libs: ["NetworkStackApiCurrentLib"], manifest: "AndroidManifest.xml" manifest: "AndroidManifest.xml", enabled: false, // Disabled in mainline-prod } // NetworkStack build targeting the current API release, for testing on in-development SDK Loading @@ -197,6 +202,7 @@ android_app { manifest: "AndroidManifest_Next.xml", // The permission configuration *must* be included to ensure security of the device required: ["NetworkPermissionConfig"], enabled: false, // Disabled in mainline-prod } // Updatable network stack for finalized API Loading @@ -220,6 +226,7 @@ android_library { visibility: [ "//frameworks/base/tests/net/integration", "//cts/tests/tests/net", "//packages/modules/Connectivity/tests/cts/net", ], } Loading @@ -234,6 +241,9 @@ cc_library_shared { "liblog", "libnativehelper_compat_libc++", ], static_libs: [ "libnetjniutils", ], // We cannot use plain "libc++" here to link libc++ dynamically because it results in: // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found Loading Loading @@ -278,8 +288,8 @@ genrule { android_app { name: "TestNetworkStack", defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"], static_libs: ["NetworkStackApiCurrentLib"], defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"], static_libs: ["NetworkStackApiStableLib"], certificate: "networkstack", manifest: ":NetworkStackTestAndroidManifest", // The permission configuration *must* be included to ensure security of the device Loading TEST_MAPPING +13 −0 Original line number Diff line number Diff line Loading @@ -14,5 +14,18 @@ { "name": "NetworkStackIntegrationTests" } ], "mainline-presubmit": [ // These are unit tests only, so they don't actually require any modules to be installed. // We must specify at least one module here or the tests won't run. Use the same set as CTS // so in theory the infra would not need to reinstall/reboot devices to run both. { "name": "NetworkStackTests[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]" } ], "imports": [ { "path": "packages/modules/Connectivity" } ] } apishim/29/com/android/networkstack/apishim/api29/CaptivePortalDataShimImpl.java +19 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.networkstack.apishim.api29; import android.net.CaptivePortalData; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; Loading Loading @@ -48,8 +50,25 @@ public abstract class CaptivePortalDataShimImpl implements CaptivePortalDataShim throw new UnsupportedApiLevelException("CaptivePortalData not supported on API 29"); } @Override public String getVenueFriendlyName() { // Not supported in API level 29 return null; } @VisibleForTesting public static boolean isSupported() { return false; } /** * Generate a {@link CaptivePortalData} object with a friendly name set * * @param friendlyName The friendly name to set * @return a {@link CaptivePortalData} object with a friendly name set */ public CaptivePortalData withVenueFriendlyName(String friendlyName) { // Not supported in API level 29 return null; } } apishim/29/com/android/networkstack/apishim/api29/NetworkInformationShimImpl.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.networkstack.apishim.api29; import android.net.CaptivePortalData; import android.net.IpPrefix; import android.net.LinkProperties; import android.net.NetworkCapabilities; Loading Loading @@ -57,6 +58,14 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { return false; } /** * Indicates whether the shim can use APIs above the R SDK. */ @VisibleForTesting public static boolean useApiAboveR() { return false; } @Nullable @Override public Uri getCaptivePortalApiUrl(@Nullable LinkProperties lp) { Loading Loading @@ -105,4 +114,17 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { @NonNull Inet4Address serverAddress) { // Not supported on this API level: no-op } /** * Set captive portal data in {@link LinkProperties} * @param lp Link properties object to be updated * @param captivePortalData Captive portal data to be used */ public void setCaptivePortalData(@NonNull LinkProperties lp, @Nullable CaptivePortalData captivePortalData) { if (lp == null) { return; } lp.setCaptivePortalData(captivePortalData); } } apishim/30/com/android/networkstack/apishim/api30/CaptivePortalDataShimImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ import org.json.JSONObject; public class CaptivePortalDataShimImpl extends com.android.networkstack.apishim.api29.CaptivePortalDataShimImpl { @NonNull private final CaptivePortalData mData; protected final CaptivePortalData mData; protected CaptivePortalDataShimImpl(@NonNull CaptivePortalData data) { mData = data; Loading Loading
Android.bp +13 −3 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ // Common defaults to define SDK level java_defaults { name: "NetworkStackDevApiLevel", min_sdk_version: "29", sdk_version: "system_current", } Loading Loading @@ -113,6 +114,7 @@ android_library { ":statslog-networkstack-java-gen" ], manifest: "AndroidManifestBase.xml", enabled: false, // Disabled in mainline-prod } // For API stable, first build the dependencies using jarjar compat rules, then build the sources Loading Loading @@ -145,6 +147,7 @@ filegroup { "//packages/modules/NetworkStack/tests/unit", "//packages/modules/NetworkStack/tests/integration", "//frameworks/base/packages/Tethering/tests/integration", "//packages/modules/Connectivity/Tethering/tests/integration", ] } Loading Loading @@ -178,6 +181,7 @@ android_app { // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces // the default CaptivePortalLogin. required: ["PlatformNetworkPermissionConfig", "PlatformCaptivePortalLogin"], enabled: false, // Disabled in mainline-prod } // Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top Loading @@ -185,7 +189,8 @@ android_library { name: "NetworkStackNextManifestBase", defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"], static_libs: ["NetworkStackApiCurrentLib"], manifest: "AndroidManifest.xml" manifest: "AndroidManifest.xml", enabled: false, // Disabled in mainline-prod } // NetworkStack build targeting the current API release, for testing on in-development SDK Loading @@ -197,6 +202,7 @@ android_app { manifest: "AndroidManifest_Next.xml", // The permission configuration *must* be included to ensure security of the device required: ["NetworkPermissionConfig"], enabled: false, // Disabled in mainline-prod } // Updatable network stack for finalized API Loading @@ -220,6 +226,7 @@ android_library { visibility: [ "//frameworks/base/tests/net/integration", "//cts/tests/tests/net", "//packages/modules/Connectivity/tests/cts/net", ], } Loading @@ -234,6 +241,9 @@ cc_library_shared { "liblog", "libnativehelper_compat_libc++", ], static_libs: [ "libnetjniutils", ], // We cannot use plain "libc++" here to link libc++ dynamically because it results in: // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found Loading Loading @@ -278,8 +288,8 @@ genrule { android_app { name: "TestNetworkStack", defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"], static_libs: ["NetworkStackApiCurrentLib"], defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"], static_libs: ["NetworkStackApiStableLib"], certificate: "networkstack", manifest: ":NetworkStackTestAndroidManifest", // The permission configuration *must* be included to ensure security of the device Loading
TEST_MAPPING +13 −0 Original line number Diff line number Diff line Loading @@ -14,5 +14,18 @@ { "name": "NetworkStackIntegrationTests" } ], "mainline-presubmit": [ // These are unit tests only, so they don't actually require any modules to be installed. // We must specify at least one module here or the tests won't run. Use the same set as CTS // so in theory the infra would not need to reinstall/reboot devices to run both. { "name": "NetworkStackTests[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]" } ], "imports": [ { "path": "packages/modules/Connectivity" } ] }
apishim/29/com/android/networkstack/apishim/api29/CaptivePortalDataShimImpl.java +19 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.networkstack.apishim.api29; import android.net.CaptivePortalData; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; Loading Loading @@ -48,8 +50,25 @@ public abstract class CaptivePortalDataShimImpl implements CaptivePortalDataShim throw new UnsupportedApiLevelException("CaptivePortalData not supported on API 29"); } @Override public String getVenueFriendlyName() { // Not supported in API level 29 return null; } @VisibleForTesting public static boolean isSupported() { return false; } /** * Generate a {@link CaptivePortalData} object with a friendly name set * * @param friendlyName The friendly name to set * @return a {@link CaptivePortalData} object with a friendly name set */ public CaptivePortalData withVenueFriendlyName(String friendlyName) { // Not supported in API level 29 return null; } }
apishim/29/com/android/networkstack/apishim/api29/NetworkInformationShimImpl.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.networkstack.apishim.api29; import android.net.CaptivePortalData; import android.net.IpPrefix; import android.net.LinkProperties; import android.net.NetworkCapabilities; Loading Loading @@ -57,6 +58,14 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { return false; } /** * Indicates whether the shim can use APIs above the R SDK. */ @VisibleForTesting public static boolean useApiAboveR() { return false; } @Nullable @Override public Uri getCaptivePortalApiUrl(@Nullable LinkProperties lp) { Loading Loading @@ -105,4 +114,17 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { @NonNull Inet4Address serverAddress) { // Not supported on this API level: no-op } /** * Set captive portal data in {@link LinkProperties} * @param lp Link properties object to be updated * @param captivePortalData Captive portal data to be used */ public void setCaptivePortalData(@NonNull LinkProperties lp, @Nullable CaptivePortalData captivePortalData) { if (lp == null) { return; } lp.setCaptivePortalData(captivePortalData); } }
apishim/30/com/android/networkstack/apishim/api30/CaptivePortalDataShimImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ import org.json.JSONObject; public class CaptivePortalDataShimImpl extends com.android.networkstack.apishim.api29.CaptivePortalDataShimImpl { @NonNull private final CaptivePortalData mData; protected final CaptivePortalData mData; protected CaptivePortalDataShimImpl(@NonNull CaptivePortalData data) { mData = data; Loading