Merge "Adding Metrics/protos in the ConnectivityService"
diff --git a/Cronet/Android.bp b/Cronet/Android.bp
index ec7158c..3ce88ef 100644
--- a/Cronet/Android.bp
+++ b/Cronet/Android.bp
@@ -20,26 +20,28 @@
name: "cronet_impl_native_java",
jars: ["prebuilt/cronet_impl_native_java.jar"],
visibility: ["//visibility:private"],
- apex_available: ["com.android.cronet"],
+ apex_available: ["com.android.tethering"],
+ min_sdk_version: "29",
}
java_import {
name: "cronet_impl_common_java",
jars: ["prebuilt/cronet_impl_common_java.jar"],
visibility: ["//visibility:private"],
- apex_available: ["com.android.cronet"],
+ apex_available: ["com.android.tethering"],
+ min_sdk_version: "29",
}
java_import {
name: "cronet_impl_platform_java",
jars: ["prebuilt/cronet_impl_platform_java.jar"],
visibility: ["//visibility:private"],
- apex_available: ["com.android.cronet"],
+ apex_available: ["com.android.tethering"],
+ min_sdk_version: "29",
}
cc_prebuilt_library_shared {
- name: "libcronet.80.0.3986.0",
- // STOPSHIP: Confirm if it is safe
+ name: "libcronet.107.0.5284.2",
shared_libs: [
"libandroid",
"libc",
@@ -50,23 +52,24 @@
stl: "libc++_static",
target: {
android_arm64: {
- srcs: ["prebuilt/libs/arm64-v8a/libcronet.80.0.3986.0.so"],
+ srcs: ["prebuilt/libs/arm64-v8a/libcronet.107.0.5284.2.so"],
},
android_arm: {
- srcs: ["prebuilt/libs/armeabi-v7a/libcronet.80.0.3986.0.so"],
+ srcs: ["prebuilt/libs/armeabi-v7a/libcronet.107.0.5284.2.so"],
},
android_x86_64: {
- srcs: ["prebuilt/libs/x86_64/libcronet.80.0.3986.0.so"],
+ srcs: ["prebuilt/libs/x86_64/libcronet.107.0.5284.2.so"],
},
android_x86: {
- srcs: ["prebuilt/libs/x86/libcronet.80.0.3986.0.so"],
+ srcs: ["prebuilt/libs/x86/libcronet.107.0.5284.2.so"],
},
},
// These are already stripped, and restripping them just issues diagnostics.
strip: {
none: true,
},
- apex_available: ["com.android.cronet"],
+ apex_available: ["com.android.tethering"],
+ min_sdk_version: "29",
}
genrule {
@@ -79,35 +82,25 @@
}
java_sdk_library {
- name: "org.chromium.net.cronet",
+ name: "framework-cronet",
+ defaults: ["framework-module-defaults"],
srcs: [
":cronet_api-src",
],
- // Only public non-hide methods for now.
- // TODO: Confirm target APIs with Cronet team.
- api_packages: [
- "org.chromium.net",
- ],
libs: [
"androidx.annotation_annotation",
],
static_libs: [
+ "androidx.core_core-nodeps",
"cronet_impl_common_java",
"cronet_impl_native_java",
"cronet_impl_platform_java",
],
- // Add dependencies on files used by droiddoc_options.
- droiddoc_option_files: [":cronet-api-current.txt"],
- apex_available: ["com.android.cronet"],
+ apex_available: ["com.android.tethering"],
+ jarjar_rules: "jarjar-rules.txt",
unsafe_ignore_missing_latest_api: true,
dist_group: "android",
-}
-
-// Make the current.txt available for use by the cts/tests/signature tests.
-// ========================================================================
-filegroup {
- name: "cronet-api-current.txt",
- srcs: [
- "api/current.txt",
- ],
+ // cronet is used as a shared library.
+ shared_library: true,
+ exclude_kotlinc_generated_files: true,
}
diff --git a/Cronet/apex/Android.bp b/Cronet/apex/Android.bp
index 2c5b481..180dafb 100644
--- a/Cronet/apex/Android.bp
+++ b/Cronet/apex/Android.bp
@@ -30,38 +30,25 @@
apex_defaults {
name: "CronetApexDefaultsEnabled",
- jni_libs: ["libcronet.80.0.3986.0"],
- java_libs: ["org.chromium.net.cronet"],
+ jni_libs: ["libcronet.107.0.5284.2"],
+ java_libs: ["framework-cronet"],
+ arch: {
+ riscv64: {
+ // TODO: remove this when there is a riscv64 libcronet
+ exclude_jni_libs: ["libcronet.107.0.5284.2"],
+ },
+ },
}
apex_defaults {
name: "CronetApexDefaultsDisabled",
}
-apex_defaults {
- name: "com.android.cronet-defaults",
- compile_multilib: "both",
- jni_libs: ["libcronet.80.0.3986.0"],
- java_libs: ["org.chromium.net.cronet"],
- key: "com.android.cronet.key",
- certificate: ":com.android.cronet.certificate",
- updatable: false,
- generate_hashtree: false,
-
- // Use a custom AndroidManifest.xml used for API targeting.
- androidManifest: ":cronet-manifest.xml",
-}
-
-filegroup {
- name: "cronet-manifest.xml",
- srcs: [
- "AndroidManifest.xml",
- ],
-}
-
+// TODO: Remove cronet apex after com.android.cronet is removed from PRODUCT_PACKAGES
apex {
name: "com.android.cronet",
- defaults: ["com.android.cronet-defaults"],
+ key: "com.android.cronet.key",
+ updatable: false,
manifest: "manifest.json",
}
@@ -70,8 +57,3 @@
public_key: "com.android.cronet.avbpubkey",
private_key: "com.android.cronet.pem",
}
-
-android_app_certificate {
- name: "com.android.cronet.certificate",
- certificate: "com.android.cronet",
-}
diff --git a/Cronet/apex/testing/Android.bp b/Cronet/apex/testing/Android.bp
deleted file mode 100644
index a6859ff..0000000
--- a/Cronet/apex/testing/Android.bp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 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 {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-apex_test {
- name: "test_com.android.cronet",
- visibility: [
- "//system/apex/tests",
- ],
- defaults: ["com.android.cronet-defaults"],
- manifest: "test_apex_manifest.json",
- file_contexts: ":com.android.cronet-file_contexts",
- // Test APEX, should never be installed
- installable: false,
-}
diff --git a/Cronet/apex/testing/test_apex_manifest.json b/Cronet/apex/testing/test_apex_manifest.json
deleted file mode 100644
index 15aaead..0000000
--- a/Cronet/apex/testing/test_apex_manifest.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "com.android.cronet",
- "version": 300000000
-}
\ No newline at end of file
diff --git a/Cronet/api/module-lib-current.txt b/Cronet/api/module-lib-current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/Cronet/api/module-lib-current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/Cronet/api/module-lib-removed.txt b/Cronet/api/module-lib-removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/Cronet/api/module-lib-removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/Cronet/jarjar-rules.txt b/Cronet/jarjar-rules.txt
new file mode 100644
index 0000000..7111ebc
--- /dev/null
+++ b/Cronet/jarjar-rules.txt
@@ -0,0 +1,3 @@
+rule androidx.** com.android.cronet.@0
+rule android.support.** com.android.cronet.@0
+
diff --git a/Cronet/prebuilt/cronet_api-src.jar b/Cronet/prebuilt/cronet_api-src.jar
index 9d0aa34..924b877 100644
--- a/Cronet/prebuilt/cronet_api-src.jar
+++ b/Cronet/prebuilt/cronet_api-src.jar
Binary files differ
diff --git a/Cronet/prebuilt/cronet_api.jar b/Cronet/prebuilt/cronet_api.jar
index b0c3967..977b28d 100644
--- a/Cronet/prebuilt/cronet_api.jar
+++ b/Cronet/prebuilt/cronet_api.jar
Binary files differ
diff --git a/Cronet/prebuilt/cronet_impl_common_java.jar b/Cronet/prebuilt/cronet_impl_common_java.jar
index 7006c09..fa71bf3 100644
--- a/Cronet/prebuilt/cronet_impl_common_java.jar
+++ b/Cronet/prebuilt/cronet_impl_common_java.jar
Binary files differ
diff --git a/Cronet/prebuilt/cronet_impl_native_java.jar b/Cronet/prebuilt/cronet_impl_native_java.jar
index 835d882..4cdd6f3 100644
--- a/Cronet/prebuilt/cronet_impl_native_java.jar
+++ b/Cronet/prebuilt/cronet_impl_native_java.jar
Binary files differ
diff --git a/Cronet/prebuilt/cronet_impl_platform_java.jar b/Cronet/prebuilt/cronet_impl_platform_java.jar
index 8394ddb..6d6042f 100644
--- a/Cronet/prebuilt/cronet_impl_platform_java.jar
+++ b/Cronet/prebuilt/cronet_impl_platform_java.jar
Binary files differ
diff --git a/Cronet/prebuilt/libs/arm64-v8a/libcronet.107.0.5284.2.so b/Cronet/prebuilt/libs/arm64-v8a/libcronet.107.0.5284.2.so
new file mode 100644
index 0000000..7f2540a
--- /dev/null
+++ b/Cronet/prebuilt/libs/arm64-v8a/libcronet.107.0.5284.2.so
Binary files differ
diff --git a/Cronet/prebuilt/libs/arm64-v8a/libcronet.80.0.3986.0.so b/Cronet/prebuilt/libs/arm64-v8a/libcronet.80.0.3986.0.so
deleted file mode 100644
index 34809eb..0000000
--- a/Cronet/prebuilt/libs/arm64-v8a/libcronet.80.0.3986.0.so
+++ /dev/null
Binary files differ
diff --git a/Cronet/prebuilt/libs/armeabi-v7a/libcronet.107.0.5284.2.so b/Cronet/prebuilt/libs/armeabi-v7a/libcronet.107.0.5284.2.so
new file mode 100644
index 0000000..115429a
--- /dev/null
+++ b/Cronet/prebuilt/libs/armeabi-v7a/libcronet.107.0.5284.2.so
Binary files differ
diff --git a/Cronet/prebuilt/libs/armeabi-v7a/libcronet.80.0.3986.0.so b/Cronet/prebuilt/libs/armeabi-v7a/libcronet.80.0.3986.0.so
deleted file mode 100644
index 91bd63f..0000000
--- a/Cronet/prebuilt/libs/armeabi-v7a/libcronet.80.0.3986.0.so
+++ /dev/null
Binary files differ
diff --git a/Cronet/prebuilt/libs/x86/libcronet.107.0.5284.2.so b/Cronet/prebuilt/libs/x86/libcronet.107.0.5284.2.so
new file mode 100644
index 0000000..27923f7
--- /dev/null
+++ b/Cronet/prebuilt/libs/x86/libcronet.107.0.5284.2.so
Binary files differ
diff --git a/Cronet/prebuilt/libs/x86/libcronet.80.0.3986.0.so b/Cronet/prebuilt/libs/x86/libcronet.80.0.3986.0.so
deleted file mode 100644
index b97d497..0000000
--- a/Cronet/prebuilt/libs/x86/libcronet.80.0.3986.0.so
+++ /dev/null
Binary files differ
diff --git a/Cronet/prebuilt/libs/x86_64/libcronet.107.0.5284.2.so b/Cronet/prebuilt/libs/x86_64/libcronet.107.0.5284.2.so
new file mode 100644
index 0000000..803e5cd
--- /dev/null
+++ b/Cronet/prebuilt/libs/x86_64/libcronet.107.0.5284.2.so
Binary files differ
diff --git a/Cronet/prebuilt/libs/x86_64/libcronet.80.0.3986.0.so b/Cronet/prebuilt/libs/x86_64/libcronet.80.0.3986.0.so
deleted file mode 100644
index 14c6281..0000000
--- a/Cronet/prebuilt/libs/x86_64/libcronet.80.0.3986.0.so
+++ /dev/null
Binary files differ
diff --git a/Cronet/tests/apitest/Android.bp b/Cronet/tests/apitest/Android.bp
index 9f1c007..e71c707 100644
--- a/Cronet/tests/apitest/Android.bp
+++ b/Cronet/tests/apitest/Android.bp
@@ -31,13 +31,13 @@
"android.test.base",
"android.test.mock",
"androidx.annotation_annotation",
- "org.chromium.net.cronet.stubs",
+ "framework-cronet",
],
}
android_test {
name: "CronetApiTest",
- platform_apis: true,
+ sdk_version: "test_current",
test_suites: ["device-tests"],
certificate: "platform",
static_libs: [
diff --git a/Cronet/tests/apitest/AndroidManifest.xml b/Cronet/tests/apitest/AndroidManifest.xml
index 052ac8f..db0f0b3 100644
--- a/Cronet/tests/apitest/AndroidManifest.xml
+++ b/Cronet/tests/apitest/AndroidManifest.xml
@@ -25,7 +25,7 @@
<application>
<uses-library android:name="android.test.runner" />
- <uses-library android:name="org.chromium.net.cronet" />
+ <uses-library android:name="framework-cronet" />
</application>
<instrumentation
diff --git a/Tethering/apex/Android.bp b/Tethering/apex/Android.bp
index 8cf46ef..c590850 100644
--- a/Tethering/apex/Android.bp
+++ b/Tethering/apex/Android.bp
@@ -54,6 +54,7 @@
name: "com.android.tethering",
defaults: [
"ConnectivityApexDefaults",
+ "CronetApexDefaults",
"r-launched-apex-module",
],
compile_multilib: "both",
diff --git a/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java b/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
index 2c6054d..ffcea4e 100644
--- a/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
+++ b/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
@@ -76,8 +76,7 @@
.setUpstreamType(UpstreamType.UT_UNKNOWN)
.setErrorCode(ErrorCode.EC_NO_ERROR)
.setUpstreamEvents(UpstreamEvents.newBuilder())
- .setDurationMillis(0)
- .build();
+ .setDurationMillis(0);
mBuilderMap.put(downstreamType, statsBuilder);
}
diff --git a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
index c61b6eb..f0f9a31 100644
--- a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
+++ b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
@@ -76,7 +76,7 @@
import android.net.TetheringManager.TetheringEventCallback;
import android.net.TetheringManager.TetheringRequest;
import android.net.TetheringTester.TetheredDevice;
-import android.net.cts.util.CtsNetUtils;;
+import android.net.cts.util.CtsNetUtils;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java
index 0bd6380..225fed7 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java
@@ -138,6 +138,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.Map;
@RunWith(AndroidJUnit4.class)
@SmallTest
@@ -195,13 +196,11 @@
UPSTREAM_IFACE2, UPSTREAM_IFINDEX2, MacAddress.fromString("44:55:66:00:00:0c"),
NetworkStackConstants.ETHER_MTU);
- private static final HashMap<Integer, UpstreamInformation> UPSTREAM_INFORMATIONS =
- new HashMap<Integer, UpstreamInformation>() {{
- put(UPSTREAM_IFINDEX, new UpstreamInformation(UPSTREAM_IFACE_PARAMS,
- PUBLIC_ADDR, NetworkCapabilities.TRANSPORT_CELLULAR, TEST_NET_ID));
- put(UPSTREAM_IFINDEX2, new UpstreamInformation(UPSTREAM_IFACE_PARAMS2,
- PUBLIC_ADDR2, NetworkCapabilities.TRANSPORT_WIFI, TEST_NET_ID2));
- }};
+ private static final Map<Integer, UpstreamInformation> UPSTREAM_INFORMATIONS = Map.of(
+ UPSTREAM_IFINDEX, new UpstreamInformation(UPSTREAM_IFACE_PARAMS,
+ PUBLIC_ADDR, NetworkCapabilities.TRANSPORT_CELLULAR, TEST_NET_ID),
+ UPSTREAM_IFINDEX2, new UpstreamInformation(UPSTREAM_IFACE_PARAMS2,
+ PUBLIC_ADDR2, NetworkCapabilities.TRANSPORT_WIFI, TEST_NET_ID2));
private static final ClientInfo CLIENT_INFO_A = new ClientInfo(DOWNSTREAM_IFINDEX,
DOWNSTREAM_MAC, PRIVATE_ADDR, MAC_A);
diff --git a/common/src/com/android/net/module/util/bpf/Tether4Key.java b/common/src/com/android/net/module/util/bpf/Tether4Key.java
index 8273e6a..738256a 100644
--- a/common/src/com/android/net/module/util/bpf/Tether4Key.java
+++ b/common/src/com/android/net/module/util/bpf/Tether4Key.java
@@ -75,7 +75,7 @@
Inet4Address.getByAddress(src4), Inet4Address.getByAddress(dst4),
Short.toUnsignedInt((short) srcPort), Short.toUnsignedInt((short) dstPort));
} catch (UnknownHostException | IllegalArgumentException e) {
- return String.format("Invalid IP address", e);
+ return "Invalid IP address" + e;
}
}
}
diff --git a/common/src/com/android/net/module/util/bpf/Tether4Value.java b/common/src/com/android/net/module/util/bpf/Tether4Value.java
index 74fdda2..449c1da 100644
--- a/common/src/com/android/net/module/util/bpf/Tether4Value.java
+++ b/common/src/com/android/net/module/util/bpf/Tether4Value.java
@@ -91,7 +91,7 @@
Short.toUnsignedInt((short) srcPort), Short.toUnsignedInt((short) dstPort),
lastUsed);
} catch (UnknownHostException | IllegalArgumentException e) {
- return String.format("Invalid IP address", e);
+ return "Invalid IP address" + e;
}
}
}
diff --git a/framework-t/src/android/net/IpSecAlgorithm.java b/framework-t/src/android/net/IpSecAlgorithm.java
index 10a22ac..a39a80d 100644
--- a/framework-t/src/android/net/IpSecAlgorithm.java
+++ b/framework-t/src/android/net/IpSecAlgorithm.java
@@ -488,4 +488,4 @@
&& Arrays.equals(lhs.mKey, rhs.mKey)
&& lhs.mTruncLenBits == rhs.mTruncLenBits);
}
-};
+}
diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java
index 547b4ba..b5c3c64 100644
--- a/framework/src/android/net/ConnectivityManager.java
+++ b/framework/src/android/net/ConnectivityManager.java
@@ -4080,7 +4080,7 @@
}
}
- private class CallbackHandler extends Handler {
+ private static class CallbackHandler extends Handler {
private static final String TAG = "ConnectivityManager.CallbackHandler";
private static final boolean DBG = false;
@@ -4095,7 +4095,10 @@
@Override
public void handleMessage(Message message) {
if (message.what == EXPIRE_LEGACY_REQUEST) {
- expireRequest((NetworkCapabilities) message.obj, message.arg1);
+ // the sInstance can't be null because to send this message a ConnectivityManager
+ // instance must have been created prior to creating the thread on which this
+ // Handler is running.
+ sInstance.expireRequest((NetworkCapabilities) message.obj, message.arg1);
return;
}
diff --git a/service/src/com/android/server/connectivity/ClatCoordinator.java b/service/src/com/android/server/connectivity/ClatCoordinator.java
index 42b3827..5d04632 100644
--- a/service/src/com/android/server/connectivity/ClatCoordinator.java
+++ b/service/src/com/android/server/connectivity/ClatCoordinator.java
@@ -899,7 +899,7 @@
}
/**
- * Dump the cordinator information.
+ * Dump the coordinator information.
*
* @param pw print writer.
*/
@@ -907,7 +907,7 @@
// TODO: move map dump to a global place to avoid duplicate dump while there are two or
// more IPv6 only networks.
if (isStarted()) {
- pw.println("CLAT tracker: " + mClatdTracker.toString());
+ pw.println("CLAT tracker: " + mClatdTracker);
pw.println("Forwarding rules:");
pw.increaseIndent();
dumpBpfIngress(pw);
diff --git a/tests/cts/net/src/android/net/cts/DscpPolicyTest.kt b/tests/cts/net/src/android/net/cts/DscpPolicyTest.kt
index 8940075..db13c49 100644
--- a/tests/cts/net/src/android/net/cts/DscpPolicyTest.kt
+++ b/tests/cts/net/src/android/net/cts/DscpPolicyTest.kt
@@ -105,6 +105,7 @@
private const val TAG = "DscpPolicyTest"
private const val PACKET_TIMEOUT_MS = 2_000L
+private const val IPV6_ADDRESS_WAIT_TIME_MS = 10_000L
@AppModeFull(reason = "Instant apps cannot create test networks")
@RunWith(AndroidJUnit4::class)
@@ -222,7 +223,7 @@
var inet6Addr: Inet6Address? = null
val onLinkPrefix = raResponder.prefix
val startTime = SystemClock.elapsedRealtime()
- while (SystemClock.elapsedRealtime() - startTime < PACKET_TIMEOUT_MS) {
+ while (SystemClock.elapsedRealtime() - startTime < IPV6_ADDRESS_WAIT_TIME_MS) {
SystemClock.sleep(50 /* ms */)
val sock = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)
try {
diff --git a/tests/unit/java/com/android/server/ConnectivityServiceTest.java b/tests/unit/java/com/android/server/ConnectivityServiceTest.java
index 65e0b10..2d35330 100755
--- a/tests/unit/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/unit/java/com/android/server/ConnectivityServiceTest.java
@@ -2689,7 +2689,7 @@
final TestNetworkCallback generalCb = new TestNetworkCallback();
final TestNetworkCallback defaultCb = new TestNetworkCallback();
mCm.registerNetworkCallback(
- new NetworkRequest.Builder().addTransportType(transport | transport).build(),
+ new NetworkRequest.Builder().addTransportType(transport).build(),
generalCb);
mCm.registerDefaultNetworkCallback(defaultCb);
@@ -2944,7 +2944,8 @@
@Test
public void testRequiresValidation() {
- assertTrue(NetworkMonitorUtils.isValidationRequired(false /* isVpnValidationRequired */,
+ assertTrue(NetworkMonitorUtils.isValidationRequired(false /* isDunValidationRequired */,
+ false /* isVpnValidationRequired */,
mCm.getDefaultRequest().networkCapabilities));
}
@@ -4755,6 +4756,81 @@
return new NetworkRequest.Builder().addTransportType(TRANSPORT_WIFI);
}
+ // A NetworkSpecifier subclass that matches all networks but must not be visible to apps.
+ static class ConfidentialMatchAllNetworkSpecifier extends NetworkSpecifier implements
+ Parcelable {
+ public static final Parcelable.Creator<ConfidentialMatchAllNetworkSpecifier> CREATOR =
+ new Parcelable.Creator<ConfidentialMatchAllNetworkSpecifier>() {
+ public ConfidentialMatchAllNetworkSpecifier createFromParcel(Parcel in) {
+ return new ConfidentialMatchAllNetworkSpecifier();
+ }
+
+ public ConfidentialMatchAllNetworkSpecifier[] newArray(int size) {
+ return new ConfidentialMatchAllNetworkSpecifier[size];
+ }
+ };
+ @Override
+ public boolean canBeSatisfiedBy(NetworkSpecifier other) {
+ return true;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {}
+
+ @Override
+ public NetworkSpecifier redact() {
+ return null;
+ }
+ }
+
+ // A network specifier that matches either another LocalNetworkSpecifier with the same
+ // string or a ConfidentialMatchAllNetworkSpecifier, and can be passed to apps as is.
+ static class LocalStringNetworkSpecifier extends NetworkSpecifier implements Parcelable {
+ public static final Parcelable.Creator<LocalStringNetworkSpecifier> CREATOR =
+ new Parcelable.Creator<LocalStringNetworkSpecifier>() {
+ public LocalStringNetworkSpecifier createFromParcel(Parcel in) {
+ return new LocalStringNetworkSpecifier(in);
+ }
+
+ public LocalStringNetworkSpecifier[] newArray(int size) {
+ return new LocalStringNetworkSpecifier[size];
+ }
+ };
+ private String mString;
+
+ LocalStringNetworkSpecifier(String string) {
+ mString = string;
+ }
+
+ LocalStringNetworkSpecifier(Parcel in) {
+ mString = in.readString();
+ }
+
+ @Override
+ public boolean canBeSatisfiedBy(NetworkSpecifier other) {
+ if (other instanceof LocalStringNetworkSpecifier) {
+ return TextUtils.equals(mString,
+ ((LocalStringNetworkSpecifier) other).mString);
+ }
+ if (other instanceof ConfidentialMatchAllNetworkSpecifier) return true;
+ return false;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(mString);
+ }
+ }
+
/**
* Verify request matching behavior with network specifiers.
*
@@ -4764,56 +4840,6 @@
*/
@Test
public void testNetworkSpecifier() throws Exception {
- // A NetworkSpecifier subclass that matches all networks but must not be visible to apps.
- class ConfidentialMatchAllNetworkSpecifier extends NetworkSpecifier implements
- Parcelable {
- @Override
- public boolean canBeSatisfiedBy(NetworkSpecifier other) {
- return true;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {}
-
- @Override
- public NetworkSpecifier redact() {
- return null;
- }
- }
-
- // A network specifier that matches either another LocalNetworkSpecifier with the same
- // string or a ConfidentialMatchAllNetworkSpecifier, and can be passed to apps as is.
- class LocalStringNetworkSpecifier extends NetworkSpecifier implements Parcelable {
- private String mString;
-
- LocalStringNetworkSpecifier(String string) {
- mString = string;
- }
-
- @Override
- public boolean canBeSatisfiedBy(NetworkSpecifier other) {
- if (other instanceof LocalStringNetworkSpecifier) {
- return TextUtils.equals(mString,
- ((LocalStringNetworkSpecifier) other).mString);
- }
- if (other instanceof ConfidentialMatchAllNetworkSpecifier) return true;
- return false;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
- @Override
- public void writeToParcel(Parcel dest, int flags) {}
- }
-
-
NetworkRequest rEmpty1 = newWifiRequestBuilder().build();
NetworkRequest rEmpty2 = newWifiRequestBuilder().setNetworkSpecifier((String) null).build();
NetworkRequest rEmpty3 = newWifiRequestBuilder().setNetworkSpecifier("").build();
@@ -4897,6 +4923,29 @@
return mContext.getAttributionTag();
}
+ static class NonParcelableSpecifier extends NetworkSpecifier {
+ @Override
+ public boolean canBeSatisfiedBy(NetworkSpecifier other) {
+ return false;
+ }
+ }
+ static class ParcelableSpecifier extends NonParcelableSpecifier implements Parcelable {
+ public static final Parcelable.Creator<NonParcelableSpecifier> CREATOR =
+ new Parcelable.Creator<NonParcelableSpecifier>() {
+ public NonParcelableSpecifier createFromParcel(Parcel in) {
+ return new NonParcelableSpecifier();
+ }
+
+ public NonParcelableSpecifier[] newArray(int size) {
+ return new NonParcelableSpecifier[size];
+ }
+ };
+ @Override public int describeContents() {
+ return 0;
+ }
+ @Override public void writeToParcel(Parcel p, int flags) {}
+ }
+
@Test
public void testInvalidNetworkSpecifier() {
assertThrows(IllegalArgumentException.class, () -> {
@@ -4914,17 +4963,6 @@
mContext.getPackageName(), getAttributionTag());
});
- class NonParcelableSpecifier extends NetworkSpecifier {
- @Override
- public boolean canBeSatisfiedBy(NetworkSpecifier other) {
- return false;
- }
- };
- class ParcelableSpecifier extends NonParcelableSpecifier implements Parcelable {
- @Override public int describeContents() { return 0; }
- @Override public void writeToParcel(Parcel p, int flags) {}
- }
-
final NetworkRequest.Builder builder =
new NetworkRequest.Builder().addTransportType(TRANSPORT_ETHERNET);
assertThrows(ClassCastException.class, () -> {
@@ -8277,6 +8315,7 @@
// VPN networks do not satisfy the default request and are automatically validated
// by NetworkMonitor
assertFalse(NetworkMonitorUtils.isValidationRequired(
+ false /* isDunValidationRequired */,
NetworkAgentConfigShimImpl.newInstance(mMockVpn.getNetworkAgentConfig())
.isVpnValidationRequired(),
mMockVpn.getAgent().getNetworkCapabilities()));
@@ -8429,6 +8468,7 @@
assertTrue(nc.hasCapability(NET_CAPABILITY_INTERNET));
assertFalse(NetworkMonitorUtils.isValidationRequired(
+ false /* isDunValidationRequired */,
NetworkAgentConfigShimImpl.newInstance(mMockVpn.getNetworkAgentConfig())
.isVpnValidationRequired(),
mMockVpn.getAgent().getNetworkCapabilities()));
@@ -16909,7 +16949,7 @@
// Wi-Fi disconnecting (e.g., because the capability change to wifiNc2 caused it
// to stop satisfying the default request).
mCellNetworkAgent.disconnect();
- mDefaultNetworkCallback.expectCallback(CallbackEntry.LOST, mCellNetworkAgent);
+ mDefaultNetworkCallback.expect(CallbackEntry.LOST, mCellNetworkAgent);
mDefaultNetworkCallback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
}
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 72674bd..a86eea4 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -2055,20 +2055,28 @@
// GN: //build/android:build_config_gen
genrule {
name: "cronet_aml_build_android_build_config_gen",
- cmd: "$(location build/android/gyp/gcc_preprocess.py) --include-dirs " +
- "[\"../../\", \"gen\"] " +
- "--output " +
- "gen/build/android/build_config_gen.srcjar " +
- "--define " +
- "_ENABLE_ASSERTS " +
- "../../build/android/java/templates/BuildConfig.template",
+ tools: [
+ "soong_zip",
+ ],
+ cmd: "echo " +
+ "\"package org.chromium.build;\n " +
+ "public class BuildConfig {\n " +
+ "public static boolean IS_MULTIDEX_ENABLED ;\n " +
+ "public static boolean ENABLE_ASSERTS = true;\n " +
+ "public static boolean IS_UBSAN ;\n " +
+ "public static boolean IS_CHROME_BRANDED ;\n " +
+ "public static int R_STRING_PRODUCT_VERSION ;\n " +
+ "public static int MIN_SDK_VERSION = 1;\n " +
+ "public static boolean BUNDLES_SUPPORTED ;\n " +
+ "public static boolean IS_INCREMENTAL_INSTALL ;\n " +
+ "public static boolean ISOLATED_SPLITS_ENABLED ;\n " +
+ "public static boolean IS_FOR_TEST ;\n " +
+ "}\n\" " +
+ "> $(genDir)/BuildConfig.java && " +
+ "$(location soong_zip) -o $(out) -srcjar -f $(genDir)/BuildConfig.java",
out: [
"build/android/build_config_gen.srcjar",
],
- tool_files: [
- "build/android/gyp/gcc_preprocess.py",
- "build/android/java/templates/BuildConfig.template",
- ],
}
// GN: //build/android:build_java__build_config_crbug_908819
@@ -2858,7 +2866,7 @@
genrule {
name: "cronet_aml_build_android_native_libraries_gen",
cmd: "$(location build/android/gyp/write_native_libraries_java.py) --output " +
- "gen/build/android/native_libraries_gen.srcjar " +
+ "$(out) " +
"--cpu-family " +
"CPU_FAMILY_X86",
out: [
@@ -3080,6 +3088,57 @@
name: "cronet_aml_ipc_param_traits",
}
+// GN: //net/base/registry_controlled_domains:registry_controlled_domains
+genrule {
+ name: "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
+ cmd: "$(location net/tools/dafsa/make_dafsa.py) --reverse " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names.gperf) " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names-reversed-inc.cc) " +
+ "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+ "--reverse " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf) " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1-reversed-inc.cc) " +
+ "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+ "--reverse " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2.gperf) " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2-reversed-inc.cc) " +
+ "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+ "--reverse " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3.gperf) " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3-reversed-inc.cc) " +
+ "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+ "--reverse " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4.gperf) " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4-reversed-inc.cc) " +
+ "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+ "--reverse " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5.gperf) " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5-reversed-inc.cc) " +
+ "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+ "--reverse " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6.gperf) " +
+ "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6-reversed-inc.cc)",
+ out: [
+ "net/base/registry_controlled_domains/effective_tld_names-reversed-inc.cc",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest1-reversed-inc.cc",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest2-reversed-inc.cc",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest3-reversed-inc.cc",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest4-reversed-inc.cc",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest5-reversed-inc.cc",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest6-reversed-inc.cc",
+ ],
+ tool_files: [
+ "net/base/registry_controlled_domains/effective_tld_names.gperf",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest2.gperf",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest3.gperf",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest4.gperf",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest5.gperf",
+ "net/base/registry_controlled_domains/effective_tld_names_unittest6.gperf",
+ "net/tools/dafsa/make_dafsa.py",
+ ],
+}
+
// GN: //net:buildflags
genrule {
name: "cronet_aml_net_buildflags",
@@ -3154,17 +3213,20 @@
srcs: [
"net/cert/root_store.proto",
],
+ tools: [
+ "aprotoc",
+ ],
cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) root_store.proto " +
"--protoc " +
- "./clang_x64/protoc " +
+ "$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/cert " +
+ "`dirname $(location net/cert/root_store.proto)` " +
"--cc-out-dir " +
"clang_x64/gen/net/cert/root_store_proto_full/ " +
"--py-out-dir " +
- "clang_x64/pyproto/net/cert/root_store_proto_full/",
+ "$(genDir)/clang_x64/pyproto/net/cert/root_store_proto_full/",
out: [
- "//out/test/clang_x64/pyproto/net/cert/root_store_proto_full/root_store_pb2.py",
+ "clang_x64/pyproto/net/cert/root_store_proto_full/root_store_pb2.py",
"net/cert/root_store_proto_full/root_store.pb.cc",
"net/cert/root_store_proto_full/root_store.pb.h",
],
@@ -3361,19 +3423,22 @@
srcs: [
"net/base/isolation_info.proto",
],
+ tools: [
+ "aprotoc",
+ ],
cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) isolation_info.proto " +
"--protoc " +
- "./clang_x64/protoc " +
+ "$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/base " +
+ "`dirname $(location net/base/isolation_info.proto)` " +
"--cc-out-dir " +
- "gen/net/base " +
+ "$(genDir)/net/base " +
"--py-out-dir " +
- "pyproto/net/base",
+ "$(genDir)/pyproto/net/base",
out: [
- "//out/test/pyproto/net/base/isolation_info_pb2.py",
"net/base/isolation_info.pb.cc",
"net/base/isolation_info.pb.h",
+ "pyproto/net/base/isolation_info_pb2.py",
],
tool_files: [
"tools/protoc_wrapper/protoc_wrapper.py",
@@ -4137,26 +4202,30 @@
genrule {
name: "cronet_aml_net_net_nqe_proto_gen",
srcs: [
+ "net/base/net_export.h",
"net/nqe/proto/network_id_proto.proto",
],
+ tools: [
+ "aprotoc",
+ ],
cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) network_id_proto.proto " +
"--protoc " +
- "./clang_x64/protoc " +
+ "$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/nqe/proto " +
+ "`dirname $(location net/nqe/proto/network_id_proto.proto)` " +
"--cc-out-dir " +
- "gen/net/nqe/proto " +
+ "$(genDir)/net/nqe/proto " +
"--cc-options " +
- "dllexport_decl " +
- "NET_EXPORT_PRIVATE: " +
+ "dllexport_decl=NET_EXPORT_PRIVATE: " +
+ " " +
"--include " +
- "net/base/net_export.h " +
+ "$(location net/base/net_export.h) " +
"--py-out-dir " +
- "pyproto/net/nqe/proto",
+ "$(genDir)/pyproto/net/nqe/proto",
out: [
- "//out/test/pyproto/net/nqe/proto/network_id_proto_pb2.py",
"net/nqe/proto/network_id_proto.pb.cc",
"net/nqe/proto/network_id_proto.pb.h",
+ "pyproto/net/nqe/proto/network_id_proto_pb2.py",
],
tool_files: [
"tools/protoc_wrapper/protoc_wrapper.py",
@@ -4356,36 +4425,40 @@
genrule {
name: "cronet_aml_net_third_party_quiche_net_quic_proto_gen",
srcs: [
+ "base/component_export.h",
"net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.proto",
"net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.proto",
"net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.proto",
],
+ tools: [
+ "aprotoc",
+ ],
cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) quiche/quic/core/proto/cached_network_parameters.proto " +
"quiche/quic/core/proto/crypto_server_config.proto " +
"quiche/quic/core/proto/source_address_token.proto " +
"--protoc " +
- "./clang_x64/protoc " +
+ "$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/third_party/quiche/src " +
+ "`dirname $(location net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.proto)`/../../../../ " +
"--cc-out-dir " +
- "gen/net/third_party/quiche/src " +
+ "$(genDir)/net/third_party/quiche/src " +
"--cc-options " +
- "dllexport_decl " +
- "COMPONENT_EXPORT(QUICHE): " +
+ "dllexport_decl=COMPONENT_EXPORT(QUICHE): " +
+ " " +
"--include " +
- "base/component_export.h " +
+ "$(location base/component_export.h) " +
"--py-out-dir " +
- "pyproto/net/third_party/quiche/src",
+ "$(genDir)/pyproto/net/third_party/quiche/src",
out: [
- "//out/test/pyproto/net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters_pb2.py",
- "//out/test/pyproto/net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config_pb2.py",
- "//out/test/pyproto/net/third_party/quiche/src/quiche/quic/core/proto/source_address_token_pb2.py",
"net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.pb.cc",
"net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.pb.h",
"net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.pb.cc",
"net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.pb.h",
"net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.pb.cc",
"net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.pb.h",
+ "pyproto/net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters_pb2.py",
+ "pyproto/net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config_pb2.py",
+ "pyproto/net/third_party/quiche/src/quiche/quic/core/proto/source_address_token_pb2.py",
],
tool_files: [
"tools/protoc_wrapper/protoc_wrapper.py",
@@ -4445,26 +4518,30 @@
genrule {
name: "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen",
srcs: [
+ "net/base/net_export.h",
"net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto",
],
+ tools: [
+ "aprotoc",
+ ],
cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) send_algorithm_test_result.proto " +
"--protoc " +
- "./clang_x64/protoc " +
+ "$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/third_party/quiche/src/quiche/quic/test_tools " +
+ "`dirname $(location net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto)` " +
"--cc-out-dir " +
- "gen/net/third_party/quiche/src/quiche/quic/test_tools " +
+ "$(genDir)/net/third_party/quiche/src/quiche/quic/test_tools " +
"--cc-options " +
- "dllexport_decl " +
- "NET_EXPORT_PRIVATE: " +
+ "dllexport_decl=NET_EXPORT_PRIVATE: " +
+ " " +
"--include " +
- "net/base/net_export.h " +
+ "$(location net/base/net_export.h) " +
"--py-out-dir " +
- "pyproto/net/third_party/quiche/src/quiche/quic/test_tools",
+ "$(genDir)/pyproto/net/third_party/quiche/src/quiche/quic/test_tools",
out: [
- "//out/test/pyproto/net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result_pb2.py",
"net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.pb.cc",
"net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.pb.h",
+ "pyproto/net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result_pb2.py",
],
tool_files: [
"tools/protoc_wrapper/protoc_wrapper.py",
@@ -9542,190 +9619,6 @@
cpp_std: "c++20",
}
-// GN: //third_party/protobuf:protoc
-cc_binary {
- name: "cronet_aml_third_party_protobuf_protoc",
- srcs: [
- ":cronet_aml_buildtools_third_party_libc___libc__",
- ":cronet_aml_buildtools_third_party_libc__abi_libc__abi",
- "third_party/protobuf/src/google/protobuf/compiler/main.cc",
- ],
- static_libs: [
- "cronet_aml_third_party_protobuf_protoc_lib",
- ],
- defaults: [
- "cronet_aml_defaults",
- ],
- cflags: [
- "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
- "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
- "-DCR_SYSROOT_KEY=20220331T153654Z-0",
- "-DDCHECK_ALWAYS_ON=1",
- "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
- "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
- "-DGOOGLE_PROTOBUF_NO_RTTI",
- "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
- "-DHAVE_PTHREAD",
- "-DLIBCXXABI_SILENT_TERMINATE",
- "-DLIBCXX_BUILDING_LIBCXXABI",
- "-DUSE_AURA=1",
- "-DUSE_OZONE=1",
- "-DUSE_UDEV",
- "-D_DEBUG",
- "-D_FILE_OFFSET_BITS=64",
- "-D_GNU_SOURCE",
- "-D_LARGEFILE64_SOURCE",
- "-D_LARGEFILE_SOURCE",
- "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
- "-D_LIBCPP_BUILDING_LIBRARY",
- "-D_LIBCPP_CONSTINIT=constinit",
- "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
- "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
- "-D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
- "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
- ],
- local_include_dirs: [
- "./",
- "buildtools/third_party/libc++/",
- "buildtools/third_party/libc++/trunk/include",
- "buildtools/third_party/libc++/trunk/src/",
- "buildtools/third_party/libc++abi/trunk/include",
- "third_party/protobuf/src/",
- "build/linux/debian_bullseye_amd64-sysroot/usr/include",
- ],
- cpp_std: "c++20",
-}
-
-// GN: //third_party/protobuf:protoc_lib
-cc_library_static {
- name: "cronet_aml_third_party_protobuf_protoc_lib",
- srcs: [
- "third_party/protobuf/src/google/protobuf/compiler/code_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc",
- "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
- "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_context.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_enum.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_extension.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_file.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_kotlin_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_map_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_message.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_message_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_message_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_service.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_string_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc",
- "third_party/protobuf/src/google/protobuf/compiler/js/js_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/js/well_known_types_embed.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
- "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
- "third_party/protobuf/src/google/protobuf/compiler/php/php_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/plugin.cc",
- "third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc",
- "third_party/protobuf/src/google/protobuf/compiler/python/python_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/python/python_helpers.cc",
- "third_party/protobuf/src/google/protobuf/compiler/python/python_pyi_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc",
- "third_party/protobuf/src/google/protobuf/compiler/subprocess.cc",
- "third_party/protobuf/src/google/protobuf/compiler/zip_writer.cc",
- ],
- static_libs: [
- "cronet_aml_third_party_protobuf_protobuf_full",
- ],
- defaults: [
- "cronet_aml_defaults",
- ],
- cflags: [
- "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
- "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
- "-DCR_SYSROOT_KEY=20220331T153654Z-0",
- "-DDCHECK_ALWAYS_ON=1",
- "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
- "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
- "-DGOOGLE_PROTOBUF_NO_RTTI",
- "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
- "-DHAVE_PTHREAD",
- "-DUSE_AURA=1",
- "-DUSE_OZONE=1",
- "-DUSE_UDEV",
- "-D_DEBUG",
- "-D_FILE_OFFSET_BITS=64",
- "-D_GNU_SOURCE",
- "-D_LARGEFILE64_SOURCE",
- "-D_LARGEFILE_SOURCE",
- "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
- "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
- "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
- "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
- ],
- local_include_dirs: [
- "./",
- "buildtools/third_party/libc++/",
- "buildtools/third_party/libc++/trunk/include",
- "buildtools/third_party/libc++abi/trunk/include",
- "third_party/protobuf/src/",
- "build/linux/debian_bullseye_amd64-sysroot/usr/include",
- ],
- cpp_std: "c++20",
-}
-
// GN: //third_party/zlib:zlib
cc_library_static {
name: "cronet_aml_third_party_zlib_zlib",
@@ -10084,11 +9977,11 @@
// GN: //tools/grit:grit_sources
genrule {
name: "cronet_aml_tools_grit_grit_sources",
- cmd: "$(location tools/grit/stamp_grit_sources.py) ../../tools/grit " +
- "obj/tools/grit/grit_sources.script.stamp " +
- "obj/tools/grit/grit_sources.d",
+ cmd: "python $(location tools/grit/stamp_grit_sources.py) `dirname $(location tools/grit/grit.py)` " +
+ "$(out) " +
+ "$(genDir)/grit_sources.d",
out: [
- "//out/test/obj/tools/grit/grit_sources.script.stamp",
+ "out/test/obj/tools/grit/grit_sources.script.stamp",
],
tool_files: [
"tools/grit/grit.py",
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 97eeb4d..f157b22 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -221,6 +221,8 @@
enable_uapi_headers,
'//src/profiling/memory:bionic_libc_platform_headers_on_android':
enable_bionic_libc_platform_headers_on_android,
+ '//third_party/protobuf:protoc':
+ lambda x: None,
}
# ----------------------------------------------------------------------------
@@ -667,6 +669,69 @@
blueprint.add_module(module)
+# HACK: Need to support build_cofig_gen flexibly instead of hardcoding
+# build_config_gen generates srcjar by executing gcc via gcc_preprocess.py but gcc is not
+# available in genrule sandbox. Also gcc path is not configurable.
+# Under the //net:net, gcc_preprocess.py is only used for build_config_gen.
+# So, for now, hardcoding BuildConfig.java and generates srcjar by soong_zip.
+def override_build_config_gen(module):
+ module.tool_files.clear()
+ module.tools.add("soong_zip")
+ cmd = [
+ "echo",
+ "\\\"package org.chromium.build;\\n",
+ "public class BuildConfig {\\n",
+ "public static boolean IS_MULTIDEX_ENABLED ;\\n",
+ "public static boolean ENABLE_ASSERTS = true;\\n",
+ "public static boolean IS_UBSAN ;\\n",
+ "public static boolean IS_CHROME_BRANDED ;\\n",
+ "public static int R_STRING_PRODUCT_VERSION ;\\n",
+ "public static int MIN_SDK_VERSION = 1;\\n",
+ "public static boolean BUNDLES_SUPPORTED ;\\n",
+ "public static boolean IS_INCREMENTAL_INSTALL ;\\n",
+ "public static boolean ISOLATED_SPLITS_ENABLED ;\\n",
+ "public static boolean IS_FOR_TEST ;\\n",
+ "}\\n\\\"",
+ "> $(genDir)/BuildConfig.java &&",
+ "$(location soong_zip) -o $(out) -srcjar -f $(genDir)/BuildConfig.java"
+ ]
+ NEWLINE = ' " +\n "'
+ module.cmd = NEWLINE.join(cmd)
+ return module
+
+def create_action_foreach_modules(blueprint, target):
+ """ The following assumes that rebase_path exists in the args.
+ The args of an action_foreach contains hints about which output files are generated
+ by which source files.
+ This is copied directly from the args
+ "gen/net/base/registry_controlled_domains/{{source_name_part}}-reversed-inc.cc"
+ So each source file will generate an output whose name is the {source_name-reversed-inc.cc}
+ """
+ new_args = []
+ for i, src in enumerate(sorted(target.sources)):
+ # don't add script arg for the first source -- create_action_module
+ # already does this.
+ if i != 0:
+ new_args.append('&& python3 $(location %s)' %
+ gn_utils.label_to_path(target.script))
+ for arg in target.args:
+ if '{{source}}' in arg:
+ new_args.append('$(location %s)' % (gn_utils.label_to_path(src)))
+ elif '{{source_name_part}}' in arg:
+ source_name_part = src.split("/")[-1] # Get the file name only
+ source_name_part = source_name_part.split(".")[0] # Remove the extension (Ex: .cc)
+ file_name = arg.replace('{{source_name_part}}', source_name_part).split("/")[-1]
+ # file_name represent the output file name. But we need the whole path
+ # This can be found from target.outputs.
+ for out in target.outputs:
+ if out.endswith(file_name):
+ new_args.append('$(location %s)' % out)
+ else:
+ new_args.append(arg)
+
+ target.args = new_args
+ return create_action_module(blueprint, target)
+
def create_action_module(blueprint, target):
bp_module_name = label_to_module_name(target.name)
module = Module('genrule', bp_module_name, target.name)
@@ -777,6 +842,50 @@
# wrap filename in \"$(location filename)\"
args = ['$(location %s)' % arg for arg in args]
target.args[i + 1] = '[%s]' % ', '.join(args)
+ elif target.script == "//build/android/gyp/write_native_libraries_java.py":
+ for i, val in enumerate(target.args):
+ if val == '--output':
+ target.args[i + 1] = '$(out)'
+ elif target.script == "//tools/grit/stamp_grit_sources.py":
+ target.outputs = [re.sub('^\/\/', '', out) for out in target.outputs]
+ # Directory that contains grit scripts
+ target.args[0] = '`dirname $(location tools/grit/grit.py)`'
+ # Path to the stamp file
+ target.args[1] = '$(out)'
+ # Script tries to create args[2] file but this is not in the output.
+ # Specifying file under $(genDir) so that parent directory exists.
+ # If this file is used by other module, we may need to add this file to the outputs.
+ target.args[2] = '$(genDir)/' + target.args[2].split('/')[-1]
+ elif target.script == "//tools/protoc_wrapper/protoc_wrapper.py":
+ # Use protoc in the android
+ module.tools.add("aprotoc")
+ target.outputs = [re.sub('^//out/test/', '', out) for out in target.outputs]
+ for i, val in enumerate(target.args):
+ if val == '--protoc':
+ target.args[i + 1] = '$(location aprotoc)'
+ elif val == '--proto-in-dir':
+ # Proto files in the cmd is relative path from --proto-in-dir
+ # Proto files are specified as filenames without directory except net_quic_proto_gen
+ # So getting directory from source file
+ proto_file = gn_utils.label_to_path(sorted(list(target.sources))[0])
+ target.args[i + 1] = '`dirname $(location %s)`' % proto_file
+ # Adjusting path for net_quic_proto_gen
+ if target.name == "//net/third_party/quiche:net_quic_proto_gen":
+ target.args[i + 1] += '/../../../../'
+ elif val == '--cc-out-dir':
+ target.args[i + 1] = re.sub('^gen', '$(genDir)', target.args[i + 1])
+ elif val == 'dllexport_decl':
+ # Needs to be dllexport_decl=value format
+ target.args[i] += '=' + target.args[i+1]
+ target.args[i+1] = ''
+ elif val == '--include':
+ # This file can be got from filegroup this target depends on, but currently we don't add .h
+ # files to the srcs. So far this is the only case .h files need to be added to the srcs.
+ # So, for now, adding specific for this target.
+ module.srcs.add(target.args[i+1])
+ target.args[i + 1] = '$(location %s)' % target.args[i + 1]
+ elif val == "--py-out-dir":
+ target.args[i + 1] = '$(genDir)/' + target.args[i + 1]
script = gn_utils.label_to_path(target.script)
module.tool_files.add(script)
@@ -822,6 +931,13 @@
module.srcs.remove(script)
module.out.update(target.outputs)
+
+ if target.name == "//build/android:build_config_gen":
+ module = override_build_config_gen(module)
+ elif target.script == "//tools/grit/stamp_grit_sources.py":
+ # stamp_grit_sources.py is not executable
+ module.cmd = "python " + module.cmd
+
blueprint.add_module(module)
return module
@@ -885,8 +1001,7 @@
else:
module = create_action_module(blueprint, target)
elif target.type == 'action_foreach':
- return None
- # Add basic support for action_foreach
+ module = create_action_foreach_modules(blueprint, target)
elif target.type == 'copy':
# TODO: careful now! copy targets are not supported yet, but this will stop
# traversing the dependency tree. For //base:base, this is not a big