Merge "Reinstate sleep pending better fix"
diff --git a/Tethering/src/com/android/networkstack/tethering/Tethering.java b/Tethering/src/com/android/networkstack/tethering/Tethering.java
index 1f3fc11..c2cf92c 100644
--- a/Tethering/src/com/android/networkstack/tethering/Tethering.java
+++ b/Tethering/src/com/android/networkstack/tethering/Tethering.java
@@ -477,17 +477,10 @@
             wifiManager.registerSoftApCallback(mExecutor, softApCallback);
         }
         if (SdkLevel.isAtLeastT() && wifiManager != null) {
-            try {
-                // Although WifiManager#registerLocalOnlyHotspotSoftApCallback document that it need
-                // NEARBY_WIFI_DEVICES permission, but actually a caller who have NETWORK_STACK
-                // or MAINLINE_NETWORK_STACK permission would also able to use this API.
-                wifiManager.registerLocalOnlyHotspotSoftApCallback(mExecutor, softApCallback);
-            } catch (UnsupportedOperationException e) {
-                // Since wifi module development in internal branch,
-                // #registerLocalOnlyHotspotSoftApCallback currently doesn't supported in AOSP
-                // before AOSP switch to Android T + 1.
-                Log.wtf(TAG, "registerLocalOnlyHotspotSoftApCallback API is not supported");
-            }
+            // Although WifiManager#registerLocalOnlyHotspotSoftApCallback document that it need
+            // NEARBY_WIFI_DEVICES permission, but actually a caller who have NETWORK_STACK
+            // or MAINLINE_NETWORK_STACK permission would also able to use this API.
+            wifiManager.registerLocalOnlyHotspotSoftApCallback(mExecutor, softApCallback);
         }
 
         startTrackDefaultNetwork();
diff --git a/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java b/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java
index 7ed4725..903de9d 100644
--- a/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java
+++ b/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java
@@ -194,8 +194,13 @@
 
         isDunRequired = checkDunRequired(ctx);
 
-        final boolean forceAutomaticUpstream = !SdkLevel.isAtLeastS()
-                && isConnectivityFeatureEnabled(ctx, TETHER_FORCE_UPSTREAM_AUTOMATIC_VERSION);
+        // Here is how automatic mode enable/disable support on different Android version:
+        // - R   : can be enabled/disabled by resource config_tether_upstream_automatic.
+        //         but can be force-enabled by flag TETHER_FORCE_UPSTREAM_AUTOMATIC_VERSION.
+        // - S, T: can be enabled/disabled by resource config_tether_upstream_automatic.
+        // - U+  : automatic mode only.
+        final boolean forceAutomaticUpstream = SdkLevel.isAtLeastU() || (!SdkLevel.isAtLeastS()
+                && isConnectivityFeatureEnabled(ctx, TETHER_FORCE_UPSTREAM_AUTOMATIC_VERSION));
         chooseUpstreamAutomatically = forceAutomaticUpstream || getResourceBoolean(
                 res, R.bool.config_tether_upstream_automatic, false /** defaultValue */);
         preferredUpstreamIfaceTypes = getUpstreamIfaceTypes(res, isDunRequired);
diff --git a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
index f0f9a31..c2c9fc4 100644
--- a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
+++ b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
@@ -556,23 +556,6 @@
         // client, which is not possible in this test.
     }
 
-    private boolean isEthernetTetheringSupported() throws Exception {
-        final CompletableFuture<Boolean> future = new CompletableFuture<>();
-        final TetheringEventCallback callback = new TetheringEventCallback() {
-            @Override
-            public void onSupportedTetheringTypes(Set<Integer> supportedTypes) {
-                future.complete(supportedTypes.contains(TETHERING_ETHERNET));
-            }
-        };
-
-        try {
-            mTm.registerTetheringEventCallback(mHandler::post, callback);
-            return future.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        } finally {
-            mTm.unregisterTetheringEventCallback(callback);
-        }
-    }
-
     private static final class MyTetheringEventCallback implements TetheringEventCallback {
         private final TetheringManager mTm;
         private final CountDownLatch mTetheringStartedLatch = new CountDownLatch(1);
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringConfigurationTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringConfigurationTest.java
index 1a12125..f662c02 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringConfigurationTest.java
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringConfigurationTest.java
@@ -545,7 +545,8 @@
         assertTrue(testCfg.shouldEnableWifiP2pDedicatedIp());
     }
 
-    @Test
+    // The config only works on T-
+    @Test @IgnoreAfter(Build.VERSION_CODES.TIRAMISU)
     public void testChooseUpstreamAutomatically() throws Exception {
         when(mResources.getBoolean(R.bool.config_tether_upstream_automatic))
                 .thenReturn(true);
@@ -556,6 +557,20 @@
         assertChooseUpstreamAutomaticallyIs(false);
     }
 
+    // The automatic mode is always enabled on U+
+    @Test @IgnoreUpTo(Build.VERSION_CODES.TIRAMISU)
+    public void testChooseUpstreamAutomaticallyAfterT() throws Exception {
+        // Expect that automatic mode is always enabled no matter what
+        // config_tether_upstream_automatic is.
+        when(mResources.getBoolean(R.bool.config_tether_upstream_automatic))
+                .thenReturn(true);
+        assertChooseUpstreamAutomaticallyIs(true);
+
+        when(mResources.getBoolean(R.bool.config_tether_upstream_automatic))
+                .thenReturn(false);
+        assertChooseUpstreamAutomaticallyIs(true);
+    }
+
     // The flag override only works on R-
     @Test @IgnoreAfter(Build.VERSION_CODES.R)
     public void testChooseUpstreamAutomatically_FlagOverride() throws Exception {
@@ -574,14 +589,34 @@
         assertChooseUpstreamAutomaticallyIs(false);
     }
 
-    @Test @IgnoreUpTo(Build.VERSION_CODES.R)
-    public void testChooseUpstreamAutomatically_FlagOverrideAfterR() throws Exception {
+    @Test @IgnoreUpTo(Build.VERSION_CODES.R) @IgnoreAfter(Build.VERSION_CODES.TIRAMISU)
+    public void testChooseUpstreamAutomatically_FlagOverrideOnSAndT() throws Exception {
         when(mResources.getBoolean(R.bool.config_tether_upstream_automatic))
                 .thenReturn(false);
         setTetherForceUpstreamAutomaticFlagVersion(TEST_PACKAGE_VERSION - 1);
         assertChooseUpstreamAutomaticallyIs(false);
     }
 
+    // The automatic mode is always enabled on U+
+    @Test @IgnoreUpTo(Build.VERSION_CODES.TIRAMISU)
+    public void testChooseUpstreamAutomatically_FlagOverrideAfterT() throws Exception {
+        // Expect that automatic mode is always enabled no matter what
+        // TETHER_FORCE_UPSTREAM_AUTOMATIC_VERSION is.
+        when(mResources.getBoolean(R.bool.config_tether_upstream_automatic))
+                .thenReturn(false);
+        setTetherForceUpstreamAutomaticFlagVersion(TEST_PACKAGE_VERSION - 1);
+        assertTrue(DeviceConfigUtils.isFeatureEnabled(mMockContext, NAMESPACE_CONNECTIVITY,
+                TetheringConfiguration.TETHER_FORCE_UPSTREAM_AUTOMATIC_VERSION, APEX_NAME, false));
+
+        assertChooseUpstreamAutomaticallyIs(true);
+
+        setTetherForceUpstreamAutomaticFlagVersion(0L);
+        assertChooseUpstreamAutomaticallyIs(true);
+
+        setTetherForceUpstreamAutomaticFlagVersion(Long.MAX_VALUE);
+        assertChooseUpstreamAutomaticallyIs(true);
+    }
+
     private void setTetherForceUpstreamAutomaticFlagVersion(Long version) {
         doReturn(version == null ? null : Long.toString(version)).when(
                 () -> DeviceConfig.getProperty(eq(NAMESPACE_CONNECTIVITY),
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
index 9337b1a..a8d886b 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
@@ -196,6 +196,7 @@
 import com.android.networkstack.tethering.TestConnectivityManager.TestNetworkAgent;
 import com.android.networkstack.tethering.metrics.TetheringMetrics;
 import com.android.testutils.DevSdkIgnoreRule;
+import com.android.testutils.DevSdkIgnoreRule.IgnoreAfter;
 import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
 import com.android.testutils.MiscAsserts;
 
@@ -1212,13 +1213,12 @@
         inOrder.verify(mUpstreamNetworkMonitor).setCurrentUpstream(wifi.networkId);
     }
 
-    @Test
-    public void testAutomaticUpstreamSelection() throws Exception {
+    private void verifyAutomaticUpstreamSelection(boolean configAutomatic) throws Exception {
         TestNetworkAgent mobile = new TestNetworkAgent(mCm, buildMobileDualStackUpstreamState());
         TestNetworkAgent wifi = new TestNetworkAgent(mCm, buildWifiUpstreamState());
         InOrder inOrder = inOrder(mCm, mUpstreamNetworkMonitor);
         // Enable automatic upstream selection.
-        upstreamSelectionTestCommon(true, inOrder, mobile, wifi);
+        upstreamSelectionTestCommon(configAutomatic, inOrder, mobile, wifi);
 
         // This code has historically been racy, so test different orderings of CONNECTIVITY_ACTION
         // broadcasts and callbacks, and add mLooper.dispatchAll() calls between the two.
@@ -1298,6 +1298,20 @@
     }
 
     @Test
+    public void testAutomaticUpstreamSelection() throws Exception {
+        verifyAutomaticUpstreamSelection(true /* configAutomatic */);
+    }
+
+    @Test
+    @IgnoreUpTo(Build.VERSION_CODES.TIRAMISU)
+    public void testAutomaticUpstreamSelectionWithConfigDisabled() throws Exception {
+        // Expect that automatic config can't disable the automatic mode because automatic mode
+        // is always enabled on U+ device.
+        verifyAutomaticUpstreamSelection(false /* configAutomatic */);
+    }
+
+    @Test
+    @IgnoreAfter(Build.VERSION_CODES.TIRAMISU)
     public void testLegacyUpstreamSelection() throws Exception {
         TestNetworkAgent mobile = new TestNetworkAgent(mCm, buildMobileDualStackUpstreamState());
         TestNetworkAgent wifi = new TestNetworkAgent(mCm, buildWifiUpstreamState());
@@ -1323,14 +1337,13 @@
         verifyDisableTryCellWhenTetheringStop(inOrder);
     }
 
-    @Test
-    public void testChooseDunUpstreamByAutomaticMode() throws Exception {
+    private void verifyChooseDunUpstreamByAutomaticMode(boolean configAutomatic) throws Exception {
         // Enable automatic upstream selection.
         TestNetworkAgent mobile = new TestNetworkAgent(mCm, buildMobileDualStackUpstreamState());
         TestNetworkAgent wifi = new TestNetworkAgent(mCm, buildWifiUpstreamState());
         TestNetworkAgent dun = new TestNetworkAgent(mCm, buildDunUpstreamState());
         InOrder inOrder = inOrder(mCm, mUpstreamNetworkMonitor);
-        chooseDunUpstreamTestCommon(true, inOrder, mobile, wifi, dun);
+        chooseDunUpstreamTestCommon(configAutomatic, inOrder, mobile, wifi, dun);
 
         // When default network switch to mobile and wifi is connected (may have low signal),
         // automatic mode would request dun again and choose it as upstream.
@@ -1359,6 +1372,18 @@
     }
 
     @Test
+    public void testChooseDunUpstreamByAutomaticMode() throws Exception {
+        verifyChooseDunUpstreamByAutomaticMode(true /* configAutomatic */);
+    }
+
+    @Test
+    @IgnoreUpTo(Build.VERSION_CODES.TIRAMISU)
+    public void testChooseDunUpstreamByAutomaticModeWithConfigDisabled() throws Exception {
+        verifyChooseDunUpstreamByAutomaticMode(false /* configAutomatic */);
+    }
+
+    @Test
+    @IgnoreAfter(Build.VERSION_CODES.TIRAMISU)
     public void testChooseDunUpstreamByLegacyMode() throws Exception {
         // Enable Legacy upstream selection.
         TestNetworkAgent mobile = new TestNetworkAgent(mCm, buildMobileDualStackUpstreamState());
diff --git a/service-t/src/com/android/server/ethernet/EthernetServiceImpl.java b/service-t/src/com/android/server/ethernet/EthernetServiceImpl.java
index edf04b2..f6a55c8 100644
--- a/service-t/src/com/android/server/ethernet/EthernetServiceImpl.java
+++ b/service-t/src/com/android/server/ethernet/EthernetServiceImpl.java
@@ -289,7 +289,7 @@
 
         enforceAdminPermission(iface, false, "enableInterface()");
 
-        mTracker.enableInterface(iface, new EthernetCallback(cb));
+        mTracker.setInterfaceEnabled(iface, true /* enabled */, new EthernetCallback(cb));
     }
 
     @Override
@@ -301,7 +301,7 @@
 
         enforceAdminPermission(iface, false, "disableInterface()");
 
-        mTracker.disableInterface(iface, new EthernetCallback(cb));
+        mTracker.setInterfaceEnabled(iface, false /* enabled */, new EthernetCallback(cb));
     }
 
     @Override
diff --git a/service-t/src/com/android/server/ethernet/EthernetTracker.java b/service-t/src/com/android/server/ethernet/EthernetTracker.java
index 95baf81..852cf42 100644
--- a/service-t/src/com/android/server/ethernet/EthernetTracker.java
+++ b/service-t/src/com/android/server/ethernet/EthernetTracker.java
@@ -371,15 +371,9 @@
     }
 
     @VisibleForTesting(visibility = PACKAGE)
-    protected void enableInterface(@NonNull final String iface,
+    protected void setInterfaceEnabled(@NonNull final String iface, boolean enabled,
             @Nullable final EthernetCallback cb) {
-        mHandler.post(() -> updateInterfaceState(iface, true, cb));
-    }
-
-    @VisibleForTesting(visibility = PACKAGE)
-    protected void disableInterface(@NonNull final String iface,
-            @Nullable final EthernetCallback cb) {
-        mHandler.post(() -> updateInterfaceState(iface, false, cb));
+        mHandler.post(() -> updateInterfaceState(iface, enabled, cb));
     }
 
     IpConfiguration getIpConfiguration(String iface) {
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/MdnsNsecRecord.java b/service/mdns/com/android/server/connectivity/mdns/MdnsNsecRecord.java
new file mode 100644
index 0000000..57c3c03
--- /dev/null
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsNsecRecord.java
@@ -0,0 +1,142 @@
+/*
+ * 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 com.android.net.module.util.CollectionUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+/**
+ * A mDNS "NSEC" record, used in particular for negative responses (RFC6762 6.1).
+ */
+public class MdnsNsecRecord extends MdnsRecord {
+    private String[] mNextDomain;
+    private int[] mTypes;
+
+    public MdnsNsecRecord(String[] name, MdnsPacketReader reader) throws IOException {
+        this(name, reader, false);
+    }
+
+    public MdnsNsecRecord(String[] name, MdnsPacketReader reader, boolean isQuestion)
+            throws IOException {
+        super(name, TYPE_NSEC, reader, isQuestion);
+    }
+
+    public MdnsNsecRecord(String[] name, long receiptTimeMillis, boolean cacheFlush, long ttlMillis,
+            String[] nextDomain, int[] types) {
+        super(name, TYPE_NSEC, DnsResolver.CLASS_IN, receiptTimeMillis, cacheFlush, ttlMillis);
+        mNextDomain = nextDomain;
+        final int[] sortedTypes = Arrays.copyOf(types, types.length);
+        Arrays.sort(sortedTypes);
+        mTypes = sortedTypes;
+    }
+
+    public String[] getNextDomain() {
+        return mNextDomain;
+    }
+
+    public int[] getTypes() {
+        return mTypes;
+    }
+
+    @Override
+    protected void readData(MdnsPacketReader reader) throws IOException {
+        mNextDomain = reader.readLabels();
+        mTypes = readTypes(reader);
+    }
+
+    private int[] readTypes(MdnsPacketReader reader) throws IOException {
+        // See RFC3845 #2.1.2
+        final ArrayList<Integer> types = new ArrayList<>();
+        int prevBlockNumber = -1;
+        while (reader.getRemaining() > 0) {
+            final int blockNumber = reader.readUInt8();
+            if (blockNumber <= prevBlockNumber) {
+                throw new IOException(
+                        "Unordered block number: " + blockNumber + " after " + prevBlockNumber);
+            }
+            prevBlockNumber = blockNumber;
+            final int bitmapLength = reader.readUInt8();
+            if (bitmapLength > 32 || bitmapLength <= 0) {
+                throw new IOException("Invalid bitmap length: " + bitmapLength);
+            }
+            final byte[] bitmap = new byte[bitmapLength];
+            reader.readBytes(bitmap);
+
+            for (int bitmapIndex = 0; bitmapIndex < bitmap.length; bitmapIndex++) {
+                final byte bitmapByte = bitmap[bitmapIndex];
+                for (int bit = 0; bit < 8; bit++) {
+                    if ((bitmapByte & (1 << (7 - bit))) != 0) {
+                        types.add(blockNumber * 256 + bitmapIndex * 8 + bit);
+                    }
+                }
+            }
+        }
+
+        return CollectionUtils.toIntArray(types);
+    }
+
+    @Override
+    protected void writeData(MdnsPacketWriter writer) throws IOException {
+        // No compression as per RFC3845 2.1.1
+        writer.writeLabelsNoCompression(mNextDomain);
+
+        // type bitmaps: RFC3845 2.1.2
+        int typesBlockStart = 0;
+        int pendingBlockNumber = -1;
+        int blockLength = 0;
+        // Loop on types (which are sorted in increasing order) to find each block and determine
+        // their length; use writeTypeBlock once the length of each block has been found.
+        for (int i = 0; i < mTypes.length; i++) {
+            final int blockNumber = mTypes[i] / 256;
+            final int typeLowOrder = mTypes[i] % 256;
+            // If the low-order 8 bits are e.g. 0x10, bit number 16 (=0x10) will be set in the
+            // bitmap; this is the first bit of byte 2 (byte 0 is 0-7, 1 is 8-15, etc.)
+            final int byteIndex = typeLowOrder / 8;
+
+            if (pendingBlockNumber >= 0 && blockNumber != pendingBlockNumber) {
+                // Just reached a new block; write the previous one
+                writeTypeBlock(writer, typesBlockStart, i - 1, blockLength);
+                typesBlockStart = i;
+                blockLength = 0;
+            }
+            blockLength = Math.max(blockLength, byteIndex + 1);
+            pendingBlockNumber = blockNumber;
+        }
+
+        if (pendingBlockNumber >= 0) {
+            writeTypeBlock(writer, typesBlockStart, mTypes.length - 1, blockLength);
+        }
+    }
+
+    private void writeTypeBlock(MdnsPacketWriter writer,
+            int typesStart, int typesEnd, int bytesInBlock) throws IOException {
+        final int blockNumber = mTypes[typesStart] / 256;
+        final byte[] bytes = new byte[bytesInBlock];
+        for (int i = typesStart; i <= typesEnd; i++) {
+            final int typeLowOrder = mTypes[i] % 256;
+            bytes[typeLowOrder / 8] |= 1 << (7 - (typeLowOrder % 8));
+        }
+        writer.writeUInt8(blockNumber);
+        writer.writeUInt8(bytesInBlock);
+        writer.writeBytes(bytes);
+    }
+}
diff --git a/service/mdns/com/android/server/connectivity/mdns/MdnsPacketWriter.java b/service/mdns/com/android/server/connectivity/mdns/MdnsPacketWriter.java
index b78aa5d..611787f 100644
--- a/service/mdns/com/android/server/connectivity/mdns/MdnsPacketWriter.java
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsPacketWriter.java
@@ -190,12 +190,7 @@
             }
             writePointer(suffixPointer);
         } else {
-            int[] offsets = new int[labels.length];
-            for (int i = 0; i < labels.length; ++i) {
-                offsets[i] = getWritePosition();
-                writeString(labels[i]);
-            }
-            writeUInt8(0); // NUL terminator
+            int[] offsets = writeLabelsNoCompression(labels);
 
             // Add entries to the label dictionary for each suffix of the label list, including
             // the whole list itself.
@@ -207,6 +202,21 @@
         }
     }
 
+    /**
+     * Write a series a labels, without using name compression.
+     *
+     * @return The offsets where each label was written to.
+     */
+    public int[] writeLabelsNoCompression(String[] labels) throws IOException {
+        int[] offsets = new int[labels.length];
+        for (int i = 0; i < labels.length; ++i) {
+            offsets[i] = getWritePosition();
+            writeString(labels[i]);
+        }
+        writeUInt8(0); // NUL terminator
+        return offsets;
+    }
+
     /** Returns the number of bytes that can still be written. */
     public int getRemaining() {
         return data.length - pos;
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..10b8825 100644
--- a/service/mdns/com/android/server/connectivity/mdns/MdnsRecord.java
+++ b/service/mdns/com/android/server/connectivity/mdns/MdnsRecord.java
@@ -39,6 +39,12 @@
     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_NSEC = 0x002f;
+    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 +64,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 +161,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 +238,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/android/net/VpnTransportInfoTest.java b/tests/common/java/android/net/VpnTransportInfoTest.java
similarity index 94%
rename from tests/unit/java/android/net/VpnTransportInfoTest.java
rename to tests/common/java/android/net/VpnTransportInfoTest.java
index 0510209..161f9ee 100644
--- a/tests/unit/java/android/net/VpnTransportInfoTest.java
+++ b/tests/common/java/android/net/VpnTransportInfoTest.java
@@ -20,7 +20,7 @@
 import static android.net.NetworkCapabilities.REDACT_NONE;
 
 import static com.android.testutils.MiscAsserts.assertThrows;
-import static com.android.testutils.ParcelUtils.assertParcelSane;
+import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -31,6 +31,7 @@
 
 import androidx.test.filters.SmallTest;
 
+import com.android.testutils.ConnectivityModuleTest;
 import com.android.testutils.DevSdkIgnoreRule;
 import com.android.testutils.DevSdkIgnoreRunner;
 
@@ -41,6 +42,7 @@
 @RunWith(DevSdkIgnoreRunner.class)
 @SmallTest
 @DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
+@ConnectivityModuleTest
 public class VpnTransportInfoTest {
     @Rule
     public final DevSdkIgnoreRule ignoreRule = new DevSdkIgnoreRule();
@@ -48,11 +50,11 @@
     @Test
     public void testParceling() {
         final VpnTransportInfo v = new VpnTransportInfo(VpnManager.TYPE_VPN_PLATFORM, "12345");
-        assertParcelSane(v, 3 /* fieldCount */);
+        assertParcelingIsLossless(v);
 
         final VpnTransportInfo v2 =
                 new VpnTransportInfo(VpnManager.TYPE_VPN_PLATFORM, "12345", true);
-        assertParcelSane(v2, 3 /* fieldCount */);
+        assertParcelingIsLossless(v2);
     }
 
     @Test
diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
index f796ecc..6c6070e 100644
--- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -1072,14 +1072,6 @@
             }, NETWORK_SETTINGS);
             registerBestMatchingNetworkCallback(makeDefaultRequest(), bestMatchingCallback, h);
         }
-        if (TestUtils.shouldTestTApis()) {
-            // Verify registerSystemDefaultNetworkCallback can be accessed via
-            // CONNECTIVITY_USE_RESTRICTED_NETWORKS permission.
-            final TestNetworkCallback systemDefaultCallback2 = new TestNetworkCallback();
-            runWithShellPermissionIdentity(() ->
-                    registerSystemDefaultNetworkCallback(systemDefaultCallback2, h),
-                    CONNECTIVITY_USE_RESTRICTED_NETWORKS);
-        }
 
         Network wifiNetwork = null;
         mCtsNetUtils.ensureWifiConnected();
@@ -1109,6 +1101,18 @@
         }
     }
 
+    @ConnectivityModuleTest
+    @IgnoreUpTo(Build.VERSION_CODES.R)
+    @Test
+    public void testRegisterSystemDefaultNetworkCallbackPermission() {
+        final Handler h = new Handler(Looper.getMainLooper());
+        // Verify registerSystemDefaultNetworkCallback can be accessed via
+        // CONNECTIVITY_USE_RESTRICTED_NETWORKS permission.
+        runWithShellPermissionIdentity(() ->
+                        registerSystemDefaultNetworkCallback(new TestNetworkCallback(), h),
+                CONNECTIVITY_USE_RESTRICTED_NETWORKS);
+    }
+
     /**
      * Tests both registerNetworkCallback and unregisterNetworkCallback similarly to
      * {@link #testRegisterNetworkCallback} except that a {@code PendingIntent} is used instead
diff --git a/tests/cts/net/src/android/net/cts/TestUtils.java b/tests/cts/net/src/android/net/cts/TestUtils.java
index 001aa01..6180845 100644
--- a/tests/cts/net/src/android/net/cts/TestUtils.java
+++ b/tests/cts/net/src/android/net/cts/TestUtils.java
@@ -16,8 +16,6 @@
 
 package android.net.cts;
 
-import static com.android.testutils.DevSdkIgnoreRuleKt.SC_V2;
-
 import android.os.Build;
 
 import com.android.modules.utils.build.SdkLevel;
@@ -37,11 +35,18 @@
     }
 
     /**
-     * Whether to test T+ APIs. This requires a) that the test be running on an S+ device, and
+     * Whether to test T+ APIs. This requires a) that the test be running on an T+ device, and
      * b) that the code be compiled against shims new enough to access these APIs.
      */
     public static boolean shouldTestTApis() {
-        // TODO: replace SC_V2 with Build.VERSION_CODES.S_V2 when it's available in mainline branch.
-        return SdkLevel.isAtLeastT() && ConstantsShim.VERSION > SC_V2;
+        return SdkLevel.isAtLeastT() && ConstantsShim.VERSION > Build.VERSION_CODES.S_V2;
+    }
+
+    /**
+     * Whether to test U+ APIs. This requires a) that the test be running on an U+ device, and
+     * b) that the code be compiled against shims new enough to access these APIs.
+     */
+    public static boolean shouldTestUApis() {
+        return SdkLevel.isAtLeastU() && ConstantsShim.VERSION > Build.VERSION_CODES.TIRAMISU;
     }
 }
diff --git a/tests/unit/java/com/android/server/connectivity/CarrierPrivilegeAuthenticatorTest.java b/tests/unit/java/com/android/server/connectivity/CarrierPrivilegeAuthenticatorTest.java
index 157507b..3849e49 100644
--- a/tests/unit/java/com/android/server/connectivity/CarrierPrivilegeAuthenticatorTest.java
+++ b/tests/unit/java/com/android/server/connectivity/CarrierPrivilegeAuthenticatorTest.java
@@ -20,18 +20,17 @@
 import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
 import static android.telephony.TelephonyManager.ACTION_MULTI_SIM_CONFIG_CHANGED;
 
-import static com.android.testutils.DevSdkIgnoreRuleKt.SC_V2;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.clearInvocations;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 import android.annotation.NonNull;
@@ -40,14 +39,15 @@
 import android.content.IntentFilter;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
-import android.net.NetworkRequest;
-import android.net.NetworkSpecifier;
+import android.net.NetworkCapabilities;
 import android.net.TelephonyNetworkSpecifier;
+import android.os.Build;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 
+import com.android.net.module.util.CollectionUtils;
 import com.android.networkstack.apishim.TelephonyManagerShimImpl;
-import com.android.networkstack.apishim.common.TelephonyManagerShim;
+import com.android.networkstack.apishim.common.TelephonyManagerShim.CarrierPrivilegesListenerShim;
 import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
 import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
 import com.android.testutils.DevSdkIgnoreRunner;
@@ -58,16 +58,16 @@
 import org.mockito.ArgumentCaptor;
 
 import java.util.Collections;
-import java.util.List;
+import java.util.Map;
 
 /**
  * Tests for CarrierPrivilegeAuthenticatorTest.
  *
  * Build, install and run with:
- *  runtest frameworks-net -c com.android.server.connectivity.CarrierPrivilegeAuthenticatorTest
+ *  atest FrameworksNetTests:CarrierPrivilegeAuthenticatorTest
  */
 @RunWith(DevSdkIgnoreRunner.class)
-@IgnoreUpTo(SC_V2) // TODO: Use to Build.VERSION_CODES.SC_V2 when available
+@IgnoreUpTo(Build.VERSION_CODES.S_V2)
 public class CarrierPrivilegeAuthenticatorTest {
     private static final int SUBSCRIPTION_COUNT = 2;
     private static final int TEST_SUBSCRIPTION_ID = 1;
@@ -107,8 +107,7 @@
         doReturn(mPackageManager).when(mContext).getPackageManager();
         final ApplicationInfo applicationInfo = new ApplicationInfo();
         applicationInfo.uid = mCarrierConfigPkgUid;
-        doReturn(applicationInfo).when(mPackageManager)
-                .getApplicationInfo(eq(mTestPkg), anyInt());
+        doReturn(applicationInfo).when(mPackageManager).getApplicationInfo(eq(mTestPkg), anyInt());
         mCarrierPrivilegeAuthenticator =
                 new TestCarrierPrivilegeAuthenticator(mContext, mTelephonyManager);
     }
@@ -119,21 +118,23 @@
         return captor.getValue();
     }
 
-    private List<TelephonyManagerShim.CarrierPrivilegesListenerShim>
-            getCarrierPrivilegesListeners() {
-        final ArgumentCaptor<TelephonyManagerShim.CarrierPrivilegesListenerShim> captor =
-                ArgumentCaptor.forClass(TelephonyManagerShim.CarrierPrivilegesListenerShim.class);
+    private Map<Integer, CarrierPrivilegesListenerShim> getCarrierPrivilegesListeners() {
+        final ArgumentCaptor<Integer> slotCaptor = ArgumentCaptor.forClass(Integer.class);
+        final ArgumentCaptor<CarrierPrivilegesListenerShim> listenerCaptor =
+                ArgumentCaptor.forClass(CarrierPrivilegesListenerShim.class);
         try {
-            verify(mTelephonyManagerShim, atLeastOnce())
-                    .addCarrierPrivilegesListener(anyInt(), any(), captor.capture());
+            verify(mTelephonyManagerShim, atLeastOnce()).addCarrierPrivilegesListener(
+                    slotCaptor.capture(), any(), listenerCaptor.capture());
         } catch (UnsupportedApiLevelException e) {
         }
-        return captor.getAllValues();
+        final Map<Integer, CarrierPrivilegesListenerShim> result =
+                CollectionUtils.assoc(slotCaptor.getAllValues(), listenerCaptor.getAllValues());
+        clearInvocations(mTelephonyManagerShim);
+        return result;
     }
 
     private Intent buildTestMultiSimConfigBroadcastIntent() {
-        final Intent intent = new Intent(ACTION_MULTI_SIM_CONFIG_CHANGED);
-        return intent;
+        return new Intent(ACTION_MULTI_SIM_CONFIG_CHANGED);
     }
     @Test
     public void testConstructor() throws Exception {
@@ -146,99 +147,96 @@
         assertEquals(1, filter.countActions());
         assertTrue(filter.hasAction(ACTION_MULTI_SIM_CONFIG_CHANGED));
 
-        verify(mTelephonyManagerShim, times(2))
-                .addCarrierPrivilegesListener(anyInt(), any(), any());
-        verify(mTelephonyManagerShim)
-                .addCarrierPrivilegesListener(eq(0), any(), any());
-        verify(mTelephonyManagerShim)
-                .addCarrierPrivilegesListener(eq(1), any(), any());
-        assertEquals(2, getCarrierPrivilegesListeners().size());
+        // Two listeners originally registered, one for slot 0 and one for slot 1
+        final Map<Integer, CarrierPrivilegesListenerShim> initialListeners =
+                getCarrierPrivilegesListeners();
+        assertNotNull(initialListeners.get(0));
+        assertNotNull(initialListeners.get(1));
+        assertEquals(2, initialListeners.size());
 
-        final TelephonyNetworkSpecifier telephonyNetworkSpecifier =
-                new TelephonyNetworkSpecifier(0);
-        final NetworkRequest.Builder networkRequestBuilder = new NetworkRequest.Builder();
-        networkRequestBuilder.addTransportType(TRANSPORT_CELLULAR);
-        networkRequestBuilder.setNetworkSpecifier(telephonyNetworkSpecifier);
+        final NetworkCapabilities.Builder ncBuilder = new NetworkCapabilities.Builder()
+                .addTransportType(TRANSPORT_CELLULAR)
+                .setNetworkSpecifier(new TelephonyNetworkSpecifier(0));
 
         assertTrue(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid, ncBuilder.build()));
         assertFalse(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid + 1, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid + 1, ncBuilder.build()));
     }
 
     @Test
     public void testMultiSimConfigChanged() throws Exception {
-        doReturn(1).when(mTelephonyManager).getActiveModemCount();
-        final List<TelephonyManagerShim.CarrierPrivilegesListenerShim> carrierPrivilegesListeners =
+        // Two listeners originally registered, one for slot 0 and one for slot 1
+        final Map<Integer, CarrierPrivilegesListenerShim> initialListeners =
                 getCarrierPrivilegesListeners();
+        assertNotNull(initialListeners.get(0));
+        assertNotNull(initialListeners.get(1));
+        assertEquals(2, initialListeners.size());
 
+        doReturn(1).when(mTelephonyManager).getActiveModemCount();
         mCarrierPrivilegeAuthenticator.onReceive(
                 mContext, buildTestMultiSimConfigBroadcastIntent());
-        for (TelephonyManagerShim.CarrierPrivilegesListenerShim carrierPrivilegesListener
-                : carrierPrivilegesListeners) {
-            verify(mTelephonyManagerShim)
-                    .removeCarrierPrivilegesListener(eq(carrierPrivilegesListener));
+        // Check all listeners have been removed
+        for (CarrierPrivilegesListenerShim listener : initialListeners.values()) {
+            verify(mTelephonyManagerShim).removeCarrierPrivilegesListener(eq(listener));
         }
 
         // Expect a new CarrierPrivilegesListener to have been registered for slot 0, and none other
-        // (2 previously registered during startup, for slots 0 & 1)
-        verify(mTelephonyManagerShim, times(3))
-                .addCarrierPrivilegesListener(anyInt(), any(), any());
-        verify(mTelephonyManagerShim, times(2))
-                .addCarrierPrivilegesListener(eq(0), any(), any());
+        final Map<Integer, CarrierPrivilegesListenerShim> newListeners =
+                getCarrierPrivilegesListeners();
+        assertNotNull(newListeners.get(0));
+        assertEquals(1, newListeners.size());
 
-        final TelephonyNetworkSpecifier telephonyNetworkSpecifier =
-                new TelephonyNetworkSpecifier(0);
-        final NetworkRequest.Builder networkRequestBuilder = new NetworkRequest.Builder();
-        networkRequestBuilder.addTransportType(TRANSPORT_CELLULAR);
-        networkRequestBuilder.setNetworkSpecifier(telephonyNetworkSpecifier);
+        final TelephonyNetworkSpecifier specifier = new TelephonyNetworkSpecifier(0);
+        final NetworkCapabilities nc = new NetworkCapabilities.Builder()
+                .addTransportType(TRANSPORT_CELLULAR)
+                .setNetworkSpecifier(specifier)
+                .build();
         assertTrue(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid, nc));
         assertFalse(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid + 1, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid + 1, nc));
     }
 
     @Test
     public void testOnCarrierPrivilegesChanged() throws Exception {
-        final TelephonyManagerShim.CarrierPrivilegesListenerShim listener =
-                getCarrierPrivilegesListeners().get(0);
+        final CarrierPrivilegesListenerShim listener = getCarrierPrivilegesListeners().get(0);
 
-        final TelephonyNetworkSpecifier telephonyNetworkSpecifier =
-                new TelephonyNetworkSpecifier(0);
-        final NetworkRequest.Builder networkRequestBuilder = new NetworkRequest.Builder();
-        networkRequestBuilder.addTransportType(TRANSPORT_CELLULAR);
-        networkRequestBuilder.setNetworkSpecifier(telephonyNetworkSpecifier);
+        final TelephonyNetworkSpecifier specifier = new TelephonyNetworkSpecifier(0);
+        final NetworkCapabilities nc = new NetworkCapabilities.Builder()
+                .addTransportType(TRANSPORT_CELLULAR)
+                .setNetworkSpecifier(specifier)
+                .build();
 
         final ApplicationInfo applicationInfo = new ApplicationInfo();
         applicationInfo.uid = mCarrierConfigPkgUid + 1;
-        doReturn(applicationInfo).when(mPackageManager)
-                .getApplicationInfo(eq(mTestPkg), anyInt());
+        doReturn(applicationInfo).when(mPackageManager).getApplicationInfo(eq(mTestPkg), anyInt());
         listener.onCarrierPrivilegesChanged(Collections.emptyList(), new int[] {});
 
         assertFalse(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid, nc));
         assertTrue(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid + 1, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid + 1, nc));
     }
 
     @Test
     public void testDefaultSubscription() throws Exception {
-        final NetworkRequest.Builder networkRequestBuilder = new NetworkRequest.Builder();
-        networkRequestBuilder.addTransportType(TRANSPORT_CELLULAR);
+        final NetworkCapabilities.Builder ncBuilder = new NetworkCapabilities.Builder();
+        ncBuilder.addTransportType(TRANSPORT_CELLULAR);
         assertFalse(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid, ncBuilder.build()));
 
-        networkRequestBuilder.setNetworkSpecifier(new TelephonyNetworkSpecifier(0));
+        ncBuilder.setNetworkSpecifier(new TelephonyNetworkSpecifier(0));
         assertTrue(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid, ncBuilder.build()));
 
-        // The builder for NetworkRequest doesn't allow removing the transport as long as a
+        // The builder for NetworkCapabilities doesn't allow removing the transport as long as a
         // specifier is set, so unset it first. TODO : fix the builder
-        networkRequestBuilder.setNetworkSpecifier((NetworkSpecifier) null);
-        networkRequestBuilder.removeTransportType(TRANSPORT_CELLULAR);
-        networkRequestBuilder.addTransportType(TRANSPORT_WIFI);
-        networkRequestBuilder.setNetworkSpecifier(new TelephonyNetworkSpecifier(0));
+        ncBuilder.setNetworkSpecifier(null);
+        ncBuilder.removeTransportType(TRANSPORT_CELLULAR);
+        ncBuilder.addTransportType(TRANSPORT_WIFI);
+        ncBuilder.setNetworkSpecifier(new TelephonyNetworkSpecifier(0));
         assertFalse(mCarrierPrivilegeAuthenticator.hasCarrierPrivilegeForNetworkCapabilities(
-                mCarrierConfigPkgUid, networkRequestBuilder.build().networkCapabilities));
+                mCarrierConfigPkgUid, ncBuilder.build()));
     }
 }
diff --git a/tests/unit/java/com/android/server/connectivity/VpnTest.java b/tests/unit/java/com/android/server/connectivity/VpnTest.java
index 3c23d7b..e6745d1 100644
--- a/tests/unit/java/com/android/server/connectivity/VpnTest.java
+++ b/tests/unit/java/com/android/server/connectivity/VpnTest.java
@@ -1853,6 +1853,7 @@
 
         // Check if allowBypass is set or not.
         assertTrue(nacCaptor.getValue().isBypassableVpn());
+        assertTrue(((VpnTransportInfo) ncCaptor.getValue().getTransportInfo()).getBypassable());
 
         return new PlatformVpnSnapshot(vpn, nwCb, ikeCb, childCb);
     }
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..7d800d8 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordTests.java
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordTests.java
@@ -18,11 +18,13 @@
 
 import static com.android.testutils.DevSdkIgnoreRuleKt.SC_V2;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
 
 import android.util.Log;
 
@@ -79,14 +81,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 +118,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 +155,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 +196,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,20 +237,90 @@
         assertEquals(1, record.getServicePriority());
         assertEquals(255, record.getServiceWeight());
 
-        // 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);
     }
 
     @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);
+    }
+
+    @Test
+    public void testNsecRecord() throws IOException {
+        final byte[] dataIn = HexDump.hexStringToByteArray(
+                // record.android.com
+                "067265636F726407616E64726F696403636F6D00"
+                        // Type 0x002f (NSEC), cache flush set on class IN (0x8001)
+                        + "002F8001"
+                        // TTL 0x0000003c (60 secs)
+                        + "0000003C"
+                        // Data length
+                        + "003C"
+                        // nextdomain.android.com
+                        + "0A6E657874646F6D61696E07616E64726F696403636F6D00"
+                        // Type bitmaps: window block 0x00, bitmap length 0x05,
+                        // bits 16 (TXT) and 33 (SRV) set: 0x0000800040
+                        + "00050000800040"
+                        // For 1234, 4*256 + 210 = 1234, so window block 0x04, bitmap length 27/0x1B
+                        // (26*8 + 2 = 210, need 27 bytes to set bit 210),
+                        // bit 2 set on byte 27 (0x20).
+                        + "041B000000000000000000000000000000000000000000000000000020");
+        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("record.android.com", fqdn);
+
+        int type = reader.readUInt16();
+        assertEquals(MdnsRecord.TYPE_NSEC, type);
+
+        MdnsNsecRecord record = new MdnsNsecRecord(name, reader);
+        assertTrue(record.getCacheFlush());
+        assertEquals(60_000L, record.getTtl());
+        assertEquals("nextdomain.android.com", MdnsRecord.labelsToString(record.getNextDomain()));
+        assertArrayEquals(new int[] { MdnsRecord.TYPE_TXT,
+                MdnsRecord.TYPE_SRV,
+                // Non-existing record type, > 256
+                1234 }, record.getTypes());
+
+        String dataOutText = toHex(record);
+        assertEquals(dataInText, dataOutText);
+    }
+
+    @Test
     public void testTextRecord() throws IOException {
         final byte[] dataIn = HexDump.hexStringToByteArray(
                 "0474657374000010"
@@ -320,19 +364,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/tests/unit/java/com/android/server/ethernet/EthernetServiceImplTest.java b/tests/unit/java/com/android/server/ethernet/EthernetServiceImplTest.java
index 9bf893a..de0af94 100644
--- a/tests/unit/java/com/android/server/ethernet/EthernetServiceImplTest.java
+++ b/tests/unit/java/com/android/server/ethernet/EthernetServiceImplTest.java
@@ -312,14 +312,15 @@
     @Test
     public void testEnableInterface() {
         mEthernetServiceImpl.enableInterface(TEST_IFACE, NULL_LISTENER);
-        verify(mEthernetTracker).enableInterface(eq(TEST_IFACE),
+        verify(mEthernetTracker).setInterfaceEnabled(eq(TEST_IFACE), eq(true),
                 any(EthernetCallback.class));
     }
 
     @Test
     public void testDisableInterface() {
         mEthernetServiceImpl.disableInterface(TEST_IFACE, NULL_LISTENER);
-        verify(mEthernetTracker).disableInterface(eq(TEST_IFACE), any(EthernetCallback.class));
+        verify(mEthernetTracker).setInterfaceEnabled(eq(TEST_IFACE), eq(false),
+                any(EthernetCallback.class));
     }
 
     @Test
@@ -384,7 +385,7 @@
         denyManageEthPermission();
 
         mEthernetServiceImpl.enableInterface(TEST_IFACE, NULL_LISTENER);
-        verify(mEthernetTracker).enableInterface(eq(TEST_IFACE),
+        verify(mEthernetTracker).setInterfaceEnabled(eq(TEST_IFACE), eq(true),
                 any(EthernetCallback.class));
     }
 
@@ -395,7 +396,7 @@
         denyManageEthPermission();
 
         mEthernetServiceImpl.disableInterface(TEST_IFACE, NULL_LISTENER);
-        verify(mEthernetTracker).disableInterface(eq(TEST_IFACE),
+        verify(mEthernetTracker).setInterfaceEnabled(eq(TEST_IFACE), eq(false),
                 any(EthernetCallback.class));
     }
 
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 62afa61..8ea9633 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -117,6 +117,58 @@
 // GN: //base/allocator/partition_allocator:partition_alloc
 cc_library_static {
     name: "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+    srcs: [
+        "base/allocator/partition_allocator/address_pool_manager.cc",
+        "base/allocator/partition_allocator/address_pool_manager_bitmap.cc",
+        "base/allocator/partition_allocator/address_space_randomization.cc",
+        "base/allocator/partition_allocator/allocation_guard.cc",
+        "base/allocator/partition_allocator/dangling_raw_ptr_checks.cc",
+        "base/allocator/partition_allocator/gwp_asan_support.cc",
+        "base/allocator/partition_allocator/memory_reclaimer.cc",
+        "base/allocator/partition_allocator/oom.cc",
+        "base/allocator/partition_allocator/oom_callback.cc",
+        "base/allocator/partition_allocator/page_allocator.cc",
+        "base/allocator/partition_allocator/page_allocator_internals_posix.cc",
+        "base/allocator/partition_allocator/partition_address_space.cc",
+        "base/allocator/partition_allocator/partition_alloc.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/check.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/cpu.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/debug/alias.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/files/file_util_posix.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/logging.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/memory/ref_counted.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/pkey.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/posix/safe_strerror.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/rand_util.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/strings/stringprintf.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/time/time.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/time/time_conversion_posix.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/time/time_now_posix.cc",
+        "base/allocator/partition_allocator/partition_alloc_base/time/time_override.cc",
+        "base/allocator/partition_allocator/partition_alloc_hooks.cc",
+        "base/allocator/partition_allocator/partition_bucket.cc",
+        "base/allocator/partition_allocator/partition_oom.cc",
+        "base/allocator/partition_allocator/partition_page.cc",
+        "base/allocator/partition_allocator/partition_root.cc",
+        "base/allocator/partition_allocator/partition_stats.cc",
+        "base/allocator/partition_allocator/random.cc",
+        "base/allocator/partition_allocator/reservation_offset_table.cc",
+        "base/allocator/partition_allocator/spinning_mutex.cc",
+        "base/allocator/partition_allocator/starscan/metadata_allocator.cc",
+        "base/allocator/partition_allocator/starscan/pcscan.cc",
+        "base/allocator/partition_allocator/starscan/pcscan_internal.cc",
+        "base/allocator/partition_allocator/starscan/pcscan_scheduling.cc",
+        "base/allocator/partition_allocator/starscan/snapshot.cc",
+        "base/allocator/partition_allocator/starscan/stack/stack.cc",
+        "base/allocator/partition_allocator/starscan/stats_collector.cc",
+        "base/allocator/partition_allocator/starscan/write_protector.cc",
+        "base/allocator/partition_allocator/tagging.cc",
+        "base/allocator/partition_allocator/thread_cache.cc",
+    ],
+    host_supported: true,
     generated_headers: [
         "cronet_aml_base_allocator_partition_allocator_chromecast_buildflags",
         "cronet_aml_base_allocator_partition_allocator_chromeos_buildflags",
@@ -133,15 +185,13 @@
     ],
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_third_party_android_ndk_cpu_features",
     ],
     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",
-        "-DHAVE_SYS_UIO_H",
         "-DIS_PARTITION_ALLOC_IMPL",
         "-DPA_PCSCAN_STACK_SUPPORTED",
         "-D_DEBUG",
@@ -158,127 +208,55 @@
         "buildtools/third_party/libc++/",
         "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",
     ],
     cpp_std: "c++20",
-    arch: {
-        x86: {
+    target: {
+        android_x86: {
             srcs: [
-                ":cronet_aml_third_party_android_ndk_cpu_features",
-                "base/allocator/partition_allocator/address_pool_manager.cc",
-                "base/allocator/partition_allocator/address_pool_manager_bitmap.cc",
-                "base/allocator/partition_allocator/address_space_randomization.cc",
-                "base/allocator/partition_allocator/allocation_guard.cc",
-                "base/allocator/partition_allocator/dangling_raw_ptr_checks.cc",
-                "base/allocator/partition_allocator/gwp_asan_support.cc",
-                "base/allocator/partition_allocator/memory_reclaimer.cc",
-                "base/allocator/partition_allocator/oom.cc",
-                "base/allocator/partition_allocator/oom_callback.cc",
-                "base/allocator/partition_allocator/page_allocator.cc",
-                "base/allocator/partition_allocator/page_allocator_internals_posix.cc",
-                "base/allocator/partition_allocator/partition_address_space.cc",
-                "base/allocator/partition_allocator/partition_alloc.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/check.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/cpu.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/debug/alias.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/files/file_path.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/files/file_util_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/logging.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/memory/ref_counted.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/native_library.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/pkey.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/posix/safe_strerror.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/rand_util.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/strings/stringprintf.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time_conversion_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time_now_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time_override.cc",
-                "base/allocator/partition_allocator/partition_alloc_hooks.cc",
-                "base/allocator/partition_allocator/partition_bucket.cc",
-                "base/allocator/partition_allocator/partition_oom.cc",
-                "base/allocator/partition_allocator/partition_page.cc",
-                "base/allocator/partition_allocator/partition_root.cc",
-                "base/allocator/partition_allocator/partition_stats.cc",
-                "base/allocator/partition_allocator/random.cc",
-                "base/allocator/partition_allocator/reservation_offset_table.cc",
-                "base/allocator/partition_allocator/spinning_mutex.cc",
-                "base/allocator/partition_allocator/starscan/metadata_allocator.cc",
-                "base/allocator/partition_allocator/starscan/pcscan.cc",
-                "base/allocator/partition_allocator/starscan/pcscan_internal.cc",
-                "base/allocator/partition_allocator/starscan/pcscan_scheduling.cc",
-                "base/allocator/partition_allocator/starscan/snapshot.cc",
                 "base/allocator/partition_allocator/starscan/stack/asm/x86/push_registers_asm.cc",
-                "base/allocator/partition_allocator/starscan/stack/stack.cc",
-                "base/allocator/partition_allocator/starscan/stats_collector.cc",
-                "base/allocator/partition_allocator/starscan/write_protector.cc",
-                "base/allocator/partition_allocator/tagging.cc",
-                "base/allocator/partition_allocator/thread_cache.cc",
+            ],
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+            local_include_dirs: [
+                "third_party/android_ndk/sources/android/cpufeatures/",
             ],
         },
-        x86_64: {
+        android_x86_64: {
             srcs: [
-                ":cronet_aml_third_party_android_ndk_cpu_features",
-                "base/allocator/partition_allocator/address_pool_manager.cc",
-                "base/allocator/partition_allocator/address_pool_manager_bitmap.cc",
-                "base/allocator/partition_allocator/address_space_randomization.cc",
-                "base/allocator/partition_allocator/allocation_guard.cc",
-                "base/allocator/partition_allocator/dangling_raw_ptr_checks.cc",
-                "base/allocator/partition_allocator/gwp_asan_support.cc",
-                "base/allocator/partition_allocator/memory_reclaimer.cc",
-                "base/allocator/partition_allocator/oom.cc",
-                "base/allocator/partition_allocator/oom_callback.cc",
-                "base/allocator/partition_allocator/page_allocator.cc",
-                "base/allocator/partition_allocator/page_allocator_internals_posix.cc",
-                "base/allocator/partition_allocator/partition_address_space.cc",
-                "base/allocator/partition_allocator/partition_alloc.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/check.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/cpu.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/debug/alias.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/files/file_path.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/files/file_util_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/logging.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/memory/ref_counted.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/native_library.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/pkey.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/posix/safe_strerror.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/rand_util.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/strings/stringprintf.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time_conversion_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time_now_posix.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time_override.cc",
-                "base/allocator/partition_allocator/partition_alloc_hooks.cc",
-                "base/allocator/partition_allocator/partition_bucket.cc",
-                "base/allocator/partition_allocator/partition_oom.cc",
-                "base/allocator/partition_allocator/partition_page.cc",
-                "base/allocator/partition_allocator/partition_root.cc",
-                "base/allocator/partition_allocator/partition_stats.cc",
-                "base/allocator/partition_allocator/random.cc",
-                "base/allocator/partition_allocator/reservation_offset_table.cc",
-                "base/allocator/partition_allocator/spinning_mutex.cc",
-                "base/allocator/partition_allocator/starscan/metadata_allocator.cc",
-                "base/allocator/partition_allocator/starscan/pcscan.cc",
-                "base/allocator/partition_allocator/starscan/pcscan_internal.cc",
-                "base/allocator/partition_allocator/starscan/pcscan_scheduling.cc",
-                "base/allocator/partition_allocator/starscan/snapshot.cc",
                 "base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc",
-                "base/allocator/partition_allocator/starscan/stack/stack.cc",
-                "base/allocator/partition_allocator/starscan/stats_collector.cc",
-                "base/allocator/partition_allocator/starscan/write_protector.cc",
-                "base/allocator/partition_allocator/tagging.cc",
-                "base/allocator/partition_allocator/thread_cache.cc",
+            ],
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+            local_include_dirs: [
+                "third_party/android_ndk/sources/android/cpufeatures/",
+            ],
+        },
+        host: {
+            srcs: [
+                "base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc",
+            ],
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
             ],
         },
     },
@@ -365,189 +343,17 @@
 cc_library_static {
     name: "cronet_aml_base_base",
     srcs: [
-        ":cronet_aml_base_numerics_base_numerics",
-        ":cronet_aml_third_party_abseil_cpp_absl",
-        ":cronet_aml_third_party_abseil_cpp_absl_algorithm_algorithm",
-        ":cronet_aml_third_party_abseil_cpp_absl_algorithm_container",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_atomic_hook",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_base",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_base_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_config",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_core_headers",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_cycleclock_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_dynamic_annotations",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_endian",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_errno_saver",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_fast_type_id",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_prefetch",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        ":cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup",
-        ":cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_btree",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_common",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_common_policy_traits",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_compressed_tuple",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_container_memory",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_fixed_array",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_map",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_set",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_hash_function_defaults",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_hash_policy_traits",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtable_debug_hooks",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_layout",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_node_hash_map",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_node_hash_set",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_node_slot_policy",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_map",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        ":cronet_aml_third_party_abseil_cpp_absl_functional_any_invocable",
-        ":cronet_aml_third_party_abseil_cpp_absl_functional_bind_front",
-        ":cronet_aml_third_party_abseil_cpp_absl_functional_function_ref",
-        ":cronet_aml_third_party_abseil_cpp_absl_hash_city",
-        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash",
-        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash",
-        ":cronet_aml_third_party_abseil_cpp_absl_memory_memory",
-        ":cronet_aml_third_party_abseil_cpp_absl_meta_type_traits",
-        ":cronet_aml_third_party_abseil_cpp_absl_numeric_bits",
-        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        ":cronet_aml_third_party_abseil_cpp_absl_numeric_representation",
-        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        ":cronet_aml_third_party_abseil_cpp_absl_profiling_sample_recorder",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_distribution_caller",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_fast_uniform_bits",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_fastmath",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_generate_real",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_iostream_state_saver",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_nonsecure_base",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pcg_engine",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_engine",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_salted_seed_seq",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_traits",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_uniform_helper",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_wide_multiply",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_random",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences",
-        ":cronet_aml_third_party_abseil_cpp_absl_status_status",
-        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_statistics",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_scope",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_tracker",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_kernel_timeout_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization",
-        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time",
-        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone",
-        ":cronet_aml_third_party_abseil_cpp_absl_time_time",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_compare",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_optional",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_span",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_variant",
-        ":cronet_aml_third_party_abseil_cpp_absl_utility_utility",
-        ":cronet_aml_third_party_android_ndk_cpu_features",
-        ":cronet_aml_third_party_ashmem_ashmem",
         "base/allocator/allocator_check.cc",
         "base/allocator/allocator_extension.cc",
         "base/allocator/dispatcher/dispatcher.cc",
         "base/allocator/dispatcher/internal/dispatch_data.cc",
         "base/allocator/dispatcher/reentry_guard.cc",
         "base/allocator/partition_allocator/shim/allocator_shim.cc",
-        "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
-        "base/android/android_hardware_buffer_compat.cc",
-        "base/android/android_image_reader_compat.cc",
-        "base/android/apk_assets.cc",
-        "base/android/application_status_listener.cc",
-        "base/android/base_feature_list.cc",
-        "base/android/base_features.cc",
-        "base/android/base_jni_onload.cc",
-        "base/android/build_info.cc",
-        "base/android/bundle_utils.cc",
-        "base/android/callback_android.cc",
-        "base/android/child_process_service.cc",
-        "base/android/command_line_android.cc",
-        "base/android/content_uri_utils.cc",
-        "base/android/cpu_features.cc",
-        "base/android/early_trace_event_binding.cc",
-        "base/android/event_log.cc",
-        "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/jank_metric_uma_recorder.cc",
-        "base/android/java_exception_reporter.cc",
-        "base/android/java_handler_thread.cc",
-        "base/android/java_heap_dump_generator.cc",
-        "base/android/java_runtime.cc",
-        "base/android/jni_android.cc",
-        "base/android/jni_array.cc",
-        "base/android/jni_registrar.cc",
-        "base/android/jni_string.cc",
-        "base/android/jni_utils.cc",
-        "base/android/jni_weak_ref.cc",
-        "base/android/library_loader/anchor_functions.cc",
-        "base/android/library_loader/library_loader_hooks.cc",
-        "base/android/library_loader/library_prefetcher.cc",
-        "base/android/library_loader/library_prefetcher_hooks.cc",
-        "base/android/locale_utils.cc",
-        "base/android/memory_pressure_listener_android.cc",
-        "base/android/native_uma_recorder.cc",
-        "base/android/path_service_android.cc",
-        "base/android/path_utils.cc",
-        "base/android/radio_utils.cc",
-        "base/android/reached_addresses_bitset.cc",
-        "base/android/reached_code_profiler_stub.cc",
-        "base/android/remove_stale_data.cc",
-        "base/android/scoped_hardware_buffer_fence_sync.cc",
-        "base/android/scoped_hardware_buffer_handle.cc",
-        "base/android/scoped_java_ref.cc",
-        "base/android/statistics_recorder_android.cc",
-        "base/android/sys_utils.cc",
-        "base/android/task_scheduler/post_task_android.cc",
-        "base/android/task_scheduler/task_runner_android.cc",
-        "base/android/thread_instruction_count.cc",
-        "base/android/timezone_utils.cc",
-        "base/android/trace_event_binding.cc",
-        "base/android/unguessable_token_android.cc",
         "base/at_exit.cc",
         "base/barrier_closure.cc",
         "base/base64.cc",
         "base/base64url.cc",
         "base/base_paths.cc",
-        "base/base_paths_android.cc",
         "base/big_endian.cc",
         "base/build_time.cc",
         "base/callback_list.cc",
@@ -574,7 +380,6 @@
         "base/debug/proc_maps_linux.cc",
         "base/debug/profiler.cc",
         "base/debug/stack_trace.cc",
-        "base/debug/stack_trace_android.cc",
         "base/debug/task_trace.cc",
         "base/environment.cc",
         "base/feature_list.cc",
@@ -592,7 +397,6 @@
         "base/files/file_proxy.cc",
         "base/files/file_tracing.cc",
         "base/files/file_util.cc",
-        "base/files/file_util_android.cc",
         "base/files/file_util_posix.cc",
         "base/files/important_file_writer.cc",
         "base/files/important_file_writer_cleaner.cc",
@@ -600,7 +404,6 @@
         "base/files/memory_mapped_file_posix.cc",
         "base/files/safe_base_name.cc",
         "base/files/scoped_file.cc",
-        "base/files/scoped_file_android.cc",
         "base/files/scoped_temp_dir.cc",
         "base/functional/callback_helpers.cc",
         "base/functional/callback_internal.cc",
@@ -632,9 +435,7 @@
         "base/memory/nonscannable_memory.cc",
         "base/memory/page_size_posix.cc",
         "base/memory/platform_shared_memory_handle.cc",
-        "base/memory/platform_shared_memory_mapper_android.cc",
         "base/memory/platform_shared_memory_region.cc",
-        "base/memory/platform_shared_memory_region_android.cc",
         "base/memory/raw_ptr.cc",
         "base/memory/raw_ptr_asan_bound_arg_tracker.cc",
         "base/memory/raw_ptr_asan_service.cc",
@@ -650,7 +451,6 @@
         "base/memory/weak_ptr.cc",
         "base/memory/writable_shared_memory_region.cc",
         "base/message_loop/message_pump.cc",
-        "base/message_loop/message_pump_android.cc",
         "base/message_loop/message_pump_default.cc",
         "base/message_loop/message_pump_epoll.cc",
         "base/message_loop/message_pump_libevent.cc",
@@ -686,7 +486,6 @@
         "base/observer_list_threadsafe.cc",
         "base/observer_list_types.cc",
         "base/one_shot_event.cc",
-        "base/os_compat_android.cc",
         "base/path_service.cc",
         "base/pending_task.cc",
         "base/pickle.cc",
@@ -700,7 +499,6 @@
         "base/power_monitor/moving_average.cc",
         "base/power_monitor/power_monitor.cc",
         "base/power_monitor/power_monitor_device_source.cc",
-        "base/power_monitor/power_monitor_device_source_android.cc",
         "base/power_monitor/power_monitor_features.cc",
         "base/power_monitor/power_monitor_source.cc",
         "base/power_monitor/sampling_event_source.cc",
@@ -713,7 +511,6 @@
         "base/process/launch_posix.cc",
         "base/process/memory.cc",
         "base/process/memory_linux.cc",
-        "base/process/process_android.cc",
         "base/process/process_handle.cc",
         "base/process/process_handle_linux.cc",
         "base/process/process_handle_posix.cc",
@@ -736,7 +533,6 @@
         "base/profiler/stack_copier_signal.cc",
         "base/profiler/stack_copier_suspend.cc",
         "base/profiler/stack_sampler.cc",
-        "base/profiler/stack_sampler_android.cc",
         "base/profiler/stack_sampler_impl.cc",
         "base/profiler/stack_sampling_profiler.cc",
         "base/profiler/thread_delegate_posix.cc",
@@ -783,7 +579,6 @@
         "base/synchronization/waitable_event_watcher_posix.cc",
         "base/syslog_logging.cc",
         "base/system/sys_info.cc",
-        "base/system/sys_info_android.cc",
         "base/system/sys_info_linux.cc",
         "base/system/sys_info_posix.cc",
         "base/system/system_monitor.cc",
@@ -862,7 +657,6 @@
         "base/third_party/superfasthash/superfasthash.c",
         "base/threading/hang_watcher.cc",
         "base/threading/platform_thread.cc",
-        "base/threading/platform_thread_android.cc",
         "base/threading/platform_thread_internal_posix.cc",
         "base/threading/platform_thread_posix.cc",
         "base/threading/platform_thread_ref.cc",
@@ -889,7 +683,6 @@
         "base/time/default_tick_clock.cc",
         "base/time/tick_clock.cc",
         "base/time/time.cc",
-        "base/time/time_android.cc",
         "base/time/time_conversion_posix.cc",
         "base/time/time_delta_from_string.cc",
         "base/time/time_exploded_icu.cc",
@@ -914,10 +707,6 @@
         "base/version.cc",
         "base/vlog.cc",
     ],
-    shared_libs: [
-        "libandroid",
-        "liblog",
-    ],
     static_libs: [
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base_static",
@@ -929,6 +718,7 @@
         "cronet_aml_third_party_libevent_libevent",
         "cronet_aml_third_party_modp_b64_modp_b64",
     ],
+    host_supported: true,
     generated_headers: [
         "cronet_aml_base_allocator_buildflags",
         "cronet_aml_base_allocator_partition_allocator_chromecast_buildflags",
@@ -990,18 +780,129 @@
         "cronet_aml_build_config_compiler_compiler_buildflags",
     ],
     defaults: [
+        "cronet_aml_base_numerics_base_numerics",
         "cronet_aml_defaults",
+        "cronet_aml_third_party_abseil_cpp_absl",
+        "cronet_aml_third_party_abseil_cpp_absl_algorithm_algorithm",
+        "cronet_aml_third_party_abseil_cpp_absl_algorithm_container",
+        "cronet_aml_third_party_abseil_cpp_absl_base_atomic_hook",
+        "cronet_aml_third_party_abseil_cpp_absl_base_base",
+        "cronet_aml_third_party_abseil_cpp_absl_base_base_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_base_config",
+        "cronet_aml_third_party_abseil_cpp_absl_base_core_headers",
+        "cronet_aml_third_party_abseil_cpp_absl_base_cycleclock_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_base_dynamic_annotations",
+        "cronet_aml_third_party_abseil_cpp_absl_base_endian",
+        "cronet_aml_third_party_abseil_cpp_absl_base_errno_saver",
+        "cronet_aml_third_party_abseil_cpp_absl_base_fast_type_id",
+        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
+        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_base_prefetch",
+        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
+        "cronet_aml_third_party_abseil_cpp_absl_base_strerror",
+        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
+        "cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup",
+        "cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_container_btree",
+        "cronet_aml_third_party_abseil_cpp_absl_container_common",
+        "cronet_aml_third_party_abseil_cpp_absl_container_common_policy_traits",
+        "cronet_aml_third_party_abseil_cpp_absl_container_compressed_tuple",
+        "cronet_aml_third_party_abseil_cpp_absl_container_container_memory",
+        "cronet_aml_third_party_abseil_cpp_absl_container_fixed_array",
+        "cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_map",
+        "cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_set",
+        "cronet_aml_third_party_abseil_cpp_absl_container_hash_function_defaults",
+        "cronet_aml_third_party_abseil_cpp_absl_container_hash_policy_traits",
+        "cronet_aml_third_party_abseil_cpp_absl_container_hashtable_debug_hooks",
+        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler",
+        "cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector",
+        "cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_container_layout",
+        "cronet_aml_third_party_abseil_cpp_absl_container_node_hash_map",
+        "cronet_aml_third_party_abseil_cpp_absl_container_node_hash_set",
+        "cronet_aml_third_party_abseil_cpp_absl_container_node_slot_policy",
+        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_map",
+        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
+        "cronet_aml_third_party_abseil_cpp_absl_functional_any_invocable",
+        "cronet_aml_third_party_abseil_cpp_absl_functional_bind_front",
+        "cronet_aml_third_party_abseil_cpp_absl_functional_function_ref",
+        "cronet_aml_third_party_abseil_cpp_absl_hash_city",
+        "cronet_aml_third_party_abseil_cpp_absl_hash_hash",
+        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash",
+        "cronet_aml_third_party_abseil_cpp_absl_memory_memory",
+        "cronet_aml_third_party_abseil_cpp_absl_meta_type_traits",
+        "cronet_aml_third_party_abseil_cpp_absl_numeric_bits",
+        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
+        "cronet_aml_third_party_abseil_cpp_absl_numeric_representation",
+        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
+        "cronet_aml_third_party_abseil_cpp_absl_profiling_sample_recorder",
+        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_distribution_caller",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_fast_uniform_bits",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_fastmath",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_generate_real",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_iostream_state_saver",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_nonsecure_base",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pcg_engine",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_engine",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_salted_seed_seq",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_traits",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_uniform_helper",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_wide_multiply",
+        "cronet_aml_third_party_abseil_cpp_absl_random_random",
+        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception",
+        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences",
+        "cronet_aml_third_party_abseil_cpp_absl_status_status",
+        "cronet_aml_third_party_abseil_cpp_absl_status_statusor",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cord",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_statistics",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_scope",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_tracker",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
+        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_synchronization_kernel_timeout_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization",
+        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time",
+        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone",
+        "cronet_aml_third_party_abseil_cpp_absl_time_time",
+        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
+        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access",
+        "cronet_aml_third_party_abseil_cpp_absl_types_compare",
+        "cronet_aml_third_party_abseil_cpp_absl_types_optional",
+        "cronet_aml_third_party_abseil_cpp_absl_types_span",
+        "cronet_aml_third_party_abseil_cpp_absl_types_variant",
+        "cronet_aml_third_party_abseil_cpp_absl_utility_utility",
+        "cronet_aml_third_party_android_ndk_cpu_features",
+        "cronet_aml_third_party_ashmem_ashmem",
     ],
     cflags: [
         "-DABSL_ALLOCATOR_NOTHROW=1",
-        "-DANDROID",
-        "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DBASE_IMPLEMENTATION",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
-        "-DHAVE_SYS_UIO_H",
         "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
         "-DUSE_CHROMIUM_ICU=1",
         "-DU_ENABLE_DYLOAD=0",
@@ -1024,16 +925,222 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
-        "third_party/android_ndk/sources/android/cpufeatures/",
         "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",
     ],
     header_libs: [
         "jni_headers",
     ],
     cpp_std: "c++20",
+    target: {
+        android: {
+            shared_libs: [
+                "libandroid",
+                "liblog",
+            ],
+        },
+        android_x86: {
+            srcs: [
+                "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
+                "base/android/android_hardware_buffer_compat.cc",
+                "base/android/android_image_reader_compat.cc",
+                "base/android/apk_assets.cc",
+                "base/android/application_status_listener.cc",
+                "base/android/base_feature_list.cc",
+                "base/android/base_features.cc",
+                "base/android/base_jni_onload.cc",
+                "base/android/build_info.cc",
+                "base/android/bundle_utils.cc",
+                "base/android/callback_android.cc",
+                "base/android/child_process_service.cc",
+                "base/android/command_line_android.cc",
+                "base/android/content_uri_utils.cc",
+                "base/android/cpu_features.cc",
+                "base/android/early_trace_event_binding.cc",
+                "base/android/event_log.cc",
+                "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/jank_metric_uma_recorder.cc",
+                "base/android/java_exception_reporter.cc",
+                "base/android/java_handler_thread.cc",
+                "base/android/java_heap_dump_generator.cc",
+                "base/android/java_runtime.cc",
+                "base/android/jni_android.cc",
+                "base/android/jni_array.cc",
+                "base/android/jni_registrar.cc",
+                "base/android/jni_string.cc",
+                "base/android/jni_utils.cc",
+                "base/android/jni_weak_ref.cc",
+                "base/android/library_loader/anchor_functions.cc",
+                "base/android/library_loader/library_loader_hooks.cc",
+                "base/android/library_loader/library_prefetcher.cc",
+                "base/android/library_loader/library_prefetcher_hooks.cc",
+                "base/android/locale_utils.cc",
+                "base/android/memory_pressure_listener_android.cc",
+                "base/android/native_uma_recorder.cc",
+                "base/android/path_service_android.cc",
+                "base/android/path_utils.cc",
+                "base/android/radio_utils.cc",
+                "base/android/reached_addresses_bitset.cc",
+                "base/android/reached_code_profiler_stub.cc",
+                "base/android/remove_stale_data.cc",
+                "base/android/scoped_hardware_buffer_fence_sync.cc",
+                "base/android/scoped_hardware_buffer_handle.cc",
+                "base/android/scoped_java_ref.cc",
+                "base/android/statistics_recorder_android.cc",
+                "base/android/sys_utils.cc",
+                "base/android/task_scheduler/post_task_android.cc",
+                "base/android/task_scheduler/task_runner_android.cc",
+                "base/android/thread_instruction_count.cc",
+                "base/android/timezone_utils.cc",
+                "base/android/trace_event_binding.cc",
+                "base/android/unguessable_token_android.cc",
+                "base/base_paths_android.cc",
+                "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/os_compat_android.cc",
+                "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",
+            ],
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+            local_include_dirs: [
+                "third_party/android_ndk/sources/android/cpufeatures/",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
+                "base/android/android_hardware_buffer_compat.cc",
+                "base/android/android_image_reader_compat.cc",
+                "base/android/apk_assets.cc",
+                "base/android/application_status_listener.cc",
+                "base/android/base_feature_list.cc",
+                "base/android/base_features.cc",
+                "base/android/base_jni_onload.cc",
+                "base/android/build_info.cc",
+                "base/android/bundle_utils.cc",
+                "base/android/callback_android.cc",
+                "base/android/child_process_service.cc",
+                "base/android/command_line_android.cc",
+                "base/android/content_uri_utils.cc",
+                "base/android/cpu_features.cc",
+                "base/android/early_trace_event_binding.cc",
+                "base/android/event_log.cc",
+                "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/jank_metric_uma_recorder.cc",
+                "base/android/java_exception_reporter.cc",
+                "base/android/java_handler_thread.cc",
+                "base/android/java_heap_dump_generator.cc",
+                "base/android/java_runtime.cc",
+                "base/android/jni_android.cc",
+                "base/android/jni_array.cc",
+                "base/android/jni_registrar.cc",
+                "base/android/jni_string.cc",
+                "base/android/jni_utils.cc",
+                "base/android/jni_weak_ref.cc",
+                "base/android/library_loader/anchor_functions.cc",
+                "base/android/library_loader/library_loader_hooks.cc",
+                "base/android/library_loader/library_prefetcher.cc",
+                "base/android/library_loader/library_prefetcher_hooks.cc",
+                "base/android/locale_utils.cc",
+                "base/android/memory_pressure_listener_android.cc",
+                "base/android/native_uma_recorder.cc",
+                "base/android/path_service_android.cc",
+                "base/android/path_utils.cc",
+                "base/android/radio_utils.cc",
+                "base/android/reached_addresses_bitset.cc",
+                "base/android/reached_code_profiler_stub.cc",
+                "base/android/remove_stale_data.cc",
+                "base/android/scoped_hardware_buffer_fence_sync.cc",
+                "base/android/scoped_hardware_buffer_handle.cc",
+                "base/android/scoped_java_ref.cc",
+                "base/android/statistics_recorder_android.cc",
+                "base/android/sys_utils.cc",
+                "base/android/task_scheduler/post_task_android.cc",
+                "base/android/task_scheduler/task_runner_android.cc",
+                "base/android/thread_instruction_count.cc",
+                "base/android/timezone_utils.cc",
+                "base/android/trace_event_binding.cc",
+                "base/android/unguessable_token_android.cc",
+                "base/base_paths_android.cc",
+                "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/os_compat_android.cc",
+                "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",
+            ],
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+            local_include_dirs: [
+                "third_party/android_ndk/sources/android/cpufeatures/",
+            ],
+        },
+        host: {
+            srcs: [
+                "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_glibc.cc",
+                "base/base_paths_posix.cc",
+                "base/debug/stack_trace_posix.cc",
+                "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/xdg_util.cc",
+                "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/threading/platform_thread_linux.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_third_party_symbolize_symbolize",
+                "cronet_aml_base_third_party_xdg_mime_xdg_mime",
+                "cronet_aml_base_third_party_xdg_user_dirs_xdg_user_dirs",
+            ],
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DGLOG_EXPORT=",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_SYMBOLIZE",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+        },
+    },
 }
 
 // GN: //base:base_jni_headers
@@ -1307,6 +1414,7 @@
     srcs: [
         "base/base_switches.cc",
     ],
+    host_supported: true,
     generated_headers: [
         "cronet_aml_build_chromeos_buildflags",
     ],
@@ -1317,13 +1425,10 @@
         "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",
-        "-DHAVE_SYS_UIO_H",
         "-D_DEBUG",
         "-D_GNU_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
@@ -1338,9 +1443,35 @@
         "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",
     ],
     cpp_std: "c++20",
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+        },
+    },
 }
 
 // GN: //base:build_date
@@ -1399,7 +1530,7 @@
 // GN: //base:debugging_buildflags
 genrule {
     name: "cronet_aml_base_debugging_buildflags",
-    cmd: "echo '--flags DCHECK_IS_CONFIGURABLE=\"false\" ENABLE_LOCATION_SOURCE=\"true\" ENABLE_PROFILING=\"false\" CAN_UNWIND_WITH_FRAME_POINTERS=\"false\" UNSAFE_DEVELOPER_BUILD=\"true\" CAN_UNWIND_WITH_CFI_TABLE=\"false\" EXCLUDE_UNWIND_TABLES=\"false\" ENABLE_GDBINIT_WARNING=\"true\" ENABLE_LLDBINIT_WARNING=\"false\" EXPENSIVE_DCHECKS_ARE_ON=\"true\" ENABLE_STACK_TRACE_LINE_NUMBERS=\"false\"' | " +
+    cmd: "echo '--flags DCHECK_IS_CONFIGURABLE=\"false\" ENABLE_LOCATION_SOURCE=\"true\" ENABLE_PROFILING=\"false\" CAN_UNWIND_WITH_FRAME_POINTERS=\"true\" UNSAFE_DEVELOPER_BUILD=\"true\" CAN_UNWIND_WITH_CFI_TABLE=\"false\" EXCLUDE_UNWIND_TABLES=\"false\" ENABLE_GDBINIT_WARNING=\"true\" ENABLE_LLDBINIT_WARNING=\"false\" EXPENSIVE_DCHECKS_ARE_ON=\"true\" ENABLE_STACK_TRACE_LINE_NUMBERS=\"false\"' | " +
          "$(location build/write_buildflag_header.py) --output " +
          "$(out) " +
          "--rulename " +
@@ -1497,7 +1628,7 @@
 }
 
 // GN: //base/numerics:base_numerics
-filegroup {
+cc_defaults {
     name: "cronet_aml_base_numerics_base_numerics",
 }
 
@@ -1634,17 +1765,15 @@
         "base/third_party/double_conversion/double-conversion/string-to-double.cc",
         "base/third_party/double_conversion/double-conversion/strtod.cc",
     ],
+    host_supported: true,
     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",
-        "-DHAVE_SYS_UIO_H",
         "-D_DEBUG",
         "-D_GNU_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
@@ -1659,9 +1788,35 @@
         "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",
     ],
     cpp_std: "c++20",
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+        },
+    },
 }
 
 // GN: //base/third_party/dynamic_annotations:dynamic_annotations
@@ -1670,17 +1825,15 @@
     srcs: [
         "base/third_party/dynamic_annotations/dynamic_annotations.c",
     ],
+    host_supported: true,
     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",
-        "-DHAVE_SYS_UIO_H",
         "-D_DEBUG",
         "-D_GNU_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
@@ -1693,9 +1846,35 @@
         "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",
     ],
     cpp_std: "c++20",
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+        },
+    },
 }
 
 // GN: //base/third_party/symbolize:symbolize
@@ -1705,6 +1884,8 @@
         "base/third_party/symbolize/demangle.cc",
         "base/third_party/symbolize/symbolize.cc",
     ],
+    host_supported: true,
+    device_supported: false,
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -1733,7 +1914,6 @@
         "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",
     ],
     cpp_std: "c++20",
 }
@@ -1751,6 +1931,8 @@
         "base/third_party/xdg_mime/xdgmimemagic.c",
         "base/third_party/xdg_mime/xdgmimeparent.c",
     ],
+    host_supported: true,
+    device_supported: false,
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -1778,7 +1960,6 @@
         "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",
     ],
     cpp_std: "c++20",
 }
@@ -1789,6 +1970,8 @@
     srcs: [
         "base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc",
     ],
+    host_supported: true,
+    device_supported: false,
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -1818,7 +2001,6 @@
         "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",
     ],
     cpp_std: "c++20",
 }
@@ -1864,7 +2046,7 @@
 }
 
 // GN: //build:buildflag_header_h
-filegroup {
+cc_defaults {
     name: "cronet_aml_build_buildflag_header_h",
 }
 
@@ -1929,90 +2111,247 @@
 }
 
 // GN: //buildtools/third_party/libc++:libc++
-filegroup {
+cc_defaults {
     name: "cronet_aml_buildtools_third_party_libc___libc__",
-    srcs: [
-        "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
-        "buildtools/third_party/libc++/trunk/src/any.cpp",
-        "buildtools/third_party/libc++/trunk/src/atomic.cpp",
-        "buildtools/third_party/libc++/trunk/src/barrier.cpp",
-        "buildtools/third_party/libc++/trunk/src/bind.cpp",
-        "buildtools/third_party/libc++/trunk/src/charconv.cpp",
-        "buildtools/third_party/libc++/trunk/src/chrono.cpp",
-        "buildtools/third_party/libc++/trunk/src/condition_variable.cpp",
-        "buildtools/third_party/libc++/trunk/src/condition_variable_destructor.cpp",
-        "buildtools/third_party/libc++/trunk/src/exception.cpp",
-        "buildtools/third_party/libc++/trunk/src/format.cpp",
-        "buildtools/third_party/libc++/trunk/src/functional.cpp",
-        "buildtools/third_party/libc++/trunk/src/future.cpp",
-        "buildtools/third_party/libc++/trunk/src/hash.cpp",
-        "buildtools/third_party/libc++/trunk/src/ios.cpp",
-        "buildtools/third_party/libc++/trunk/src/ios.instantiations.cpp",
-        "buildtools/third_party/libc++/trunk/src/iostream.cpp",
-        "buildtools/third_party/libc++/trunk/src/legacy_pointer_safety.cpp",
-        "buildtools/third_party/libc++/trunk/src/locale.cpp",
-        "buildtools/third_party/libc++/trunk/src/memory.cpp",
-        "buildtools/third_party/libc++/trunk/src/mutex.cpp",
-        "buildtools/third_party/libc++/trunk/src/mutex_destructor.cpp",
-        "buildtools/third_party/libc++/trunk/src/new.cpp",
-        "buildtools/third_party/libc++/trunk/src/optional.cpp",
-        "buildtools/third_party/libc++/trunk/src/random.cpp",
-        "buildtools/third_party/libc++/trunk/src/random_shuffle.cpp",
-        "buildtools/third_party/libc++/trunk/src/regex.cpp",
-        "buildtools/third_party/libc++/trunk/src/ryu/d2fixed.cpp",
-        "buildtools/third_party/libc++/trunk/src/ryu/d2s.cpp",
-        "buildtools/third_party/libc++/trunk/src/ryu/f2s.cpp",
-        "buildtools/third_party/libc++/trunk/src/shared_mutex.cpp",
-        "buildtools/third_party/libc++/trunk/src/stdexcept.cpp",
-        "buildtools/third_party/libc++/trunk/src/string.cpp",
-        "buildtools/third_party/libc++/trunk/src/strstream.cpp",
-        "buildtools/third_party/libc++/trunk/src/system_error.cpp",
-        "buildtools/third_party/libc++/trunk/src/thread.cpp",
-        "buildtools/third_party/libc++/trunk/src/typeinfo.cpp",
-        "buildtools/third_party/libc++/trunk/src/utility.cpp",
-        "buildtools/third_party/libc++/trunk/src/valarray.cpp",
-        "buildtools/third_party/libc++/trunk/src/variant.cpp",
-        "buildtools/third_party/libc++/trunk/src/vector.cpp",
-        "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
+                "buildtools/third_party/libc++/trunk/src/any.cpp",
+                "buildtools/third_party/libc++/trunk/src/atomic.cpp",
+                "buildtools/third_party/libc++/trunk/src/barrier.cpp",
+                "buildtools/third_party/libc++/trunk/src/bind.cpp",
+                "buildtools/third_party/libc++/trunk/src/charconv.cpp",
+                "buildtools/third_party/libc++/trunk/src/chrono.cpp",
+                "buildtools/third_party/libc++/trunk/src/condition_variable.cpp",
+                "buildtools/third_party/libc++/trunk/src/condition_variable_destructor.cpp",
+                "buildtools/third_party/libc++/trunk/src/exception.cpp",
+                "buildtools/third_party/libc++/trunk/src/format.cpp",
+                "buildtools/third_party/libc++/trunk/src/functional.cpp",
+                "buildtools/third_party/libc++/trunk/src/future.cpp",
+                "buildtools/third_party/libc++/trunk/src/hash.cpp",
+                "buildtools/third_party/libc++/trunk/src/ios.cpp",
+                "buildtools/third_party/libc++/trunk/src/ios.instantiations.cpp",
+                "buildtools/third_party/libc++/trunk/src/iostream.cpp",
+                "buildtools/third_party/libc++/trunk/src/legacy_pointer_safety.cpp",
+                "buildtools/third_party/libc++/trunk/src/locale.cpp",
+                "buildtools/third_party/libc++/trunk/src/memory.cpp",
+                "buildtools/third_party/libc++/trunk/src/mutex.cpp",
+                "buildtools/third_party/libc++/trunk/src/mutex_destructor.cpp",
+                "buildtools/third_party/libc++/trunk/src/new.cpp",
+                "buildtools/third_party/libc++/trunk/src/optional.cpp",
+                "buildtools/third_party/libc++/trunk/src/random.cpp",
+                "buildtools/third_party/libc++/trunk/src/random_shuffle.cpp",
+                "buildtools/third_party/libc++/trunk/src/regex.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/d2fixed.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/d2s.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/f2s.cpp",
+                "buildtools/third_party/libc++/trunk/src/shared_mutex.cpp",
+                "buildtools/third_party/libc++/trunk/src/stdexcept.cpp",
+                "buildtools/third_party/libc++/trunk/src/string.cpp",
+                "buildtools/third_party/libc++/trunk/src/strstream.cpp",
+                "buildtools/third_party/libc++/trunk/src/system_error.cpp",
+                "buildtools/third_party/libc++/trunk/src/thread.cpp",
+                "buildtools/third_party/libc++/trunk/src/typeinfo.cpp",
+                "buildtools/third_party/libc++/trunk/src/utility.cpp",
+                "buildtools/third_party/libc++/trunk/src/valarray.cpp",
+                "buildtools/third_party/libc++/trunk/src/variant.cpp",
+                "buildtools/third_party/libc++/trunk/src/vector.cpp",
+                "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
+                "buildtools/third_party/libc++/trunk/src/any.cpp",
+                "buildtools/third_party/libc++/trunk/src/atomic.cpp",
+                "buildtools/third_party/libc++/trunk/src/barrier.cpp",
+                "buildtools/third_party/libc++/trunk/src/bind.cpp",
+                "buildtools/third_party/libc++/trunk/src/charconv.cpp",
+                "buildtools/third_party/libc++/trunk/src/chrono.cpp",
+                "buildtools/third_party/libc++/trunk/src/condition_variable.cpp",
+                "buildtools/third_party/libc++/trunk/src/condition_variable_destructor.cpp",
+                "buildtools/third_party/libc++/trunk/src/exception.cpp",
+                "buildtools/third_party/libc++/trunk/src/format.cpp",
+                "buildtools/third_party/libc++/trunk/src/functional.cpp",
+                "buildtools/third_party/libc++/trunk/src/future.cpp",
+                "buildtools/third_party/libc++/trunk/src/hash.cpp",
+                "buildtools/third_party/libc++/trunk/src/ios.cpp",
+                "buildtools/third_party/libc++/trunk/src/ios.instantiations.cpp",
+                "buildtools/third_party/libc++/trunk/src/iostream.cpp",
+                "buildtools/third_party/libc++/trunk/src/legacy_pointer_safety.cpp",
+                "buildtools/third_party/libc++/trunk/src/locale.cpp",
+                "buildtools/third_party/libc++/trunk/src/memory.cpp",
+                "buildtools/third_party/libc++/trunk/src/mutex.cpp",
+                "buildtools/third_party/libc++/trunk/src/mutex_destructor.cpp",
+                "buildtools/third_party/libc++/trunk/src/new.cpp",
+                "buildtools/third_party/libc++/trunk/src/optional.cpp",
+                "buildtools/third_party/libc++/trunk/src/random.cpp",
+                "buildtools/third_party/libc++/trunk/src/random_shuffle.cpp",
+                "buildtools/third_party/libc++/trunk/src/regex.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/d2fixed.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/d2s.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/f2s.cpp",
+                "buildtools/third_party/libc++/trunk/src/shared_mutex.cpp",
+                "buildtools/third_party/libc++/trunk/src/stdexcept.cpp",
+                "buildtools/third_party/libc++/trunk/src/string.cpp",
+                "buildtools/third_party/libc++/trunk/src/strstream.cpp",
+                "buildtools/third_party/libc++/trunk/src/system_error.cpp",
+                "buildtools/third_party/libc++/trunk/src/thread.cpp",
+                "buildtools/third_party/libc++/trunk/src/typeinfo.cpp",
+                "buildtools/third_party/libc++/trunk/src/utility.cpp",
+                "buildtools/third_party/libc++/trunk/src/valarray.cpp",
+                "buildtools/third_party/libc++/trunk/src/variant.cpp",
+                "buildtools/third_party/libc++/trunk/src/vector.cpp",
+                "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
+            ],
+        },
+        host: {
+            srcs: [
+                "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
+                "buildtools/third_party/libc++/trunk/src/any.cpp",
+                "buildtools/third_party/libc++/trunk/src/atomic.cpp",
+                "buildtools/third_party/libc++/trunk/src/barrier.cpp",
+                "buildtools/third_party/libc++/trunk/src/bind.cpp",
+                "buildtools/third_party/libc++/trunk/src/charconv.cpp",
+                "buildtools/third_party/libc++/trunk/src/chrono.cpp",
+                "buildtools/third_party/libc++/trunk/src/condition_variable.cpp",
+                "buildtools/third_party/libc++/trunk/src/condition_variable_destructor.cpp",
+                "buildtools/third_party/libc++/trunk/src/exception.cpp",
+                "buildtools/third_party/libc++/trunk/src/format.cpp",
+                "buildtools/third_party/libc++/trunk/src/functional.cpp",
+                "buildtools/third_party/libc++/trunk/src/future.cpp",
+                "buildtools/third_party/libc++/trunk/src/hash.cpp",
+                "buildtools/third_party/libc++/trunk/src/ios.cpp",
+                "buildtools/third_party/libc++/trunk/src/ios.instantiations.cpp",
+                "buildtools/third_party/libc++/trunk/src/iostream.cpp",
+                "buildtools/third_party/libc++/trunk/src/legacy_pointer_safety.cpp",
+                "buildtools/third_party/libc++/trunk/src/locale.cpp",
+                "buildtools/third_party/libc++/trunk/src/memory.cpp",
+                "buildtools/third_party/libc++/trunk/src/mutex.cpp",
+                "buildtools/third_party/libc++/trunk/src/mutex_destructor.cpp",
+                "buildtools/third_party/libc++/trunk/src/new.cpp",
+                "buildtools/third_party/libc++/trunk/src/optional.cpp",
+                "buildtools/third_party/libc++/trunk/src/random.cpp",
+                "buildtools/third_party/libc++/trunk/src/random_shuffle.cpp",
+                "buildtools/third_party/libc++/trunk/src/regex.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/d2fixed.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/d2s.cpp",
+                "buildtools/third_party/libc++/trunk/src/ryu/f2s.cpp",
+                "buildtools/third_party/libc++/trunk/src/shared_mutex.cpp",
+                "buildtools/third_party/libc++/trunk/src/stdexcept.cpp",
+                "buildtools/third_party/libc++/trunk/src/string.cpp",
+                "buildtools/third_party/libc++/trunk/src/strstream.cpp",
+                "buildtools/third_party/libc++/trunk/src/system_error.cpp",
+                "buildtools/third_party/libc++/trunk/src/thread.cpp",
+                "buildtools/third_party/libc++/trunk/src/typeinfo.cpp",
+                "buildtools/third_party/libc++/trunk/src/utility.cpp",
+                "buildtools/third_party/libc++/trunk/src/valarray.cpp",
+                "buildtools/third_party/libc++/trunk/src/variant.cpp",
+                "buildtools/third_party/libc++/trunk/src/vector.cpp",
+                "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
+            ],
+        },
+    },
 }
 
 // GN: //buildtools/third_party/libc++abi:libc++abi
-filegroup {
+cc_defaults {
     name: "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-    srcs: [
-        "buildtools/third_party/libc++abi/cxa_demangle_stub.cc",
-        "buildtools/third_party/libc++abi/trunk/src/abort_message.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_aux_runtime.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_default_handlers.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_exception.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_exception_storage.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_guard.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_handlers.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_personality.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_thread_atexit.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_vector.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/cxa_virtual.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/fallback_malloc.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/private_typeinfo.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/stdlib_exception.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
-        "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "buildtools/third_party/libc++abi/cxa_demangle_stub.cc",
+                "buildtools/third_party/libc++abi/trunk/src/abort_message.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_aux_runtime.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_default_handlers.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_exception.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_exception_storage.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_guard.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_handlers.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_personality.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_thread_atexit.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_vector.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_virtual.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/fallback_malloc.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/private_typeinfo.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_exception.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "buildtools/third_party/libc++abi/cxa_demangle_stub.cc",
+                "buildtools/third_party/libc++abi/trunk/src/abort_message.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_aux_runtime.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_default_handlers.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_exception.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_exception_storage.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_guard.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_handlers.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_personality.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_thread_atexit.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_vector.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_virtual.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/fallback_malloc.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/private_typeinfo.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_exception.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
+            ],
+        },
+        host: {
+            srcs: [
+                "buildtools/third_party/libc++abi/trunk/src/abort_message.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_aux_runtime.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_default_handlers.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_demangle.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_exception.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_exception_storage.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_guard.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_handlers.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_personality.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_thread_atexit.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_vector.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/cxa_virtual.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/fallback_malloc.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/private_typeinfo.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_exception.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
+                "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
+            ],
+        },
+    },
 }
 
 // GN: //buildtools/third_party/libunwind:libunwind
-filegroup {
+cc_defaults {
     name: "cronet_aml_buildtools_third_party_libunwind_libunwind",
-    srcs: [
-        "buildtools/third_party/libunwind/trunk/src/Unwind-EHABI.cpp",
-        "buildtools/third_party/libunwind/trunk/src/Unwind-sjlj.c",
-        "buildtools/third_party/libunwind/trunk/src/UnwindLevel1-gcc-ext.c",
-        "buildtools/third_party/libunwind/trunk/src/UnwindLevel1.c",
-        "buildtools/third_party/libunwind/trunk/src/UnwindRegistersRestore.S",
-        "buildtools/third_party/libunwind/trunk/src/UnwindRegistersSave.S",
-        "buildtools/third_party/libunwind/trunk/src/libunwind.cpp",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "buildtools/third_party/libunwind/trunk/src/Unwind-EHABI.cpp",
+                "buildtools/third_party/libunwind/trunk/src/Unwind-sjlj.c",
+                "buildtools/third_party/libunwind/trunk/src/UnwindLevel1-gcc-ext.c",
+                "buildtools/third_party/libunwind/trunk/src/UnwindLevel1.c",
+                "buildtools/third_party/libunwind/trunk/src/UnwindRegistersRestore.S",
+                "buildtools/third_party/libunwind/trunk/src/UnwindRegistersSave.S",
+                "buildtools/third_party/libunwind/trunk/src/libunwind.cpp",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "buildtools/third_party/libunwind/trunk/src/Unwind-EHABI.cpp",
+                "buildtools/third_party/libunwind/trunk/src/Unwind-sjlj.c",
+                "buildtools/third_party/libunwind/trunk/src/UnwindLevel1-gcc-ext.c",
+                "buildtools/third_party/libunwind/trunk/src/UnwindLevel1.c",
+                "buildtools/third_party/libunwind/trunk/src/UnwindRegistersRestore.S",
+                "buildtools/third_party/libunwind/trunk/src/UnwindRegistersSave.S",
+                "buildtools/third_party/libunwind/trunk/src/libunwind.cpp",
+            ],
+        },
+    },
 }
 
 // GN: //components/cronet/android:buildflags
@@ -2039,18 +2378,6 @@
 cc_library_shared {
     name: "cronet_aml_components_cronet_android_cronet",
     srcs: [
-        ":cronet_aml_buildtools_third_party_libc___libc__",
-        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-        ":cronet_aml_buildtools_third_party_libunwind_libunwind",
-        ":cronet_aml_components_cronet_android_cronet_static",
-        ":cronet_aml_components_cronet_cronet_common",
-        ":cronet_aml_components_cronet_cronet_version_header",
-        ":cronet_aml_components_cronet_metrics_util",
-        ":cronet_aml_components_cronet_native_cronet_native_headers",
-        ":cronet_aml_components_cronet_native_cronet_native_impl",
-        ":cronet_aml_components_grpc_support_grpc_support",
-        ":cronet_aml_components_grpc_support_headers",
-        ":cronet_aml_components_metrics_library_support",
         ":cronet_aml_third_party_metrics_proto_metrics_proto_gen",
         "components/cronet/android/cronet_jni.cc",
     ],
@@ -2065,9 +2392,6 @@
         "cronet_aml_base_base_static",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_base_third_party_symbolize_symbolize",
-        "cronet_aml_base_third_party_xdg_mime_xdg_mime",
-        "cronet_aml_base_third_party_xdg_user_dirs_xdg_user_dirs",
         "cronet_aml_components_prefs_prefs",
         "cronet_aml_crypto_crypto",
         "cronet_aml_net_net",
@@ -2081,6 +2405,7 @@
         "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_lite",
         "cronet_aml_third_party_zlib_zlib",
         "cronet_aml_url_url",
     ],
@@ -2097,6 +2422,18 @@
         "cronet_aml_url_buildflags",
     ],
     defaults: [
+        "cronet_aml_buildtools_third_party_libc___libc__",
+        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
+        "cronet_aml_buildtools_third_party_libunwind_libunwind",
+        "cronet_aml_components_cronet_android_cronet_static",
+        "cronet_aml_components_cronet_cronet_common",
+        "cronet_aml_components_cronet_cronet_version_header",
+        "cronet_aml_components_cronet_metrics_util",
+        "cronet_aml_components_cronet_native_cronet_native_headers",
+        "cronet_aml_components_cronet_native_cronet_native_impl",
+        "cronet_aml_components_grpc_support_grpc_support",
+        "cronet_aml_components_grpc_support_headers",
+        "cronet_aml_components_metrics_library_support",
         "cronet_aml_defaults",
     ],
     cflags: [
@@ -2142,8 +2479,8 @@
         "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",
     ],
     header_libs: [
         "jni_headers",
@@ -2274,17 +2611,78 @@
 }
 
 // GN: //components/cronet/android:cronet_static
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_cronet_android_cronet_static",
-    srcs: [
-        "components/cronet/android/cronet_bidirectional_stream_adapter.cc",
-        "components/cronet/android/cronet_context_adapter.cc",
-        "components/cronet/android/cronet_library_loader.cc",
-        "components/cronet/android/cronet_upload_data_stream_adapter.cc",
-        "components/cronet/android/cronet_url_request_adapter.cc",
-        "components/cronet/android/io_buffer_with_byte_buffer.cc",
-        "components/cronet/android/url_request_error.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "components/cronet/android/cronet_bidirectional_stream_adapter.cc",
+                "components/cronet/android/cronet_context_adapter.cc",
+                "components/cronet/android/cronet_library_loader.cc",
+                "components/cronet/android/cronet_upload_data_stream_adapter.cc",
+                "components/cronet/android/cronet_url_request_adapter.cc",
+                "components/cronet/android/io_buffer_with_byte_buffer.cc",
+                "components/cronet/android/url_request_error.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_components_prefs_prefs",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_net",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "components/cronet/android/cronet_bidirectional_stream_adapter.cc",
+                "components/cronet/android/cronet_context_adapter.cc",
+                "components/cronet/android/cronet_library_loader.cc",
+                "components/cronet/android/cronet_upload_data_stream_adapter.cc",
+                "components/cronet/android/cronet_url_request_adapter.cc",
+                "components/cronet/android/io_buffer_with_byte_buffer.cc",
+                "components/cronet/android/url_request_error.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_components_prefs_prefs",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_net",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //components/cronet:cronet_buildflags
@@ -2308,21 +2706,82 @@
 }
 
 // GN: //components/cronet:cronet_common
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_cronet_cronet_common",
-    srcs: [
-        "components/cronet/cronet_context.cc",
-        "components/cronet/cronet_prefs_manager.cc",
-        "components/cronet/cronet_upload_data_stream.cc",
-        "components/cronet/cronet_url_request.cc",
-        "components/cronet/host_cache_persistence_manager.cc",
-        "components/cronet/stale_host_resolver.cc",
-        "components/cronet/url_request_context_config.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "components/cronet/cronet_context.cc",
+                "components/cronet/cronet_prefs_manager.cc",
+                "components/cronet/cronet_upload_data_stream.cc",
+                "components/cronet/cronet_url_request.cc",
+                "components/cronet/host_cache_persistence_manager.cc",
+                "components/cronet/stale_host_resolver.cc",
+                "components/cronet/url_request_context_config.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_components_prefs_prefs",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_net",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "components/cronet/cronet_context.cc",
+                "components/cronet/cronet_prefs_manager.cc",
+                "components/cronet/cronet_upload_data_stream.cc",
+                "components/cronet/cronet_url_request.cc",
+                "components/cronet/host_cache_persistence_manager.cc",
+                "components/cronet/stale_host_resolver.cc",
+                "components/cronet/url_request_context_config.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_components_prefs_prefs",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_net",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //components/cronet:cronet_version_header
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_cronet_cronet_version_header",
 }
 
@@ -2350,54 +2809,290 @@
 }
 
 // GN: //components/cronet:metrics_util
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_cronet_metrics_util",
-    srcs: [
-        "components/cronet/metrics_util.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "components/cronet/metrics_util.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "cronet_aml_third_party_icu_icuuc_private",
+                "cronet_aml_third_party_libevent_libevent",
+                "cronet_aml_third_party_modp_b64_modp_b64",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "components/cronet/metrics_util.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "cronet_aml_third_party_icu_icuuc_private",
+                "cronet_aml_third_party_libevent_libevent",
+                "cronet_aml_third_party_modp_b64_modp_b64",
+            ],
+        },
+    },
 }
 
 // GN: //components/cronet/native:cronet_native_headers
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_cronet_native_cronet_native_headers",
+    target: {
+        android_x86: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "cronet_aml_third_party_icu_icuuc_private",
+                "cronet_aml_third_party_libevent_libevent",
+                "cronet_aml_third_party_modp_b64_modp_b64",
+            ],
+        },
+        android_x86_64: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "cronet_aml_third_party_icu_icuuc_private",
+                "cronet_aml_third_party_libevent_libevent",
+                "cronet_aml_third_party_modp_b64_modp_b64",
+            ],
+        },
+    },
 }
 
 // GN: //components/cronet/native:cronet_native_impl
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_cronet_native_cronet_native_impl",
-    srcs: [
-        "components/cronet/native/buffer.cc",
-        "components/cronet/native/engine.cc",
-        "components/cronet/native/generated/cronet.idl_impl_interface.cc",
-        "components/cronet/native/generated/cronet.idl_impl_struct.cc",
-        "components/cronet/native/io_buffer_with_cronet_buffer.cc",
-        "components/cronet/native/native_metrics_util.cc",
-        "components/cronet/native/runnables.cc",
-        "components/cronet/native/upload_data_sink.cc",
-        "components/cronet/native/url_request.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "components/cronet/native/buffer.cc",
+                "components/cronet/native/engine.cc",
+                "components/cronet/native/generated/cronet.idl_impl_interface.cc",
+                "components/cronet/native/generated/cronet.idl_impl_struct.cc",
+                "components/cronet/native/io_buffer_with_cronet_buffer.cc",
+                "components/cronet/native/native_metrics_util.cc",
+                "components/cronet/native/runnables.cc",
+                "components/cronet/native/upload_data_sink.cc",
+                "components/cronet/native/url_request.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_components_prefs_prefs",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_net",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "components/cronet/native/buffer.cc",
+                "components/cronet/native/engine.cc",
+                "components/cronet/native/generated/cronet.idl_impl_interface.cc",
+                "components/cronet/native/generated/cronet.idl_impl_struct.cc",
+                "components/cronet/native/io_buffer_with_cronet_buffer.cc",
+                "components/cronet/native/native_metrics_util.cc",
+                "components/cronet/native/runnables.cc",
+                "components/cronet/native/upload_data_sink.cc",
+                "components/cronet/native/url_request.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_components_prefs_prefs",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_net",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //components/grpc_support:grpc_support
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_grpc_support_grpc_support",
-    srcs: [
-        "components/grpc_support/bidirectional_stream.cc",
-        "components/grpc_support/bidirectional_stream_c.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "components/grpc_support/bidirectional_stream.cc",
+                "components/grpc_support/bidirectional_stream_c.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_net",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "components/grpc_support/bidirectional_stream.cc",
+                "components/grpc_support/bidirectional_stream_c.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_net",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //components/grpc_support:headers
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_grpc_support_headers",
 }
 
 // GN: //components/metrics:library_support
-filegroup {
+cc_defaults {
     name: "cronet_aml_components_metrics_library_support",
-    srcs: [
-        "components/metrics/histogram_encoder.cc",
-        "components/metrics/library_support/histogram_manager.cc",
+    target: {
+        android_x86: {
+            srcs: [
+                "components/metrics/histogram_encoder.cc",
+                "components/metrics/library_support/histogram_manager.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "components/metrics/histogram_encoder.cc",
+                "components/metrics/library_support/histogram_manager.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+            ],
+        },
+    },
+}
+
+// GN: //components/nacl/common:buildflags
+genrule {
+    name: "cronet_aml_components_nacl_common_buildflags",
+    cmd: "echo '--flags ENABLE_NACL=\"true\" IS_MINIMAL_TOOLCHAIN=\"false\"' | " +
+         "$(location build/write_buildflag_header.py) --output " +
+         "$(out) " +
+         "--rulename " +
+         "//components/nacl/common:buildflags " +
+         "--gen-dir " +
+         ". " +
+         "--definitions " +
+         "/dev/stdin",
+    out: [
+        "components/nacl/common/buildflags.h",
+    ],
+    tool_files: [
+        "build/write_buildflag_header.py",
     ],
 }
 
@@ -2514,7 +3209,6 @@
         "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",
     ],
     header_libs: [
         "jni_headers",
@@ -2566,10 +3260,6 @@
         "crypto/unexportable_key.cc",
         "crypto/unexportable_key_metrics.cc",
     ],
-    shared_libs: [
-        "libandroid",
-        "liblog",
-    ],
     static_libs: [
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
@@ -2582,24 +3272,26 @@
         "cronet_aml_third_party_libevent_libevent",
         "cronet_aml_third_party_modp_b64_modp_b64",
     ],
+    host_supported: true,
     generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_components_nacl_common_buildflags",
         "cronet_aml_crypto_buildflags",
     ],
     export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_components_nacl_common_buildflags",
         "cronet_aml_crypto_buildflags",
     ],
     defaults: [
         "cronet_aml_defaults",
     ],
     cflags: [
-        "-DANDROID",
-        "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCRYPTO_IMPLEMENTATION",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
-        "-DHAVE_SYS_UIO_H",
         "-D_DEBUG",
         "-D_GNU_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
@@ -2616,9 +3308,54 @@
         "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",
     ],
     cpp_std: "c++20",
+    target: {
+        android: {
+            shared_libs: [
+                "libandroid",
+                "liblog",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        host: {
+            srcs: [
+                "crypto/nss_key_util.cc",
+                "crypto/nss_util.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_third_party_symbolize_symbolize",
+                "cronet_aml_base_third_party_xdg_mime_xdg_mime",
+                "cronet_aml_base_third_party_xdg_user_dirs_xdg_user_dirs",
+            ],
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+            local_include_dirs: [
+                "build/linux/debian_bullseye_amd64-sysroot/usr/include/nspr",
+                "build/linux/debian_bullseye_amd64-sysroot/usr/include/nss",
+            ],
+        },
+    },
 }
 
 // GN: //gn:default_deps
@@ -2640,10 +3377,28 @@
         "-fvisibility=hidden",
     ],
     stl: "none",
+    target: {
+        android_x86: {
+            export_system_include_dirs: [
+                "build/linux/debian_bullseye_i386-sysroot/usr/include",
+            ],
+        },
+        android_x86_64: {
+            export_system_include_dirs: [
+                "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+                "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+            ],
+        },
+        host: {
+            export_system_include_dirs: [
+                "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
+            ],
+        },
+    },
 }
 
 // GN: //ipc:param_traits
-filegroup {
+cc_defaults {
     name: "cronet_aml_ipc_param_traits",
 }
 
@@ -2729,7 +3484,7 @@
 // GN: //net:buildflags
 genrule {
     name: "cronet_aml_net_buildflags",
-    cmd: "echo '--flags POSIX_BYPASS_MMAP=\"true\" DISABLE_FILE_SUPPORT=\"true\" ENABLE_MDNS=\"false\" ENABLE_REPORTING=\"true\" ENABLE_WEBSOCKETS=\"false\" INCLUDE_TRANSPORT_SECURITY_STATE_PRELOAD_LIST=\"false\" USE_KERBEROS=\"true\" USE_EXTERNAL_GSSAPI=\"false\" TRIAL_COMPARISON_CERT_VERIFIER_SUPPORTED=\"false\" CHROME_ROOT_STORE_SUPPORTED=\"false\"' | " +
+    cmd: "echo '--flags POSIX_BYPASS_MMAP=\"false\" DISABLE_FILE_SUPPORT=\"true\" ENABLE_MDNS=\"false\" ENABLE_REPORTING=\"true\" ENABLE_WEBSOCKETS=\"false\" INCLUDE_TRANSPORT_SECURITY_STATE_PRELOAD_LIST=\"false\" USE_KERBEROS=\"true\" USE_EXTERNAL_GSSAPI=\"false\" TRIAL_COMPARISON_CERT_VERIFIER_SUPPORTED=\"false\" CHROME_ROOT_STORE_SUPPORTED=\"false\"' | " +
          "$(location build/write_buildflag_header.py) --output " +
          "$(out) " +
          "--rulename " +
@@ -2746,44 +3501,39 @@
     ],
 }
 
-// GN: //net/cert:root_store_proto_full
-genrule {
-    name: "cronet_aml_net_cert_root_store_proto_full_gen",
-    srcs: [
-        "net/cert/root_store.proto",
-    ],
-    tools: [
-        "aprotoc",
-    ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/cert --cpp_out=lite=true:$(genDir)/external/chromium_org/net/cert/ $(in)",
-    out: [
-        "external/chromium_org/net/cert/root_store.pb.cc",
-    ],
-}
-
-// GN: //net/cert:root_store_proto_full
-genrule {
-    name: "cronet_aml_net_cert_root_store_proto_full_gen_headers",
-    srcs: [
-        "net/cert/root_store.proto",
-    ],
-    tools: [
-        "aprotoc",
-    ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/cert --cpp_out=lite=true:$(genDir)/external/chromium_org/net/cert/ $(in)",
-    out: [
-        "external/chromium_org/net/cert/root_store.pb.h",
-    ],
-    export_include_dirs: [
-        ".",
-        "net/cert",
-        "protos",
-    ],
-}
-
 // GN: //net:constants
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_constants",
+    target: {
+        android_x86: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "cronet_aml_third_party_icu_icuuc_private",
+                "cronet_aml_third_party_libevent_libevent",
+                "cronet_aml_third_party_modp_b64_modp_b64",
+            ],
+        },
+        android_x86_64: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "cronet_aml_third_party_icu_icuuc_private",
+                "cronet_aml_third_party_libevent_libevent",
+                "cronet_aml_third_party_modp_b64_modp_b64",
+            ],
+        },
+    },
 }
 
 // GN: //net/data/ssl/chrome_root_store:gen_root_store_inc
@@ -2810,90 +3560,478 @@
 }
 
 // GN: //net/dns:dns
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_dns_dns",
-    srcs: [
-        "net/dns/address_info.cc",
-        "net/dns/address_sorter_posix.cc",
-        "net/dns/context_host_resolver.cc",
-        "net/dns/dns_alias_utility.cc",
-        "net/dns/dns_client.cc",
-        "net/dns/dns_config.cc",
-        "net/dns/dns_config_service.cc",
-        "net/dns/dns_config_service_android.cc",
-        "net/dns/dns_hosts.cc",
-        "net/dns/dns_query.cc",
-        "net/dns/dns_reloader.cc",
-        "net/dns/dns_response.cc",
-        "net/dns/dns_response_result_extractor.cc",
-        "net/dns/dns_server_iterator.cc",
-        "net/dns/dns_session.cc",
-        "net/dns/dns_transaction.cc",
-        "net/dns/dns_udp_tracker.cc",
-        "net/dns/dns_util.cc",
-        "net/dns/host_cache.cc",
-        "net/dns/host_resolver.cc",
-        "net/dns/host_resolver_manager.cc",
-        "net/dns/host_resolver_mdns_listener_impl.cc",
-        "net/dns/host_resolver_mdns_task.cc",
-        "net/dns/host_resolver_nat64_task.cc",
-        "net/dns/host_resolver_proc.cc",
-        "net/dns/host_resolver_system_task.cc",
-        "net/dns/https_record_rdata.cc",
-        "net/dns/httpssvc_metrics.cc",
-        "net/dns/mapped_host_resolver.cc",
-        "net/dns/nsswitch_reader.cc",
-        "net/dns/opt_record_rdata.cc",
-        "net/dns/record_parsed.cc",
-        "net/dns/record_rdata.cc",
-        "net/dns/resolve_context.cc",
-        "net/dns/serial_worker.cc",
-        "net/dns/system_dns_config_change_notifier.cc",
-        "net/dns/test_dns_config_service.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "net/dns/address_info.cc",
+                "net/dns/address_sorter_posix.cc",
+                "net/dns/context_host_resolver.cc",
+                "net/dns/dns_alias_utility.cc",
+                "net/dns/dns_client.cc",
+                "net/dns/dns_config.cc",
+                "net/dns/dns_config_service.cc",
+                "net/dns/dns_config_service_android.cc",
+                "net/dns/dns_hosts.cc",
+                "net/dns/dns_query.cc",
+                "net/dns/dns_reloader.cc",
+                "net/dns/dns_response.cc",
+                "net/dns/dns_response_result_extractor.cc",
+                "net/dns/dns_server_iterator.cc",
+                "net/dns/dns_session.cc",
+                "net/dns/dns_transaction.cc",
+                "net/dns/dns_udp_tracker.cc",
+                "net/dns/dns_util.cc",
+                "net/dns/host_cache.cc",
+                "net/dns/host_resolver.cc",
+                "net/dns/host_resolver_manager.cc",
+                "net/dns/host_resolver_mdns_listener_impl.cc",
+                "net/dns/host_resolver_mdns_task.cc",
+                "net/dns/host_resolver_nat64_task.cc",
+                "net/dns/host_resolver_proc.cc",
+                "net/dns/host_resolver_system_task.cc",
+                "net/dns/https_record_rdata.cc",
+                "net/dns/httpssvc_metrics.cc",
+                "net/dns/mapped_host_resolver.cc",
+                "net/dns/nsswitch_reader.cc",
+                "net/dns/opt_record_rdata.cc",
+                "net/dns/record_parsed.cc",
+                "net/dns/record_rdata.cc",
+                "net/dns/resolve_context.cc",
+                "net/dns/serial_worker.cc",
+                "net/dns/system_dns_config_change_notifier.cc",
+                "net/dns/test_dns_config_service.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "net/dns/address_info.cc",
+                "net/dns/address_sorter_posix.cc",
+                "net/dns/context_host_resolver.cc",
+                "net/dns/dns_alias_utility.cc",
+                "net/dns/dns_client.cc",
+                "net/dns/dns_config.cc",
+                "net/dns/dns_config_service.cc",
+                "net/dns/dns_config_service_android.cc",
+                "net/dns/dns_hosts.cc",
+                "net/dns/dns_query.cc",
+                "net/dns/dns_reloader.cc",
+                "net/dns/dns_response.cc",
+                "net/dns/dns_response_result_extractor.cc",
+                "net/dns/dns_server_iterator.cc",
+                "net/dns/dns_session.cc",
+                "net/dns/dns_transaction.cc",
+                "net/dns/dns_udp_tracker.cc",
+                "net/dns/dns_util.cc",
+                "net/dns/host_cache.cc",
+                "net/dns/host_resolver.cc",
+                "net/dns/host_resolver_manager.cc",
+                "net/dns/host_resolver_mdns_listener_impl.cc",
+                "net/dns/host_resolver_mdns_task.cc",
+                "net/dns/host_resolver_nat64_task.cc",
+                "net/dns/host_resolver_proc.cc",
+                "net/dns/host_resolver_system_task.cc",
+                "net/dns/https_record_rdata.cc",
+                "net/dns/httpssvc_metrics.cc",
+                "net/dns/mapped_host_resolver.cc",
+                "net/dns/nsswitch_reader.cc",
+                "net/dns/opt_record_rdata.cc",
+                "net/dns/record_parsed.cc",
+                "net/dns/record_rdata.cc",
+                "net/dns/resolve_context.cc",
+                "net/dns/serial_worker.cc",
+                "net/dns/system_dns_config_change_notifier.cc",
+                "net/dns/test_dns_config_service.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //net/dns:dns_client
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_dns_dns_client",
+    target: {
+        android_x86: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //net/dns:host_resolver
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_dns_host_resolver",
+    target: {
+        android_x86: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //net/dns:host_resolver_manager
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_dns_host_resolver_manager",
+    target: {
+        android_x86: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //net/dns:mdns_client
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_dns_mdns_client",
+    target: {
+        android_x86: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //net/dns/public:public
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_dns_public_public",
-    srcs: [
-        "net/dns/public/dns_config_overrides.cc",
-        "net/dns/public/dns_over_https_config.cc",
-        "net/dns/public/dns_over_https_server_config.cc",
-        "net/dns/public/dns_query_type.cc",
-        "net/dns/public/doh_provider_entry.cc",
-        "net/dns/public/host_resolver_results.cc",
-        "net/dns/public/resolve_error_info.cc",
-        "net/dns/public/util.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "net/dns/public/dns_config_overrides.cc",
+                "net/dns/public/dns_over_https_config.cc",
+                "net/dns/public/dns_over_https_server_config.cc",
+                "net/dns/public/dns_query_type.cc",
+                "net/dns/public/doh_provider_entry.cc",
+                "net/dns/public/host_resolver_results.cc",
+                "net/dns/public/resolve_error_info.cc",
+                "net/dns/public/util.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "net/dns/public/dns_config_overrides.cc",
+                "net/dns/public/dns_over_https_config.cc",
+                "net/dns/public/dns_over_https_server_config.cc",
+                "net/dns/public/dns_query_type.cc",
+                "net/dns/public/doh_provider_entry.cc",
+                "net/dns/public/host_resolver_results.cc",
+                "net/dns/public/resolve_error_info.cc",
+                "net/dns/public/util.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //net/http:transport_security_state_generated_files
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_http_transport_security_state_generated_files",
-    srcs: [
-        "net/http/transport_security_state.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "net/http/transport_security_state.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "net/http/transport_security_state.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //net:ios_cronet_buildflags
@@ -2923,9 +4061,9 @@
         "net/base/isolation_info.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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",
     ],
@@ -2938,9 +4076,9 @@
         "net/base/isolation_info.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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",
     ],
@@ -2955,21 +4093,9 @@
 cc_library_static {
     name: "cronet_aml_net_net",
     srcs: [
-        ":cronet_aml_net_constants",
-        ":cronet_aml_net_dns_dns",
-        ":cronet_aml_net_dns_dns_client",
-        ":cronet_aml_net_dns_host_resolver",
-        ":cronet_aml_net_dns_host_resolver_manager",
-        ":cronet_aml_net_dns_mdns_client",
-        ":cronet_aml_net_dns_public_public",
-        ":cronet_aml_net_http_transport_security_state_generated_files",
         ":cronet_aml_net_isolation_info_proto_gen",
-        ":cronet_aml_net_net_deps",
-        ":cronet_aml_net_net_export_header",
         ":cronet_aml_net_net_nqe_proto_gen",
-        ":cronet_aml_net_net_public_deps",
         ":cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen",
-        ":cronet_aml_net_traffic_annotation_traffic_annotation",
         "net/android/android_http_util.cc",
         "net/android/cert_verify_result_android.cc",
         "net/android/gurl_utils.cc",
@@ -3158,7 +4284,6 @@
         "net/disk_cache/blockfile/in_flight_backend_io.cc",
         "net/disk_cache/blockfile/in_flight_io.cc",
         "net/disk_cache/blockfile/mapped_file.cc",
-        "net/disk_cache/blockfile/mapped_file_bypass_mmap_posix.cc",
         "net/disk_cache/blockfile/rankings.cc",
         "net/disk_cache/blockfile/sparse_control.cc",
         "net/disk_cache/blockfile/stats.cc",
@@ -3465,9 +4590,6 @@
         "cronet_aml_base_base_static",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_base_third_party_symbolize_symbolize",
-        "cronet_aml_base_third_party_xdg_mime_xdg_mime",
-        "cronet_aml_base_third_party_xdg_user_dirs_xdg_user_dirs",
         "cronet_aml_crypto_crypto",
         "cronet_aml_net_preload_decoder",
         "cronet_aml_net_third_party_quiche_quiche",
@@ -3479,6 +4601,7 @@
         "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_lite",
         "cronet_aml_third_party_zlib_zlib",
         "cronet_aml_url_url",
     ],
@@ -3516,6 +4639,18 @@
     ],
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_net_constants",
+        "cronet_aml_net_dns_dns",
+        "cronet_aml_net_dns_dns_client",
+        "cronet_aml_net_dns_host_resolver",
+        "cronet_aml_net_dns_host_resolver_manager",
+        "cronet_aml_net_dns_mdns_client",
+        "cronet_aml_net_dns_public_public",
+        "cronet_aml_net_http_transport_security_state_generated_files",
+        "cronet_aml_net_net_deps",
+        "cronet_aml_net_net_export_header",
+        "cronet_aml_net_net_public_deps",
+        "cronet_aml_net_traffic_annotation_traffic_annotation",
     ],
     cflags: [
         "-DANDROID",
@@ -3551,23 +4686,75 @@
         "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",
     ],
     header_libs: [
         "jni_headers",
     ],
     cpp_std: "c++20",
     rtti: true,
+    target: {
+        android_x86: {
+            srcs: [
+                "net/disk_cache/blockfile/mapped_file_posix.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "net/disk_cache/blockfile/mapped_file_bypass_mmap_posix.cc",
+            ],
+        },
+    },
 }
 
 // GN: //net:net_deps
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_net_deps",
+    target: {
+        android_x86: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+            ],
+        },
+        android_x86_64: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_net_preload_decoder",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_brotli_common",
+                "cronet_aml_third_party_brotli_dec",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+            ],
+        },
+    },
 }
 
 // GN: //net:net_export_header
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_net_export_header",
 }
 
@@ -3681,9 +4868,9 @@
         "net/nqe/proto/network_id_proto.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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 +4883,9 @@
         "net/nqe/proto/network_id_proto.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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",
     ],
@@ -3710,8 +4897,50 @@
 }
 
 // GN: //net:net_public_deps
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_net_public_deps",
+    target: {
+        android_x86: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+        android_x86_64: {
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_crypto_crypto",
+                "cronet_aml_net_third_party_quiche_quiche",
+                "cronet_aml_net_uri_template",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "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_lite",
+                "cronet_aml_third_party_zlib_zlib",
+                "cronet_aml_url_url",
+            ],
+        },
+    },
 }
 
 // GN: //net:preload_decoder
@@ -3763,7 +4992,6 @@
         "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",
     ],
     cpp_std: "c++20",
 }
@@ -3777,9 +5005,9 @@
         "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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 +5024,9 @@
         "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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 +5046,9 @@
         "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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 +5061,9 @@
         "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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",
     ],
@@ -3851,117 +5079,6 @@
     name: "cronet_aml_net_third_party_quiche_quiche",
     srcs: [
         ":cronet_aml_net_third_party_quiche_net_quic_proto_gen",
-        ":cronet_aml_third_party_abseil_cpp_absl",
-        ":cronet_aml_third_party_abseil_cpp_absl_algorithm_algorithm",
-        ":cronet_aml_third_party_abseil_cpp_absl_algorithm_container",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_atomic_hook",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_base",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_base_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_config",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_core_headers",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_cycleclock_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_dynamic_annotations",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_endian",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_errno_saver",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_fast_type_id",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_prefetch",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror",
-        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        ":cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup",
-        ":cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_btree",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_common",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_common_policy_traits",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_compressed_tuple",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_container_memory",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_fixed_array",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_map",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_set",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_hash_function_defaults",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_hash_policy_traits",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtable_debug_hooks",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_layout",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_node_hash_map",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_node_hash_set",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_node_slot_policy",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_map",
-        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace",
-        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        ":cronet_aml_third_party_abseil_cpp_absl_functional_any_invocable",
-        ":cronet_aml_third_party_abseil_cpp_absl_functional_bind_front",
-        ":cronet_aml_third_party_abseil_cpp_absl_functional_function_ref",
-        ":cronet_aml_third_party_abseil_cpp_absl_hash_city",
-        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash",
-        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash",
-        ":cronet_aml_third_party_abseil_cpp_absl_memory_memory",
-        ":cronet_aml_third_party_abseil_cpp_absl_meta_type_traits",
-        ":cronet_aml_third_party_abseil_cpp_absl_numeric_bits",
-        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        ":cronet_aml_third_party_abseil_cpp_absl_numeric_representation",
-        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        ":cronet_aml_third_party_abseil_cpp_absl_profiling_sample_recorder",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_distribution_caller",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_fast_uniform_bits",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_fastmath",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_generate_real",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_iostream_state_saver",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_nonsecure_base",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pcg_engine",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_engine",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_salted_seed_seq",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_traits",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_uniform_helper",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_wide_multiply",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_random",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception",
-        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences",
-        ":cronet_aml_third_party_abseil_cpp_absl_status_status",
-        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_statistics",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_scope",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_tracker",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_kernel_timeout_internal",
-        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization",
-        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time",
-        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone",
-        ":cronet_aml_third_party_abseil_cpp_absl_time_time",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_compare",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_optional",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_span",
-        ":cronet_aml_third_party_abseil_cpp_absl_types_variant",
-        ":cronet_aml_third_party_abseil_cpp_absl_utility_utility",
         "net/third_party/quiche/overrides/quiche_platform_impl/quiche_mutex_impl.cc",
         "net/third_party/quiche/overrides/quiche_platform_impl/quiche_time_utils_impl.cc",
         "net/third_party/quiche/overrides/quiche_platform_impl/quiche_url_utils_impl.cc",
@@ -4259,6 +5376,7 @@
         "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_lite",
         "cronet_aml_third_party_zlib_zlib",
         "cronet_aml_url_url",
     ],
@@ -4272,6 +5390,117 @@
     ],
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_third_party_abseil_cpp_absl",
+        "cronet_aml_third_party_abseil_cpp_absl_algorithm_algorithm",
+        "cronet_aml_third_party_abseil_cpp_absl_algorithm_container",
+        "cronet_aml_third_party_abseil_cpp_absl_base_atomic_hook",
+        "cronet_aml_third_party_abseil_cpp_absl_base_base",
+        "cronet_aml_third_party_abseil_cpp_absl_base_base_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_base_config",
+        "cronet_aml_third_party_abseil_cpp_absl_base_core_headers",
+        "cronet_aml_third_party_abseil_cpp_absl_base_cycleclock_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_base_dynamic_annotations",
+        "cronet_aml_third_party_abseil_cpp_absl_base_endian",
+        "cronet_aml_third_party_abseil_cpp_absl_base_errno_saver",
+        "cronet_aml_third_party_abseil_cpp_absl_base_fast_type_id",
+        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
+        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_base_prefetch",
+        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
+        "cronet_aml_third_party_abseil_cpp_absl_base_strerror",
+        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
+        "cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup",
+        "cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_container_btree",
+        "cronet_aml_third_party_abseil_cpp_absl_container_common",
+        "cronet_aml_third_party_abseil_cpp_absl_container_common_policy_traits",
+        "cronet_aml_third_party_abseil_cpp_absl_container_compressed_tuple",
+        "cronet_aml_third_party_abseil_cpp_absl_container_container_memory",
+        "cronet_aml_third_party_abseil_cpp_absl_container_fixed_array",
+        "cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_map",
+        "cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_set",
+        "cronet_aml_third_party_abseil_cpp_absl_container_hash_function_defaults",
+        "cronet_aml_third_party_abseil_cpp_absl_container_hash_policy_traits",
+        "cronet_aml_third_party_abseil_cpp_absl_container_hashtable_debug_hooks",
+        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler",
+        "cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector",
+        "cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_container_layout",
+        "cronet_aml_third_party_abseil_cpp_absl_container_node_hash_map",
+        "cronet_aml_third_party_abseil_cpp_absl_container_node_hash_set",
+        "cronet_aml_third_party_abseil_cpp_absl_container_node_slot_policy",
+        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_map",
+        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace",
+        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
+        "cronet_aml_third_party_abseil_cpp_absl_functional_any_invocable",
+        "cronet_aml_third_party_abseil_cpp_absl_functional_bind_front",
+        "cronet_aml_third_party_abseil_cpp_absl_functional_function_ref",
+        "cronet_aml_third_party_abseil_cpp_absl_hash_city",
+        "cronet_aml_third_party_abseil_cpp_absl_hash_hash",
+        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash",
+        "cronet_aml_third_party_abseil_cpp_absl_memory_memory",
+        "cronet_aml_third_party_abseil_cpp_absl_meta_type_traits",
+        "cronet_aml_third_party_abseil_cpp_absl_numeric_bits",
+        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
+        "cronet_aml_third_party_abseil_cpp_absl_numeric_representation",
+        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
+        "cronet_aml_third_party_abseil_cpp_absl_profiling_sample_recorder",
+        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_distribution_caller",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_fast_uniform_bits",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_fastmath",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_generate_real",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_iostream_state_saver",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_nonsecure_base",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pcg_engine",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_engine",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_salted_seed_seq",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_traits",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_uniform_helper",
+        "cronet_aml_third_party_abseil_cpp_absl_random_internal_wide_multiply",
+        "cronet_aml_third_party_abseil_cpp_absl_random_random",
+        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception",
+        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences",
+        "cronet_aml_third_party_abseil_cpp_absl_status_status",
+        "cronet_aml_third_party_abseil_cpp_absl_status_statusor",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cord",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_statistics",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_scope",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_tracker",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
+        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_synchronization_kernel_timeout_internal",
+        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization",
+        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time",
+        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone",
+        "cronet_aml_third_party_abseil_cpp_absl_time_time",
+        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
+        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access",
+        "cronet_aml_third_party_abseil_cpp_absl_types_compare",
+        "cronet_aml_third_party_abseil_cpp_absl_types_optional",
+        "cronet_aml_third_party_abseil_cpp_absl_types_span",
+        "cronet_aml_third_party_abseil_cpp_absl_types_variant",
+        "cronet_aml_third_party_abseil_cpp_absl_utility_utility",
     ],
     cflags: [
         "-DABSL_ALLOCATOR_NOTHROW=1",
@@ -4306,100 +5535,51 @@
         "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",
     ],
     cpp_std: "c++20",
 }
 
-// GN: //net/tools/root_store_tool:root_store_tool
-cc_binary {
-    name: "cronet_aml_net_tools_root_store_tool_root_store_tool",
-    srcs: [
-        ":cronet_aml_buildtools_third_party_libc___libc__",
-        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-        ":cronet_aml_net_cert_root_store_proto_full_gen",
-        "net/tools/root_store_tool/root_store_tool.cc",
-    ],
-    shared_libs: [
-        "libprotobuf-cpp-lite",
-    ],
-    static_libs: [
-        "cronet_aml_base_allocator_partition_allocator_partition_alloc",
-        "cronet_aml_base_base",
-        "cronet_aml_base_base_static",
-        "cronet_aml_base_third_party_double_conversion_double_conversion",
-        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_base_third_party_symbolize_symbolize",
-        "cronet_aml_base_third_party_xdg_mime_xdg_mime",
-        "cronet_aml_base_third_party_xdg_user_dirs_xdg_user_dirs",
-        "cronet_aml_crypto_crypto",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_icu_icui18n",
-        "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_zlib_zlib",
-    ],
-    generated_headers: [
-        "cronet_aml_net_cert_root_store_proto_full_gen_headers",
-    ],
-    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",
-        "-D__STDC_CONSTANT_MACROS",
-        "-D__STDC_FORMAT_MACROS",
-    ],
-    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/abseil-cpp/",
-        "third_party/boringssl/src/include/",
-        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
-    ],
-    cpp_std: "c++20",
-    cppflags: [
-        "-fexceptions",
-    ],
-    rtti: true,
-}
-
 // GN: //net/traffic_annotation:traffic_annotation
-filegroup {
+cc_defaults {
     name: "cronet_aml_net_traffic_annotation_traffic_annotation",
-    srcs: [
-        "net/traffic_annotation/network_traffic_annotation_android.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "net/traffic_annotation/network_traffic_annotation_android.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "cronet_aml_third_party_icu_icuuc_private",
+                "cronet_aml_third_party_libevent_libevent",
+                "cronet_aml_third_party_modp_b64_modp_b64",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "net/traffic_annotation/network_traffic_annotation_android.cc",
+            ],
+            static_libs: [
+                "cronet_aml_base_allocator_partition_allocator_partition_alloc",
+                "cronet_aml_base_base",
+                "cronet_aml_base_base_static",
+                "cronet_aml_base_third_party_double_conversion_double_conversion",
+                "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+                "cronet_aml_third_party_boringssl_boringssl",
+                "cronet_aml_third_party_icu_icui18n",
+                "cronet_aml_third_party_icu_icuuc_private",
+                "cronet_aml_third_party_libevent_libevent",
+                "cronet_aml_third_party_modp_b64_modp_b64",
+            ],
+        },
+    },
 }
 
 // GN: //net:uri_template
@@ -4452,787 +5632,1841 @@
         "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",
     ],
     cpp_std: "c++20",
 }
 
 // GN: //third_party/abseil-cpp:absl
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl",
 }
 
 // GN: //third_party/abseil-cpp/absl/algorithm:algorithm
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_algorithm_algorithm",
 }
 
 // GN: //third_party/abseil-cpp/absl/algorithm:container
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_algorithm_container",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:atomic_hook
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_atomic_hook",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:base
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_base",
-    srcs: [
-        "third_party/abseil-cpp/absl/base/internal/cycleclock.cc",
-        "third_party/abseil-cpp/absl/base/internal/spinlock.cc",
-        "third_party/abseil-cpp/absl/base/internal/sysinfo.cc",
-        "third_party/abseil-cpp/absl/base/internal/thread_identity.cc",
-        "third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/cycleclock.cc",
+                "third_party/abseil-cpp/absl/base/internal/spinlock.cc",
+                "third_party/abseil-cpp/absl/base/internal/sysinfo.cc",
+                "third_party/abseil-cpp/absl/base/internal/thread_identity.cc",
+                "third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/cycleclock.cc",
+                "third_party/abseil-cpp/absl/base/internal/spinlock.cc",
+                "third_party/abseil-cpp/absl/base/internal/sysinfo.cc",
+                "third_party/abseil-cpp/absl/base/internal/thread_identity.cc",
+                "third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/cycleclock.cc",
+                "third_party/abseil-cpp/absl/base/internal/spinlock.cc",
+                "third_party/abseil-cpp/absl/base/internal/sysinfo.cc",
+                "third_party/abseil-cpp/absl/base/internal/thread_identity.cc",
+                "third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/base:base_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_base_internal",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:config
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_config",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:core_headers
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_core_headers",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:cycleclock_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_cycleclock_internal",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:dynamic_annotations
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_dynamic_annotations",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:endian
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_endian",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:errno_saver
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_errno_saver",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:fast_type_id
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_fast_type_id",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:log_severity
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-    srcs: [
-        "third_party/abseil-cpp/absl/base/log_severity.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/log_severity.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/log_severity.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/log_severity.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/base:malloc_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal",
-    srcs: [
-        "third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/base:prefetch
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_prefetch",
 }
 
 // GN: //third_party/abseil-cpp/absl/base:raw_logging_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-    srcs: [
-        "third_party/abseil-cpp/absl/base/internal/raw_logging.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/raw_logging.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/raw_logging.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/raw_logging.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/base:spinlock_wait
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-    srcs: [
-        "third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/base:strerror
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_strerror",
-    srcs: [
-        "third_party/abseil-cpp/absl/base/internal/strerror.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/strerror.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/strerror.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/strerror.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/base:throw_delegate
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-    srcs: [
-        "third_party/abseil-cpp/absl/base/internal/throw_delegate.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/throw_delegate.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/throw_delegate.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/base/internal/throw_delegate.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/cleanup:cleanup
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup",
 }
 
 // GN: //third_party/abseil-cpp/absl/cleanup:cleanup_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_cleanup_cleanup_internal",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:btree
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_btree",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:common
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_common",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:common_policy_traits
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_common_policy_traits",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:compressed_tuple
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_compressed_tuple",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:container_memory
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_container_memory",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:fixed_array
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_fixed_array",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:flat_hash_map
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_map",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:flat_hash_set
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_flat_hash_set",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:hash_function_defaults
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_hash_function_defaults",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:hash_policy_traits
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_hash_policy_traits",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:hashtable_debug_hooks
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_hashtable_debug_hooks",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:hashtablez_sampler
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler",
-    srcs: [
-        "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc",
-        "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc",
+                "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc",
+                "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc",
+                "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/container:inlined_vector
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:inlined_vector_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_inlined_vector_internal",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:layout
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_layout",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:node_hash_map
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_node_hash_map",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:node_hash_set
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_node_hash_set",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:node_slot_policy
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_node_slot_policy",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:raw_hash_map
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_map",
 }
 
 // GN: //third_party/abseil-cpp/absl/container:raw_hash_set
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set",
-    srcs: [
-        "third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:debugging_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal",
-    srcs: [
-        "third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc",
-        "third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc",
-        "third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc",
+                "third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc",
+                "third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc",
+                "third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc",
+                "third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc",
+                "third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc",
+                "third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:demangle_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal",
-    srcs: [
-        "third_party/abseil-cpp/absl/debugging/internal/demangle.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/demangle.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/demangle.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/demangle.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:examine_stack
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack",
-    srcs: [
-        "third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:failure_signal_handler
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler",
-    srcs: [
-        "third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:stacktrace
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace",
-    srcs: [
-        "third_party/abseil-cpp/absl/debugging/stacktrace.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/stacktrace.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/stacktrace.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/stacktrace.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:symbolize
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-    srcs: [
-        "third_party/abseil-cpp/absl/debugging/symbolize.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/symbolize.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/symbolize.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/debugging/symbolize.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/functional:any_invocable
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_functional_any_invocable",
 }
 
 // GN: //third_party/abseil-cpp/absl/functional:bind_front
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_functional_bind_front",
 }
 
 // GN: //third_party/abseil-cpp/absl/functional:function_ref
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_functional_function_ref",
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:city
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_city",
-    srcs: [
-        "third_party/abseil-cpp/absl/hash/internal/city.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/city.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/city.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/city.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:hash
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_hash",
-    srcs: [
-        "third_party/abseil-cpp/absl/hash/internal/hash.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/hash.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/hash.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/hash.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:low_level_hash
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash",
-    srcs: [
-        "third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/memory:memory
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_memory_memory",
 }
 
 // GN: //third_party/abseil-cpp/absl/meta:type_traits
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_meta_type_traits",
 }
 
 // GN: //third_party/abseil-cpp/absl/numeric:bits
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_numeric_bits",
 }
 
 // GN: //third_party/abseil-cpp/absl/numeric:int128
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-    srcs: [
-        "third_party/abseil-cpp/absl/numeric/int128.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/numeric/int128.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/numeric/int128.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/numeric/int128.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/numeric:representation
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_numeric_representation",
 }
 
 // GN: //third_party/abseil-cpp/absl/profiling:exponential_biased
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-    srcs: [
-        "third_party/abseil-cpp/absl/profiling/internal/exponential_biased.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/profiling/internal/exponential_biased.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/profiling/internal/exponential_biased.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/profiling/internal/exponential_biased.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/profiling:sample_recorder
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_profiling_sample_recorder",
 }
 
 // GN: //third_party/abseil-cpp/absl/random:distributions
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/discrete_distribution.cc",
-        "third_party/abseil-cpp/absl/random/gaussian_distribution.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/discrete_distribution.cc",
+                "third_party/abseil-cpp/absl/random/gaussian_distribution.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/discrete_distribution.cc",
+                "third_party/abseil-cpp/absl/random/gaussian_distribution.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/discrete_distribution.cc",
+                "third_party/abseil-cpp/absl/random/gaussian_distribution.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:distribution_caller
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_distribution_caller",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:fast_uniform_bits
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_fast_uniform_bits",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:fastmath
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_fastmath",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:generate_real
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_generate_real",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:iostream_state_saver
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_iostream_state_saver",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:nonsecure_base
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_nonsecure_base",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:pcg_engine
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_pcg_engine",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:platform
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:pool_urbg
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/internal/pool_urbg.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/pool_urbg.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/pool_urbg.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/pool_urbg.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/internal/randen.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_engine
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_engine",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_hwaes
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/internal/randen_detect.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_detect.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_detect.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_detect.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_hwaes_impl
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_slow
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/internal/randen_slow.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_slow.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_slow.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/randen_slow.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:salted_seed_seq
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_salted_seed_seq",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:seed_material
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/internal/seed_material.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/seed_material.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/seed_material.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/internal/seed_material.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:traits
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_traits",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:uniform_helper
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_uniform_helper",
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:wide_multiply
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_wide_multiply",
 }
 
 // GN: //third_party/abseil-cpp/absl/random:random
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_random",
 }
 
 // GN: //third_party/abseil-cpp/absl/random:seed_gen_exception
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/seed_gen_exception.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/seed_gen_exception.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/seed_gen_exception.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/seed_gen_exception.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/random:seed_sequences
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences",
-    srcs: [
-        "third_party/abseil-cpp/absl/random/seed_sequences.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/seed_sequences.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/seed_sequences.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/random/seed_sequences.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/status:status
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_status_status",
-    srcs: [
-        "third_party/abseil-cpp/absl/status/status.cc",
-        "third_party/abseil-cpp/absl/status/status_payload_printer.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/status/status.cc",
+                "third_party/abseil-cpp/absl/status/status_payload_printer.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/status/status.cc",
+                "third_party/abseil-cpp/absl/status/status_payload_printer.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/status/status.cc",
+                "third_party/abseil-cpp/absl/status/status_payload_printer.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/status:statusor
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_status_statusor",
-    srcs: [
-        "third_party/abseil-cpp/absl/status/statusor.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/status/statusor.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/status/statusor.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/status/statusor.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cord
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cord",
-    srcs: [
-        "third_party/abseil-cpp/absl/strings/cord.cc",
-        "third_party/abseil-cpp/absl/strings/cord_analysis.cc",
-        "third_party/abseil-cpp/absl/strings/cord_buffer.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/cord.cc",
+                "third_party/abseil-cpp/absl/strings/cord_analysis.cc",
+                "third_party/abseil-cpp/absl/strings/cord_buffer.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/cord.cc",
+                "third_party/abseil-cpp/absl/strings/cord_analysis.cc",
+                "third_party/abseil-cpp/absl/strings/cord_buffer.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/cord.cc",
+                "third_party/abseil-cpp/absl/strings/cord_analysis.cc",
+                "third_party/abseil-cpp/absl/strings/cord_buffer.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cord_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal",
-    srcs: [
-        "third_party/abseil-cpp/absl/strings/internal/cord_internal.cc",
-        "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc",
-        "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc",
-        "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc",
-        "third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc",
-        "third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc",
-        "third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cord_internal.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cord_internal.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cord_internal.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc",
+                "third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_functions
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions",
-    srcs: [
-        "third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_handle
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle",
-    srcs: [
-        "third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_info
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info",
-    srcs: [
-        "third_party/abseil-cpp/absl/strings/internal/cordz_info.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_info.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_info.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/cordz_info.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_statistics
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_statistics",
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_update_scope
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_scope",
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_update_tracker
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_update_tracker",
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-    srcs: [
-        "third_party/abseil-cpp/absl/strings/internal/escaping.cc",
-        "third_party/abseil-cpp/absl/strings/internal/ostringstream.cc",
-        "third_party/abseil-cpp/absl/strings/internal/utf8.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/escaping.cc",
+                "third_party/abseil-cpp/absl/strings/internal/ostringstream.cc",
+                "third_party/abseil-cpp/absl/strings/internal/utf8.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/escaping.cc",
+                "third_party/abseil-cpp/absl/strings/internal/ostringstream.cc",
+                "third_party/abseil-cpp/absl/strings/internal/utf8.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/escaping.cc",
+                "third_party/abseil-cpp/absl/strings/internal/ostringstream.cc",
+                "third_party/abseil-cpp/absl/strings/internal/utf8.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:str_format
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_str_format",
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:str_format_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal",
-    srcs: [
-        "third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc",
-        "third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc",
-        "third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc",
-        "third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc",
-        "third_party/abseil-cpp/absl/strings/internal/str_format/output.cc",
-        "third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/output.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/output.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/output.cc",
+                "third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:strings
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-    srcs: [
-        "third_party/abseil-cpp/absl/strings/ascii.cc",
-        "third_party/abseil-cpp/absl/strings/charconv.cc",
-        "third_party/abseil-cpp/absl/strings/escaping.cc",
-        "third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc",
-        "third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc",
-        "third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc",
-        "third_party/abseil-cpp/absl/strings/internal/memutil.cc",
-        "third_party/abseil-cpp/absl/strings/match.cc",
-        "third_party/abseil-cpp/absl/strings/numbers.cc",
-        "third_party/abseil-cpp/absl/strings/str_cat.cc",
-        "third_party/abseil-cpp/absl/strings/str_replace.cc",
-        "third_party/abseil-cpp/absl/strings/str_split.cc",
-        "third_party/abseil-cpp/absl/strings/string_view.cc",
-        "third_party/abseil-cpp/absl/strings/substitute.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/ascii.cc",
+                "third_party/abseil-cpp/absl/strings/charconv.cc",
+                "third_party/abseil-cpp/absl/strings/escaping.cc",
+                "third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc",
+                "third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc",
+                "third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc",
+                "third_party/abseil-cpp/absl/strings/internal/memutil.cc",
+                "third_party/abseil-cpp/absl/strings/match.cc",
+                "third_party/abseil-cpp/absl/strings/numbers.cc",
+                "third_party/abseil-cpp/absl/strings/str_cat.cc",
+                "third_party/abseil-cpp/absl/strings/str_replace.cc",
+                "third_party/abseil-cpp/absl/strings/str_split.cc",
+                "third_party/abseil-cpp/absl/strings/string_view.cc",
+                "third_party/abseil-cpp/absl/strings/substitute.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/ascii.cc",
+                "third_party/abseil-cpp/absl/strings/charconv.cc",
+                "third_party/abseil-cpp/absl/strings/escaping.cc",
+                "third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc",
+                "third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc",
+                "third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc",
+                "third_party/abseil-cpp/absl/strings/internal/memutil.cc",
+                "third_party/abseil-cpp/absl/strings/match.cc",
+                "third_party/abseil-cpp/absl/strings/numbers.cc",
+                "third_party/abseil-cpp/absl/strings/str_cat.cc",
+                "third_party/abseil-cpp/absl/strings/str_replace.cc",
+                "third_party/abseil-cpp/absl/strings/str_split.cc",
+                "third_party/abseil-cpp/absl/strings/string_view.cc",
+                "third_party/abseil-cpp/absl/strings/substitute.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/strings/ascii.cc",
+                "third_party/abseil-cpp/absl/strings/charconv.cc",
+                "third_party/abseil-cpp/absl/strings/escaping.cc",
+                "third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc",
+                "third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc",
+                "third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc",
+                "third_party/abseil-cpp/absl/strings/internal/memutil.cc",
+                "third_party/abseil-cpp/absl/strings/match.cc",
+                "third_party/abseil-cpp/absl/strings/numbers.cc",
+                "third_party/abseil-cpp/absl/strings/str_cat.cc",
+                "third_party/abseil-cpp/absl/strings/str_replace.cc",
+                "third_party/abseil-cpp/absl/strings/str_split.cc",
+                "third_party/abseil-cpp/absl/strings/string_view.cc",
+                "third_party/abseil-cpp/absl/strings/substitute.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/synchronization:graphcycles_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal",
-    srcs: [
-        "third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/synchronization:kernel_timeout_internal
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_synchronization_kernel_timeout_internal",
 }
 
 // GN: //third_party/abseil-cpp/absl/synchronization:synchronization
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization",
-    srcs: [
-        "third_party/abseil-cpp/absl/synchronization/barrier.cc",
-        "third_party/abseil-cpp/absl/synchronization/blocking_counter.cc",
-        "third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc",
-        "third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc",
-        "third_party/abseil-cpp/absl/synchronization/internal/waiter.cc",
-        "third_party/abseil-cpp/absl/synchronization/mutex.cc",
-        "third_party/abseil-cpp/absl/synchronization/notification.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/synchronization/barrier.cc",
+                "third_party/abseil-cpp/absl/synchronization/blocking_counter.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/waiter.cc",
+                "third_party/abseil-cpp/absl/synchronization/mutex.cc",
+                "third_party/abseil-cpp/absl/synchronization/notification.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/synchronization/barrier.cc",
+                "third_party/abseil-cpp/absl/synchronization/blocking_counter.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/waiter.cc",
+                "third_party/abseil-cpp/absl/synchronization/mutex.cc",
+                "third_party/abseil-cpp/absl/synchronization/notification.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/synchronization/barrier.cc",
+                "third_party/abseil-cpp/absl/synchronization/blocking_counter.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc",
+                "third_party/abseil-cpp/absl/synchronization/internal/waiter.cc",
+                "third_party/abseil-cpp/absl/synchronization/mutex.cc",
+                "third_party/abseil-cpp/absl/synchronization/notification.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/time/internal/cctz:civil_time
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time",
-    srcs: [
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/time/internal/cctz:time_zone
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone",
-    srcs: [
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc",
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc",
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc",
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc",
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc",
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc",
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc",
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc",
-        "third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc",
+                "third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/time:time
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_time_time",
-    srcs: [
-        "third_party/abseil-cpp/absl/time/civil_time.cc",
-        "third_party/abseil-cpp/absl/time/clock.cc",
-        "third_party/abseil-cpp/absl/time/duration.cc",
-        "third_party/abseil-cpp/absl/time/format.cc",
-        "third_party/abseil-cpp/absl/time/time.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/civil_time.cc",
+                "third_party/abseil-cpp/absl/time/clock.cc",
+                "third_party/abseil-cpp/absl/time/duration.cc",
+                "third_party/abseil-cpp/absl/time/format.cc",
+                "third_party/abseil-cpp/absl/time/time.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/civil_time.cc",
+                "third_party/abseil-cpp/absl/time/clock.cc",
+                "third_party/abseil-cpp/absl/time/duration.cc",
+                "third_party/abseil-cpp/absl/time/format.cc",
+                "third_party/abseil-cpp/absl/time/time.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/time/civil_time.cc",
+                "third_party/abseil-cpp/absl/time/clock.cc",
+                "third_party/abseil-cpp/absl/time/duration.cc",
+                "third_party/abseil-cpp/absl/time/format.cc",
+                "third_party/abseil-cpp/absl/time/time.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/types:bad_optional_access
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
-    srcs: [
-        "third_party/abseil-cpp/absl/types/bad_optional_access.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/types/bad_optional_access.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/types/bad_optional_access.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/types/bad_optional_access.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/types:bad_variant_access
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access",
-    srcs: [
-        "third_party/abseil-cpp/absl/types/bad_variant_access.cc",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/abseil-cpp/absl/types/bad_variant_access.cc",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/abseil-cpp/absl/types/bad_variant_access.cc",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/abseil-cpp/absl/types/bad_variant_access.cc",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/abseil-cpp/absl/types:compare
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_compare",
 }
 
 // GN: //third_party/abseil-cpp/absl/types:optional
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_optional",
 }
 
 // GN: //third_party/abseil-cpp/absl/types:span
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_span",
 }
 
 // GN: //third_party/abseil-cpp/absl/types:variant
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_variant",
 }
 
 // GN: //third_party/abseil-cpp/absl/utility:utility
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_abseil_cpp_absl_utility_utility",
 }
 
 // GN: //third_party/android_ndk:cpu_features
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_android_ndk_cpu_features",
-    srcs: [
-        "third_party/android_ndk/sources/android/cpufeatures/cpu-features.c",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/android_ndk/sources/android/cpufeatures/cpu-features.c",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/android_ndk/sources/android/cpufeatures/cpu-features.c",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/ashmem:ashmem
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_ashmem_ashmem",
-    srcs: [
-        "third_party/ashmem/ashmem-dev.c",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/ashmem/ashmem-dev.c",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/ashmem/ashmem-dev.c",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/boringssl:boringssl
 cc_library_static {
     name: "cronet_aml_third_party_boringssl_boringssl",
+    srcs: [
+        "third_party/boringssl/err_data.c",
+        "third_party/boringssl/src/crypto/asn1/a_bitstr.c",
+        "third_party/boringssl/src/crypto/asn1/a_bool.c",
+        "third_party/boringssl/src/crypto/asn1/a_d2i_fp.c",
+        "third_party/boringssl/src/crypto/asn1/a_dup.c",
+        "third_party/boringssl/src/crypto/asn1/a_gentm.c",
+        "third_party/boringssl/src/crypto/asn1/a_i2d_fp.c",
+        "third_party/boringssl/src/crypto/asn1/a_int.c",
+        "third_party/boringssl/src/crypto/asn1/a_mbstr.c",
+        "third_party/boringssl/src/crypto/asn1/a_object.c",
+        "third_party/boringssl/src/crypto/asn1/a_octet.c",
+        "third_party/boringssl/src/crypto/asn1/a_print.c",
+        "third_party/boringssl/src/crypto/asn1/a_strex.c",
+        "third_party/boringssl/src/crypto/asn1/a_strnid.c",
+        "third_party/boringssl/src/crypto/asn1/a_time.c",
+        "third_party/boringssl/src/crypto/asn1/a_type.c",
+        "third_party/boringssl/src/crypto/asn1/a_utctm.c",
+        "third_party/boringssl/src/crypto/asn1/a_utf8.c",
+        "third_party/boringssl/src/crypto/asn1/asn1_lib.c",
+        "third_party/boringssl/src/crypto/asn1/asn1_par.c",
+        "third_party/boringssl/src/crypto/asn1/asn_pack.c",
+        "third_party/boringssl/src/crypto/asn1/f_int.c",
+        "third_party/boringssl/src/crypto/asn1/f_string.c",
+        "third_party/boringssl/src/crypto/asn1/posix_time.c",
+        "third_party/boringssl/src/crypto/asn1/tasn_dec.c",
+        "third_party/boringssl/src/crypto/asn1/tasn_enc.c",
+        "third_party/boringssl/src/crypto/asn1/tasn_fre.c",
+        "third_party/boringssl/src/crypto/asn1/tasn_new.c",
+        "third_party/boringssl/src/crypto/asn1/tasn_typ.c",
+        "third_party/boringssl/src/crypto/asn1/tasn_utl.c",
+        "third_party/boringssl/src/crypto/base64/base64.c",
+        "third_party/boringssl/src/crypto/bio/bio.c",
+        "third_party/boringssl/src/crypto/bio/bio_mem.c",
+        "third_party/boringssl/src/crypto/bio/connect.c",
+        "third_party/boringssl/src/crypto/bio/fd.c",
+        "third_party/boringssl/src/crypto/bio/file.c",
+        "third_party/boringssl/src/crypto/bio/hexdump.c",
+        "third_party/boringssl/src/crypto/bio/pair.c",
+        "third_party/boringssl/src/crypto/bio/printf.c",
+        "third_party/boringssl/src/crypto/bio/socket.c",
+        "third_party/boringssl/src/crypto/bio/socket_helper.c",
+        "third_party/boringssl/src/crypto/blake2/blake2.c",
+        "third_party/boringssl/src/crypto/bn_extra/bn_asn1.c",
+        "third_party/boringssl/src/crypto/bn_extra/convert.c",
+        "third_party/boringssl/src/crypto/buf/buf.c",
+        "third_party/boringssl/src/crypto/bytestring/asn1_compat.c",
+        "third_party/boringssl/src/crypto/bytestring/ber.c",
+        "third_party/boringssl/src/crypto/bytestring/cbb.c",
+        "third_party/boringssl/src/crypto/bytestring/cbs.c",
+        "third_party/boringssl/src/crypto/bytestring/unicode.c",
+        "third_party/boringssl/src/crypto/chacha/chacha.c",
+        "third_party/boringssl/src/crypto/cipher_extra/cipher_extra.c",
+        "third_party/boringssl/src/crypto/cipher_extra/derive_key.c",
+        "third_party/boringssl/src/crypto/cipher_extra/e_aesctrhmac.c",
+        "third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c",
+        "third_party/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c",
+        "third_party/boringssl/src/crypto/cipher_extra/e_des.c",
+        "third_party/boringssl/src/crypto/cipher_extra/e_null.c",
+        "third_party/boringssl/src/crypto/cipher_extra/e_rc2.c",
+        "third_party/boringssl/src/crypto/cipher_extra/e_rc4.c",
+        "third_party/boringssl/src/crypto/cipher_extra/e_tls.c",
+        "third_party/boringssl/src/crypto/cipher_extra/tls_cbc.c",
+        "third_party/boringssl/src/crypto/conf/conf.c",
+        "third_party/boringssl/src/crypto/cpu_aarch64_apple.c",
+        "third_party/boringssl/src/crypto/cpu_aarch64_fuchsia.c",
+        "third_party/boringssl/src/crypto/cpu_aarch64_linux.c",
+        "third_party/boringssl/src/crypto/cpu_aarch64_win.c",
+        "third_party/boringssl/src/crypto/cpu_arm.c",
+        "third_party/boringssl/src/crypto/cpu_arm_linux.c",
+        "third_party/boringssl/src/crypto/cpu_intel.c",
+        "third_party/boringssl/src/crypto/cpu_ppc64le.c",
+        "third_party/boringssl/src/crypto/crypto.c",
+        "third_party/boringssl/src/crypto/curve25519/curve25519.c",
+        "third_party/boringssl/src/crypto/curve25519/spake25519.c",
+        "third_party/boringssl/src/crypto/des/des.c",
+        "third_party/boringssl/src/crypto/dh_extra/dh_asn1.c",
+        "third_party/boringssl/src/crypto/dh_extra/params.c",
+        "third_party/boringssl/src/crypto/digest_extra/digest_extra.c",
+        "third_party/boringssl/src/crypto/dsa/dsa.c",
+        "third_party/boringssl/src/crypto/dsa/dsa_asn1.c",
+        "third_party/boringssl/src/crypto/ec_extra/ec_asn1.c",
+        "third_party/boringssl/src/crypto/ec_extra/ec_derive.c",
+        "third_party/boringssl/src/crypto/ec_extra/hash_to_curve.c",
+        "third_party/boringssl/src/crypto/ecdh_extra/ecdh_extra.c",
+        "third_party/boringssl/src/crypto/ecdsa_extra/ecdsa_asn1.c",
+        "third_party/boringssl/src/crypto/engine/engine.c",
+        "third_party/boringssl/src/crypto/err/err.c",
+        "third_party/boringssl/src/crypto/evp/evp.c",
+        "third_party/boringssl/src/crypto/evp/evp_asn1.c",
+        "third_party/boringssl/src/crypto/evp/evp_ctx.c",
+        "third_party/boringssl/src/crypto/evp/p_dsa_asn1.c",
+        "third_party/boringssl/src/crypto/evp/p_ec.c",
+        "third_party/boringssl/src/crypto/evp/p_ec_asn1.c",
+        "third_party/boringssl/src/crypto/evp/p_ed25519.c",
+        "third_party/boringssl/src/crypto/evp/p_ed25519_asn1.c",
+        "third_party/boringssl/src/crypto/evp/p_hkdf.c",
+        "third_party/boringssl/src/crypto/evp/p_rsa.c",
+        "third_party/boringssl/src/crypto/evp/p_rsa_asn1.c",
+        "third_party/boringssl/src/crypto/evp/p_x25519.c",
+        "third_party/boringssl/src/crypto/evp/p_x25519_asn1.c",
+        "third_party/boringssl/src/crypto/evp/pbkdf.c",
+        "third_party/boringssl/src/crypto/evp/print.c",
+        "third_party/boringssl/src/crypto/evp/scrypt.c",
+        "third_party/boringssl/src/crypto/evp/sign.c",
+        "third_party/boringssl/src/crypto/ex_data.c",
+        "third_party/boringssl/src/crypto/fipsmodule/bcm.c",
+        "third_party/boringssl/src/crypto/fipsmodule/fips_shared_support.c",
+        "third_party/boringssl/src/crypto/hkdf/hkdf.c",
+        "third_party/boringssl/src/crypto/hpke/hpke.c",
+        "third_party/boringssl/src/crypto/hrss/hrss.c",
+        "third_party/boringssl/src/crypto/lhash/lhash.c",
+        "third_party/boringssl/src/crypto/mem.c",
+        "third_party/boringssl/src/crypto/obj/obj.c",
+        "third_party/boringssl/src/crypto/obj/obj_xref.c",
+        "third_party/boringssl/src/crypto/pem/pem_all.c",
+        "third_party/boringssl/src/crypto/pem/pem_info.c",
+        "third_party/boringssl/src/crypto/pem/pem_lib.c",
+        "third_party/boringssl/src/crypto/pem/pem_oth.c",
+        "third_party/boringssl/src/crypto/pem/pem_pk8.c",
+        "third_party/boringssl/src/crypto/pem/pem_pkey.c",
+        "third_party/boringssl/src/crypto/pem/pem_x509.c",
+        "third_party/boringssl/src/crypto/pem/pem_xaux.c",
+        "third_party/boringssl/src/crypto/pkcs7/pkcs7.c",
+        "third_party/boringssl/src/crypto/pkcs7/pkcs7_x509.c",
+        "third_party/boringssl/src/crypto/pkcs8/p5_pbev2.c",
+        "third_party/boringssl/src/crypto/pkcs8/pkcs8.c",
+        "third_party/boringssl/src/crypto/pkcs8/pkcs8_x509.c",
+        "third_party/boringssl/src/crypto/poly1305/poly1305.c",
+        "third_party/boringssl/src/crypto/poly1305/poly1305_arm.c",
+        "third_party/boringssl/src/crypto/poly1305/poly1305_vec.c",
+        "third_party/boringssl/src/crypto/pool/pool.c",
+        "third_party/boringssl/src/crypto/rand_extra/deterministic.c",
+        "third_party/boringssl/src/crypto/rand_extra/forkunsafe.c",
+        "third_party/boringssl/src/crypto/rand_extra/fuchsia.c",
+        "third_party/boringssl/src/crypto/rand_extra/passive.c",
+        "third_party/boringssl/src/crypto/rand_extra/rand_extra.c",
+        "third_party/boringssl/src/crypto/rand_extra/windows.c",
+        "third_party/boringssl/src/crypto/rc4/rc4.c",
+        "third_party/boringssl/src/crypto/refcount_c11.c",
+        "third_party/boringssl/src/crypto/refcount_lock.c",
+        "third_party/boringssl/src/crypto/rsa_extra/rsa_asn1.c",
+        "third_party/boringssl/src/crypto/rsa_extra/rsa_print.c",
+        "third_party/boringssl/src/crypto/siphash/siphash.c",
+        "third_party/boringssl/src/crypto/stack/stack.c",
+        "third_party/boringssl/src/crypto/thread.c",
+        "third_party/boringssl/src/crypto/thread_none.c",
+        "third_party/boringssl/src/crypto/thread_pthread.c",
+        "third_party/boringssl/src/crypto/thread_win.c",
+        "third_party/boringssl/src/crypto/trust_token/pmbtoken.c",
+        "third_party/boringssl/src/crypto/trust_token/trust_token.c",
+        "third_party/boringssl/src/crypto/trust_token/voprf.c",
+        "third_party/boringssl/src/crypto/x509/a_digest.c",
+        "third_party/boringssl/src/crypto/x509/a_sign.c",
+        "third_party/boringssl/src/crypto/x509/a_verify.c",
+        "third_party/boringssl/src/crypto/x509/algorithm.c",
+        "third_party/boringssl/src/crypto/x509/asn1_gen.c",
+        "third_party/boringssl/src/crypto/x509/by_dir.c",
+        "third_party/boringssl/src/crypto/x509/by_file.c",
+        "third_party/boringssl/src/crypto/x509/i2d_pr.c",
+        "third_party/boringssl/src/crypto/x509/name_print.c",
+        "third_party/boringssl/src/crypto/x509/rsa_pss.c",
+        "third_party/boringssl/src/crypto/x509/t_crl.c",
+        "third_party/boringssl/src/crypto/x509/t_req.c",
+        "third_party/boringssl/src/crypto/x509/t_x509.c",
+        "third_party/boringssl/src/crypto/x509/t_x509a.c",
+        "third_party/boringssl/src/crypto/x509/x509.c",
+        "third_party/boringssl/src/crypto/x509/x509_att.c",
+        "third_party/boringssl/src/crypto/x509/x509_cmp.c",
+        "third_party/boringssl/src/crypto/x509/x509_d2.c",
+        "third_party/boringssl/src/crypto/x509/x509_def.c",
+        "third_party/boringssl/src/crypto/x509/x509_ext.c",
+        "third_party/boringssl/src/crypto/x509/x509_lu.c",
+        "third_party/boringssl/src/crypto/x509/x509_obj.c",
+        "third_party/boringssl/src/crypto/x509/x509_req.c",
+        "third_party/boringssl/src/crypto/x509/x509_set.c",
+        "third_party/boringssl/src/crypto/x509/x509_trs.c",
+        "third_party/boringssl/src/crypto/x509/x509_txt.c",
+        "third_party/boringssl/src/crypto/x509/x509_v3.c",
+        "third_party/boringssl/src/crypto/x509/x509_vfy.c",
+        "third_party/boringssl/src/crypto/x509/x509_vpm.c",
+        "third_party/boringssl/src/crypto/x509/x509cset.c",
+        "third_party/boringssl/src/crypto/x509/x509name.c",
+        "third_party/boringssl/src/crypto/x509/x509rset.c",
+        "third_party/boringssl/src/crypto/x509/x509spki.c",
+        "third_party/boringssl/src/crypto/x509/x_algor.c",
+        "third_party/boringssl/src/crypto/x509/x_all.c",
+        "third_party/boringssl/src/crypto/x509/x_attrib.c",
+        "third_party/boringssl/src/crypto/x509/x_crl.c",
+        "third_party/boringssl/src/crypto/x509/x_exten.c",
+        "third_party/boringssl/src/crypto/x509/x_info.c",
+        "third_party/boringssl/src/crypto/x509/x_name.c",
+        "third_party/boringssl/src/crypto/x509/x_pkey.c",
+        "third_party/boringssl/src/crypto/x509/x_pubkey.c",
+        "third_party/boringssl/src/crypto/x509/x_req.c",
+        "third_party/boringssl/src/crypto/x509/x_sig.c",
+        "third_party/boringssl/src/crypto/x509/x_spki.c",
+        "third_party/boringssl/src/crypto/x509/x_val.c",
+        "third_party/boringssl/src/crypto/x509/x_x509.c",
+        "third_party/boringssl/src/crypto/x509/x_x509a.c",
+        "third_party/boringssl/src/crypto/x509v3/pcy_cache.c",
+        "third_party/boringssl/src/crypto/x509v3/pcy_data.c",
+        "third_party/boringssl/src/crypto/x509v3/pcy_map.c",
+        "third_party/boringssl/src/crypto/x509v3/pcy_node.c",
+        "third_party/boringssl/src/crypto/x509v3/pcy_tree.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_akey.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_akeya.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_alt.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_bcons.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_bitst.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_conf.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_cpols.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_crld.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_enum.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_extku.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_genn.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_ia5.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_info.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_int.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_lib.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_ncons.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_ocsp.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_pci.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_pcia.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_pcons.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_pmaps.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_prn.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_purp.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_skey.c",
+        "third_party/boringssl/src/crypto/x509v3/v3_utl.c",
+        "third_party/boringssl/src/ssl/bio_ssl.cc",
+        "third_party/boringssl/src/ssl/d1_both.cc",
+        "third_party/boringssl/src/ssl/d1_lib.cc",
+        "third_party/boringssl/src/ssl/d1_pkt.cc",
+        "third_party/boringssl/src/ssl/d1_srtp.cc",
+        "third_party/boringssl/src/ssl/dtls_method.cc",
+        "third_party/boringssl/src/ssl/dtls_record.cc",
+        "third_party/boringssl/src/ssl/encrypted_client_hello.cc",
+        "third_party/boringssl/src/ssl/extensions.cc",
+        "third_party/boringssl/src/ssl/handoff.cc",
+        "third_party/boringssl/src/ssl/handshake.cc",
+        "third_party/boringssl/src/ssl/handshake_client.cc",
+        "third_party/boringssl/src/ssl/handshake_server.cc",
+        "third_party/boringssl/src/ssl/s3_both.cc",
+        "third_party/boringssl/src/ssl/s3_lib.cc",
+        "third_party/boringssl/src/ssl/s3_pkt.cc",
+        "third_party/boringssl/src/ssl/ssl_aead_ctx.cc",
+        "third_party/boringssl/src/ssl/ssl_asn1.cc",
+        "third_party/boringssl/src/ssl/ssl_buffer.cc",
+        "third_party/boringssl/src/ssl/ssl_cert.cc",
+        "third_party/boringssl/src/ssl/ssl_cipher.cc",
+        "third_party/boringssl/src/ssl/ssl_file.cc",
+        "third_party/boringssl/src/ssl/ssl_key_share.cc",
+        "third_party/boringssl/src/ssl/ssl_lib.cc",
+        "third_party/boringssl/src/ssl/ssl_privkey.cc",
+        "third_party/boringssl/src/ssl/ssl_session.cc",
+        "third_party/boringssl/src/ssl/ssl_stat.cc",
+        "third_party/boringssl/src/ssl/ssl_transcript.cc",
+        "third_party/boringssl/src/ssl/ssl_versions.cc",
+        "third_party/boringssl/src/ssl/ssl_x509.cc",
+        "third_party/boringssl/src/ssl/t1_enc.cc",
+        "third_party/boringssl/src/ssl/tls13_both.cc",
+        "third_party/boringssl/src/ssl/tls13_client.cc",
+        "third_party/boringssl/src/ssl/tls13_enc.cc",
+        "third_party/boringssl/src/ssl/tls13_server.cc",
+        "third_party/boringssl/src/ssl/tls_method.cc",
+        "third_party/boringssl/src/ssl/tls_record.cc",
+    ],
+    host_supported: true,
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_third_party_boringssl_boringssl_asm",
+        "cronet_aml_third_party_boringssl_src_third_party_fiat_fiat_license",
     ],
     cflags: [
-        "-DANDROID",
-        "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DBORINGSSL_ALLOW_CXX_RUNTIME",
         "-DBORINGSSL_IMPLEMENTATION",
         "-DBORINGSSL_NO_STATIC_INITIALIZER",
@@ -5240,7 +7474,6 @@
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
-        "-DHAVE_SYS_UIO_H",
         "-DOPENSSL_SMALL",
         "-D_DEBUG",
         "-D_GNU_SOURCE",
@@ -5257,606 +7490,111 @@
         "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",
     ],
     cpp_std: "c++20",
-    arch: {
-        x86: {
-            srcs: [
-                ":cronet_aml_third_party_boringssl_boringssl_asm_x86",
-                ":cronet_aml_third_party_boringssl_src_third_party_fiat_fiat_license",
-                "third_party/boringssl/err_data.c",
-                "third_party/boringssl/src/crypto/asn1/a_bitstr.c",
-                "third_party/boringssl/src/crypto/asn1/a_bool.c",
-                "third_party/boringssl/src/crypto/asn1/a_d2i_fp.c",
-                "third_party/boringssl/src/crypto/asn1/a_dup.c",
-                "third_party/boringssl/src/crypto/asn1/a_gentm.c",
-                "third_party/boringssl/src/crypto/asn1/a_i2d_fp.c",
-                "third_party/boringssl/src/crypto/asn1/a_int.c",
-                "third_party/boringssl/src/crypto/asn1/a_mbstr.c",
-                "third_party/boringssl/src/crypto/asn1/a_object.c",
-                "third_party/boringssl/src/crypto/asn1/a_octet.c",
-                "third_party/boringssl/src/crypto/asn1/a_print.c",
-                "third_party/boringssl/src/crypto/asn1/a_strex.c",
-                "third_party/boringssl/src/crypto/asn1/a_strnid.c",
-                "third_party/boringssl/src/crypto/asn1/a_time.c",
-                "third_party/boringssl/src/crypto/asn1/a_type.c",
-                "third_party/boringssl/src/crypto/asn1/a_utctm.c",
-                "third_party/boringssl/src/crypto/asn1/a_utf8.c",
-                "third_party/boringssl/src/crypto/asn1/asn1_lib.c",
-                "third_party/boringssl/src/crypto/asn1/asn1_par.c",
-                "third_party/boringssl/src/crypto/asn1/asn_pack.c",
-                "third_party/boringssl/src/crypto/asn1/f_int.c",
-                "third_party/boringssl/src/crypto/asn1/f_string.c",
-                "third_party/boringssl/src/crypto/asn1/posix_time.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_dec.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_enc.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_fre.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_new.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_typ.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_utl.c",
-                "third_party/boringssl/src/crypto/base64/base64.c",
-                "third_party/boringssl/src/crypto/bio/bio.c",
-                "third_party/boringssl/src/crypto/bio/bio_mem.c",
-                "third_party/boringssl/src/crypto/bio/connect.c",
-                "third_party/boringssl/src/crypto/bio/fd.c",
-                "third_party/boringssl/src/crypto/bio/file.c",
-                "third_party/boringssl/src/crypto/bio/hexdump.c",
-                "third_party/boringssl/src/crypto/bio/pair.c",
-                "third_party/boringssl/src/crypto/bio/printf.c",
-                "third_party/boringssl/src/crypto/bio/socket.c",
-                "third_party/boringssl/src/crypto/bio/socket_helper.c",
-                "third_party/boringssl/src/crypto/blake2/blake2.c",
-                "third_party/boringssl/src/crypto/bn_extra/bn_asn1.c",
-                "third_party/boringssl/src/crypto/bn_extra/convert.c",
-                "third_party/boringssl/src/crypto/buf/buf.c",
-                "third_party/boringssl/src/crypto/bytestring/asn1_compat.c",
-                "third_party/boringssl/src/crypto/bytestring/ber.c",
-                "third_party/boringssl/src/crypto/bytestring/cbb.c",
-                "third_party/boringssl/src/crypto/bytestring/cbs.c",
-                "third_party/boringssl/src/crypto/bytestring/unicode.c",
-                "third_party/boringssl/src/crypto/chacha/chacha.c",
-                "third_party/boringssl/src/crypto/cipher_extra/cipher_extra.c",
-                "third_party/boringssl/src/crypto/cipher_extra/derive_key.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_aesctrhmac.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_des.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_null.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_rc2.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_rc4.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_tls.c",
-                "third_party/boringssl/src/crypto/cipher_extra/tls_cbc.c",
-                "third_party/boringssl/src/crypto/conf/conf.c",
-                "third_party/boringssl/src/crypto/cpu_aarch64_apple.c",
-                "third_party/boringssl/src/crypto/cpu_aarch64_fuchsia.c",
-                "third_party/boringssl/src/crypto/cpu_aarch64_linux.c",
-                "third_party/boringssl/src/crypto/cpu_aarch64_win.c",
-                "third_party/boringssl/src/crypto/cpu_arm.c",
-                "third_party/boringssl/src/crypto/cpu_arm_linux.c",
-                "third_party/boringssl/src/crypto/cpu_intel.c",
-                "third_party/boringssl/src/crypto/cpu_ppc64le.c",
-                "third_party/boringssl/src/crypto/crypto.c",
-                "third_party/boringssl/src/crypto/curve25519/curve25519.c",
-                "third_party/boringssl/src/crypto/curve25519/spake25519.c",
-                "third_party/boringssl/src/crypto/des/des.c",
-                "third_party/boringssl/src/crypto/dh_extra/dh_asn1.c",
-                "third_party/boringssl/src/crypto/dh_extra/params.c",
-                "third_party/boringssl/src/crypto/digest_extra/digest_extra.c",
-                "third_party/boringssl/src/crypto/dsa/dsa.c",
-                "third_party/boringssl/src/crypto/dsa/dsa_asn1.c",
-                "third_party/boringssl/src/crypto/ec_extra/ec_asn1.c",
-                "third_party/boringssl/src/crypto/ec_extra/ec_derive.c",
-                "third_party/boringssl/src/crypto/ec_extra/hash_to_curve.c",
-                "third_party/boringssl/src/crypto/ecdh_extra/ecdh_extra.c",
-                "third_party/boringssl/src/crypto/ecdsa_extra/ecdsa_asn1.c",
-                "third_party/boringssl/src/crypto/engine/engine.c",
-                "third_party/boringssl/src/crypto/err/err.c",
-                "third_party/boringssl/src/crypto/evp/evp.c",
-                "third_party/boringssl/src/crypto/evp/evp_asn1.c",
-                "third_party/boringssl/src/crypto/evp/evp_ctx.c",
-                "third_party/boringssl/src/crypto/evp/p_dsa_asn1.c",
-                "third_party/boringssl/src/crypto/evp/p_ec.c",
-                "third_party/boringssl/src/crypto/evp/p_ec_asn1.c",
-                "third_party/boringssl/src/crypto/evp/p_ed25519.c",
-                "third_party/boringssl/src/crypto/evp/p_ed25519_asn1.c",
-                "third_party/boringssl/src/crypto/evp/p_hkdf.c",
-                "third_party/boringssl/src/crypto/evp/p_rsa.c",
-                "third_party/boringssl/src/crypto/evp/p_rsa_asn1.c",
-                "third_party/boringssl/src/crypto/evp/p_x25519.c",
-                "third_party/boringssl/src/crypto/evp/p_x25519_asn1.c",
-                "third_party/boringssl/src/crypto/evp/pbkdf.c",
-                "third_party/boringssl/src/crypto/evp/print.c",
-                "third_party/boringssl/src/crypto/evp/scrypt.c",
-                "third_party/boringssl/src/crypto/evp/sign.c",
-                "third_party/boringssl/src/crypto/ex_data.c",
-                "third_party/boringssl/src/crypto/fipsmodule/bcm.c",
-                "third_party/boringssl/src/crypto/fipsmodule/fips_shared_support.c",
-                "third_party/boringssl/src/crypto/hkdf/hkdf.c",
-                "third_party/boringssl/src/crypto/hpke/hpke.c",
-                "third_party/boringssl/src/crypto/hrss/hrss.c",
-                "third_party/boringssl/src/crypto/lhash/lhash.c",
-                "third_party/boringssl/src/crypto/mem.c",
-                "third_party/boringssl/src/crypto/obj/obj.c",
-                "third_party/boringssl/src/crypto/obj/obj_xref.c",
-                "third_party/boringssl/src/crypto/pem/pem_all.c",
-                "third_party/boringssl/src/crypto/pem/pem_info.c",
-                "third_party/boringssl/src/crypto/pem/pem_lib.c",
-                "third_party/boringssl/src/crypto/pem/pem_oth.c",
-                "third_party/boringssl/src/crypto/pem/pem_pk8.c",
-                "third_party/boringssl/src/crypto/pem/pem_pkey.c",
-                "third_party/boringssl/src/crypto/pem/pem_x509.c",
-                "third_party/boringssl/src/crypto/pem/pem_xaux.c",
-                "third_party/boringssl/src/crypto/pkcs7/pkcs7.c",
-                "third_party/boringssl/src/crypto/pkcs7/pkcs7_x509.c",
-                "third_party/boringssl/src/crypto/pkcs8/p5_pbev2.c",
-                "third_party/boringssl/src/crypto/pkcs8/pkcs8.c",
-                "third_party/boringssl/src/crypto/pkcs8/pkcs8_x509.c",
-                "third_party/boringssl/src/crypto/poly1305/poly1305.c",
-                "third_party/boringssl/src/crypto/poly1305/poly1305_arm.c",
-                "third_party/boringssl/src/crypto/poly1305/poly1305_vec.c",
-                "third_party/boringssl/src/crypto/pool/pool.c",
-                "third_party/boringssl/src/crypto/rand_extra/deterministic.c",
-                "third_party/boringssl/src/crypto/rand_extra/forkunsafe.c",
-                "third_party/boringssl/src/crypto/rand_extra/fuchsia.c",
-                "third_party/boringssl/src/crypto/rand_extra/passive.c",
-                "third_party/boringssl/src/crypto/rand_extra/rand_extra.c",
-                "third_party/boringssl/src/crypto/rand_extra/windows.c",
-                "third_party/boringssl/src/crypto/rc4/rc4.c",
-                "third_party/boringssl/src/crypto/refcount_c11.c",
-                "third_party/boringssl/src/crypto/refcount_lock.c",
-                "third_party/boringssl/src/crypto/rsa_extra/rsa_asn1.c",
-                "third_party/boringssl/src/crypto/rsa_extra/rsa_print.c",
-                "third_party/boringssl/src/crypto/siphash/siphash.c",
-                "third_party/boringssl/src/crypto/stack/stack.c",
-                "third_party/boringssl/src/crypto/thread.c",
-                "third_party/boringssl/src/crypto/thread_none.c",
-                "third_party/boringssl/src/crypto/thread_pthread.c",
-                "third_party/boringssl/src/crypto/thread_win.c",
-                "third_party/boringssl/src/crypto/trust_token/pmbtoken.c",
-                "third_party/boringssl/src/crypto/trust_token/trust_token.c",
-                "third_party/boringssl/src/crypto/trust_token/voprf.c",
-                "third_party/boringssl/src/crypto/x509/a_digest.c",
-                "third_party/boringssl/src/crypto/x509/a_sign.c",
-                "third_party/boringssl/src/crypto/x509/a_verify.c",
-                "third_party/boringssl/src/crypto/x509/algorithm.c",
-                "third_party/boringssl/src/crypto/x509/asn1_gen.c",
-                "third_party/boringssl/src/crypto/x509/by_dir.c",
-                "third_party/boringssl/src/crypto/x509/by_file.c",
-                "third_party/boringssl/src/crypto/x509/i2d_pr.c",
-                "third_party/boringssl/src/crypto/x509/name_print.c",
-                "third_party/boringssl/src/crypto/x509/rsa_pss.c",
-                "third_party/boringssl/src/crypto/x509/t_crl.c",
-                "third_party/boringssl/src/crypto/x509/t_req.c",
-                "third_party/boringssl/src/crypto/x509/t_x509.c",
-                "third_party/boringssl/src/crypto/x509/t_x509a.c",
-                "third_party/boringssl/src/crypto/x509/x509.c",
-                "third_party/boringssl/src/crypto/x509/x509_att.c",
-                "third_party/boringssl/src/crypto/x509/x509_cmp.c",
-                "third_party/boringssl/src/crypto/x509/x509_d2.c",
-                "third_party/boringssl/src/crypto/x509/x509_def.c",
-                "third_party/boringssl/src/crypto/x509/x509_ext.c",
-                "third_party/boringssl/src/crypto/x509/x509_lu.c",
-                "third_party/boringssl/src/crypto/x509/x509_obj.c",
-                "third_party/boringssl/src/crypto/x509/x509_req.c",
-                "third_party/boringssl/src/crypto/x509/x509_set.c",
-                "third_party/boringssl/src/crypto/x509/x509_trs.c",
-                "third_party/boringssl/src/crypto/x509/x509_txt.c",
-                "third_party/boringssl/src/crypto/x509/x509_v3.c",
-                "third_party/boringssl/src/crypto/x509/x509_vfy.c",
-                "third_party/boringssl/src/crypto/x509/x509_vpm.c",
-                "third_party/boringssl/src/crypto/x509/x509cset.c",
-                "third_party/boringssl/src/crypto/x509/x509name.c",
-                "third_party/boringssl/src/crypto/x509/x509rset.c",
-                "third_party/boringssl/src/crypto/x509/x509spki.c",
-                "third_party/boringssl/src/crypto/x509/x_algor.c",
-                "third_party/boringssl/src/crypto/x509/x_all.c",
-                "third_party/boringssl/src/crypto/x509/x_attrib.c",
-                "third_party/boringssl/src/crypto/x509/x_crl.c",
-                "third_party/boringssl/src/crypto/x509/x_exten.c",
-                "third_party/boringssl/src/crypto/x509/x_info.c",
-                "third_party/boringssl/src/crypto/x509/x_name.c",
-                "third_party/boringssl/src/crypto/x509/x_pkey.c",
-                "third_party/boringssl/src/crypto/x509/x_pubkey.c",
-                "third_party/boringssl/src/crypto/x509/x_req.c",
-                "third_party/boringssl/src/crypto/x509/x_sig.c",
-                "third_party/boringssl/src/crypto/x509/x_spki.c",
-                "third_party/boringssl/src/crypto/x509/x_val.c",
-                "third_party/boringssl/src/crypto/x509/x_x509.c",
-                "third_party/boringssl/src/crypto/x509/x_x509a.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_cache.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_data.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_map.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_node.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_tree.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_akey.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_akeya.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_alt.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_bcons.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_bitst.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_conf.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_cpols.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_crld.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_enum.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_extku.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_genn.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_ia5.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_info.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_int.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_lib.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_ncons.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_ocsp.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_pci.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_pcia.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_pcons.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_pmaps.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_prn.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_purp.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_skey.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_utl.c",
-                "third_party/boringssl/src/ssl/bio_ssl.cc",
-                "third_party/boringssl/src/ssl/d1_both.cc",
-                "third_party/boringssl/src/ssl/d1_lib.cc",
-                "third_party/boringssl/src/ssl/d1_pkt.cc",
-                "third_party/boringssl/src/ssl/d1_srtp.cc",
-                "third_party/boringssl/src/ssl/dtls_method.cc",
-                "third_party/boringssl/src/ssl/dtls_record.cc",
-                "third_party/boringssl/src/ssl/encrypted_client_hello.cc",
-                "third_party/boringssl/src/ssl/extensions.cc",
-                "third_party/boringssl/src/ssl/handoff.cc",
-                "third_party/boringssl/src/ssl/handshake.cc",
-                "third_party/boringssl/src/ssl/handshake_client.cc",
-                "third_party/boringssl/src/ssl/handshake_server.cc",
-                "third_party/boringssl/src/ssl/s3_both.cc",
-                "third_party/boringssl/src/ssl/s3_lib.cc",
-                "third_party/boringssl/src/ssl/s3_pkt.cc",
-                "third_party/boringssl/src/ssl/ssl_aead_ctx.cc",
-                "third_party/boringssl/src/ssl/ssl_asn1.cc",
-                "third_party/boringssl/src/ssl/ssl_buffer.cc",
-                "third_party/boringssl/src/ssl/ssl_cert.cc",
-                "third_party/boringssl/src/ssl/ssl_cipher.cc",
-                "third_party/boringssl/src/ssl/ssl_file.cc",
-                "third_party/boringssl/src/ssl/ssl_key_share.cc",
-                "third_party/boringssl/src/ssl/ssl_lib.cc",
-                "third_party/boringssl/src/ssl/ssl_privkey.cc",
-                "third_party/boringssl/src/ssl/ssl_session.cc",
-                "third_party/boringssl/src/ssl/ssl_stat.cc",
-                "third_party/boringssl/src/ssl/ssl_transcript.cc",
-                "third_party/boringssl/src/ssl/ssl_versions.cc",
-                "third_party/boringssl/src/ssl/ssl_x509.cc",
-                "third_party/boringssl/src/ssl/t1_enc.cc",
-                "third_party/boringssl/src/ssl/tls13_both.cc",
-                "third_party/boringssl/src/ssl/tls13_client.cc",
-                "third_party/boringssl/src/ssl/tls13_enc.cc",
-                "third_party/boringssl/src/ssl/tls13_server.cc",
-                "third_party/boringssl/src/ssl/tls_method.cc",
-                "third_party/boringssl/src/ssl/tls_record.cc",
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
             ],
         },
-        x86_64: {
-            srcs: [
-                ":cronet_aml_third_party_boringssl_boringssl_asm",
-                ":cronet_aml_third_party_boringssl_src_third_party_fiat_fiat_license",
-                "third_party/boringssl/err_data.c",
-                "third_party/boringssl/src/crypto/asn1/a_bitstr.c",
-                "third_party/boringssl/src/crypto/asn1/a_bool.c",
-                "third_party/boringssl/src/crypto/asn1/a_d2i_fp.c",
-                "third_party/boringssl/src/crypto/asn1/a_dup.c",
-                "third_party/boringssl/src/crypto/asn1/a_gentm.c",
-                "third_party/boringssl/src/crypto/asn1/a_i2d_fp.c",
-                "third_party/boringssl/src/crypto/asn1/a_int.c",
-                "third_party/boringssl/src/crypto/asn1/a_mbstr.c",
-                "third_party/boringssl/src/crypto/asn1/a_object.c",
-                "third_party/boringssl/src/crypto/asn1/a_octet.c",
-                "third_party/boringssl/src/crypto/asn1/a_print.c",
-                "third_party/boringssl/src/crypto/asn1/a_strex.c",
-                "third_party/boringssl/src/crypto/asn1/a_strnid.c",
-                "third_party/boringssl/src/crypto/asn1/a_time.c",
-                "third_party/boringssl/src/crypto/asn1/a_type.c",
-                "third_party/boringssl/src/crypto/asn1/a_utctm.c",
-                "third_party/boringssl/src/crypto/asn1/a_utf8.c",
-                "third_party/boringssl/src/crypto/asn1/asn1_lib.c",
-                "third_party/boringssl/src/crypto/asn1/asn1_par.c",
-                "third_party/boringssl/src/crypto/asn1/asn_pack.c",
-                "third_party/boringssl/src/crypto/asn1/f_int.c",
-                "third_party/boringssl/src/crypto/asn1/f_string.c",
-                "third_party/boringssl/src/crypto/asn1/posix_time.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_dec.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_enc.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_fre.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_new.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_typ.c",
-                "third_party/boringssl/src/crypto/asn1/tasn_utl.c",
-                "third_party/boringssl/src/crypto/base64/base64.c",
-                "third_party/boringssl/src/crypto/bio/bio.c",
-                "third_party/boringssl/src/crypto/bio/bio_mem.c",
-                "third_party/boringssl/src/crypto/bio/connect.c",
-                "third_party/boringssl/src/crypto/bio/fd.c",
-                "third_party/boringssl/src/crypto/bio/file.c",
-                "third_party/boringssl/src/crypto/bio/hexdump.c",
-                "third_party/boringssl/src/crypto/bio/pair.c",
-                "third_party/boringssl/src/crypto/bio/printf.c",
-                "third_party/boringssl/src/crypto/bio/socket.c",
-                "third_party/boringssl/src/crypto/bio/socket_helper.c",
-                "third_party/boringssl/src/crypto/blake2/blake2.c",
-                "third_party/boringssl/src/crypto/bn_extra/bn_asn1.c",
-                "third_party/boringssl/src/crypto/bn_extra/convert.c",
-                "third_party/boringssl/src/crypto/buf/buf.c",
-                "third_party/boringssl/src/crypto/bytestring/asn1_compat.c",
-                "third_party/boringssl/src/crypto/bytestring/ber.c",
-                "third_party/boringssl/src/crypto/bytestring/cbb.c",
-                "third_party/boringssl/src/crypto/bytestring/cbs.c",
-                "third_party/boringssl/src/crypto/bytestring/unicode.c",
-                "third_party/boringssl/src/crypto/chacha/chacha.c",
-                "third_party/boringssl/src/crypto/cipher_extra/cipher_extra.c",
-                "third_party/boringssl/src/crypto/cipher_extra/derive_key.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_aesctrhmac.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_des.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_null.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_rc2.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_rc4.c",
-                "third_party/boringssl/src/crypto/cipher_extra/e_tls.c",
-                "third_party/boringssl/src/crypto/cipher_extra/tls_cbc.c",
-                "third_party/boringssl/src/crypto/conf/conf.c",
-                "third_party/boringssl/src/crypto/cpu_aarch64_apple.c",
-                "third_party/boringssl/src/crypto/cpu_aarch64_fuchsia.c",
-                "third_party/boringssl/src/crypto/cpu_aarch64_linux.c",
-                "third_party/boringssl/src/crypto/cpu_aarch64_win.c",
-                "third_party/boringssl/src/crypto/cpu_arm.c",
-                "third_party/boringssl/src/crypto/cpu_arm_linux.c",
-                "third_party/boringssl/src/crypto/cpu_intel.c",
-                "third_party/boringssl/src/crypto/cpu_ppc64le.c",
-                "third_party/boringssl/src/crypto/crypto.c",
-                "third_party/boringssl/src/crypto/curve25519/curve25519.c",
-                "third_party/boringssl/src/crypto/curve25519/spake25519.c",
-                "third_party/boringssl/src/crypto/des/des.c",
-                "third_party/boringssl/src/crypto/dh_extra/dh_asn1.c",
-                "third_party/boringssl/src/crypto/dh_extra/params.c",
-                "third_party/boringssl/src/crypto/digest_extra/digest_extra.c",
-                "third_party/boringssl/src/crypto/dsa/dsa.c",
-                "third_party/boringssl/src/crypto/dsa/dsa_asn1.c",
-                "third_party/boringssl/src/crypto/ec_extra/ec_asn1.c",
-                "third_party/boringssl/src/crypto/ec_extra/ec_derive.c",
-                "third_party/boringssl/src/crypto/ec_extra/hash_to_curve.c",
-                "third_party/boringssl/src/crypto/ecdh_extra/ecdh_extra.c",
-                "third_party/boringssl/src/crypto/ecdsa_extra/ecdsa_asn1.c",
-                "third_party/boringssl/src/crypto/engine/engine.c",
-                "third_party/boringssl/src/crypto/err/err.c",
-                "third_party/boringssl/src/crypto/evp/evp.c",
-                "third_party/boringssl/src/crypto/evp/evp_asn1.c",
-                "third_party/boringssl/src/crypto/evp/evp_ctx.c",
-                "third_party/boringssl/src/crypto/evp/p_dsa_asn1.c",
-                "third_party/boringssl/src/crypto/evp/p_ec.c",
-                "third_party/boringssl/src/crypto/evp/p_ec_asn1.c",
-                "third_party/boringssl/src/crypto/evp/p_ed25519.c",
-                "third_party/boringssl/src/crypto/evp/p_ed25519_asn1.c",
-                "third_party/boringssl/src/crypto/evp/p_hkdf.c",
-                "third_party/boringssl/src/crypto/evp/p_rsa.c",
-                "third_party/boringssl/src/crypto/evp/p_rsa_asn1.c",
-                "third_party/boringssl/src/crypto/evp/p_x25519.c",
-                "third_party/boringssl/src/crypto/evp/p_x25519_asn1.c",
-                "third_party/boringssl/src/crypto/evp/pbkdf.c",
-                "third_party/boringssl/src/crypto/evp/print.c",
-                "third_party/boringssl/src/crypto/evp/scrypt.c",
-                "third_party/boringssl/src/crypto/evp/sign.c",
-                "third_party/boringssl/src/crypto/ex_data.c",
-                "third_party/boringssl/src/crypto/fipsmodule/bcm.c",
-                "third_party/boringssl/src/crypto/fipsmodule/fips_shared_support.c",
-                "third_party/boringssl/src/crypto/hkdf/hkdf.c",
-                "third_party/boringssl/src/crypto/hpke/hpke.c",
-                "third_party/boringssl/src/crypto/hrss/hrss.c",
-                "third_party/boringssl/src/crypto/lhash/lhash.c",
-                "third_party/boringssl/src/crypto/mem.c",
-                "third_party/boringssl/src/crypto/obj/obj.c",
-                "third_party/boringssl/src/crypto/obj/obj_xref.c",
-                "third_party/boringssl/src/crypto/pem/pem_all.c",
-                "third_party/boringssl/src/crypto/pem/pem_info.c",
-                "third_party/boringssl/src/crypto/pem/pem_lib.c",
-                "third_party/boringssl/src/crypto/pem/pem_oth.c",
-                "third_party/boringssl/src/crypto/pem/pem_pk8.c",
-                "third_party/boringssl/src/crypto/pem/pem_pkey.c",
-                "third_party/boringssl/src/crypto/pem/pem_x509.c",
-                "third_party/boringssl/src/crypto/pem/pem_xaux.c",
-                "third_party/boringssl/src/crypto/pkcs7/pkcs7.c",
-                "third_party/boringssl/src/crypto/pkcs7/pkcs7_x509.c",
-                "third_party/boringssl/src/crypto/pkcs8/p5_pbev2.c",
-                "third_party/boringssl/src/crypto/pkcs8/pkcs8.c",
-                "third_party/boringssl/src/crypto/pkcs8/pkcs8_x509.c",
-                "third_party/boringssl/src/crypto/poly1305/poly1305.c",
-                "third_party/boringssl/src/crypto/poly1305/poly1305_arm.c",
-                "third_party/boringssl/src/crypto/poly1305/poly1305_vec.c",
-                "third_party/boringssl/src/crypto/pool/pool.c",
-                "third_party/boringssl/src/crypto/rand_extra/deterministic.c",
-                "third_party/boringssl/src/crypto/rand_extra/forkunsafe.c",
-                "third_party/boringssl/src/crypto/rand_extra/fuchsia.c",
-                "third_party/boringssl/src/crypto/rand_extra/passive.c",
-                "third_party/boringssl/src/crypto/rand_extra/rand_extra.c",
-                "third_party/boringssl/src/crypto/rand_extra/windows.c",
-                "third_party/boringssl/src/crypto/rc4/rc4.c",
-                "third_party/boringssl/src/crypto/refcount_c11.c",
-                "third_party/boringssl/src/crypto/refcount_lock.c",
-                "third_party/boringssl/src/crypto/rsa_extra/rsa_asn1.c",
-                "third_party/boringssl/src/crypto/rsa_extra/rsa_print.c",
-                "third_party/boringssl/src/crypto/siphash/siphash.c",
-                "third_party/boringssl/src/crypto/stack/stack.c",
-                "third_party/boringssl/src/crypto/thread.c",
-                "third_party/boringssl/src/crypto/thread_none.c",
-                "third_party/boringssl/src/crypto/thread_pthread.c",
-                "third_party/boringssl/src/crypto/thread_win.c",
-                "third_party/boringssl/src/crypto/trust_token/pmbtoken.c",
-                "third_party/boringssl/src/crypto/trust_token/trust_token.c",
-                "third_party/boringssl/src/crypto/trust_token/voprf.c",
-                "third_party/boringssl/src/crypto/x509/a_digest.c",
-                "third_party/boringssl/src/crypto/x509/a_sign.c",
-                "third_party/boringssl/src/crypto/x509/a_verify.c",
-                "third_party/boringssl/src/crypto/x509/algorithm.c",
-                "third_party/boringssl/src/crypto/x509/asn1_gen.c",
-                "third_party/boringssl/src/crypto/x509/by_dir.c",
-                "third_party/boringssl/src/crypto/x509/by_file.c",
-                "third_party/boringssl/src/crypto/x509/i2d_pr.c",
-                "third_party/boringssl/src/crypto/x509/name_print.c",
-                "third_party/boringssl/src/crypto/x509/rsa_pss.c",
-                "third_party/boringssl/src/crypto/x509/t_crl.c",
-                "third_party/boringssl/src/crypto/x509/t_req.c",
-                "third_party/boringssl/src/crypto/x509/t_x509.c",
-                "third_party/boringssl/src/crypto/x509/t_x509a.c",
-                "third_party/boringssl/src/crypto/x509/x509.c",
-                "third_party/boringssl/src/crypto/x509/x509_att.c",
-                "third_party/boringssl/src/crypto/x509/x509_cmp.c",
-                "third_party/boringssl/src/crypto/x509/x509_d2.c",
-                "third_party/boringssl/src/crypto/x509/x509_def.c",
-                "third_party/boringssl/src/crypto/x509/x509_ext.c",
-                "third_party/boringssl/src/crypto/x509/x509_lu.c",
-                "third_party/boringssl/src/crypto/x509/x509_obj.c",
-                "third_party/boringssl/src/crypto/x509/x509_req.c",
-                "third_party/boringssl/src/crypto/x509/x509_set.c",
-                "third_party/boringssl/src/crypto/x509/x509_trs.c",
-                "third_party/boringssl/src/crypto/x509/x509_txt.c",
-                "third_party/boringssl/src/crypto/x509/x509_v3.c",
-                "third_party/boringssl/src/crypto/x509/x509_vfy.c",
-                "third_party/boringssl/src/crypto/x509/x509_vpm.c",
-                "third_party/boringssl/src/crypto/x509/x509cset.c",
-                "third_party/boringssl/src/crypto/x509/x509name.c",
-                "third_party/boringssl/src/crypto/x509/x509rset.c",
-                "third_party/boringssl/src/crypto/x509/x509spki.c",
-                "third_party/boringssl/src/crypto/x509/x_algor.c",
-                "third_party/boringssl/src/crypto/x509/x_all.c",
-                "third_party/boringssl/src/crypto/x509/x_attrib.c",
-                "third_party/boringssl/src/crypto/x509/x_crl.c",
-                "third_party/boringssl/src/crypto/x509/x_exten.c",
-                "third_party/boringssl/src/crypto/x509/x_info.c",
-                "third_party/boringssl/src/crypto/x509/x_name.c",
-                "third_party/boringssl/src/crypto/x509/x_pkey.c",
-                "third_party/boringssl/src/crypto/x509/x_pubkey.c",
-                "third_party/boringssl/src/crypto/x509/x_req.c",
-                "third_party/boringssl/src/crypto/x509/x_sig.c",
-                "third_party/boringssl/src/crypto/x509/x_spki.c",
-                "third_party/boringssl/src/crypto/x509/x_val.c",
-                "third_party/boringssl/src/crypto/x509/x_x509.c",
-                "third_party/boringssl/src/crypto/x509/x_x509a.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_cache.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_data.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_map.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_node.c",
-                "third_party/boringssl/src/crypto/x509v3/pcy_tree.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_akey.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_akeya.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_alt.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_bcons.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_bitst.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_conf.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_cpols.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_crld.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_enum.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_extku.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_genn.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_ia5.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_info.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_int.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_lib.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_ncons.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_ocsp.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_pci.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_pcia.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_pcons.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_pmaps.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_prn.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_purp.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_skey.c",
-                "third_party/boringssl/src/crypto/x509v3/v3_utl.c",
-                "third_party/boringssl/src/ssl/bio_ssl.cc",
-                "third_party/boringssl/src/ssl/d1_both.cc",
-                "third_party/boringssl/src/ssl/d1_lib.cc",
-                "third_party/boringssl/src/ssl/d1_pkt.cc",
-                "third_party/boringssl/src/ssl/d1_srtp.cc",
-                "third_party/boringssl/src/ssl/dtls_method.cc",
-                "third_party/boringssl/src/ssl/dtls_record.cc",
-                "third_party/boringssl/src/ssl/encrypted_client_hello.cc",
-                "third_party/boringssl/src/ssl/extensions.cc",
-                "third_party/boringssl/src/ssl/handoff.cc",
-                "third_party/boringssl/src/ssl/handshake.cc",
-                "third_party/boringssl/src/ssl/handshake_client.cc",
-                "third_party/boringssl/src/ssl/handshake_server.cc",
-                "third_party/boringssl/src/ssl/s3_both.cc",
-                "third_party/boringssl/src/ssl/s3_lib.cc",
-                "third_party/boringssl/src/ssl/s3_pkt.cc",
-                "third_party/boringssl/src/ssl/ssl_aead_ctx.cc",
-                "third_party/boringssl/src/ssl/ssl_asn1.cc",
-                "third_party/boringssl/src/ssl/ssl_buffer.cc",
-                "third_party/boringssl/src/ssl/ssl_cert.cc",
-                "third_party/boringssl/src/ssl/ssl_cipher.cc",
-                "third_party/boringssl/src/ssl/ssl_file.cc",
-                "third_party/boringssl/src/ssl/ssl_key_share.cc",
-                "third_party/boringssl/src/ssl/ssl_lib.cc",
-                "third_party/boringssl/src/ssl/ssl_privkey.cc",
-                "third_party/boringssl/src/ssl/ssl_session.cc",
-                "third_party/boringssl/src/ssl/ssl_stat.cc",
-                "third_party/boringssl/src/ssl/ssl_transcript.cc",
-                "third_party/boringssl/src/ssl/ssl_versions.cc",
-                "third_party/boringssl/src/ssl/ssl_x509.cc",
-                "third_party/boringssl/src/ssl/t1_enc.cc",
-                "third_party/boringssl/src/ssl/tls13_both.cc",
-                "third_party/boringssl/src/ssl/tls13_client.cc",
-                "third_party/boringssl/src/ssl/tls13_enc.cc",
-                "third_party/boringssl/src/ssl/tls13_server.cc",
-                "third_party/boringssl/src/ssl/tls_method.cc",
-                "third_party/boringssl/src/ssl/tls_record.cc",
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
             ],
         },
     },
 }
 
 // GN: //third_party/boringssl:boringssl_asm
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_boringssl_boringssl_asm",
-    srcs: [
-        "third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/md5-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/p256-x86_64-asm.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/rdrand-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/rsaz-avx2.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/vpaes-x86_64.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/x86_64-mont.S",
-        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/x86_64-mont5.S",
-        "third_party/boringssl/linux-x86_64/crypto/test/trampoline-x86_64.S",
-        "third_party/boringssl/src/crypto/hrss/asm/poly_rq_mul.S",
-    ],
-}
-
-// GN: //third_party/boringssl:boringssl_asm
-filegroup {
-    name: "cronet_aml_third_party_boringssl_boringssl_asm_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",
-    ],
+    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",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/md5-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/p256-x86_64-asm.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/rdrand-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/rsaz-avx2.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/vpaes-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/x86_64-mont.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/x86_64-mont5.S",
+                "third_party/boringssl/linux-x86_64/crypto/test/trampoline-x86_64.S",
+                "third_party/boringssl/src/crypto/hrss/asm/poly_rq_mul.S",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/md5-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/p256-x86_64-asm.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/rdrand-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/rsaz-avx2.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/vpaes-x86_64.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/x86_64-mont.S",
+                "third_party/boringssl/linux-x86_64/crypto/fipsmodule/x86_64-mont5.S",
+                "third_party/boringssl/linux-x86_64/crypto/test/trampoline-x86_64.S",
+                "third_party/boringssl/src/crypto/hrss/asm/poly_rq_mul.S",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/boringssl/src/third_party/fiat:fiat_license
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_boringssl_src_third_party_fiat_fiat_license",
 }
 
@@ -5864,7 +7602,6 @@
 cc_library_static {
     name: "cronet_aml_third_party_brotli_common",
     srcs: [
-        ":cronet_aml_third_party_brotli_headers",
         "third_party/brotli/common/constants.c",
         "third_party/brotli/common/context.c",
         "third_party/brotli/common/dictionary.c",
@@ -5874,6 +7611,7 @@
     ],
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_third_party_brotli_headers",
     ],
     cflags: [
         "-DANDROID",
@@ -5898,7 +7636,6 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/brotli/include/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
 }
@@ -5907,7 +7644,6 @@
 cc_library_static {
     name: "cronet_aml_third_party_brotli_dec",
     srcs: [
-        ":cronet_aml_third_party_brotli_headers",
         "third_party/brotli/dec/bit_reader.c",
         "third_party/brotli/dec/decode.c",
         "third_party/brotli/dec/huffman.c",
@@ -5918,6 +7654,7 @@
     ],
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_third_party_brotli_headers",
     ],
     cflags: [
         "-DANDROID",
@@ -5942,13 +7679,12 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/brotli/include/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
 }
 
 // GN: //third_party/brotli:headers
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_brotli_headers",
 }
 
@@ -6200,18 +7936,16 @@
     static_libs: [
         "cronet_aml_third_party_icu_icuuc_private",
     ],
+    host_supported: true,
     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",
         "-DHAVE_DLOPEN=0",
-        "-DHAVE_SYS_UIO_H",
         "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
         "-DUCONFIG_ONLY_HTML_CONVERSION=1",
         "-DUCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
@@ -6237,17 +7971,42 @@
         "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",
     ],
     cpp_std: "c++20",
     rtti: true,
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/icu:icuuc_private
 cc_library_static {
     name: "cronet_aml_third_party_icu_icuuc_private",
     srcs: [
-        ":cronet_aml_third_party_icu_icuuc_public",
         "third_party/icu/source/common/appendable.cpp",
         "third_party/icu/source/common/bmpset.cpp",
         "third_party/icu/source/common/brkeng.cpp",
@@ -6448,18 +8207,17 @@
         "third_party/icu/source/common/wintz.cpp",
         "third_party/icu/source/stubdata/stubdata.cpp",
     ],
+    host_supported: true,
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_third_party_icu_icuuc_public",
     ],
     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",
         "-DHAVE_DLOPEN=0",
-        "-DHAVE_SYS_UIO_H",
         "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
         "-DUCONFIG_ONLY_HTML_CONVERSION=1",
         "-DUCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
@@ -6488,14 +8246,40 @@
         "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",
     ],
     cpp_std: "c++20",
     rtti: true,
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/icu:icuuc_public
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_icu_icuuc_public",
 }
 
@@ -6518,18 +8302,16 @@
         "third_party/libevent/signal.c",
         "third_party/libevent/strlcpy.c",
     ],
+    host_supported: true,
     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",
         "-DHAVE_CONFIG_H",
-        "-DHAVE_SYS_UIO_H",
         "-D_DEBUG",
         "-D_GNU_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
@@ -6542,10 +8324,44 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/libevent/android/",
-        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+            local_include_dirs: [
+                "third_party/libevent/android/",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+            local_include_dirs: [
+                "third_party/libevent/android/",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+            local_include_dirs: [
+                "third_party/libevent/linux/",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/metrics_proto:metrics_proto
@@ -6581,9 +8397,9 @@
         "third_party/metrics_proto/user_demographics.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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",
@@ -6648,9 +8464,9 @@
         "third_party/metrics_proto/user_demographics.proto",
     ],
     tools: [
-        "aprotoc",
+        "cronet_aml_third_party_protobuf_protoc",
     ],
-    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) --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,17 +8509,15 @@
     srcs: [
         "third_party/modp_b64/modp_b64.cc",
     ],
+    host_supported: true,
     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",
-        "-DHAVE_SYS_UIO_H",
         "-D_DEBUG",
         "-D_GNU_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
@@ -6718,7 +8532,431 @@
         "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",
+    ],
+    cpp_std: "c++20",
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+        },
+    },
+}
+
+// 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",
+    ],
+    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/",
+    ],
+    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/",
+    ],
+    cpp_std: "c++20",
+}
+
+// GN: //third_party/protobuf:protoc
+cc_binary {
+    name: "cronet_aml_third_party_protobuf_protoc",
+    srcs: [
+        "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_buildtools_third_party_libc___libc__",
+        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
+        "cronet_aml_buildtools_third_party_libunwind_libunwind",
+        "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/",
+    ],
+    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",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "third_party/protobuf/src/",
     ],
     cpp_std: "c++20",
 }
@@ -6727,11 +8965,6 @@
 cc_library_static {
     name: "cronet_aml_third_party_zlib_zlib",
     srcs: [
-        ":cronet_aml_third_party_zlib_zlib_adler32_simd",
-        ":cronet_aml_third_party_zlib_zlib_common_headers",
-        ":cronet_aml_third_party_zlib_zlib_crc32_simd",
-        ":cronet_aml_third_party_zlib_zlib_inflate_chunk_simd",
-        ":cronet_aml_third_party_zlib_zlib_slide_hash_simd",
         "third_party/zlib/adler32.c",
         "third_party/zlib/compress.c",
         "third_party/zlib/cpu_features.c",
@@ -6748,37 +8981,38 @@
         "third_party/zlib/uncompr.c",
         "third_party/zlib/zutil.c",
     ],
+    host_supported: true,
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_third_party_android_ndk_cpu_features",
+        "cronet_aml_third_party_zlib_zlib_adler32_simd",
+        "cronet_aml_third_party_zlib_zlib_common_headers",
+        "cronet_aml_third_party_zlib_zlib_crc32_simd",
+        "cronet_aml_third_party_zlib_zlib_inflate_chunk_simd",
+        "cronet_aml_third_party_zlib_zlib_slide_hash_simd",
     ],
     cflags: [
         "-DADLER32_SIMD_SSSE3",
         "-DCRC32_SIMD_SSE42_PCLMUL",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
-        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDEFLATE_SLIDE_HASH_SSE2",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
-        "-DINFLATE_CHUNK_READ_64LE",
         "-DINFLATE_CHUNK_SIMD_SSE2",
-        "-DUSE_AURA=1",
-        "-DUSE_OZONE=1",
-        "-DUSE_UDEV",
         "-DX86_NOT_WINDOWS",
         "-DZLIB_DEBUG",
         "-DZLIB_IMPLEMENTATION",
         "-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",
         "-D__STDC_CONSTANT_MACROS",
         "-D__STDC_FORMAT_MACROS",
+        "-mpclmul",
+        "-mssse3",
     ],
     local_include_dirs: [
         "./",
@@ -6786,44 +9020,124 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/zlib/",
-        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
     ],
     cpp_std: "c++20",
+    target: {
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+            ],
+            local_include_dirs: [
+                "third_party/android_ndk/sources/android/cpufeatures/",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+                "-DINFLATE_CHUNK_READ_64LE",
+            ],
+            local_include_dirs: [
+                "third_party/android_ndk/sources/android/cpufeatures/",
+            ],
+        },
+        host: {
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DINFLATE_CHUNK_READ_64LE",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/zlib:zlib_adler32_simd
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_zlib_zlib_adler32_simd",
-    srcs: [
-        "third_party/zlib/adler32_simd.c",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/zlib/adler32_simd.c",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/zlib/adler32_simd.c",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/zlib/adler32_simd.c",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/zlib:zlib_common_headers
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_zlib_zlib_common_headers",
 }
 
 // GN: //third_party/zlib:zlib_crc32_simd
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_zlib_zlib_crc32_simd",
-    srcs: [
-        "third_party/zlib/crc32_simd.c",
-        "third_party/zlib/crc_folding.c",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/zlib/crc32_simd.c",
+                "third_party/zlib/crc_folding.c",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/zlib/crc32_simd.c",
+                "third_party/zlib/crc_folding.c",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/zlib/crc32_simd.c",
+                "third_party/zlib/crc_folding.c",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/zlib:zlib_inflate_chunk_simd
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_zlib_zlib_inflate_chunk_simd",
-    srcs: [
-        "third_party/zlib/contrib/optimizations/inffast_chunk.c",
-        "third_party/zlib/contrib/optimizations/inflate.c",
-    ],
+    target: {
+        android_x86: {
+            srcs: [
+                "third_party/zlib/contrib/optimizations/inffast_chunk.c",
+                "third_party/zlib/contrib/optimizations/inflate.c",
+            ],
+        },
+        android_x86_64: {
+            srcs: [
+                "third_party/zlib/contrib/optimizations/inffast_chunk.c",
+                "third_party/zlib/contrib/optimizations/inflate.c",
+            ],
+        },
+        host: {
+            srcs: [
+                "third_party/zlib/contrib/optimizations/inffast_chunk.c",
+                "third_party/zlib/contrib/optimizations/inflate.c",
+            ],
+        },
+    },
 }
 
 // GN: //third_party/zlib:zlib_slide_hash_simd
-filegroup {
+cc_defaults {
     name: "cronet_aml_third_party_zlib_zlib_slide_hash_simd",
 }
 
@@ -6851,7 +9165,6 @@
 cc_library_static {
     name: "cronet_aml_url_url",
     srcs: [
-        ":cronet_aml_ipc_param_traits",
         "url/gurl.cc",
         "url/origin.cc",
         "url/scheme_host_port.cc",
@@ -6890,7 +9203,6 @@
         "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_zlib_zlib",
     ],
     generated_headers: [
         "cronet_aml_base_debugging_buildflags",
@@ -6908,6 +9220,7 @@
     ],
     defaults: [
         "cronet_aml_defaults",
+        "cronet_aml_ipc_param_traits",
     ],
     cflags: [
         "-DANDROID",
@@ -6934,7 +9247,6 @@
         "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",
     ],
     header_libs: [
         "jni_headers",
diff --git a/tools/gn2bp/desc.json b/tools/gn2bp/desc.json
deleted file mode 100644
index 5648519..0000000
--- a/tools/gn2bp/desc.json
+++ /dev/null
Binary files differ
diff --git a/tools/gn2bp/desc_arm.json b/tools/gn2bp/desc_arm.json
new file mode 100644
index 0000000..996b5f5
--- /dev/null
+++ b/tools/gn2bp/desc_arm.json
Binary files differ
diff --git a/tools/gn2bp/desc_arm64.json b/tools/gn2bp/desc_arm64.json
new file mode 100644
index 0000000..dd8e800
--- /dev/null
+++ b/tools/gn2bp/desc_arm64.json
Binary files differ
diff --git a/tools/gn2bp/desc_x64.json b/tools/gn2bp/desc_x64.json
new file mode 100644
index 0000000..555f044
--- /dev/null
+++ b/tools/gn2bp/desc_x64.json
Binary files differ
diff --git a/tools/gn2bp/desc_x86.json b/tools/gn2bp/desc_x86.json
new file mode 100644
index 0000000..11e4e95
--- /dev/null
+++ b/tools/gn2bp/desc_x86.json
Binary files differ
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 4bd2479..3ec96f7 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,123 +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 == 'cc_binary_host':
-    module.static_libs.add('libprotobuf-cpp-full')
-  elif module.host_supported:
-    module.host.static_libs.add('libprotobuf-cpp-full')
-    module.android.shared_libs.add('libprotobuf-cpp-full')
-  elif module.type not in ['genrule', 'filegroup']:
-    module.shared_libs.add('libprotobuf-cpp-full')
-
-
-def enable_protobuf_lite(module):
-  if module.type not in ['genrule', 'filegroup']:
-    module.shared_libs.add('libprotobuf-cpp-lite')
-
-
-def enable_protoc_lib(module):
-  if module.type == 'cc_binary_host':
-    module.static_libs.add('libprotoc')
-  elif module.type not in ['genrule', 'filegroup']:
-    module.shared_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':
+    '//net/tools/root_store_tool:root_store_tool':
         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,
-    '//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,
 }
 
 # ----------------------------------------------------------------------------
@@ -307,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()
@@ -314,9 +207,13 @@
     self.dist = dict()
     self.strip = dict()
     self.stl = None
+    self.cppflags = set()
+    self.local_include_dirs = []
+    self.export_system_include_dirs = set()
 
   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')
@@ -324,6 +221,9 @@
     self._output_field(nested_out, 'stl')
     self._output_field(nested_out, 'dist')
     self._output_field(nested_out, 'strip')
+    self._output_field(nested_out, 'cppflags')
+    self._output_field(nested_out, 'local_include_dirs')
+    self._output_field(nested_out, 'export_system_include_dirs')
 
     if nested_out:
       output.append('    %s: {' % self.name)
@@ -344,7 +244,7 @@
     self.gn_target = gn_target
     self.name = name
     self.srcs = set()
-    self.comment = 'GN: ' + gn_utils.label_without_toolchain(gn_target)
+    self.comment = 'GN: ' + gn_target
     self.shared_libs = set()
     self.static_libs = set()
     self.whole_static_libs = set()
@@ -352,6 +252,7 @@
     self.tools = set()
     self.cmd = None
     self.host_supported = False
+    self.device_supported = True
     self.vendor_available = False
     self.init_rc = set()
     self.out = set()
@@ -366,8 +267,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()
@@ -389,7 +297,6 @@
     self.stubs = {}
     self.cppflags = set()
     self.rtti = False
-    self.arch = dict()
 
   def to_string(self, output):
     if self.comment:
@@ -405,6 +312,8 @@
     self._output_field(output, 'cmd', sort=False)
     if self.host_supported:
       self._output_field(output, 'host_supported')
+    if not self.device_supported:
+      self._output_field(output, 'device_supported')
     if self.vendor_available:
       self._output_field(output, 'vendor_available')
     self._output_field(output, 'init_rc')
@@ -436,11 +345,13 @@
     self._output_field(output, 'cppflags')
     if self.rtti:
       self._output_field(output, 'rtti')
-    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:
@@ -454,7 +365,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)
 
@@ -462,7 +373,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)
 
@@ -470,6 +381,9 @@
     value = getattr(self, name)
     return write_blueprint_key_value(output, name, value, sort)
 
+  def is_compiled(self):
+    return self.type not in ('genrule', 'filegroup', 'cc_defaults')
+
 
 class Blueprint(object):
   """In-memory representation of an Android.bp file."""
@@ -493,17 +407,9 @@
 
 def label_to_module_name(label):
   """Turn a GN label (e.g., //:perfetto_tests) into a module name."""
-  # If the label is explicibly listed in the default target list, don't prefix
-  # its name and return just the target name. This is so tools like
-  # "traceconv" stay as such in the Android tree.
-  label_without_toolchain = gn_utils.label_without_toolchain(label)
-  module = re.sub(r'^//:?', '', label_without_toolchain)
+  module = re.sub(r'^//:?', '', label)
   module = re.sub(r'[^a-zA-Z0-9_]', '_', module)
 
-  # If it's required to support multi toolchain for more targets, it's better to avoid hardcoding.
-  if label == "//third_party/boringssl:boringssl_asm(//build/toolchain/android:android_clang_x86)":
-    module += "_x86"
-
   if not module.startswith(module_prefix):
     return module_prefix + module
   return module
@@ -531,13 +437,15 @@
     """
   assert (target.type == 'proto_library')
 
-  tools = {'aprotoc'}
+  protoc_gn_target_name = gn.get_target('//third_party/protobuf:protoc').name
+  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:
@@ -1044,12 +952,45 @@
 
 
 
-def _get_cflags(target):
-  cflags = {flag for flag in target.cflags if re.match(cflag_allowlist, flag)}
+def _get_cflags(cflags, defines):
+  cflags = {flag for flag in cflags if flag in cflag_allowlist}
   # Consider proper allowlist or denylist if needed
-  cflags |= set("-D%s" % define.replace("\"", "\\\"") for define in target.defines)
+  cflags |= set("-D%s" % define.replace("\"", "\\\"") for define in defines)
+  # -DANDROID is added by default but target.defines contain -DANDROID if it's required.
+  # So adding -UANDROID to cancel default -DANDROID if it's not specified.
+  # This is needed for some targets(e.g. symbolize)
+  # TODO: Set -UANDROID considering common define
+  # if "ANDROID" not in defines:
+  #   cflags.add("-UANDROID")
   return cflags
 
+def set_module_flags(module, cflags, defines):
+  module.cflags.update(_get_cflags(cflags, defines))
+  # TODO: implement proper cflag parsing.
+  for flag in cflags:
+    if '-std=' in flag:
+      module.cpp_std = flag[len('-std='):]
+    if '-frtti' in flag:
+      module.rtti = True
+    if '-fexceptions' in flag:
+      module.cppflags.add('-fexceptions')
+
+def set_module_include_dirs(module, cflags, include_dirs):
+  local_include_dirs_set = set()
+  for flag in cflags:
+    if '-isystem' in flag:
+      local_include_dirs_set.add(flag[len('-isystem../../'):])
+
+  # Adding local_include_dirs is necessary due to source_sets / filegroups
+  # which do not properly propagate include directories.
+  # Filter any directory inside //out as a) this directory does not exist for
+  # aosp / soong builds and b) the include directory should already be
+  # configured via library dependency.
+  local_include_dirs_set.update([gn_utils.label_to_path(d)
+                                 for d in include_dirs
+                                 if not re.match('^//out/.*', d)])
+  module.local_include_dirs = sorted(list(local_include_dirs_set))
+
 
 def create_modules_from_target(blueprint, gn, gn_target_name):
   """Generate module(s) for a given GN target.
@@ -1068,13 +1009,11 @@
   target = gn.get_target(gn_target_name)
   log.info('create modules for %s (%s)', target.name, target.type)
 
-  name_without_toolchain = gn_utils.label_without_toolchain(target.name)
   if target.type == 'executable':
-    if target.toolchain == gn_utils.HOST_TOOLCHAIN:
-      module_type = 'cc_binary_host'
-    elif target.testonly:
+    if target.testonly:
       module_type = 'cc_test'
     else:
+      # Can be used for both host and device targets.
       module_type = 'cc_binary'
     module = Module(module_type, bp_module_name, gn_target_name)
   elif target.type == 'static_library':
@@ -1082,7 +1021,7 @@
   elif target.type == 'shared_library':
     module = Module('cc_library_shared', bp_module_name, gn_target_name)
   elif target.type == 'source_set':
-    module = Module('filegroup', bp_module_name, gn_target_name)
+    module = Module('cc_defaults', bp_module_name, gn_target_name)
   elif target.type == 'group':
     # "group" targets are resolved recursively by gn_utils.get_target().
     # There's nothing we need to do at this level for them.
@@ -1094,10 +1033,10 @@
   elif target.type == 'action':
     if 'gen_amalgamated_sql_metrics' in target.name:
       module = create_amalgamated_sql_metrics_module(blueprint, target)
-    elif re.match('.*gen_cc_.*_descriptor$', name_without_toolchain):
+    elif re.match('.*gen_cc_.*_descriptor$', target.name):
       module = create_cc_proto_descriptor_module(blueprint, target)
     elif target.type == 'action' and \
-        name_without_toolchain == gn_utils.GEN_VERSION_TARGET:
+        target.name == gn_utils.GEN_VERSION_TARGET:
       module = create_gen_version_module(blueprint, target, bp_module_name)
     else:
       module = create_action_module(blueprint, target)
@@ -1116,47 +1055,31 @@
     raise Error('Unknown target %s (%s)' % (target.name, target.type))
 
   blueprint.add_module(module)
-  module.host_supported = (name_without_toolchain in target_host_supported)
   module.init_rc = target_initrc.get(target.name, [])
   module.srcs.update(
       gn_utils.label_to_path(src)
       for src in target.sources
       if is_supported_source_file(src) and not src.startswith("//out/test"))
 
-  local_include_dirs_set = set()
+  # 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
+      if is_supported_source_file(src) and not src.startswith("//out/test"))
+
   if target.type in gn_utils.LINKER_UNIT_TYPES:
-    module.cflags.update(_get_cflags(target))
-    # TODO: implement proper cflag parsing.
-    for flag in target.cflags:
-      if '-std=' in flag:
-        module.cpp_std = flag[len('-std='):]
-      if '-isystem' in flag:
-        local_include_dirs_set.add(flag[len('-isystem../../'):])
-      if '-frtti' in flag:
-        module.rtti = True
-      if '-fexceptions' in flag:
-        module.cppflags.add('-fexceptions')
+    set_module_flags(module, target.cflags, target.defines)
+    set_module_include_dirs(module, target.cflags, target.include_dirs)
+    # TODO: set_module_xxx is confusing, apply similar function to module and target in better way.
+    for arch_name, arch in target.arch.items():
+      set_module_flags(module.target[arch_name], arch.cflags, arch.defines)
+      set_module_include_dirs(module.target[arch_name], arch.cflags, arch.include_dirs)
 
+  if module.is_compiled():
+    module.host_supported = target.host_supported()
+    module.device_supported = target.device_supported()
 
-    # Adding local_include_dirs is necessary due to source_sets / filegroups
-    # which do not properly propagate include directories.
-    # Filter any directory inside //out as a) this directory does not exist for
-    # aosp / soong builds and b) the include directory should already be
-    # configured via library dependency.
-    local_include_dirs_set.update([gn_utils.label_to_path(d)
-                                      for d in target.include_dirs
-                                      if not re.match('^//out/.*', d)])
-    module.local_include_dirs = sorted(list(local_include_dirs_set))
-
-    # Order matters for some targets. For example, base/time/time_exploded_icu.cc
-    # in //base:base needs to have sysroot include after icu/source/common
-    # include. So adding sysroot include at the end.
-    for flag in target.cflags:
-      if '--sysroot' in flag:
-        module.local_include_dirs.append(flag[len('--sysroot=../../'):] + "/usr/include")
-
-  module_is_compiled = module.type not in ('genrule', 'filegroup')
-  if module_is_compiled:
     # Don't try to inject library/source dependencies into genrules or
     # filegroups because they are not compiled in the traditional sense.
     module.defaults = [defaults_module]
@@ -1188,8 +1111,8 @@
   for dep_name in all_deps:
     # |builtin_deps| override GN deps with Android-specific ones. See the
     # config in the top of this file.
-    if gn_utils.label_without_toolchain(dep_name) in builtin_deps:
-      builtin_deps[gn_utils.label_without_toolchain(dep_name)](module)
+    if dep_name in builtin_deps:
+      builtin_deps[dep_name](module)
       continue
 
     dep_module = create_modules_from_target(blueprint, gn, dep_name)
@@ -1206,8 +1129,9 @@
         module.genrule_headers.add(dep_module.name)
         module.genrule_headers.update(dep_module.genrule_headers)
 
-    # For filegroups and genrule, recurse but don't apply the deps.
-    if not module_is_compiled:
+    # For cc_defaults, filegroups, and genrule, recurse but don't apply the
+    # deps.
+    if not module.is_compiled():
       continue
 
     if dep_module is None:
@@ -1216,8 +1140,8 @@
       module.shared_libs.add(dep_module.name)
     elif dep_module.type == 'cc_library_static':
       module.static_libs.add(dep_module.name)
-    elif dep_module.type == 'filegroup':
-      module.srcs.add(':' + dep_module.name)
+    elif dep_module.type == 'cc_defaults':
+      module.defaults.append(dep_module.name)
     elif dep_module.type == 'genrule':
       module.generated_headers.update(dep_module.genrule_headers)
       module.srcs.update(dep_module.genrule_srcs)
@@ -1229,24 +1153,16 @@
       raise Error('Unknown dep %s (%s) for target %s' %
                   (dep_module.name, dep_module.type, module.name))
 
-  # TODO: support arch difference in generic way
-  # Currently, it is expected that only a couple of modules (e.g. partition_alloc, boringssl)
-  # need arch condition. So, for now, hardcoding arch condition
-  if module.name == "cronet_aml_base_allocator_partition_allocator_partition_alloc":
-    x86_srcs = module.srcs.copy()
-    x86_srcs.remove(
-      "base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc")
-    x86_srcs.add("base/allocator/partition_allocator/starscan/stack/asm/x86/push_registers_asm.cc")
-    module.arch['x86'] = {'srcs': x86_srcs}
-    module.arch['x86_64'] = {'srcs': module.srcs.copy()}
-    module.srcs.clear()
-  elif module.name == "cronet_aml_third_party_boringssl_boringssl":
-    x86_srcs = module.srcs.copy()
-    x86_srcs.remove(":cronet_aml_third_party_boringssl_boringssl_asm")
-    x86_srcs.add(":cronet_aml_third_party_boringssl_boringssl_asm_x86")
-    module.arch['x86'] = {'srcs': x86_srcs}
-    module.arch['x86_64'] = {'srcs': module.srcs.copy()}
-    module.srcs.clear()
+  for arch_name, arch in target.arch.items():
+    for dep_name in arch.deps:
+      dep_module = create_modules_from_target(blueprint, gn, dep_name)
+      # Arch-specific dependencies currently only include cc_library_static.
+      # Revisit this approach once we need to support more target types.
+      if dep_module.type == 'cc_library_static':
+        module.target[arch_name].static_libs.add(dep_module.name)
+      else:
+        raise Error('Unsupported arch-specific dependency %s of target %s with type %s' %
+                    (dep_module.name, target.name, dep_module.type))
 
   return module
 
@@ -1282,7 +1198,7 @@
   module.srcs.update([
     "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java"])
 
-def create_blueprint_for_targets(gn, desc, targets):
+def create_blueprint_for_targets(gn, targets):
   """Generate a blueprint for a list of GN targets."""
   blueprint = Blueprint()
 
@@ -1303,19 +1219,25 @@
       '-Wno-unreachable-code-loop-increment', # needed for icui18n
       '-O2',
   ]
+  # TODO: can we get these from somewhere else?
+  # TODO: what to do for arm?
+  defaults.target['android_x86'].export_system_include_dirs = [
+      'build/linux/debian_bullseye_i386-sysroot/usr/include',
+  ]
+  defaults.target['android_x86_64'].export_system_include_dirs = [
+      'build/linux/debian_bullseye_amd64-sysroot/usr/include',
+      'build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu',
+  ]
+  defaults.target['host'].export_system_include_dirs = [
+      # TODO: do we need this?
+      'third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include',
+  ]
   defaults.stl = 'none'
   blueprint.add_module(defaults)
 
   for target in targets:
     create_modules_from_target(blueprint, gn, target)
 
-  # Currently, multi tool chain is not supported for all targets and create_modules_from_target can
-  # not reach to this target by following the dependency.
-  # So it's required to specify explicitly.
-  create_modules_from_target(blueprint, gn,
-                             "//third_party/boringssl:boringssl_asm" +
-                             "(//build/toolchain/android:android_clang_x86)")
-
   create_java_module(blueprint, gn)
   update_jni_registration_module(blueprint, gn)
 
@@ -1345,8 +1267,10 @@
       description='Generate Android.bp from a GN description.')
   parser.add_argument(
       '--desc',
-      help='GN description (e.g., gn desc out --format=json --all-toolchains "//*"',
-      required=True
+      help='GN description (e.g., gn desc out --format=json --all-toolchains "//*".' +
+           'You can specify multiple --desc options for different target_cpu',
+      required=True,
+      action='append'
   )
   parser.add_argument(
       '--extras',
@@ -1374,11 +1298,14 @@
   if args.verbose:
     log.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s', level=log.DEBUG)
 
-  with open(args.desc) as f:
-    desc = json.load(f)
-
-  gn = gn_utils.GnParser(desc)
-  blueprint = create_blueprint_for_targets(gn, desc, args.targets or default_targets)
+  targets = args.targets or default_targets
+  gn = gn_utils.GnParser()
+  for desc_file in args.desc:
+    with open(desc_file) as f:
+      desc = json.load(f)
+    for target in targets:
+      gn.parse_gn_desc(desc, target)
+  blueprint = create_blueprint_for_targets(gn, targets)
   project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
   tool_name = os.path.relpath(os.path.abspath(__file__), project_root)
 
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 118208c..d9e677a 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -29,8 +29,6 @@
 
 BUILDFLAGS_TARGET = '//gn:gen_buildflags'
 GEN_VERSION_TARGET = '//src/base:version_gen_h'
-TARGET_TOOLCHAIN = '//gn/standalone/toolchain:gcc_like_host'
-HOST_TOOLCHAIN = '//gn/standalone/toolchain:gcc_like_host'
 LINKER_UNIT_TYPES = ('executable', 'shared_library', 'static_library')
 
 # TODO(primiano): investigate these, they require further componentization.
@@ -94,6 +92,17 @@
         Maked properties are propagated up the dependency chain when a
         source_set dependency is encountered.
         """
+    class Arch():
+      """Architecture-dependent properties
+        """
+      def __init__(self):
+        self.sources = set()
+        self.cflags = set()
+        self.defines = set()
+        self.include_dirs = set()
+        self.deps = set()
+        self.transitive_static_libs_deps = set()
+
 
     def __init__(self, name, type):
       self.name = name  # e.g. //src/ipc:ipc
@@ -135,14 +144,17 @@
       self.source_set_deps = set()  # Transitive set of source_set deps.
       self.proto_deps = set()
       self.transitive_proto_deps = set()
-      self.transitive_static_libs_deps = set()
 
-      # Deps on //gn:xxx have this flag set to True. These dependencies
-      # are special because they pull third_party code from buildtools/.
-      # We don't want to keep recursing into //buildtools in generators,
-      # this flag is used to stop the recursion and create an empty
-      # placeholder target once we hit //gn:protoc or similar.
-      self.is_third_party_dep_ = False
+      # TODO: come up with a better way to only run this once.
+      # is_finalized tracks whether finalize() was called on this target.
+      self.is_finalized = False
+      self.arch = dict()
+
+    def host_supported(self):
+      return 'host' in self.arch
+
+    def device_supported(self):
+      return any([name.startswith('android') for name in self.arch.keys()])
 
     def __lt__(self, other):
       if isinstance(other, self.__class__):
@@ -159,14 +171,48 @@
                         indent=4,
                         sort_keys=True)
 
-    def update(self, other):
+    def update(self, other, arch):
       for key in ('cflags', 'defines', 'deps', 'include_dirs', 'ldflags',
                   'source_set_deps', 'proto_deps', 'transitive_proto_deps',
                   'libs', 'proto_paths'):
         self.__dict__[key].update(other.__dict__.get(key, []))
 
-  def __init__(self, gn_desc):
-    self.gn_desc_ = gn_desc
+      for key_in_arch in ('cflags', 'defines', 'include_dirs'):
+        self.arch[arch].__dict__[key_in_arch].update(
+          other.arch[arch].__dict__.get(key_in_arch, []))
+
+    def finalize(self):
+      """Move common properties out of arch-dependent subobjects to Target object.
+
+        TODO: find a better name for this function.
+        """
+      if self.is_finalized:
+        return
+      self.is_finalized = True
+
+      # There are targets that depend on source_set only in specific arch.
+      # Currently, source_set is converted to cc_defaults and defaults can not be target specific
+      # So, skip extracting common part and keep all data for each arch
+      if self.type == 'source_set':
+        return
+
+      # Target contains the intersection of arch-dependent properties
+      self.sources = set.intersection(*[arch.sources for arch in self.arch.values()])
+      self.cflags = set.intersection(*[arch.cflags for arch in self.arch.values()])
+      self.defines = set.intersection(*[arch.defines for arch in self.arch.values()])
+      self.include_dirs = set.intersection(*[arch.include_dirs for arch in self.arch.values()])
+      self.deps.update(set.intersection(*[arch.deps for arch in self.arch.values()]))
+
+      # Deduplicate arch-dependent properties
+      for arch in self.arch.keys():
+        self.arch[arch].sources -= self.sources
+        self.arch[arch].cflags -= self.cflags
+        self.arch[arch].defines -= self.defines
+        self.arch[arch].include_dirs -= self.include_dirs
+        self.arch[arch].deps -= self.deps
+
+
+  def __init__(self):
     self.all_targets = {}
     self.linker_units = {}  # Executables, shared or static libraries.
     self.source_sets = {}
@@ -195,39 +241,53 @@
     # TODO: There are some other possible variations we might need to support.
     return target.type == 'group' and re.match('.*_java$', target.name)
 
+  def _get_arch(self, toolchain):
+    if toolchain == '//build/toolchain/android:android_clang_x86':
+      return 'android_x86'
+    elif toolchain == '//build/toolchain/android:android_clang_x64':
+      return 'android_x86_64'
+    elif toolchain == '//build/toolchain/android:android_clang_arm':
+      return 'android_arm'
+    elif toolchain == '//build/toolchain/android:android_clang_arm64':
+      return 'android_arm64'
+    else:
+      return 'host'
 
   def get_target(self, gn_target_name):
     """Returns a Target object from the fully qualified GN target name.
 
+      get_target() requires that parse_gn_desc() has already been called.
+      """
+    # Run this every time as parse_gn_desc can be called at any time.
+    for target in self.all_targets.values():
+      target.finalize()
+
+    return self.all_targets[label_without_toolchain(gn_target_name)]
+
+  def parse_gn_desc(self, gn_desc, gn_target_name):
+    """Parses a gn desc tree and resolves all target dependencies.
+
         It bubbles up variables from source_set dependencies as described in the
         class-level comments.
         """
-    target = self.all_targets.get(gn_target_name)
-    if target is not None:
+    # Use name without toolchain for targets to support targets built for
+    # multiple archs.
+    target_name = label_without_toolchain(gn_target_name)
+    target = self.all_targets.get(target_name)
+    desc = gn_desc[gn_target_name]
+    arch = self._get_arch(desc['toolchain'])
+    if target is None:
+      target = GnParser.Target(target_name, desc['type'])
+      self.all_targets[target_name] = target
+
+    if arch not in target.arch:
+      target.arch[arch] = GnParser.Target.Arch()
+    else:
       return target  # Target already processed.
 
-    desc = self.gn_desc_[gn_target_name]
-    target = GnParser.Target(gn_target_name, desc['type'])
     target.testonly = desc.get('testonly', False)
-    target.toolchain = desc.get('toolchain', None)
-    self.all_targets[gn_target_name] = target
 
-    # TODO: determine if below comment should apply for cronet builds in Android.
-    # We should never have GN targets directly depend on buidtools. They
-    # should hop via //gn:xxx, so we can give generators an opportunity to
-    # override them.
-    # Specifically allow targets to depend on libc++ and libunwind.
-    if not any(match in gn_target_name for match in ['libc++', 'libunwind']):
-      assert (not gn_target_name.startswith('//buildtools'))
-
-
-    # Don't descend further into third_party targets. Genrators are supposed
-    # to either ignore them or route to other externally-provided targets.
-    if gn_target_name.startswith('//gn'):
-      target.is_third_party_dep_ = True
-      return target
-
-    proto_target_type, proto_desc = self.get_proto_target_type(target)
+    proto_target_type, proto_desc = self.get_proto_target_type(gn_desc, gn_target_name)
     if proto_target_type is not None:
       self.proto_libs[target.name] = target
       target.type = 'proto_library'
@@ -235,18 +295,21 @@
       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.sources.update(proto_desc.get('sources', []))
-      assert (all(x.endswith('.proto') for x in target.sources))
+      for gn_proto_deps_name in proto_desc.get('deps', []):
+        dep = self.parse_gn_desc(gn_desc, gn_proto_deps_name)
+        target.deps.add(dep.name)
+      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':
       self.source_sets[gn_target_name] = target
-      target.sources.update(desc.get('sources', []))
+      target.arch[arch].sources.update(desc.get('sources', []))
     elif target.type in LINKER_UNIT_TYPES:
       self.linker_units[gn_target_name] = target
-      target.sources.update(desc.get('sources', []))
+      target.arch[arch].sources.update(desc.get('sources', []))
     elif target.type in ['action', 'action_foreach']:
       self.actions[gn_target_name] = target
       target.inputs.update(desc.get('inputs', []))
-      target.sources.update(desc.get('sources', []))
+      target.arch[arch].sources.update(desc.get('sources', []))
       outs = [re.sub('^//out/.+?/gen/', '', x) for x in desc['outputs']]
       target.outputs.update(outs)
       target.script = desc['script']
@@ -269,32 +332,30 @@
     public_headers = [x for x in desc.get('public', []) if x != '*']
     target.public_headers.update(public_headers)
 
-    target.cflags.update(desc.get('cflags', []) + desc.get('cflags_cc', []))
+    target.arch[arch].cflags.update(desc.get('cflags', []) + desc.get('cflags_cc', []))
     target.libs.update(desc.get('libs', []))
     target.ldflags.update(desc.get('ldflags', []))
-    target.defines.update(desc.get('defines', []))
-    target.include_dirs.update(desc.get('include_dirs', []))
+    target.arch[arch].defines.update(desc.get('defines', []))
+    target.arch[arch].include_dirs.update(desc.get('include_dirs', []))
 
     # Recurse in dependencies.
-    for dep_name in desc.get('deps', []):
-      dep = self.get_target(dep_name)
-      if dep.is_third_party_dep_:
-        target.deps.add(dep_name)
-      elif dep.type == 'proto_library':
-        target.proto_deps.add(dep_name)
-        target.transitive_proto_deps.add(dep_name)
+    for gn_dep_name in desc.get('deps', []):
+      dep = self.parse_gn_desc(gn_desc, gn_dep_name)
+      if dep.type == 'proto_library':
+        target.proto_deps.add(dep.name)
+        target.transitive_proto_deps.add(dep.name)
         target.proto_paths.update(dep.proto_paths)
         target.transitive_proto_deps.update(dep.transitive_proto_deps)
       elif dep.type == 'source_set':
-        target.source_set_deps.add(dep_name)
-        target.update(dep)  # Bubble up source set's cflags/ldflags etc.
+        target.source_set_deps.add(dep.name)
+        target.update(dep, arch)  # Bubble up source set's cflags/ldflags etc.
       elif dep.type == 'group':
-        target.update(dep)  # Bubble up groups's cflags/ldflags etc.
+        target.update(dep, arch)  # Bubble up groups's cflags/ldflags etc.
       elif dep.type in ['action', 'action_foreach', 'copy']:
         if proto_target_type is None:
-          target.deps.add(dep_name)
+          target.deps.add(dep.name)
       elif dep.type in LINKER_UNIT_TYPES:
-        target.deps.add(dep_name)
+        target.arch[arch].deps.add(dep.name)
       elif dep.type == 'java_group':
         # Explicitly break dependency chain when a java_group is added.
         # Java sources are collected and eventually compiled as one large
@@ -304,12 +365,12 @@
       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.arch[arch].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)
+      if arch in dep.arch:
+        target.arch[arch].transitive_static_libs_deps.update(
+            dep.arch[arch].transitive_static_libs_deps)
+        target.arch[arch].deps.update(target.arch[arch].transitive_static_libs_deps)
 
       # Collect java sources. Java sources are kept inside the __compile_java target.
       # This target can be used for both host and target compilation; only add
@@ -340,7 +401,7 @@
     args = proto_desc.get('args')
     return re.sub('^\.\./\.\./', '', args[args.index('--proto-in-dir') + 1])
 
-  def get_proto_target_type(self, target):
+  def get_proto_target_type(self, gn_desc, gn_target_name):
     """ Checks if the target is a proto library and return the plugin.
 
         Returns:
@@ -350,13 +411,13 @@
             json desc of the target with the .proto sources (_gen target for
             non-descriptor types or the target itself for descriptor type).
         """
-    parts = target.name.split('(', 1)
+    parts = gn_target_name.split('(', 1)
     name = parts[0]
     toolchain = '(' + parts[1] if len(parts) > 1 else ''
 
     # Descriptor targets don't have a _gen target; instead we look for the
     # characteristic flag in the args of the target itself.
-    desc = self.gn_desc_.get(target.name)
+    desc = gn_desc.get(gn_target_name)
     if '--descriptor_set_out' in desc.get('args', []):
       return 'descriptor', desc
 
@@ -368,7 +429,7 @@
 
     # In all other cases, we want to look at the _gen target as that has the
     # important information.
-    gen_desc = self.gn_desc_.get('%s_gen%s' % (name, toolchain))
+    gen_desc = gn_desc.get('%s_gen%s' % (name, toolchain))
     if gen_desc is None or gen_desc['type'] != 'action':
       return None, None
     if gen_desc['script'] != '//tools/protoc_wrapper/protoc_wrapper.py':
diff --git a/tools/gn2bp/update_results.sh b/tools/gn2bp/update_results.sh
index f9321d9..c428f4e 100755
--- a/tools/gn2bp/update_results.sh
+++ b/tools/gn2bp/update_results.sh
@@ -16,4 +16,4 @@
 )
 
 BASEDIR=$(dirname "$0")
-$BASEDIR/gen_android_bp --desc $BASEDIR/desc.json --out $BASEDIR/Android.bp ${TARGETS[@]}
+$BASEDIR/gen_android_bp --desc $BASEDIR/desc_x64.json --desc $BASEDIR/desc_x86.json --out $BASEDIR/Android.bp ${TARGETS[@]}