Loading Android.bp +18 −8 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,8 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], default_applicable_licenses: ["Android-Apache-2.0"], } } // TODO: remove this default and replace with ConnectivityNextEnableDefaults. This will need to be // done separately in each branch due to merge conflicts. // Defaults to enable/disable java targets that depend on // Defaults to enable/disable java targets that depend on // NetworkStackNext, which uses development APIs. "enabled" may // NetworkStackNext, which uses development APIs. "enabled" may // have a different value depending on the branch. // have a different value depending on the branch. Loading Loading @@ -159,16 +161,21 @@ java_library { // integer so if the next SDK release happens to use that integer, we don't need to rename them. // integer so if the next SDK release happens to use that integer, we don't need to rename them. java_library { java_library { name: "NetworkStackApi33Shims", name: "NetworkStackApi33Shims", defaults: ["NetworkStackShimsDefaults"], defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"], srcs: [ srcs: [ "apishim/33/**/*.java", "apishim/33/**/*.java", ], ], static_libs: [ "net-utils-framework-common", ], libs: [ libs: [ "NetworkStackShimsCommon", "NetworkStackShimsCommon", "NetworkStackApi29Shims", "NetworkStackApi29Shims", "NetworkStackApi30Shims", "NetworkStackApi30Shims", "NetworkStackApi31Shims", "NetworkStackApi31Shims", "framework-bluetooth", "framework-connectivity", "framework-connectivity", "framework-connectivity-t.stubs.module_lib", "framework-tethering", "framework-tethering", ], ], sdk_version: "module_current", sdk_version: "module_current", Loading @@ -180,7 +187,7 @@ java_library { // called directly by the networkstack code. // called directly by the networkstack code. java_library { java_library { name: "NetworkStackApiCurrentShims", name: "NetworkStackApiCurrentShims", defaults: ["NetworkStackShimsDefaults"], defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"], static_libs: [ static_libs: [ "NetworkStackShimsCommon", "NetworkStackShimsCommon", "NetworkStackApi29Shims", "NetworkStackApi29Shims", Loading @@ -191,6 +198,8 @@ java_library { sdk_version: "module_current", sdk_version: "module_current", visibility: [ visibility: [ "//packages/modules/Connectivity/Tethering", "//packages/modules/Connectivity/Tethering", "//packages/modules/Connectivity/service", "//packages/modules/Connectivity/service-t", "//packages/modules/Connectivity/tests/cts/net", "//packages/modules/Connectivity/tests/cts/net", "//packages/modules/Connectivity/tests/cts/hostside/app", "//packages/modules/Connectivity/tests/cts/hostside/app", ], ], Loading @@ -212,8 +221,9 @@ java_library { sdk_version: "module_31", sdk_version: "module_31", visibility: [ visibility: [ "//packages/modules/Connectivity/Tethering", "//packages/modules/Connectivity/Tethering", "//packages/modules/Connectivity/tests/cts/net", "//packages/modules/Connectivity/service", "//packages/modules/Connectivity/tests/cts/hostside/app", "//packages/modules/Connectivity/service-t", "//packages/modules/Connectivity/tests/cts:__subpackages__", ], ], } } Loading Loading @@ -250,7 +260,7 @@ android_library { defaults: [ defaults: [ "NetworkStackDevApiLevel", "NetworkStackDevApiLevel", "NetworkStackAndroidLibraryDefaults", "NetworkStackAndroidLibraryDefaults", "NetworkStackNextEnableDefaults", "ConnectivityNextEnableDefaults", ], ], srcs: [ srcs: [ "src/**/*.java", "src/**/*.java", Loading Loading @@ -323,7 +333,7 @@ android_app { defaults: [ defaults: [ "NetworkStackAppDefaults", "NetworkStackAppDefaults", "NetworkStackDevApiLevel", "NetworkStackDevApiLevel", "NetworkStackNextEnableDefaults", "ConnectivityNextEnableDefaults", ], ], static_libs: ["NetworkStackApiCurrentLib"], static_libs: ["NetworkStackApiCurrentLib"], certificate: "platform", certificate: "platform", Loading @@ -345,7 +355,7 @@ android_library { defaults: [ defaults: [ "NetworkStackAppDefaults", "NetworkStackAppDefaults", "NetworkStackDevApiLevel", "NetworkStackDevApiLevel", "NetworkStackNextEnableDefaults", "ConnectivityNextEnableDefaults", ], ], static_libs: ["NetworkStackApiCurrentLib"], static_libs: ["NetworkStackApiCurrentLib"], manifest: "AndroidManifest.xml" manifest: "AndroidManifest.xml" Loading @@ -357,7 +367,7 @@ android_app { defaults: [ defaults: [ "NetworkStackAppDefaults", "NetworkStackAppDefaults", "NetworkStackDevApiLevel", "NetworkStackDevApiLevel", "NetworkStackNextEnableDefaults", "ConnectivityNextEnableDefaults", ], ], static_libs: ["NetworkStackNextManifestBase"], static_libs: ["NetworkStackNextManifestBase"], certificate: "networkstack", certificate: "networkstack", Loading apishim/29/com/android/networkstack/apishim/api29/ConnectivityFrameworkInitShimImpl.java 0 → 100644 +41 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.networkstack.apishim.api29; import android.os.Build; import androidx.annotation.RequiresApi; import com.android.networkstack.apishim.common.ConnectivityFrameworkInitShim; /** * Implementation of {@link ConnectivityFrameworkInitShim}. */ @RequiresApi(Build.VERSION_CODES.Q) public class ConnectivityFrameworkInitShimImpl implements ConnectivityFrameworkInitShim { /** * Get a new instance of {@link NsdShim}. */ public static ConnectivityFrameworkInitShim newInstance() { return new ConnectivityFrameworkInitShimImpl(); } @Override public void registerServiceWrappers() { // No-op: ConnectivityFrameworkInitializer doesn't exist before S } } apishim/29/com/android/networkstack/apishim/api29/ConstantsShim.java +19 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,11 @@ package com.android.networkstack.apishim.api29; package com.android.networkstack.apishim.api29; import android.os.Build; import android.provider.Settings; import android.telephony.CarrierConfigManager; import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting; /** /** Loading @@ -42,4 +47,18 @@ public class ConstantsShim { // Constants defined in android.net.NetworkCapabilities. // Constants defined in android.net.NetworkCapabilities. public static final int NET_CAPABILITY_NOT_VCN_MANAGED = 28; public static final int NET_CAPABILITY_NOT_VCN_MANAGED = 28; // Constants defined in android.content.Context public static final String NEARBY_SERVICE = "nearby"; /** Compatibility class for {@link CarrierConfigManager}. */ @RequiresApi(Build.VERSION_CODES.Q) /** See {@link CarrierManager#KEY_CARRIER_SUPPORTS_TETHERING_BOOL} */ public static final String KEY_CARRIER_SUPPORTS_TETHERING_BOOL = "carrier_supports_tethering_bool"; /** Compatibility class for {@link Settings}. */ @RequiresApi(Build.VERSION_CODES.Q) /** @see android.provider.Settings#ACTION_TETHER_UNSUPPORTED_CARRIER_UI */ public static final String ACTION_TETHER_UNSUPPORTED_CARRIER_UI = "android.settings.TETHER_UNSUPPORTED_CARRIER_UI"; } } apishim/29/com/android/networkstack/apishim/api29/EthernetManagerShimImpl.java 0 → 100644 +39 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.networkstack.apishim.api29; import android.content.Context; import android.os.Build; import androidx.annotation.RequiresApi; import com.android.networkstack.apishim.common.EthernetManagerShim; /** * Implementation of {@link EthernetManagerShim} for API 29. * * Cannot actually import EthernetManager because that only became @SystemApi in API 30. */ @RequiresApi(Build.VERSION_CODES.Q) public class EthernetManagerShimImpl implements EthernetManagerShim { /** * Get a new instance of {@link EthernetManagerShim}. */ public static EthernetManagerShim newInstance(Context context) { return new EthernetManagerShimImpl(); } } apishim/29/com/android/networkstack/apishim/api29/Ikev2VpnProfileBuilderShimImpl.java 0 → 100644 +41 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.networkstack.apishim.api29; import com.android.networkstack.apishim.common.Ikev2VpnProfileBuilderShim; import com.android.networkstack.apishim.common.UnsupportedApiLevelException; /** * Implementation of Ikev2VpnProfileBuilderShim for API 29. * * @param <T> type of builder, typically Ikev2VpnProfile.Builder. This is necessary because at * compile time, shims for older releases will not have access to this class as it * debuted in SDK30. So the user of the shim has to pass it in. */ // NOTE : the trick with the formal parameter only works because when this shim was introduced, // the stable API already contained the class that the caller needs to pass in; this won't // work for a class added in the latest API level. public class Ikev2VpnProfileBuilderShimImpl<T> implements Ikev2VpnProfileBuilderShim<T> { /** * @see Ikev2VpnProfile.Builder#setRequiresInternetValidation(boolean) */ @Override public T setRequiresInternetValidation(T builder, boolean requiresInternetValidation) throws UnsupportedApiLevelException { throw new UnsupportedApiLevelException("Only supported from API level 33."); } } Loading
Android.bp +18 −8 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,8 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], default_applicable_licenses: ["Android-Apache-2.0"], } } // TODO: remove this default and replace with ConnectivityNextEnableDefaults. This will need to be // done separately in each branch due to merge conflicts. // Defaults to enable/disable java targets that depend on // Defaults to enable/disable java targets that depend on // NetworkStackNext, which uses development APIs. "enabled" may // NetworkStackNext, which uses development APIs. "enabled" may // have a different value depending on the branch. // have a different value depending on the branch. Loading Loading @@ -159,16 +161,21 @@ java_library { // integer so if the next SDK release happens to use that integer, we don't need to rename them. // integer so if the next SDK release happens to use that integer, we don't need to rename them. java_library { java_library { name: "NetworkStackApi33Shims", name: "NetworkStackApi33Shims", defaults: ["NetworkStackShimsDefaults"], defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"], srcs: [ srcs: [ "apishim/33/**/*.java", "apishim/33/**/*.java", ], ], static_libs: [ "net-utils-framework-common", ], libs: [ libs: [ "NetworkStackShimsCommon", "NetworkStackShimsCommon", "NetworkStackApi29Shims", "NetworkStackApi29Shims", "NetworkStackApi30Shims", "NetworkStackApi30Shims", "NetworkStackApi31Shims", "NetworkStackApi31Shims", "framework-bluetooth", "framework-connectivity", "framework-connectivity", "framework-connectivity-t.stubs.module_lib", "framework-tethering", "framework-tethering", ], ], sdk_version: "module_current", sdk_version: "module_current", Loading @@ -180,7 +187,7 @@ java_library { // called directly by the networkstack code. // called directly by the networkstack code. java_library { java_library { name: "NetworkStackApiCurrentShims", name: "NetworkStackApiCurrentShims", defaults: ["NetworkStackShimsDefaults"], defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"], static_libs: [ static_libs: [ "NetworkStackShimsCommon", "NetworkStackShimsCommon", "NetworkStackApi29Shims", "NetworkStackApi29Shims", Loading @@ -191,6 +198,8 @@ java_library { sdk_version: "module_current", sdk_version: "module_current", visibility: [ visibility: [ "//packages/modules/Connectivity/Tethering", "//packages/modules/Connectivity/Tethering", "//packages/modules/Connectivity/service", "//packages/modules/Connectivity/service-t", "//packages/modules/Connectivity/tests/cts/net", "//packages/modules/Connectivity/tests/cts/net", "//packages/modules/Connectivity/tests/cts/hostside/app", "//packages/modules/Connectivity/tests/cts/hostside/app", ], ], Loading @@ -212,8 +221,9 @@ java_library { sdk_version: "module_31", sdk_version: "module_31", visibility: [ visibility: [ "//packages/modules/Connectivity/Tethering", "//packages/modules/Connectivity/Tethering", "//packages/modules/Connectivity/tests/cts/net", "//packages/modules/Connectivity/service", "//packages/modules/Connectivity/tests/cts/hostside/app", "//packages/modules/Connectivity/service-t", "//packages/modules/Connectivity/tests/cts:__subpackages__", ], ], } } Loading Loading @@ -250,7 +260,7 @@ android_library { defaults: [ defaults: [ "NetworkStackDevApiLevel", "NetworkStackDevApiLevel", "NetworkStackAndroidLibraryDefaults", "NetworkStackAndroidLibraryDefaults", "NetworkStackNextEnableDefaults", "ConnectivityNextEnableDefaults", ], ], srcs: [ srcs: [ "src/**/*.java", "src/**/*.java", Loading Loading @@ -323,7 +333,7 @@ android_app { defaults: [ defaults: [ "NetworkStackAppDefaults", "NetworkStackAppDefaults", "NetworkStackDevApiLevel", "NetworkStackDevApiLevel", "NetworkStackNextEnableDefaults", "ConnectivityNextEnableDefaults", ], ], static_libs: ["NetworkStackApiCurrentLib"], static_libs: ["NetworkStackApiCurrentLib"], certificate: "platform", certificate: "platform", Loading @@ -345,7 +355,7 @@ android_library { defaults: [ defaults: [ "NetworkStackAppDefaults", "NetworkStackAppDefaults", "NetworkStackDevApiLevel", "NetworkStackDevApiLevel", "NetworkStackNextEnableDefaults", "ConnectivityNextEnableDefaults", ], ], static_libs: ["NetworkStackApiCurrentLib"], static_libs: ["NetworkStackApiCurrentLib"], manifest: "AndroidManifest.xml" manifest: "AndroidManifest.xml" Loading @@ -357,7 +367,7 @@ android_app { defaults: [ defaults: [ "NetworkStackAppDefaults", "NetworkStackAppDefaults", "NetworkStackDevApiLevel", "NetworkStackDevApiLevel", "NetworkStackNextEnableDefaults", "ConnectivityNextEnableDefaults", ], ], static_libs: ["NetworkStackNextManifestBase"], static_libs: ["NetworkStackNextManifestBase"], certificate: "networkstack", certificate: "networkstack", Loading
apishim/29/com/android/networkstack/apishim/api29/ConnectivityFrameworkInitShimImpl.java 0 → 100644 +41 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.networkstack.apishim.api29; import android.os.Build; import androidx.annotation.RequiresApi; import com.android.networkstack.apishim.common.ConnectivityFrameworkInitShim; /** * Implementation of {@link ConnectivityFrameworkInitShim}. */ @RequiresApi(Build.VERSION_CODES.Q) public class ConnectivityFrameworkInitShimImpl implements ConnectivityFrameworkInitShim { /** * Get a new instance of {@link NsdShim}. */ public static ConnectivityFrameworkInitShim newInstance() { return new ConnectivityFrameworkInitShimImpl(); } @Override public void registerServiceWrappers() { // No-op: ConnectivityFrameworkInitializer doesn't exist before S } }
apishim/29/com/android/networkstack/apishim/api29/ConstantsShim.java +19 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,11 @@ package com.android.networkstack.apishim.api29; package com.android.networkstack.apishim.api29; import android.os.Build; import android.provider.Settings; import android.telephony.CarrierConfigManager; import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting; /** /** Loading @@ -42,4 +47,18 @@ public class ConstantsShim { // Constants defined in android.net.NetworkCapabilities. // Constants defined in android.net.NetworkCapabilities. public static final int NET_CAPABILITY_NOT_VCN_MANAGED = 28; public static final int NET_CAPABILITY_NOT_VCN_MANAGED = 28; // Constants defined in android.content.Context public static final String NEARBY_SERVICE = "nearby"; /** Compatibility class for {@link CarrierConfigManager}. */ @RequiresApi(Build.VERSION_CODES.Q) /** See {@link CarrierManager#KEY_CARRIER_SUPPORTS_TETHERING_BOOL} */ public static final String KEY_CARRIER_SUPPORTS_TETHERING_BOOL = "carrier_supports_tethering_bool"; /** Compatibility class for {@link Settings}. */ @RequiresApi(Build.VERSION_CODES.Q) /** @see android.provider.Settings#ACTION_TETHER_UNSUPPORTED_CARRIER_UI */ public static final String ACTION_TETHER_UNSUPPORTED_CARRIER_UI = "android.settings.TETHER_UNSUPPORTED_CARRIER_UI"; } }
apishim/29/com/android/networkstack/apishim/api29/EthernetManagerShimImpl.java 0 → 100644 +39 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.networkstack.apishim.api29; import android.content.Context; import android.os.Build; import androidx.annotation.RequiresApi; import com.android.networkstack.apishim.common.EthernetManagerShim; /** * Implementation of {@link EthernetManagerShim} for API 29. * * Cannot actually import EthernetManager because that only became @SystemApi in API 30. */ @RequiresApi(Build.VERSION_CODES.Q) public class EthernetManagerShimImpl implements EthernetManagerShim { /** * Get a new instance of {@link EthernetManagerShim}. */ public static EthernetManagerShim newInstance(Context context) { return new EthernetManagerShimImpl(); } }
apishim/29/com/android/networkstack/apishim/api29/Ikev2VpnProfileBuilderShimImpl.java 0 → 100644 +41 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.networkstack.apishim.api29; import com.android.networkstack.apishim.common.Ikev2VpnProfileBuilderShim; import com.android.networkstack.apishim.common.UnsupportedApiLevelException; /** * Implementation of Ikev2VpnProfileBuilderShim for API 29. * * @param <T> type of builder, typically Ikev2VpnProfile.Builder. This is necessary because at * compile time, shims for older releases will not have access to this class as it * debuted in SDK30. So the user of the shim has to pass it in. */ // NOTE : the trick with the formal parameter only works because when this shim was introduced, // the stable API already contained the class that the caller needs to pass in; this won't // work for a class added in the latest API level. public class Ikev2VpnProfileBuilderShimImpl<T> implements Ikev2VpnProfileBuilderShim<T> { /** * @see Ikev2VpnProfile.Builder#setRequiresInternetValidation(boolean) */ @Override public T setRequiresInternetValidation(T builder, boolean requiresInternetValidation) throws UnsupportedApiLevelException { throw new UnsupportedApiLevelException("Only supported from API level 33."); } }