Merge "EthernetTetheringTest: remove isEthernetTetheringSupported"
diff --git a/service/mdns/com/android/server/connectivity/mdns/MdnsAnyRecord.java b/service/mdns/com/android/server/connectivity/mdns/MdnsAnyRecord.java
new file mode 100644
index 0000000..fcfe9f7
--- /dev/null
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsAnyRecord.java
@@ -0,0 +1,46 @@
+/*
+ * 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.server.connectivity.mdns;
+
+import android.net.DnsResolver;
+
+import java.io.IOException;
+
+/**
+ * A mDNS "ANY" record, used in mDNS questions to query for any record type.
+ */
+public class MdnsAnyRecord extends MdnsRecord {
+
+    protected MdnsAnyRecord(String[] name, MdnsPacketReader reader) throws IOException {
+        super(name, TYPE_ANY, reader, true /* isQuestion */);
+    }
+
+    protected MdnsAnyRecord(String[] name, boolean unicast) {
+        super(name, TYPE_ANY, DnsResolver.CLASS_IN /* cls */,
+                0L /* receiptTimeMillis */, unicast /* cacheFlush */, 0L /* ttlMillis */);
+    }
+
+    @Override
+    protected void readData(MdnsPacketReader reader) throws IOException {
+        // No data to read
+    }
+
+    @Override
+    protected void writeData(MdnsPacketWriter writer) throws IOException {
+        // No data to write
+    }
+}
diff --git a/service/mdns/com/android/server/connectivity/mdns/MdnsInetAddressRecord.java b/service/mdns/com/android/server/connectivity/mdns/MdnsInetAddressRecord.java
index 47ac20e..dd8a526 100644
--- a/service/mdns/com/android/server/connectivity/mdns/MdnsInetAddressRecord.java
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsInetAddressRecord.java
@@ -43,7 +43,32 @@
      */
     public MdnsInetAddressRecord(String[] name, int type, MdnsPacketReader reader)
             throws IOException {
-        super(name, type, reader);
+        this(name, type, reader, false);
+    }
+
+    /**
+     * Constructs the {@link MdnsRecord}
+     *
+     * @param name       the service host name
+     * @param type       the type of record (either Type 'AAAA' or Type 'A')
+     * @param reader     the reader to read the record from.
+     * @param isQuestion whether the record is in the question section
+     */
+    public MdnsInetAddressRecord(String[] name, int type, MdnsPacketReader reader,
+            boolean isQuestion)
+            throws IOException {
+        super(name, type, reader, isQuestion);
+    }
+
+    public MdnsInetAddressRecord(String[] name, long receiptTimeMillis, boolean cacheFlush,
+                    long ttlMillis, InetAddress address) {
+        super(name, address instanceof Inet4Address ? TYPE_A : TYPE_AAAA,
+                MdnsConstants.QCLASS_INTERNET, receiptTimeMillis, cacheFlush, ttlMillis);
+        if (address instanceof Inet4Address) {
+            inet4Address = (Inet4Address) address;
+        } else {
+            inet6Address = (Inet6Address) address;
+        }
     }
 
     /** Returns the IPv6 address. */
@@ -127,4 +152,4 @@
                 && Objects.equals(inet4Address, ((MdnsInetAddressRecord) other).inet4Address)
                 && Objects.equals(inet6Address, ((MdnsInetAddressRecord) other).inet6Address);
     }
-}
\ No newline at end of file
+}
diff --git a/service/mdns/com/android/server/connectivity/mdns/MdnsPointerRecord.java b/service/mdns/com/android/server/connectivity/mdns/MdnsPointerRecord.java
index 9641a40..2c7b26b 100644
--- a/service/mdns/com/android/server/connectivity/mdns/MdnsPointerRecord.java
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsPointerRecord.java
@@ -29,7 +29,19 @@
     private String[] pointer;
 
     public MdnsPointerRecord(String[] name, MdnsPacketReader reader) throws IOException {
-        super(name, TYPE_PTR, reader);
+        this(name, reader, false);
+    }
+
+    public MdnsPointerRecord(String[] name, MdnsPacketReader reader, boolean isQuestion)
+            throws IOException {
+        super(name, TYPE_PTR, reader, isQuestion);
+    }
+
+    public MdnsPointerRecord(String[] name, long receiptTimeMillis, boolean cacheFlush,
+                    long ttlMillis, String[] pointer) {
+        super(name, TYPE_PTR, MdnsConstants.QCLASS_INTERNET, receiptTimeMillis, cacheFlush,
+                ttlMillis);
+        this.pointer = pointer;
     }
 
     /** Returns the pointer as an array of labels. */
diff --git a/service/mdns/com/android/server/connectivity/mdns/MdnsRecord.java b/service/mdns/com/android/server/connectivity/mdns/MdnsRecord.java
index 35f6da1..c0481a4 100644
--- a/service/mdns/com/android/server/connectivity/mdns/MdnsRecord.java
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsRecord.java
@@ -39,6 +39,11 @@
     public static final int TYPE_PTR = 0x000C;
     public static final int TYPE_SRV = 0x0021;
     public static final int TYPE_TXT = 0x0010;
+    public static final int TYPE_ANY = 0x00ff;
+
+    private static final int FLAG_CACHE_FLUSH = 0x8000;
+
+    public static final long RECEIPT_TIME_NOT_SENT = 0L;
 
     /** Status indicating that the record is current. */
     public static final int STATUS_OK = 0;
@@ -58,23 +63,52 @@
      * Constructs a new record with the given name and type.
      *
      * @param reader The reader to read the record from.
+     * @param isQuestion Whether the record was included in the questions part of the message.
+     * @throws IOException If an error occurs while reading the packet.
+     */
+    protected MdnsRecord(String[] name, int type, MdnsPacketReader reader, boolean isQuestion)
+            throws IOException {
+        this.name = name;
+        this.type = type;
+        cls = reader.readUInt16();
+        receiptTimeMillis = SystemClock.elapsedRealtime();
+
+        if (isQuestion) {
+            // Questions do not have TTL or data
+            ttlMillis = 0L;
+        } else {
+            ttlMillis = SECONDS.toMillis(reader.readUInt32());
+            int dataLength = reader.readUInt16();
+
+            reader.setLimit(dataLength);
+            readData(reader);
+            reader.clearLimit();
+        }
+    }
+
+    /**
+     * Constructs a new record with the given name and type.
+     *
+     * @param reader The reader to read the record from.
      * @throws IOException If an error occurs while reading the packet.
      */
     // call to readData(com.android.server.connectivity.mdns.MdnsPacketReader) not allowed on given
     // receiver.
     @SuppressWarnings("nullness:method.invocation.invalid")
     protected MdnsRecord(String[] name, int type, MdnsPacketReader reader) throws IOException {
+        this(name, type, reader, false);
+    }
+
+    /**
+     * Constructs a new record with the given properties.
+     */
+    protected MdnsRecord(String[] name, int type, int cls, long receiptTimeMillis,
+            boolean cacheFlush, long ttlMillis) {
         this.name = name;
         this.type = type;
-        cls = reader.readUInt16();
-        ttlMillis = SECONDS.toMillis(reader.readUInt32());
-        int dataLength = reader.readUInt16();
-
-        receiptTimeMillis = SystemClock.elapsedRealtime();
-
-        reader.setLimit(dataLength);
-        readData(reader);
-        reader.clearLimit();
+        this.cls = cls | (cacheFlush ? FLAG_CACHE_FLUSH : 0);
+        this.receiptTimeMillis = receiptTimeMillis;
+        this.ttlMillis = ttlMillis;
     }
 
     /**
@@ -126,13 +160,29 @@
         return type;
     }
 
+    /** Return the record's class. */
+    public final int getRecordClass() {
+        return cls & ~FLAG_CACHE_FLUSH;
+    }
+
+    /** Return whether the cache flush flag is set. */
+    public final boolean getCacheFlush() {
+        return (cls & FLAG_CACHE_FLUSH) != 0;
+    }
+
     /**
      * Returns the record's remaining TTL.
      *
+     * If the record was not sent yet (receipt time {@link #RECEIPT_TIME_NOT_SENT}), this is the
+     * original TTL of the record.
      * @param now The current system time.
      * @return The remaning TTL, in milliseconds.
      */
     public long getRemainingTTL(final long now) {
+        if (receiptTimeMillis == RECEIPT_TIME_NOT_SENT) {
+            return ttlMillis;
+        }
+
         long age = now - receiptTimeMillis;
         if (age > ttlMillis) {
             return 0;
@@ -187,6 +237,9 @@
 
     /** Gets the status of the record. */
     public int getStatus(final long now) {
+        if (receiptTimeMillis == RECEIPT_TIME_NOT_SENT) {
+            return STATUS_OK;
+        }
         final long age = now - receiptTimeMillis;
         if (age > ttlMillis) {
             return STATUS_EXPIRED;
diff --git a/service/mdns/com/android/server/connectivity/mdns/MdnsServiceRecord.java b/service/mdns/com/android/server/connectivity/mdns/MdnsServiceRecord.java
index c52d25e..ebd8b77 100644
--- a/service/mdns/com/android/server/connectivity/mdns/MdnsServiceRecord.java
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsServiceRecord.java
@@ -39,7 +39,23 @@
     private String[] serviceHost;
 
     public MdnsServiceRecord(String[] name, MdnsPacketReader reader) throws IOException {
-        super(name, TYPE_SRV, reader);
+        this(name, reader, false);
+    }
+
+    public MdnsServiceRecord(String[] name, MdnsPacketReader reader, boolean isQuestion)
+            throws IOException {
+        super(name, TYPE_SRV, reader, isQuestion);
+    }
+
+    public MdnsServiceRecord(String[] name, long receiptTimeMillis, boolean cacheFlush,
+                    long ttlMillis, int servicePriority, int serviceWeight, int servicePort,
+                    String[] serviceHost) {
+        super(name, TYPE_SRV, MdnsConstants.QCLASS_INTERNET, receiptTimeMillis, cacheFlush,
+                ttlMillis);
+        this.servicePriority = servicePriority;
+        this.serviceWeight = serviceWeight;
+        this.servicePort = servicePort;
+        this.serviceHost = serviceHost;
     }
 
     /** Returns the service's port number. */
diff --git a/service/mdns/com/android/server/connectivity/mdns/MdnsTextRecord.java b/service/mdns/com/android/server/connectivity/mdns/MdnsTextRecord.java
index 1e66589..4149dbe 100644
--- a/service/mdns/com/android/server/connectivity/mdns/MdnsTextRecord.java
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsTextRecord.java
@@ -33,7 +33,19 @@
     private List<TextEntry> entries;
 
     public MdnsTextRecord(String[] name, MdnsPacketReader reader) throws IOException {
-        super(name, TYPE_TXT, reader);
+        this(name, reader, false);
+    }
+
+    public MdnsTextRecord(String[] name, MdnsPacketReader reader, boolean isQuestion)
+            throws IOException {
+        super(name, TYPE_TXT, reader, isQuestion);
+    }
+
+    public MdnsTextRecord(String[] name, long receiptTimeMillis, boolean cacheFlush, long ttlMillis,
+            List<TextEntry> entries) {
+        super(name, TYPE_TXT, MdnsConstants.QCLASS_INTERNET, receiptTimeMillis, cacheFlush,
+                ttlMillis);
+        this.entries = entries;
     }
 
     /** Returns the list of strings. */
diff --git a/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordTests.java b/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordTests.java
index 9fc4674..9746a35 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordTests.java
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordTests.java
@@ -79,14 +79,7 @@
         Inet4Address addr = record.getInet4Address();
         assertEquals("/10.1.2.3", addr.toString());
 
-        // Encode
-        MdnsPacketWriter writer = new MdnsPacketWriter(MAX_PACKET_SIZE);
-        record.write(writer, record.getReceiptTime());
-
-        packet = writer.getPacket(MULTICAST_IPV4_ADDRESS);
-        byte[] dataOut = packet.getData();
-
-        String dataOutText = HexDump.dumpHexString(dataOut, 0, packet.getLength());
+        String dataOutText = toHex(record);
         Log.d(TAG, dataOutText);
 
         assertEquals(dataInText, dataOutText);
@@ -123,14 +116,7 @@
         Inet6Address addr = record.getInet6Address();
         assertEquals("/aabb:ccdd:1122:3344:a0b0:c0d0:1020:3040", addr.toString());
 
-        // Encode
-        MdnsPacketWriter writer = new MdnsPacketWriter(MAX_PACKET_SIZE);
-        record.write(writer, record.getReceiptTime());
-
-        packet = writer.getPacket(MULTICAST_IPV6_ADDRESS);
-        byte[] dataOut = packet.getData();
-
-        String dataOutText = HexDump.dumpHexString(dataOut, 0, packet.getLength());
+        String dataOutText = toHex(record);
         Log.d(TAG, dataOutText);
 
         assertEquals(dataInText, dataOutText);
@@ -167,14 +153,7 @@
         Inet4Address addr = record.getInet4Address();
         assertEquals("/16.32.48.64", addr.toString());
 
-        // Encode
-        MdnsPacketWriter writer = new MdnsPacketWriter(MAX_PACKET_SIZE);
-        record.write(writer, record.getReceiptTime());
-
-        packet = writer.getPacket(MULTICAST_IPV4_ADDRESS);
-        byte[] dataOut = packet.getData();
-
-        String dataOutText = HexDump.dumpHexString(dataOut, 0, packet.getLength());
+        String dataOutText = toHex(record);
         Log.d(TAG, dataOutText);
 
         final byte[] expectedDataIn =
@@ -215,14 +194,7 @@
         assertFalse(record.hasSubtype());
         assertNull(record.getSubtype());
 
-        // Encode
-        MdnsPacketWriter writer = new MdnsPacketWriter(MAX_PACKET_SIZE);
-        record.write(writer, record.getReceiptTime());
-
-        packet = writer.getPacket(MULTICAST_IPV4_ADDRESS);
-        byte[] dataOut = packet.getData();
-
-        String dataOutText = HexDump.dumpHexString(dataOut, 0, packet.getLength());
+        String dataOutText = toHex(record);
         Log.d(TAG, dataOutText);
 
         assertEquals(dataInText, dataOutText);
@@ -263,14 +235,35 @@
         assertEquals(1, record.getServicePriority());
         assertEquals(255, record.getServiceWeight());
 
-        // Encode
-        MdnsPacketWriter writer = new MdnsPacketWriter(MAX_PACKET_SIZE);
-        record.write(writer, record.getReceiptTime());
+        String dataOutText = toHex(record);
+        Log.d(TAG, dataOutText);
 
-        packet = writer.getPacket(MULTICAST_IPV4_ADDRESS);
-        byte[] dataOut = packet.getData();
+        assertEquals(dataInText, dataOutText);
+    }
 
-        String dataOutText = HexDump.dumpHexString(dataOut, 0, packet.getLength());
+    @Test
+    public void testAnyRecord() throws IOException {
+        final byte[] dataIn = HexDump.hexStringToByteArray(
+                "047465737407616E64726F696403636F6D0000FF0001000000000000");
+        assertNotNull(dataIn);
+        String dataInText = HexDump.dumpHexString(dataIn, 0, dataIn.length);
+
+        // Decode
+        DatagramPacket packet = new DatagramPacket(dataIn, dataIn.length);
+        MdnsPacketReader reader = new MdnsPacketReader(packet);
+
+        String[] name = reader.readLabels();
+        assertNotNull(name);
+        assertEquals(3, name.length);
+        String fqdn = MdnsRecord.labelsToString(name);
+        assertEquals("test.android.com", fqdn);
+
+        int type = reader.readUInt16();
+        assertEquals(MdnsRecord.TYPE_ANY, type);
+
+        MdnsAnyRecord record = new MdnsAnyRecord(name, reader);
+
+        String dataOutText = toHex(record);
         Log.d(TAG, dataOutText);
 
         assertEquals(dataInText, dataOutText);
@@ -320,19 +313,23 @@
         assertEquals(new TextEntry("b", "1234567890"), entries.get(1));
         assertEquals(new TextEntry("xyz", "!@#$"), entries.get(2));
 
-        // Encode
-        MdnsPacketWriter writer = new MdnsPacketWriter(MAX_PACKET_SIZE);
-        record.write(writer, record.getReceiptTime());
-
-        packet = writer.getPacket(MULTICAST_IPV4_ADDRESS);
-        byte[] dataOut = packet.getData();
-
-        String dataOutText = HexDump.dumpHexString(dataOut, 0, packet.getLength());
+        String dataOutText = toHex(record);
         Log.d(TAG, dataOutText);
 
         assertEquals(dataInText, dataOutText);
     }
 
+    private static String toHex(MdnsRecord record) throws IOException {
+        MdnsPacketWriter writer = new MdnsPacketWriter(MAX_PACKET_SIZE);
+        record.write(writer, record.getReceiptTime());
+
+        // The address does not matter as only the data is used
+        final DatagramPacket packet = writer.getPacket(MULTICAST_IPV4_ADDRESS);
+        final byte[] dataOut = packet.getData();
+
+        return HexDump.dumpHexString(dataOut, 0, packet.getLength());
+    }
+
     @Test
     public void textRecord_recordDoesNotHaveDataOfGivenLength_throwsEOFException()
             throws Exception {
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 2821a8c..dae4cc5 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -167,9 +167,9 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/android_ndk/sources/android/cpufeatures/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
     arch: {
@@ -284,6 +284,18 @@
             ],
         },
     },
+    target: {
+        android_x86_64: {
+            srcs: [
+                "base/allocator/partition_allocator/partition_alloc_base/files/file_path.cc",
+                "base/allocator/partition_allocator/partition_alloc_base/files/file_path.h",
+                "base/allocator/partition_allocator/partition_alloc_base/native_library.cc",
+                "base/allocator/partition_allocator/partition_alloc_base/native_library.h",
+                "base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
+                "base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
+            ],
+        },
+    },
 }
 
 // GN: //base/allocator/partition_allocator:partition_alloc_buildflags
@@ -968,9 +980,9 @@
         "third_party/boringssl/src/include/",
         "third_party/icu/source/common/",
         "third_party/icu/source/i18n/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     header_libs: [
         "jni_headers",
@@ -983,6 +995,157 @@
                 "liblog",
             ],
         },
+        android_x86_64: {
+            srcs: [
+                "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
+                "base/allocator/partition_allocator/shim/allocator_shim_override_linker_wrapped_symbols.h",
+                "base/android/android_hardware_buffer_compat.cc",
+                "base/android/android_hardware_buffer_compat.h",
+                "base/android/android_image_reader_abi.h",
+                "base/android/android_image_reader_compat.cc",
+                "base/android/android_image_reader_compat.h",
+                "base/android/apk_assets.cc",
+                "base/android/apk_assets.h",
+                "base/android/application_status_listener.cc",
+                "base/android/application_status_listener.h",
+                "base/android/base_feature_list.cc",
+                "base/android/base_features.cc",
+                "base/android/base_features.h",
+                "base/android/base_jni_onload.cc",
+                "base/android/base_jni_onload.h",
+                "base/android/build_info.cc",
+                "base/android/build_info.h",
+                "base/android/bundle_utils.cc",
+                "base/android/bundle_utils.h",
+                "base/android/callback_android.cc",
+                "base/android/callback_android.h",
+                "base/android/child_process_binding_types.h",
+                "base/android/child_process_service.cc",
+                "base/android/command_line_android.cc",
+                "base/android/content_uri_utils.cc",
+                "base/android/content_uri_utils.h",
+                "base/android/cpu_features.cc",
+                "base/android/early_trace_event_binding.cc",
+                "base/android/early_trace_event_binding.h",
+                "base/android/event_log.cc",
+                "base/android/event_log.h",
+                "base/android/feature_list_jni.cc",
+                "base/android/features_jni.cc",
+                "base/android/field_trial_list.cc",
+                "base/android/important_file_writer_android.cc",
+                "base/android/int_string_callback.cc",
+                "base/android/int_string_callback.h",
+                "base/android/jank_metric_uma_recorder.cc",
+                "base/android/jank_metric_uma_recorder.h",
+                "base/android/java_exception_reporter.cc",
+                "base/android/java_exception_reporter.h",
+                "base/android/java_handler_thread.cc",
+                "base/android/java_handler_thread.h",
+                "base/android/java_heap_dump_generator.cc",
+                "base/android/java_heap_dump_generator.h",
+                "base/android/java_runtime.cc",
+                "base/android/java_runtime.h",
+                "base/android/jni_android.cc",
+                "base/android/jni_android.h",
+                "base/android/jni_array.cc",
+                "base/android/jni_array.h",
+                "base/android/jni_generator/jni_generator_helper.h",
+                "base/android/jni_int_wrapper.h",
+                "base/android/jni_registrar.cc",
+                "base/android/jni_registrar.h",
+                "base/android/jni_string.cc",
+                "base/android/jni_string.h",
+                "base/android/jni_utils.cc",
+                "base/android/jni_utils.h",
+                "base/android/jni_weak_ref.cc",
+                "base/android/jni_weak_ref.h",
+                "base/android/library_loader/anchor_functions.cc",
+                "base/android/library_loader/anchor_functions.h",
+                "base/android/library_loader/library_loader_hooks.cc",
+                "base/android/library_loader/library_loader_hooks.h",
+                "base/android/library_loader/library_prefetcher.cc",
+                "base/android/library_loader/library_prefetcher.h",
+                "base/android/library_loader/library_prefetcher_hooks.cc",
+                "base/android/locale_utils.cc",
+                "base/android/locale_utils.h",
+                "base/android/memory_pressure_listener_android.cc",
+                "base/android/memory_pressure_listener_android.h",
+                "base/android/native_uma_recorder.cc",
+                "base/android/path_service_android.cc",
+                "base/android/path_utils.cc",
+                "base/android/path_utils.h",
+                "base/android/radio_utils.cc",
+                "base/android/radio_utils.h",
+                "base/android/reached_addresses_bitset.cc",
+                "base/android/reached_addresses_bitset.h",
+                "base/android/reached_code_profiler.h",
+                "base/android/reached_code_profiler_stub.cc",
+                "base/android/remove_stale_data.cc",
+                "base/android/remove_stale_data.h",
+                "base/android/scoped_hardware_buffer_fence_sync.cc",
+                "base/android/scoped_hardware_buffer_fence_sync.h",
+                "base/android/scoped_hardware_buffer_handle.cc",
+                "base/android/scoped_hardware_buffer_handle.h",
+                "base/android/scoped_java_ref.cc",
+                "base/android/scoped_java_ref.h",
+                "base/android/statistics_recorder_android.cc",
+                "base/android/sys_utils.cc",
+                "base/android/sys_utils.h",
+                "base/android/task_scheduler/post_task_android.cc",
+                "base/android/task_scheduler/post_task_android.h",
+                "base/android/task_scheduler/task_runner_android.cc",
+                "base/android/task_scheduler/task_runner_android.h",
+                "base/android/thread_instruction_count.cc",
+                "base/android/thread_instruction_count.h",
+                "base/android/timezone_utils.cc",
+                "base/android/timezone_utils.h",
+                "base/android/trace_event_binding.cc",
+                "base/android/trace_event_binding.h",
+                "base/android/unguessable_token_android.cc",
+                "base/android/unguessable_token_android.h",
+                "base/base_paths_android.cc",
+                "base/base_paths_android.h",
+                "base/debug/stack_trace_android.cc",
+                "base/files/file_util_android.cc",
+                "base/files/scoped_file_android.cc",
+                "base/memory/platform_shared_memory_mapper_android.cc",
+                "base/memory/platform_shared_memory_region_android.cc",
+                "base/message_loop/message_pump_android.cc",
+                "base/message_loop/message_pump_android.h",
+                "base/os_compat_android.cc",
+                "base/os_compat_android.h",
+                "base/power_monitor/power_monitor_device_source_android.cc",
+                "base/process/process_android.cc",
+                "base/profiler/stack_sampler_android.cc",
+                "base/system/sys_info_android.cc",
+                "base/threading/platform_thread_android.cc",
+                "base/time/time_android.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_glibc.cc",
+                "base/allocator/partition_allocator/shim/allocator_shim_override_glibc_weak_symbols.h",
+                "base/allocator/partition_allocator/shim/allocator_shim_override_libc_symbols.h",
+                "base/base_paths_posix.cc",
+                "base/debug/stack_trace_posix.cc",
+                "base/files/dir_reader_linux.h",
+                "base/files/file_util_linux.cc",
+                "base/files/scoped_file_linux.cc",
+                "base/memory/platform_shared_memory_mapper_posix.cc",
+                "base/memory/platform_shared_memory_region_posix.cc",
+                "base/nix/mime_util_xdg.cc",
+                "base/nix/mime_util_xdg.h",
+                "base/nix/xdg_util.cc",
+                "base/nix/xdg_util.h",
+                "base/power_monitor/power_monitor_device_source_stub.cc",
+                "base/process/process_linux.cc",
+                "base/profiler/stack_sampler_posix.cc",
+                "base/stack_canary_linux.cc",
+                "base/stack_canary_linux.h",
+                "base/threading/platform_thread_linux.cc",
+            ],
+        },
     },
 }
 
@@ -1296,9 +1459,9 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
 }
@@ -1627,9 +1790,9 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
 }
@@ -1671,9 +1834,9 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
 }
@@ -1990,6 +2153,18 @@
         "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
         "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
     ],
+    target: {
+        android_x86_64: {
+            srcs: [
+                "buildtools/third_party/libc++abi/cxa_demangle_stub.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "buildtools/third_party/libc++abi/trunk/src/cxa_demangle.cpp",
+            ],
+        },
+    },
 }
 
 // GN: //buildtools/third_party/libunwind:libunwind
@@ -2072,6 +2247,9 @@
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
         "cronet_aml_third_party_modp_b64_modp_b64",
+        "cronet_aml_third_party_protobuf_protobuf_full",
+        "cronet_aml_third_party_protobuf_protobuf_lite",
+        "cronet_aml_third_party_protobuf_protoc_lib",
         "cronet_aml_third_party_zlib_zlib",
         "cronet_aml_url_url",
     ],
@@ -2133,6 +2311,7 @@
         "net/third_party/quiche/src/quiche/common/platform/default/",
         "third_party/abseil-cpp/",
         "third_party/boringssl/src/include/",
+        "third_party/protobuf/src/",
         "third_party/zlib/",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
@@ -2640,9 +2819,9 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
         "third_party/boringssl/src/include/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
     target: {
@@ -2652,6 +2831,16 @@
                 "liblog",
             ],
         },
+        host: {
+            srcs: [
+                "crypto/nss_crypto_module_delegate.h",
+                "crypto/nss_key_util.cc",
+                "crypto/nss_key_util.h",
+                "crypto/nss_util.cc",
+                "crypto/nss_util.h",
+                "crypto/nss_util_internal.h",
+            ],
+        },
     },
 }
 
@@ -2922,9 +3111,9 @@
         "net/base/isolation_info.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/base --cpp_out=lite=true:$(genDir)/external/chromium_org/net/base/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/net/base --cpp_out=lite=true:$(genDir)/external/chromium_org/net/base/ $(in)",
     out: [
         "external/chromium_org/net/base/isolation_info.pb.cc",
     ],
@@ -2937,9 +3126,9 @@
         "net/base/isolation_info.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/base --cpp_out=lite=true:$(genDir)/external/chromium_org/net/base/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/net/base --cpp_out=lite=true:$(genDir)/external/chromium_org/net/base/ $(in)",
     out: [
         "external/chromium_org/net/base/isolation_info.pb.h",
     ],
@@ -3478,9 +3667,11 @@
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
         "cronet_aml_third_party_modp_b64_modp_b64",
+        "cronet_aml_third_party_protobuf_protobuf_full",
+        "cronet_aml_third_party_protobuf_protobuf_lite",
+        "cronet_aml_third_party_protobuf_protoc_lib",
         "cronet_aml_third_party_zlib_zlib",
         "cronet_aml_url_url",
-        "libprotobuf-cpp-lite",
     ],
     generated_headers: [
         "cronet_aml_base_debugging_buildflags",
@@ -3551,6 +3742,7 @@
         "third_party/abseil-cpp/",
         "third_party/boringssl/src/include/",
         "third_party/brotli/include/",
+        "third_party/protobuf/src/",
         "third_party/zlib/",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
@@ -3681,9 +3873,9 @@
         "net/nqe/proto/network_id_proto.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/nqe/proto --cpp_out=lite=true:$(genDir)/external/chromium_org/net/nqe/proto/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/net/nqe/proto --cpp_out=lite=true:$(genDir)/external/chromium_org/net/nqe/proto/ $(in)",
     out: [
         "external/chromium_org/net/nqe/proto/network_id_proto.pb.cc",
     ],
@@ -3696,9 +3888,9 @@
         "net/nqe/proto/network_id_proto.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/nqe/proto --cpp_out=lite=true:$(genDir)/external/chromium_org/net/nqe/proto/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/net/nqe/proto --cpp_out=lite=true:$(genDir)/external/chromium_org/net/nqe/proto/ $(in)",
     out: [
         "external/chromium_org/net/nqe/proto/network_id_proto.pb.h",
     ],
@@ -3777,9 +3969,9 @@
         "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/third_party/quiche/src --cpp_out=lite=true:$(genDir)/external/chromium_org/net/third_party/quiche/src/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/net/third_party/quiche/src --cpp_out=lite=true:$(genDir)/external/chromium_org/net/third_party/quiche/src/ $(in)",
     out: [
         "external/chromium_org/net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.pb.cc",
         "external/chromium_org/net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.pb.cc",
@@ -3796,9 +3988,9 @@
         "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/third_party/quiche/src --cpp_out=lite=true:$(genDir)/external/chromium_org/net/third_party/quiche/src/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/net/third_party/quiche/src --cpp_out=lite=true:$(genDir)/external/chromium_org/net/third_party/quiche/src/ $(in)",
     out: [
         "external/chromium_org/net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.pb.h",
         "external/chromium_org/net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.pb.h",
@@ -3818,9 +4010,9 @@
         "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools --cpp_out=lite=true:$(genDir)/external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools --cpp_out=lite=true:$(genDir)/external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools/ $(in)",
     out: [
         "external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.pb.cc",
     ],
@@ -3833,9 +4025,9 @@
         "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools --cpp_out=lite=true:$(genDir)/external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools --cpp_out=lite=true:$(genDir)/external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools/ $(in)",
     out: [
         "external/chromium_org/net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.pb.h",
     ],
@@ -4259,9 +4451,11 @@
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
         "cronet_aml_third_party_modp_b64_modp_b64",
+        "cronet_aml_third_party_protobuf_protobuf_full",
+        "cronet_aml_third_party_protobuf_protobuf_lite",
+        "cronet_aml_third_party_protobuf_protoc_lib",
         "cronet_aml_third_party_zlib_zlib",
         "cronet_aml_url_url",
-        "libprotobuf-cpp-lite",
     ],
     generated_headers: [
         "cronet_aml_build_chromeos_buildflags",
@@ -4307,6 +4501,7 @@
         "net/third_party/quiche/src/quiche/common/platform/default/",
         "third_party/abseil-cpp/",
         "third_party/boringssl/src/include/",
+        "third_party/protobuf/src/",
         "third_party/zlib/",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
@@ -5184,9 +5379,9 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/boringssl/src/include/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
     arch: {
@@ -5789,6 +5984,25 @@
         "third_party/boringssl/linux-x86_64/crypto/test/trampoline-x86_64.S",
         "third_party/boringssl/src/crypto/hrss/asm/poly_rq_mul.S",
     ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/boringssl/linux-x86/crypto/chacha/chacha-x86.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/aesni-x86.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/bn-586.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/co-586.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/ghash-ssse3-x86.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/ghash-x86.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/md5-586.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/sha1-586.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/sha256-586.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/sha512-586.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/vpaes-x86.S",
+                "third_party/boringssl/linux-x86/crypto/fipsmodule/x86-mont.S",
+                "third_party/boringssl/linux-x86/crypto/test/trampoline-x86.S",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/boringssl/src/third_party/fiat:fiat_license
@@ -6181,9 +6395,9 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/icu/source/common/",
         "third_party/icu/source/i18n/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
     rtti: true,
@@ -6442,9 +6656,9 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/icu/source/common/",
         "third_party/icu/source/i18n/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
     rtti: true,
@@ -6508,11 +6722,25 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/libevent/android/",
         "third_party/libevent/linux/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
+    target: {
+        android_x86_64: {
+            srcs: [
+                "third_party/libevent/android/config.h",
+                "third_party/libevent/android/event-config.h",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/libevent/linux/config.h",
+                "third_party/libevent/linux/event-config.h",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/metrics_proto:metrics_proto
@@ -6548,9 +6776,9 @@
         "third_party/metrics_proto/user_demographics.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/third_party/metrics_proto --cpp_out=lite=true:$(genDir)/external/chromium_org/third_party/metrics_proto/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/third_party/metrics_proto --cpp_out=lite=true:$(genDir)/external/chromium_org/third_party/metrics_proto/ $(in)",
     out: [
         "external/chromium_org/third_party/metrics_proto/call_stack_profile.pb.cc",
         "external/chromium_org/third_party/metrics_proto/cast_logs.pb.cc",
@@ -6615,9 +6843,9 @@
         "third_party/metrics_proto/user_demographics.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
     ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/third_party/metrics_proto --cpp_out=lite=true:$(genDir)/external/chromium_org/third_party/metrics_proto/ $(in)",
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_) --proto_path=external/chromium_org/third_party/metrics_proto --cpp_out=lite=true:$(genDir)/external/chromium_org/third_party/metrics_proto/ $(in)",
     out: [
         "external/chromium_org/third_party/metrics_proto/call_stack_profile.pb.h",
         "external/chromium_org/third_party/metrics_proto/cast_logs.pb.h",
@@ -6693,7 +6921,421 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
+    ],
+    cpp_std: "c++20",
+}
+
+// GN: //third_party/protobuf:protobuf_full
+cc_library_static {
+    name: "cronet_aml_third_party_protobuf_protobuf_full",
+    srcs: [
+        "third_party/protobuf/src/google/protobuf/any.cc",
+        "third_party/protobuf/src/google/protobuf/any.pb.cc",
+        "third_party/protobuf/src/google/protobuf/any_lite.cc",
+        "third_party/protobuf/src/google/protobuf/api.pb.cc",
+        "third_party/protobuf/src/google/protobuf/arena.cc",
+        "third_party/protobuf/src/google/protobuf/arenastring.cc",
+        "third_party/protobuf/src/google/protobuf/arenaz_sampler.cc",
+        "third_party/protobuf/src/google/protobuf/compiler/importer.cc",
+        "third_party/protobuf/src/google/protobuf/compiler/parser.cc",
+        "third_party/protobuf/src/google/protobuf/descriptor.cc",
+        "third_party/protobuf/src/google/protobuf/descriptor.pb.cc",
+        "third_party/protobuf/src/google/protobuf/descriptor_database.cc",
+        "third_party/protobuf/src/google/protobuf/duration.pb.cc",
+        "third_party/protobuf/src/google/protobuf/dynamic_message.cc",
+        "third_party/protobuf/src/google/protobuf/empty.pb.cc",
+        "third_party/protobuf/src/google/protobuf/extension_set.cc",
+        "third_party/protobuf/src/google/protobuf/extension_set_heavy.cc",
+        "third_party/protobuf/src/google/protobuf/field_mask.pb.cc",
+        "third_party/protobuf/src/google/protobuf/generated_enum_util.cc",
+        "third_party/protobuf/src/google/protobuf/generated_message_bases.cc",
+        "third_party/protobuf/src/google/protobuf/generated_message_reflection.cc",
+        "third_party/protobuf/src/google/protobuf/generated_message_tctable_full.cc",
+        "third_party/protobuf/src/google/protobuf/generated_message_tctable_lite.cc",
+        "third_party/protobuf/src/google/protobuf/generated_message_util.cc",
+        "third_party/protobuf/src/google/protobuf/implicit_weak_message.cc",
+        "third_party/protobuf/src/google/protobuf/inlined_string_field.cc",
+        "third_party/protobuf/src/google/protobuf/io/coded_stream.cc",
+        "third_party/protobuf/src/google/protobuf/io/gzip_stream.cc",
+        "third_party/protobuf/src/google/protobuf/io/io_win32.cc",
+        "third_party/protobuf/src/google/protobuf/io/printer.cc",
+        "third_party/protobuf/src/google/protobuf/io/strtod.cc",
+        "third_party/protobuf/src/google/protobuf/io/tokenizer.cc",
+        "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.cc",
+        "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc",
+        "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
+        "third_party/protobuf/src/google/protobuf/map.cc",
+        "third_party/protobuf/src/google/protobuf/map_field.cc",
+        "third_party/protobuf/src/google/protobuf/message.cc",
+        "third_party/protobuf/src/google/protobuf/message_lite.cc",
+        "third_party/protobuf/src/google/protobuf/parse_context.cc",
+        "third_party/protobuf/src/google/protobuf/reflection_ops.cc",
+        "third_party/protobuf/src/google/protobuf/repeated_field.cc",
+        "third_party/protobuf/src/google/protobuf/repeated_ptr_field.cc",
+        "third_party/protobuf/src/google/protobuf/service.cc",
+        "third_party/protobuf/src/google/protobuf/source_context.pb.cc",
+        "third_party/protobuf/src/google/protobuf/struct.pb.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/bytestream.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/common.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/int128.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/status.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/statusor.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/stringpiece.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/stringprintf.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/structurally_valid.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/strutil.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/substitute.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/time.cc",
+        "third_party/protobuf/src/google/protobuf/text_format.cc",
+        "third_party/protobuf/src/google/protobuf/timestamp.pb.cc",
+        "third_party/protobuf/src/google/protobuf/type.pb.cc",
+        "third_party/protobuf/src/google/protobuf/unknown_field_set.cc",
+        "third_party/protobuf/src/google/protobuf/util/delimited_message_util.cc",
+        "third_party/protobuf/src/google/protobuf/util/field_comparator.cc",
+        "third_party/protobuf/src/google/protobuf/util/field_mask_util.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/error_listener.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/json_escaping.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/object_writer.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/type_info.cc",
+        "third_party/protobuf/src/google/protobuf/util/internal/utility.cc",
+        "third_party/protobuf/src/google/protobuf/util/json_util.cc",
+        "third_party/protobuf/src/google/protobuf/util/message_differencer.cc",
+        "third_party/protobuf/src/google/protobuf/util/time_util.cc",
+        "third_party/protobuf/src/google/protobuf/util/type_resolver_util.cc",
+        "third_party/protobuf/src/google/protobuf/wire_format.cc",
+        "third_party/protobuf/src/google/protobuf/wire_format_lite.cc",
+        "third_party/protobuf/src/google/protobuf/wrappers.pb.cc",
+    ],
+    static_libs: [
+        "cronet_aml_third_party_zlib_zlib",
+    ],
+    host_supported: true,
+    device_supported: false,
+    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",
+        "-DHAVE_ZLIB",
+        "-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",
+        "-UANDROID",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "third_party/protobuf/src/",
+        "third_party/zlib/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+    ],
+    cpp_std: "c++20",
+}
+
+// GN: //third_party/protobuf:protobuf_lite
+cc_library_static {
+    name: "cronet_aml_third_party_protobuf_protobuf_lite",
+    srcs: [
+        "third_party/protobuf/src/google/protobuf/any_lite.cc",
+        "third_party/protobuf/src/google/protobuf/arena.cc",
+        "third_party/protobuf/src/google/protobuf/arenastring.cc",
+        "third_party/protobuf/src/google/protobuf/arenaz_sampler.cc",
+        "third_party/protobuf/src/google/protobuf/extension_set.cc",
+        "third_party/protobuf/src/google/protobuf/generated_enum_util.cc",
+        "third_party/protobuf/src/google/protobuf/generated_message_tctable_lite.cc",
+        "third_party/protobuf/src/google/protobuf/generated_message_util.cc",
+        "third_party/protobuf/src/google/protobuf/implicit_weak_message.cc",
+        "third_party/protobuf/src/google/protobuf/inlined_string_field.cc",
+        "third_party/protobuf/src/google/protobuf/io/coded_stream.cc",
+        "third_party/protobuf/src/google/protobuf/io/io_win32.cc",
+        "third_party/protobuf/src/google/protobuf/io/strtod.cc",
+        "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.cc",
+        "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc",
+        "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
+        "third_party/protobuf/src/google/protobuf/map.cc",
+        "third_party/protobuf/src/google/protobuf/message_lite.cc",
+        "third_party/protobuf/src/google/protobuf/parse_context.cc",
+        "third_party/protobuf/src/google/protobuf/repeated_field.cc",
+        "third_party/protobuf/src/google/protobuf/repeated_ptr_field.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/bytestream.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/common.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/int128.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/status.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/statusor.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/stringpiece.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/stringprintf.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/structurally_valid.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/strutil.cc",
+        "third_party/protobuf/src/google/protobuf/stubs/time.cc",
+        "third_party/protobuf/src/google/protobuf/wire_format_lite.cc",
+    ],
+    shared_libs: [
+        "liblog",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
+        "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-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",
+        "-DHAVE_SYS_UIO_H",
+        "-D_DEBUG",
+        "-D_GNU_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/",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
+    ],
+    cpp_std: "c++20",
+}
+
+// GN: //third_party/protobuf:protoc(//build/toolchain/linux:clang_x64)
+cc_binary {
+    name: "cronet_aml_third_party_protobuf_protoc___build_toolchain_linux_clang_x64_",
+    srcs: [
+        ":cronet_aml_buildtools_third_party_libc___libc__",
+        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi",
+        ":cronet_aml_buildtools_third_party_libunwind_libunwind",
+        "third_party/protobuf/src/google/protobuf/compiler/main.cc",
+    ],
+    static_libs: [
+        "cronet_aml_third_party_protobuf_protobuf_full",
+        "cronet_aml_third_party_protobuf_protoc_lib",
+        "cronet_aml_third_party_zlib_zlib",
+    ],
+    host_supported: true,
+    device_supported: false,
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-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",
+        "-DHAVE_SYS_UIO_H",
+        "-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",
+        "-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBUNWIND_IS_NATIVE_ONLY",
+    ],
+    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",
+        "buildtools/third_party/libunwind/trunk/include/",
+        "third_party/protobuf/src/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
+    ],
+    cpp_std: "c++20",
+    cppflags: [
+        "-fexceptions",
+    ],
+    rtti: true,
+}
+
+// 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",
+        "cronet_aml_third_party_zlib_zlib",
+    ],
+    host_supported: true,
+    device_supported: false,
+    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",
+        "-UANDROID",
+    ],
+    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/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
     ],
@@ -6761,6 +7403,8 @@
         "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D__STDC_CONSTANT_MACROS",
         "-D__STDC_FORMAT_MACROS",
+        "-mpclmul",
+        "-mssse3",
     ],
     local_include_dirs: [
         "./",
@@ -6769,9 +7413,9 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/android_ndk/sources/android/cpufeatures/",
         "third_party/zlib/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
 }
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 2479813..422e126 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -91,7 +91,6 @@
 
 # Include directories that will be removed from all targets.
 local_include_dirs_denylist = [
-    'third_party/protobuf/src/',
 ]
 
 # Name of the module which settings such as compiler flags for all other
@@ -108,7 +107,12 @@
 android_protobuf_src = 'external/protobuf/src'
 
 # Compiler flags which are passed through to the blueprint.
-cflag_allowlist = r'^-DPERFETTO.*$'
+cflag_allowlist = [
+  # needed for zlib:zlib
+  "-mpclmul",
+  # needed for zlib:zlib
+  "-mssse3",
+]
 
 # Additional arguments to apply to Android.bp rules.
 additional_args = {
@@ -129,118 +133,11 @@
     ],
 }
 
-
-def enable_gtest_and_gmock(module):
-  module.static_libs.add('libgmock')
-  module.static_libs.add('libgtest')
-  if module.name != 'perfetto_gtest_logcat_printer':
-    module.whole_static_libs.add('perfetto_gtest_logcat_printer')
-
-
-def enable_protobuf_full(module):
-  if module.type not in ['genrule', 'filegroup']:
-    module.static_libs.add('libprotobuf-cpp-full')
-
-
-def enable_protobuf_lite(module):
-  if module.type not in ['genrule', 'filegroup']:
-    module.static_libs.add('libprotobuf-cpp-lite')
-
-
-def enable_protoc_lib(module):
-  if module.type not in ['genrule', 'filegroup']:
-    module.static_libs.add('libprotoc')
-
-
-def enable_libunwindstack(module):
-  if module.name != 'heapprofd_standalone_client':
-    module.shared_libs.add('libunwindstack')
-    module.shared_libs.add('libprocinfo')
-    module.shared_libs.add('libbase')
-  else:
-    module.static_libs.add('libunwindstack')
-    module.static_libs.add('libprocinfo')
-    module.static_libs.add('libbase')
-    module.static_libs.add('liblzma')
-    module.static_libs.add('libdexfile_support')
-    module.runtime_libs.add('libdexfile')  # libdexfile_support dependency
-
-
-def enable_libunwind(module):
-  # libunwind is disabled on Darwin so we cannot depend on it.
-  pass
-
-
-def enable_sqlite(module):
-  if module.type == 'cc_binary_host':
-    module.static_libs.add('libsqlite')
-    module.static_libs.add('sqlite_ext_percentile')
-  elif module.host_supported:
-    # Copy what the sqlite3 command line tool does.
-    module.android.shared_libs.add('libsqlite')
-    module.android.shared_libs.add('libicu')
-    module.android.shared_libs.add('liblog')
-    module.android.shared_libs.add('libutils')
-    module.android.static_libs.add('sqlite_ext_percentile')
-    module.host.static_libs.add('libsqlite')
-    module.host.static_libs.add('sqlite_ext_percentile')
-  else:
-    module.shared_libs.add('libsqlite')
-    module.shared_libs.add('libicu')
-    module.shared_libs.add('liblog')
-    module.shared_libs.add('libutils')
-    module.static_libs.add('sqlite_ext_percentile')
-
-
-def enable_zlib(module):
-  if module.type == 'cc_binary_host':
-    module.static_libs.add('libz')
-  elif module.host_supported:
-    module.android.shared_libs.add('libz')
-    module.host.static_libs.add('libz')
-  else:
-    module.shared_libs.add('libz')
-
-
-def enable_uapi_headers(module):
-  module.include_dirs.add('bionic/libc/kernel')
-
-
-def enable_bionic_libc_platform_headers_on_android(module):
-  module.header_libs.add('bionic_libc_platform_headers')
-
-
 # Android equivalents for third-party libraries that the upstream project
 # depends on.
 builtin_deps = {
-    '//gn:default_deps':
-        lambda x: None,
-    '//gn:gtest_main':
-        lambda x: None,
-    '//gn:gtest_and_gmock':
-        enable_gtest_and_gmock,
-    '//gn:libunwind':
-        enable_libunwind,
-    '//gn:libunwindstack':
-        enable_libunwindstack,
-    '//gn:sqlite':
-        enable_sqlite,
-    '//gn:zlib':
-        enable_zlib,
-    '//gn:bionic_kernel_uapi_headers':
-        enable_uapi_headers,
     '//net/tools/root_store_tool:root_store_tool':
         lambda x: None,
-    '//src/profiling/memory:bionic_libc_platform_headers_on_android':
-        enable_bionic_libc_platform_headers_on_android,
-    '//third_party/protobuf:protoc':
-        lambda x: None,
-    '//third_party/protobuf:protobuf_full':
-        enable_protobuf_full,
-    '//third_party/protobuf:protobuf_lite':
-        enable_protobuf_lite,
-    '//third_party/protobuf:protoc_lib':
-        enable_protoc_lib,
 }
 
 # ----------------------------------------------------------------------------
@@ -302,6 +199,7 @@
 
   def __init__(self, name):
     self.name = name
+    self.srcs = set()
     self.shared_libs = set()
     self.static_libs = set()
     self.whole_static_libs = set()
@@ -312,6 +210,7 @@
 
   def to_string(self, output):
     nested_out = []
+    self._output_field(nested_out, 'srcs')
     self._output_field(nested_out, 'shared_libs')
     self._output_field(nested_out, 'static_libs')
     self._output_field(nested_out, 'whole_static_libs')
@@ -362,8 +261,15 @@
     self.header_libs = set()
     self.required = set()
     self.tool_files = set()
-    self.android = Target('android')
-    self.host = Target('host')
+    # target contains a dict of Targets indexed by os_arch.
+    # example: { 'android_x86': Target('android_x86')
+    self.target = dict()
+    self.target['android'] = Target('android')
+    self.target['android_x86'] = Target('android_x86')
+    self.target['android_x86_64'] = Target('android_x86_64')
+    self.target['android_arm'] = Target('android_arm')
+    self.target['android_arm64'] = Target('android_arm64')
+    self.target['host'] = Target('host')
     self.stl = None
     self.cpp_std = None
     self.dist = dict()
@@ -437,8 +343,11 @@
     self._output_field(output, 'arch')
 
     target_out = []
-    self._output_field(target_out, 'android')
-    self._output_field(target_out, 'host')
+    for arch, target in sorted(self.target.items()):
+      # _output_field calls getattr(self, arch).
+      setattr(self, arch, target)
+      self._output_field(target_out, arch)
+
     if target_out:
       output.append('    target: {')
       for line in target_out:
@@ -452,7 +361,7 @@
     if self.type == 'cc_binary_host':
       raise Exception('Adding Android static lib for host tool is unsupported')
     elif self.host_supported:
-      self.android.static_libs.add(lib)
+      self.target['android'].static_libs.add(lib)
     else:
       self.static_libs.add(lib)
 
@@ -460,7 +369,7 @@
     if self.type == 'cc_binary_host':
       raise Exception('Adding Android shared lib for host tool is unsupported')
     elif self.host_supported:
-      self.android.shared_libs.add(lib)
+      self.target['android'].shared_libs.add(lib)
     else:
       self.shared_libs.add(lib)
 
@@ -525,13 +434,15 @@
     """
   assert (target.type == 'proto_library')
 
-  tools = {'aprotoc'}
+  protoc_gn_target_name = "//third_party/protobuf:protoc(//build/toolchain/linux:clang_x64)"
+  protoc_module_name = label_to_module_name(protoc_gn_target_name)
+  tools = {protoc_module_name}
   cpp_out_dir = '$(genDir)/%s/%s/' % (tree_path, target.proto_in_dir)
   target_module_name = label_to_module_name(target.name)
 
   # In GN builds the proto path is always relative to the output directory
   # (out/tmp.xxx).
-  cmd = ['$(location aprotoc)']
+  cmd = ['$(location %s)' % protoc_module_name]
   cmd += ['--proto_path=%s/%s' % (tree_path, target.proto_in_dir)]
 
   if buildtools_protobuf_src in target.proto_paths:
@@ -1039,7 +950,7 @@
 
 
 def _get_cflags(target):
-  cflags = {flag for flag in target.cflags if re.match(cflag_allowlist, flag)}
+  cflags = {flag for flag in target.cflags if flag in cflag_allowlist}
   # Consider proper allowlist or denylist if needed
   cflags |= set("-D%s" % define.replace("\"", "\\\"") for define in target.defines)
   # -DANDROID is added by default but target.defines contain -DANDROID if it's required.
@@ -1119,6 +1030,11 @@
       for src in target.sources
       if is_supported_source_file(src) and not src.startswith("//out/test"))
 
+  # Add arch-specific properties
+  for arch_name, arch in target.arch.items():
+    module.target[arch_name].srcs.update(gn_utils.label_to_path(src)
+                                         for src in arch.sources)
+
   local_include_dirs_set = set()
   if target.type in gn_utils.LINKER_UNIT_TYPES:
     module.cflags.update(_get_cflags(target))
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 27fbdb2..31cc2e1 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -280,6 +280,7 @@
       target.proto_paths.update(self.get_proto_paths(proto_desc))
       target.proto_exports.update(self.get_proto_exports(proto_desc))
       target.proto_in_dir = self.get_proto_in_dir(proto_desc)
+      target.deps.update(proto_desc.get('deps', []))
       target.arch[arch].sources.update(proto_desc.get('sources', []))
       assert (all(x.endswith('.proto') for x in target.arch[arch].sources))
     elif target.type == 'source_set':
@@ -350,9 +351,7 @@
       if dep.type == 'static_library':
         # Bubble up static_libs. Necessary, since soong does not propagate
         # static_libs up the build tree.
-        # Protobuf dependencies are handled separately.
-        if '//third_party/protobuf' not in dep_name:
-          target.transitive_static_libs_deps.add(dep_name)
+        target.transitive_static_libs_deps.add(dep_name)
 
       target.transitive_static_libs_deps.update(dep.transitive_static_libs_deps)
       target.deps.update(target.transitive_static_libs_deps)