Merge "Clean up the LinkProperties when stop monitoring sockets"
diff --git a/Cronet/tests/cts/Android.bp b/Cronet/tests/cts/Android.bp
index d969b54..7b440cd 100644
--- a/Cronet/tests/cts/Android.bp
+++ b/Cronet/tests/cts/Android.bp
@@ -64,6 +64,7 @@
         "junit",
         "hamcrest-library",
         "kotlin-test",
+        "mockito-target",
     ],
     libs: [
         "android.test.base",
diff --git a/Cronet/tests/cts/src/android/net/http/cts/CallbackExceptionTest.kt b/Cronet/tests/cts/src/android/net/http/cts/CallbackExceptionTest.kt
index e17b63f..749389e 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/CallbackExceptionTest.kt
+++ b/Cronet/tests/cts/src/android/net/http/cts/CallbackExceptionTest.kt
@@ -53,7 +53,7 @@
         val callback = TestUrlRequestCallback()
         callback.setFailure(FailureType.THROW_SYNC, ResponseStep.ON_RESPONSE_STARTED)
         val request = httpEngine
-            .newUrlRequestBuilder(server.successUrl, callback, callback.executor)
+            .newUrlRequestBuilder(server.successUrl, callback.executor, callback)
             .build()
 
         request.start()
diff --git a/Cronet/tests/cts/src/android/net/http/cts/ConnectionMigrationOptionsTest.kt b/Cronet/tests/cts/src/android/net/http/cts/ConnectionMigrationOptionsTest.kt
index 2701ed0..219db61 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/ConnectionMigrationOptionsTest.kt
+++ b/Cronet/tests/cts/src/android/net/http/cts/ConnectionMigrationOptionsTest.kt
@@ -17,30 +17,52 @@
 package android.net.http.cts
 
 import android.net.http.ConnectionMigrationOptions
+import android.net.http.ConnectionMigrationOptions.MIGRATION_OPTION_ENABLED
+import android.net.http.ConnectionMigrationOptions.MIGRATION_OPTION_UNSPECIFIED
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import kotlin.test.Test
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
+import kotlin.test.assertEquals
 import org.junit.runner.RunWith
 
 @RunWith(AndroidJUnit4::class)
 class ConnectionMigrationOptionsTest {
 
     @Test
+    fun testConnectionMigrationOptions_defaultValues() {
+        val options =
+                ConnectionMigrationOptions.Builder().build()
+
+        assertEquals(MIGRATION_OPTION_UNSPECIFIED, options.allowNonDefaultNetworkUsage)
+        assertEquals(MIGRATION_OPTION_UNSPECIFIED, options.defaultNetworkMigration)
+        assertEquals(MIGRATION_OPTION_UNSPECIFIED, options.pathDegradationMigration)
+    }
+
+    @Test
     fun testConnectionMigrationOptions_enableDefaultNetworkMigration_returnSetValue() {
         val options =
-            ConnectionMigrationOptions.Builder().setEnableDefaultNetworkMigration(true).build()
+            ConnectionMigrationOptions.Builder()
+                    .setDefaultNetworkMigration(MIGRATION_OPTION_ENABLED)
+                    .build()
 
-        assertNotNull(options.enableDefaultNetworkMigration)
-        assertTrue(options.enableDefaultNetworkMigration!!)
+        assertEquals(MIGRATION_OPTION_ENABLED, options.defaultNetworkMigration)
     }
 
     @Test
     fun testConnectionMigrationOptions_enablePathDegradationMigration_returnSetValue() {
         val options =
-            ConnectionMigrationOptions.Builder().setEnablePathDegradationMigration(true).build()
+            ConnectionMigrationOptions.Builder()
+                    .setPathDegradationMigration(MIGRATION_OPTION_ENABLED)
+                    .build()
 
-        assertNotNull(options.enablePathDegradationMigration)
-        assertTrue(options.enablePathDegradationMigration!!)
+        assertEquals(MIGRATION_OPTION_ENABLED, options.pathDegradationMigration)
+    }
+
+    @Test
+    fun testConnectionMigrationOptions_allowNonDefaultNetworkUsage_returnSetValue() {
+        val options =
+                ConnectionMigrationOptions.Builder()
+                        .setAllowNonDefaultNetworkUsage(MIGRATION_OPTION_ENABLED).build()
+
+        assertEquals(MIGRATION_OPTION_ENABLED, options.allowNonDefaultNetworkUsage)
     }
 }
diff --git a/Cronet/tests/cts/src/android/net/http/cts/DnsOptionsTest.kt b/Cronet/tests/cts/src/android/net/http/cts/DnsOptionsTest.kt
index b96e931..6f4a979 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/DnsOptionsTest.kt
+++ b/Cronet/tests/cts/src/android/net/http/cts/DnsOptionsTest.kt
@@ -17,13 +17,14 @@
 package android.net.http.cts
 
 import android.net.http.DnsOptions
+import android.net.http.DnsOptions.DNS_OPTION_ENABLED
+import android.net.http.DnsOptions.DNS_OPTION_UNSPECIFIED
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import java.time.Duration
 import kotlin.test.Test
 import kotlin.test.assertEquals
 import kotlin.test.assertNotNull
 import kotlin.test.assertNull
-import kotlin.test.assertTrue
 import org.junit.runner.RunWith
 
 @RunWith(AndroidJUnit4::class)
@@ -33,20 +34,22 @@
     fun testDnsOptions_defaultValues() {
         val options = DnsOptions.Builder().build()
 
-        assertNull(options.persistHostCache)
+        assertEquals(DNS_OPTION_UNSPECIFIED, options.persistHostCache)
         assertNull(options.persistHostCachePeriod)
-        assertNull(options.enableStaleDns)
+        assertEquals(DNS_OPTION_UNSPECIFIED, options.staleDns)
         assertNull(options.staleDnsOptions)
-        assertNull(options.useHttpStackDnsResolver)
-        assertNull(options.preestablishConnectionsToStaleDnsResults)
+        assertEquals(DNS_OPTION_UNSPECIFIED, options.useHttpStackDnsResolver)
+        assertEquals(DNS_OPTION_UNSPECIFIED,
+                options.preestablishConnectionsToStaleDnsResults)
     }
 
     @Test
     fun testDnsOptions_persistHostCache_returnSetValue() {
-        val options = DnsOptions.Builder().setPersistHostCache(true).build()
+        val options = DnsOptions.Builder()
+                .setPersistHostCache(DNS_OPTION_ENABLED)
+                .build()
 
-        assertNotNull(options.persistHostCache)
-        assertTrue(options.persistHostCache!!)
+        assertEquals(DNS_OPTION_ENABLED, options.persistHostCache)
     }
 
     @Test
@@ -59,44 +62,63 @@
 
     @Test
     fun testDnsOptions_enableStaleDns_returnSetValue() {
-        val options = DnsOptions.Builder().setEnableStaleDns(true).build()
+        val options = DnsOptions.Builder()
+                .setStaleDns(DNS_OPTION_ENABLED)
+                .build()
 
-        assertNotNull(options.enableStaleDns)
-        assertTrue(options.enableStaleDns!!)
+        assertEquals(DNS_OPTION_ENABLED, options.staleDns)
     }
 
     @Test
     fun testDnsOptions_useHttpStackDnsResolver_returnsSetValue() {
-        val options = DnsOptions.Builder().setUseHttpStackDnsResolver(true).build()
+        val options = DnsOptions.Builder()
+                .setUseHttpStackDnsResolver(DNS_OPTION_ENABLED)
+                .build()
 
-        assertNotNull(options.useHttpStackDnsResolver)
-        assertTrue(options.useHttpStackDnsResolver!!)
+        assertEquals(DNS_OPTION_ENABLED, options.useHttpStackDnsResolver)
     }
 
     @Test
     fun testDnsOptions_preestablishConnectionsToStaleDnsResults_returnsSetValue() {
-        val options = DnsOptions.Builder().setPreestablishConnectionsToStaleDnsResults(true).build()
+        val options = DnsOptions.Builder()
+                .setPreestablishConnectionsToStaleDnsResults(DNS_OPTION_ENABLED)
+                .build()
 
-        assertNotNull(options.preestablishConnectionsToStaleDnsResults)
-        assertTrue(options.preestablishConnectionsToStaleDnsResults!!)
+        assertEquals(DNS_OPTION_ENABLED,
+                options.preestablishConnectionsToStaleDnsResults)
+    }
+
+    @Test
+    fun testDnsOptions_setStaleDnsOptions_returnsSetValues() {
+        val staleOptions = DnsOptions.StaleDnsOptions.Builder()
+                .setAllowCrossNetworkUsage(DNS_OPTION_ENABLED)
+                .setFreshLookupTimeout(Duration.ofMillis(1234))
+                .build()
+        val options = DnsOptions.Builder()
+                .setStaleDns(DNS_OPTION_ENABLED)
+                .setStaleDnsOptions(staleOptions)
+                .build()
+
+        assertEquals(DNS_OPTION_ENABLED, options.staleDns)
+        assertEquals(staleOptions, options.staleDnsOptions)
     }
 
     @Test
     fun testStaleDnsOptions_defaultValues() {
         val options = DnsOptions.StaleDnsOptions.Builder().build()
 
-        assertNull(options.allowCrossNetworkUsage)
-        assertNull(options.freshLookupTimeoutMillis)
-        assertNull(options.maxExpiredDelayMillis)
-        assertNull(options.useStaleOnNameNotResolved)
+        assertEquals(DNS_OPTION_UNSPECIFIED, options.allowCrossNetworkUsage)
+        assertNull(options.freshLookupTimeout)
+        assertNull(options.maxExpiredDelay)
+        assertEquals(DNS_OPTION_UNSPECIFIED, options.useStaleOnNameNotResolved)
     }
 
     @Test
     fun testStaleDnsOptions_allowCrossNetworkUsage_returnsSetValue() {
-        val options = DnsOptions.StaleDnsOptions.Builder().setAllowCrossNetworkUsage(true).build()
+        val options = DnsOptions.StaleDnsOptions.Builder()
+                .setAllowCrossNetworkUsage(DNS_OPTION_ENABLED).build()
 
-        assertNotNull(options.allowCrossNetworkUsage)
-        assertTrue(options.allowCrossNetworkUsage!!)
+        assertEquals(DNS_OPTION_ENABLED, options.allowCrossNetworkUsage)
     }
 
     @Test
@@ -104,17 +126,17 @@
         val duration = Duration.ofMillis(12345)
         val options = DnsOptions.StaleDnsOptions.Builder().setFreshLookupTimeout(duration).build()
 
-        assertNotNull(options.freshLookupTimeoutMillis)
-        assertEquals(duration.toMillis(), options.freshLookupTimeoutMillis!!)
+        assertNotNull(options.freshLookupTimeout)
+        assertEquals(duration, options.freshLookupTimeout!!)
     }
 
     @Test
     fun testStaleDnsOptions_useStaleOnNameNotResolved_returnsSetValue() {
-        val options =
-                DnsOptions.StaleDnsOptions.Builder().setUseStaleOnNameNotResolved(true).build()
+        val options = DnsOptions.StaleDnsOptions.Builder()
+                .setUseStaleOnNameNotResolved(DNS_OPTION_ENABLED)
+                .build()
 
-        assertNotNull(options.useStaleOnNameNotResolved)
-        assertTrue(options.useStaleOnNameNotResolved!!)
+        assertEquals(DNS_OPTION_ENABLED, options.useStaleOnNameNotResolved)
     }
 
     @Test
@@ -122,7 +144,7 @@
         val duration = Duration.ofMillis(12345)
         val options = DnsOptions.StaleDnsOptions.Builder().setMaxExpiredDelay(duration).build()
 
-        assertNotNull(options.maxExpiredDelayMillis)
-        assertEquals(duration.toMillis(), options.maxExpiredDelayMillis!!)
+        assertNotNull(options.maxExpiredDelay)
+        assertEquals(duration, options.maxExpiredDelay!!)
     }
 }
diff --git a/Cronet/tests/cts/src/android/net/http/cts/HttpEngineTest.java b/Cronet/tests/cts/src/android/net/http/cts/HttpEngineTest.java
index 545d8c2..78ba71e 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/HttpEngineTest.java
+++ b/Cronet/tests/cts/src/android/net/http/cts/HttpEngineTest.java
@@ -29,7 +29,11 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
+import android.net.Network;
+import android.net.http.ConnectionMigrationOptions;
+import android.net.http.DnsOptions;
 import android.net.http.HttpEngine;
+import android.net.http.QuicOptions;
 import android.net.http.UrlRequest;
 import android.net.http.UrlResponseInfo;
 import android.net.http.cts.util.HttpCtsTestServer;
@@ -43,6 +47,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Mockito;
 
 @RunWith(AndroidJUnit4.class)
 public class HttpEngineTest {
@@ -51,6 +56,7 @@
 
     private HttpEngine.Builder mEngineBuilder;
     private TestUrlRequestCallback mCallback;
+    private HttpCtsTestServer mTestServer;
     private UrlRequest mRequest;
     private HttpEngine mEngine;
     private Context mContext;
@@ -61,6 +67,7 @@
         skipIfNoInternetConnection(mContext);
         mEngineBuilder = new HttpEngine.Builder(mContext);
         mCallback = new TestUrlRequestCallback();
+        mTestServer = new HttpCtsTestServer(mContext);
     }
 
     @After
@@ -72,6 +79,9 @@
         if (mEngine != null) {
             mEngine.shutdown();
         }
+        if (mTestServer != null) {
+            mTestServer.shutdown();
+        }
     }
 
     private boolean isQuic(String negotiatedProtocol) {
@@ -96,31 +106,30 @@
 
     @Test
     public void testHttpEngine_EnableHttpCache() {
-        // We need a server which sets cache-control != no-cache.
-        String url = "https://www.example.com";
+        String url = mTestServer.getCacheableTestDownloadUrl(
+                /* downloadId */ "cacheable-download",
+                /* numBytes */ 10);
         mEngine =
                 mEngineBuilder
                         .setStoragePath(mContext.getApplicationInfo().dataDir)
-                        .setEnableHttpCache(HttpEngine.Builder.HTTP_CACHE_DISK,
-                                            /* maxSize */ 100 * 1024)
+                        .setEnableHttpCache(
+                                HttpEngine.Builder.HTTP_CACHE_DISK, /* maxSize */ 100 * 1024)
                         .build();
 
         UrlRequest.Builder builder =
-                mEngine.newUrlRequestBuilder(url, mCallback, mCallback.getExecutor());
+                mEngine.newUrlRequestBuilder(url, mCallback.getExecutor(), mCallback);
         mRequest = builder.build();
         mRequest.start();
-        // This tests uses a non-hermetic server. Instead of asserting, assume the next callback.
-        // This way, if the request were to fail, the test would just be skipped instead of failing.
-        mCallback.assumeCallback(ResponseStep.ON_SUCCEEDED);
+        mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
         UrlResponseInfo info = mCallback.mResponseInfo;
         assumeOKStatusCode(info);
         assertFalse(info.wasCached());
 
         mCallback = new TestUrlRequestCallback();
-        builder = mEngine.newUrlRequestBuilder(url, mCallback, mCallback.getExecutor());
+        builder = mEngine.newUrlRequestBuilder(url, mCallback.getExecutor(), mCallback);
         mRequest = builder.build();
         mRequest.start();
-        mCallback.assumeCallback(ResponseStep.ON_SUCCEEDED);
+        mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
         info = mCallback.mResponseInfo;
         assertOKStatusCode(info);
         assertTrue(info.wasCached());
@@ -144,11 +153,12 @@
 
     @Test
     public void testHttpEngine_EnablePublicKeyPinningBypassForLocalTrustAnchors() {
+        String url = mTestServer.getSuccessUrl();
         // For known hosts, requests should succeed whether we're bypassing the local trust anchor
         // or not.
         mEngine = mEngineBuilder.setEnablePublicKeyPinningBypassForLocalTrustAnchors(false).build();
         UrlRequest.Builder builder =
-                mEngine.newUrlRequestBuilder(URL, mCallback, mCallback.getExecutor());
+                mEngine.newUrlRequestBuilder(url, mCallback.getExecutor(), mCallback);
         mRequest = builder.build();
         mRequest.start();
         mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
@@ -156,7 +166,7 @@
         mEngine.shutdown();
         mEngine = mEngineBuilder.setEnablePublicKeyPinningBypassForLocalTrustAnchors(true).build();
         mCallback = new TestUrlRequestCallback();
-        builder = mEngine.newUrlRequestBuilder(URL, mCallback, mCallback.getExecutor());
+        builder = mEngine.newUrlRequestBuilder(url, mCallback.getExecutor(), mCallback);
         mRequest = builder.build();
         mRequest.start();
         mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
@@ -202,6 +212,7 @@
     @Test
     public void testHttpEngine_GetDefaultUserAgent() throws Exception {
         assertThat(mEngineBuilder.getDefaultUserAgent(), containsString("AndroidHttpClient"));
+        assertThat(mEngineBuilder.getDefaultUserAgent()).contains(HttpEngine.getVersionString());
     }
 
     @Test
@@ -249,8 +260,114 @@
     private static String extractUserAgent(String userAgentResponseBody) {
         // If someone wants to be evil and have the title HTML tag a part of the user agent,
         // they'll have to fix this method :)
-        return userAgentResponseBody
-                .replaceFirst(".*<title>", "")
-                .replaceFirst("</title>.*", "");
+        return userAgentResponseBody.replaceFirst(".*<title>", "").replaceFirst("</title>.*", "");
+    }
+
+    @Test
+    public void testHttpEngine_bindToNetwork() throws Exception {
+        // Create a fake Android.net.Network. Since that network doesn't exist, binding to
+        // that should end up in a failed request.
+        Network mockNetwork = Mockito.mock(Network.class);
+        Mockito.when(mockNetwork.getNetworkHandle()).thenReturn(123L);
+        String url = mTestServer.getSuccessUrl();
+
+        mEngine = mEngineBuilder.build();
+        mEngine.bindToNetwork(mockNetwork);
+        UrlRequest.Builder builder =
+                mEngine.newUrlRequestBuilder(url, mCallback.getExecutor(), mCallback);
+        mRequest = builder.build();
+        mRequest.start();
+
+        mCallback.expectCallback(ResponseStep.ON_FAILED);
+    }
+
+    @Test
+    public void testHttpEngine_unbindFromNetwork() throws Exception {
+        // Create a fake Android.net.Network. Since that network doesn't exist, binding to
+        // that should end up in a failed request.
+        Network mockNetwork = Mockito.mock(Network.class);
+        Mockito.when(mockNetwork.getNetworkHandle()).thenReturn(123L);
+        String url = mTestServer.getSuccessUrl();
+
+        mEngine = mEngineBuilder.build();
+        // Bind to the fake network but then unbind. This should result in a successful
+        // request.
+        mEngine.bindToNetwork(mockNetwork);
+        mEngine.bindToNetwork(null);
+        UrlRequest.Builder builder =
+                mEngine.newUrlRequestBuilder(url, mCallback.getExecutor(), mCallback);
+        mRequest = builder.build();
+        mRequest.start();
+
+        mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
+        UrlResponseInfo info = mCallback.mResponseInfo;
+        assertOKStatusCode(info);
+    }
+
+    @Test
+    public void testHttpEngine_setConnectionMigrationOptions_requestSucceeds() {
+        ConnectionMigrationOptions options = new ConnectionMigrationOptions.Builder().build();
+        mEngine = mEngineBuilder.setConnectionMigrationOptions(options).build();
+        UrlRequest.Builder builder =
+                mEngine.newUrlRequestBuilder(
+                        mTestServer.getSuccessUrl(), mCallback.getExecutor(), mCallback);
+        mRequest = builder.build();
+        mRequest.start();
+
+        mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
+        UrlResponseInfo info = mCallback.mResponseInfo;
+        assertOKStatusCode(info);
+    }
+
+    @Test
+    public void testHttpEngine_setDnsOptions_requestSucceeds() {
+        DnsOptions options = new DnsOptions.Builder().build();
+        mEngine = mEngineBuilder.setDnsOptions(options).build();
+        UrlRequest.Builder builder =
+                mEngine.newUrlRequestBuilder(
+                        mTestServer.getSuccessUrl(), mCallback.getExecutor(), mCallback);
+        mRequest = builder.build();
+        mRequest.start();
+
+        mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
+        UrlResponseInfo info = mCallback.mResponseInfo;
+        assertOKStatusCode(info);
+    }
+
+    @Test
+    public void getVersionString_notEmpty() {
+        assertThat(HttpEngine.getVersionString()).isNotEmpty();
+    }
+
+    @Test
+    public void testHttpEngine_SetQuicOptions_RequestSucceedsWithQuic() throws Exception {
+        QuicOptions options = new QuicOptions.Builder().build();
+        mEngine = mEngineBuilder
+                .setEnableQuic(true)
+                .addQuicHint(HOST, 443, 443)
+                .setQuicOptions(options)
+                .build();
+
+        // The hint doesn't guarantee that QUIC will win the race, just that it will race TCP.
+        // We send multiple requests to reduce the flakiness of the test.
+        boolean quicWasUsed = false;
+        for (int i = 0; i < 5; i++) {
+            mCallback = new TestUrlRequestCallback();
+            UrlRequest.Builder builder =
+                    mEngine.newUrlRequestBuilder(URL, mCallback.getExecutor(), mCallback);
+            mRequest = builder.build();
+            mRequest.start();
+            mCallback.blockForDone();
+
+            quicWasUsed = isQuic(mCallback.mResponseInfo.getNegotiatedProtocol());
+            if (quicWasUsed) {
+                break;
+            }
+        }
+
+        assertTrue(quicWasUsed);
+        // This tests uses a non-hermetic server. Instead of asserting, assume the next callback.
+        // This way, if the request were to fail, the test would just be skipped instead of failing.
+        assumeOKStatusCode(mCallback.mResponseInfo);
     }
 }
diff --git a/Cronet/tests/cts/src/android/net/http/cts/NetworkExceptionTest.kt b/Cronet/tests/cts/src/android/net/http/cts/NetworkExceptionTest.kt
index dd07a41..dd4cf0d 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/NetworkExceptionTest.kt
+++ b/Cronet/tests/cts/src/android/net/http/cts/NetworkExceptionTest.kt
@@ -50,7 +50,7 @@
         val httpEngine = HttpEngine.Builder(ApplicationProvider.getApplicationContext()).build()
         val callback = TestUrlRequestCallback()
         val request =
-            httpEngine.newUrlRequestBuilder("http://localhost", callback, callback.executor).build()
+            httpEngine.newUrlRequestBuilder("http://localhost", callback.executor, callback).build()
 
         request.start()
         callback.blockForDone()
diff --git a/Cronet/tests/cts/src/android/net/http/cts/QuicExceptionTest.kt b/Cronet/tests/cts/src/android/net/http/cts/QuicExceptionTest.kt
new file mode 100644
index 0000000..4b7aa14
--- /dev/null
+++ b/Cronet/tests/cts/src/android/net/http/cts/QuicExceptionTest.kt
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2023 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 android.net.http.cts
+
+import android.net.http.QuicException
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class QuicExceptionTest {
+
+    @Test
+    fun testQuicException_returnsInputParameters() {
+        val message = "failed"
+        val cause = Throwable("thrown")
+        val quicException =
+            object : QuicException(message, cause) {
+                override fun getErrorCode() = 0
+                override fun isImmediatelyRetryable() = false
+            }
+
+        assertEquals(message, quicException.message)
+        assertEquals(cause, quicException.cause)
+    }
+
+    // TODO: add test for QuicException triggered from HttpEngine
+}
diff --git a/Cronet/tests/cts/src/android/net/http/cts/QuicOptionsTest.kt b/Cronet/tests/cts/src/android/net/http/cts/QuicOptionsTest.kt
index 1888962..0b02aa7 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/QuicOptionsTest.kt
+++ b/Cronet/tests/cts/src/android/net/http/cts/QuicOptionsTest.kt
@@ -18,6 +18,10 @@
 import android.net.http.QuicOptions
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import com.google.common.truth.Truth.assertThat
+import java.time.Duration
+import kotlin.test.assertFailsWith
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -26,11 +30,13 @@
     @Test
     fun testQuicOptions_defaultValues() {
         val quicOptions = QuicOptions.Builder().build()
-        assertThat(quicOptions.quicHostAllowlist).isEmpty()
+        assertThat(quicOptions.allowedQuicHosts).isEmpty()
         assertThat(quicOptions.handshakeUserAgent).isNull()
-        // TODO(danstahr): idleConnectionTimeout getter should be public
-        // assertThat(quicOptions.idleConnectionTimeout).isNull()
-        assertThat(quicOptions.inMemoryServerConfigsCacheSize).isNull()
+        assertThat(quicOptions.idleConnectionTimeout).isNull()
+        assertFalse(quicOptions.hasInMemoryServerConfigsCacheSize())
+        assertFailsWith(IllegalStateException::class) {
+            quicOptions.inMemoryServerConfigsCacheSize
+        }
     }
 
     @Test
@@ -41,13 +47,11 @@
                 .addAllowedQuicHost("foo")
                 .addAllowedQuicHost("baz")
                 .build()
-        assertThat(quicOptions.quicHostAllowlist)
+        assertThat(quicOptions.allowedQuicHosts)
                 .containsExactly("foo", "bar", "baz")
                 .inOrder()
     }
 
-    // TODO(danstahr): idleConnectionTimeout getter should be public
-    /*
     @Test
     fun testQuicOptions_idleConnectionTimeout_returnsSetValue() {
         val timeout = Duration.ofMinutes(10)
@@ -57,14 +61,24 @@
         assertThat(quicOptions.idleConnectionTimeout)
                 .isEqualTo(timeout)
     }
-    */
 
     @Test
     fun testQuicOptions_inMemoryServerConfigsCacheSize_returnsSetValue() {
         val quicOptions = QuicOptions.Builder()
                 .setInMemoryServerConfigsCacheSize(42)
                 .build()
+        assertTrue(quicOptions.hasInMemoryServerConfigsCacheSize())
         assertThat(quicOptions.inMemoryServerConfigsCacheSize)
                 .isEqualTo(42)
     }
+
+    @Test
+    fun testQuicOptions_handshakeUserAgent_returnsSetValue() {
+        val userAgent = "test"
+        val quicOptions = QuicOptions.Builder()
+            .setHandshakeUserAgent(userAgent)
+            .build()
+        assertThat(quicOptions.handshakeUserAgent)
+            .isEqualTo(userAgent)
+    }
 }
diff --git a/Cronet/tests/cts/src/android/net/http/cts/UrlRequestTest.java b/Cronet/tests/cts/src/android/net/http/cts/UrlRequestTest.java
index 18ceb24..e4949d3 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/UrlRequestTest.java
+++ b/Cronet/tests/cts/src/android/net/http/cts/UrlRequestTest.java
@@ -19,6 +19,8 @@
 import static android.net.http.cts.util.TestUtilsKt.assertOKStatusCode;
 import static android.net.http.cts.util.TestUtilsKt.skipIfNoInternetConnection;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.junit.Assert.assertEquals;
@@ -27,6 +29,7 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
+import android.net.http.HeaderBlock;
 import android.net.http.HttpEngine;
 import android.net.http.HttpException;
 import android.net.http.InlineExecutionProhibitedException;
@@ -40,22 +43,34 @@
 import android.net.http.cts.util.TestUploadDataProvider;
 import android.net.http.cts.util.TestUrlRequestCallback;
 import android.net.http.cts.util.TestUrlRequestCallback.ResponseStep;
+import android.net.http.cts.util.UploadDataProviders;
+import android.webkit.cts.CtsTestServer;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.google.common.base.Strings;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.net.URLEncoder;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @RunWith(AndroidJUnit4.class)
 public class UrlRequestTest {
@@ -154,11 +169,11 @@
         TestUrlRequestCallback callback = new TestUrlRequestCallback();
         callback.setAllowDirectExecutor(true);
         UrlRequest.Builder builder = mHttpEngine.newUrlRequestBuilder(
-                mTestServer.getEchoBodyUrl(), callback, DIRECT_EXECUTOR);
+                mTestServer.getEchoBodyUrl(), DIRECT_EXECUTOR, callback);
         UploadDataProvider dataProvider = InMemoryUploadDataProvider.fromUtf8String("test");
         builder.setUploadDataProvider(dataProvider, DIRECT_EXECUTOR);
         builder.addHeader("Content-Type", "text/plain;charset=UTF-8");
-        builder.setAllowDirectExecutor(true);
+        builder.setDirectExecutorAllowed(true);
         builder.build().start();
         callback.blockForDone();
 
@@ -177,7 +192,7 @@
         callback.setAllowDirectExecutor(true);
 
         UrlRequest.Builder builder = mHttpEngine.newUrlRequestBuilder(
-                mTestServer.getEchoBodyUrl(), callback, Executors.newSingleThreadExecutor());
+                mTestServer.getEchoBodyUrl(), Executors.newSingleThreadExecutor(), callback);
         UploadDataProvider dataProvider = InMemoryUploadDataProvider.fromUtf8String("test");
 
         builder.setUploadDataProvider(dataProvider, DIRECT_EXECUTOR)
@@ -197,7 +212,7 @@
         callback.setAllowDirectExecutor(true);
 
         UrlRequest.Builder builder = mHttpEngine.newUrlRequestBuilder(
-                mTestServer.getEchoBodyUrl(), callback, DIRECT_EXECUTOR);
+                mTestServer.getEchoBodyUrl(), DIRECT_EXECUTOR, callback);
         UploadDataProvider dataProvider = InMemoryUploadDataProvider.fromUtf8String("test");
 
         builder.setUploadDataProvider(dataProvider, Executors.newSingleThreadExecutor())
@@ -218,6 +233,7 @@
                 mHttpEngine
                         .newUrlRequestBuilder(
                                 mTestServer.getSuccessUrl(),
+                                Executors.newSingleThreadExecutor(),
                                 new StubUrlRequestCallback() {
                                     @Override
                                     public void onResponseStarted(
@@ -233,8 +249,7 @@
                                             HttpException error) {
                                         onFailedException.add(error);
                                     }
-                                },
-                                Executors.newSingleThreadExecutor())
+                                })
                         .build();
         request.start();
 
@@ -252,6 +267,7 @@
                 mHttpEngine
                         .newUrlRequestBuilder(
                                 mTestServer.getSuccessUrl(),
+                                Executors.newSingleThreadExecutor(),
                                 new StubUrlRequestCallback() {
                                     @Override
                                     public void onResponseStarted(
@@ -268,8 +284,7 @@
                                             HttpException error) {
                                         onFailedException.add(error);
                                     }
-                                },
-                                Executors.newSingleThreadExecutor())
+                                })
                         .build();
         request.start();
 
@@ -279,7 +294,94 @@
         assertTrue(e.getCause().getMessage().contains("full"));
     }
 
-    private static class StubUrlRequestCallback extends UrlRequest.Callback {
+    @Test
+    public void testUrlRequest_redirects() throws Exception {
+        int expectedNumRedirects = 5;
+        String url =
+                mTestServer.getRedirectingAssetUrl("html/hello_world.html", expectedNumRedirects);
+
+        UrlRequest request = createUrlRequestBuilder(url).build();
+        request.start();
+
+        mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
+        UrlResponseInfo info = mCallback.mResponseInfo;
+        assertOKStatusCode(info);
+        assertThat(mCallback.mResponseAsString).contains("hello world");
+        assertThat(info.getUrlChain()).hasSize(expectedNumRedirects + 1);
+        assertThat(info.getUrlChain().get(0)).isEqualTo(url);
+        assertThat(info.getUrlChain().get(expectedNumRedirects)).isEqualTo(info.getUrl());
+    }
+
+    @Test
+    public void testUrlRequestPost_withRedirect() throws Exception {
+        String body = Strings.repeat(
+                "Hello, this is a really interesting body, so write this 100 times.", 100);
+
+        String redirectUrlParameter =
+                URLEncoder.encode(mTestServer.getEchoBodyUrl(), "UTF-8");
+        createUrlRequestBuilder(
+                String.format(
+                        "%s/alt_redirect?dest=%s&statusCode=307",
+                        mTestServer.getBaseUri(),
+                        redirectUrlParameter))
+                .setHttpMethod("POST")
+                .addHeader("Content-Type", "text/plain")
+                .setUploadDataProvider(
+                        UploadDataProviders.create(body.getBytes(StandardCharsets.UTF_8)),
+                        mCallback.getExecutor())
+                .build()
+                .start();
+        mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
+
+        assertOKStatusCode(mCallback.mResponseInfo);
+        assertThat(mCallback.mResponseAsString).isEqualTo(body);
+    }
+
+    @Test
+    public void testUrlRequest_customHeaders() throws Exception {
+        UrlRequest.Builder builder = createUrlRequestBuilder(mTestServer.getEchoHeadersUrl());
+
+        List<Map.Entry<String, String>> expectedHeaders = Arrays.asList(
+                Map.entry("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="),
+                Map.entry("Max-Forwards", "10"),
+                Map.entry("X-Client-Data", "random custom header content"));
+
+        for (Map.Entry<String, String> header : expectedHeaders) {
+            builder.addHeader(header.getKey(), header.getValue());
+        }
+
+        builder.build().start();
+        mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
+
+        assertOKStatusCode(mCallback.mResponseInfo);
+
+        List<Map.Entry<String, String>> echoedHeaders =
+                extractEchoedHeaders(mCallback.mResponseInfo.getHeaders());
+
+        // The implementation might decide to add more headers like accepted encodings it handles
+        // internally so the server is likely to see more headers than explicitly set
+        // by the developer.
+        assertThat(echoedHeaders)
+                .containsAtLeastElementsIn(expectedHeaders);
+    }
+
+    private static List<Map.Entry<String, String>> extractEchoedHeaders(HeaderBlock headers) {
+        return headers.getAsList()
+                .stream()
+                .flatMap(input -> {
+                    if (input.getKey().startsWith(CtsTestServer.ECHOED_RESPONSE_HEADER_PREFIX)) {
+                        String strippedKey =
+                                input.getKey().substring(
+                                        CtsTestServer.ECHOED_RESPONSE_HEADER_PREFIX.length());
+                        return Stream.of(Map.entry(strippedKey, input.getValue()));
+                    } else {
+                        return Stream.empty();
+                    }
+                })
+                .collect(Collectors.toList());
+    }
+
+    private static class StubUrlRequestCallback implements UrlRequest.Callback {
 
         @Override
         public void onRedirectReceived(
@@ -307,6 +409,11 @@
         public void onFailed(UrlRequest request, UrlResponseInfo info, HttpException error) {
             throw new UnsupportedOperationException(error);
         }
+
+        @Override
+        public void onCanceled(@NonNull UrlRequest request, @Nullable UrlResponseInfo info) {
+            throw new UnsupportedOperationException();
+        }
     }
 
     private static class InMemoryUploadDataProvider extends UploadDataProvider {
diff --git a/Cronet/tests/cts/src/android/net/http/cts/UrlResponseInfoTest.kt b/Cronet/tests/cts/src/android/net/http/cts/UrlResponseInfoTest.kt
index f5b72dc..38da9c5 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/UrlResponseInfoTest.kt
+++ b/Cronet/tests/cts/src/android/net/http/cts/UrlResponseInfoTest.kt
@@ -40,7 +40,7 @@
         val httpEngine = HttpEngine.Builder(context).build()
         val callback = TestUrlRequestCallback()
         val url = server.successUrl
-        val request = httpEngine.newUrlRequestBuilder(url, callback, callback.executor).build()
+        val request = httpEngine.newUrlRequestBuilder(url, callback.executor, callback).build()
 
         request.start()
         callback.expectCallback(ResponseStep.ON_SUCCEEDED)
diff --git a/Cronet/tests/cts/src/android/net/http/cts/util/TestBidirectionalStreamCallback.java b/Cronet/tests/cts/src/android/net/http/cts/util/TestBidirectionalStreamCallback.java
index e82b24d..1e7333c 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/util/TestBidirectionalStreamCallback.java
+++ b/Cronet/tests/cts/src/android/net/http/cts/util/TestBidirectionalStreamCallback.java
@@ -26,6 +26,7 @@
 import static org.junit.Assume.assumeTrue;
 
 import android.net.http.BidirectionalStream;
+import android.net.http.HeaderBlock;
 import android.net.http.HttpException;
 import android.net.http.UrlResponseInfo;
 import android.os.ConditionVariable;
@@ -43,7 +44,7 @@
  * the stream completes on another thread. Allows to cancel, block stream or throw an exception from
  * an arbitrary step.
  */
-public class TestBidirectionalStreamCallback extends BidirectionalStream.Callback {
+public class TestBidirectionalStreamCallback implements BidirectionalStream.Callback {
     private static final int TIMEOUT_MS = 12_000;
     public UrlResponseInfo mResponseInfo;
     public HttpException mError;
@@ -56,7 +57,7 @@
     public int mHttpResponseDataLength;
     public String mResponseAsString = "";
 
-    public UrlResponseInfo.HeaderBlock mTrailers;
+    public HeaderBlock mTrailers;
 
     private static final int READ_BUFFER_SIZE = 32 * 1024;
 
@@ -337,7 +338,7 @@
     public void onResponseTrailersReceived(
             BidirectionalStream stream,
             UrlResponseInfo info,
-            UrlResponseInfo.HeaderBlock trailers) {
+            HeaderBlock trailers) {
         checkOnValidThread();
         assertFalse(stream.isDone());
         assertNull(mError);
diff --git a/Cronet/tests/cts/src/android/net/http/cts/util/TestUrlRequestCallback.java b/Cronet/tests/cts/src/android/net/http/cts/util/TestUrlRequestCallback.java
index efbcff6..28443b7 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/util/TestUrlRequestCallback.java
+++ b/Cronet/tests/cts/src/android/net/http/cts/util/TestUrlRequestCallback.java
@@ -50,7 +50,7 @@
  * method to block thread until the request completes on another thread.
  * Allows us to cancel, block request or throw an exception from an arbitrary step.
  */
-public class TestUrlRequestCallback extends UrlRequest.Callback {
+public class TestUrlRequestCallback implements UrlRequest.Callback {
     private static final int TIMEOUT_MS = 12_000;
     public ArrayList<UrlResponseInfo> mRedirectResponseInfoList = new ArrayList<>();
     public ArrayList<String> mRedirectUrlList = new ArrayList<>();
diff --git a/Cronet/tests/cts/src/android/net/http/cts/util/UploadDataProviders.java b/Cronet/tests/cts/src/android/net/http/cts/util/UploadDataProviders.java
new file mode 100644
index 0000000..889f8f2
--- /dev/null
+++ b/Cronet/tests/cts/src/android/net/http/cts/util/UploadDataProviders.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2023 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 android.net.http.cts.util;
+
+import android.net.http.UploadDataProvider;
+import android.net.http.UploadDataSink;
+import android.os.ParcelFileDescriptor;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+
+/**
+ * Provides implementations of {@link UploadDataProvider} for common use cases. Corresponds to
+ * {@code android.net.http.apihelpers.UploadDataProviders} which is not an exposed API.
+ */
+public final class UploadDataProviders {
+    /**
+     * Uploads an entire file.
+     *
+     * @param file The file to upload
+     * @return A new UploadDataProvider for the given file
+     */
+    public static UploadDataProvider create(final File file) {
+        return new FileUploadProvider(() -> new FileInputStream(file).getChannel());
+    }
+
+    /**
+     * Uploads an entire file, closing the descriptor when it is no longer needed.
+     *
+     * @param fd The file descriptor to upload
+     * @throws IllegalArgumentException if {@code fd} is not a file.
+     * @return A new UploadDataProvider for the given file descriptor
+     */
+    public static UploadDataProvider create(final ParcelFileDescriptor fd) {
+        return new FileUploadProvider(() -> {
+            if (fd.getStatSize() != -1) {
+                return new ParcelFileDescriptor.AutoCloseInputStream(fd).getChannel();
+            } else {
+                fd.close();
+                throw new IllegalArgumentException("Not a file: " + fd);
+            }
+        });
+    }
+
+    /**
+     * Uploads a ByteBuffer, from the current {@code buffer.position()} to {@code buffer.limit()}
+     *
+     * @param buffer The data to upload
+     * @return A new UploadDataProvider for the given buffer
+     */
+    public static UploadDataProvider create(ByteBuffer buffer) {
+        return new ByteBufferUploadProvider(buffer.slice());
+    }
+
+    /**
+     * Uploads {@code length} bytes from {@code data}, starting from {@code offset}
+     *
+     * @param data Array containing data to upload
+     * @param offset Offset within data to start with
+     * @param length Number of bytes to upload
+     * @return A new UploadDataProvider for the given data
+     */
+    public static UploadDataProvider create(byte[] data, int offset, int length) {
+        return new ByteBufferUploadProvider(ByteBuffer.wrap(data, offset, length).slice());
+    }
+
+    /**
+     * Uploads the contents of {@code data}
+     *
+     * @param data Array containing data to upload
+     * @return A new UploadDataProvider for the given data
+     */
+    public static UploadDataProvider create(byte[] data) {
+        return create(data, 0, data.length);
+    }
+
+    private interface FileChannelProvider {
+        FileChannel getChannel() throws IOException;
+    }
+
+    private static final class FileUploadProvider extends UploadDataProvider {
+        private volatile FileChannel mChannel;
+        private final FileChannelProvider mProvider;
+        /** Guards initialization of {@code mChannel} */
+        private final Object mLock = new Object();
+
+        private FileUploadProvider(FileChannelProvider provider) {
+            this.mProvider = provider;
+        }
+
+        @Override
+        public long getLength() throws IOException {
+            return getChannel().size();
+        }
+
+        @Override
+        public void read(UploadDataSink uploadDataSink, ByteBuffer byteBuffer) throws IOException {
+            if (!byteBuffer.hasRemaining()) {
+                throw new IllegalStateException("Cronet passed a buffer with no bytes remaining");
+            }
+            FileChannel channel = getChannel();
+            int bytesRead = 0;
+            while (bytesRead == 0) {
+                int read = channel.read(byteBuffer);
+                if (read == -1) {
+                    break;
+                } else {
+                    bytesRead += read;
+                }
+            }
+            uploadDataSink.onReadSucceeded(false);
+        }
+
+        @Override
+        public void rewind(UploadDataSink uploadDataSink) throws IOException {
+            getChannel().position(0);
+            uploadDataSink.onRewindSucceeded();
+        }
+
+        /**
+         * Lazily initializes the channel so that a blocking operation isn't performed
+         * on a non-executor thread.
+         */
+        private FileChannel getChannel() throws IOException {
+            if (mChannel == null) {
+                synchronized (mLock) {
+                    if (mChannel == null) {
+                        mChannel = mProvider.getChannel();
+                    }
+                }
+            }
+            return mChannel;
+        }
+
+        @Override
+        public void close() throws IOException {
+            FileChannel channel = mChannel;
+            if (channel != null) {
+                channel.close();
+            }
+        }
+    }
+
+    private static final class ByteBufferUploadProvider extends UploadDataProvider {
+        private final ByteBuffer mUploadBuffer;
+
+        private ByteBufferUploadProvider(ByteBuffer uploadBuffer) {
+            this.mUploadBuffer = uploadBuffer;
+        }
+
+        @Override
+        public long getLength() {
+            return mUploadBuffer.limit();
+        }
+
+        @Override
+        public void read(UploadDataSink uploadDataSink, ByteBuffer byteBuffer) {
+            if (!byteBuffer.hasRemaining()) {
+                throw new IllegalStateException("Cronet passed a buffer with no bytes remaining");
+            }
+            if (byteBuffer.remaining() >= mUploadBuffer.remaining()) {
+                byteBuffer.put(mUploadBuffer);
+            } else {
+                int oldLimit = mUploadBuffer.limit();
+                mUploadBuffer.limit(mUploadBuffer.position() + byteBuffer.remaining());
+                byteBuffer.put(mUploadBuffer);
+                mUploadBuffer.limit(oldLimit);
+            }
+            uploadDataSink.onReadSucceeded(false);
+        }
+
+        @Override
+        public void rewind(UploadDataSink uploadDataSink) {
+            mUploadBuffer.position(0);
+            uploadDataSink.onRewindSucceeded();
+        }
+    }
+
+    // Prevent instantiation
+    private UploadDataProviders() {}
+}
diff --git a/Cronet/tests/mts/Android.bp b/Cronet/tests/mts/Android.bp
index 03d163c..ac71653 100644
--- a/Cronet/tests/mts/Android.bp
+++ b/Cronet/tests/mts/Android.bp
@@ -19,7 +19,7 @@
 
 android_library {
     name: "NetHttpTestsLibPreJarJar",
-    srcs: [":cronet_aml_javatests_sources"],
+    srcs: ["//external/cronet:cronet_aml_javatests_sources"],
     sdk_version: "test_current",
     min_sdk_version: "30",
     static_libs: [
diff --git a/Cronet/tools/import/copy.bara.sky b/Cronet/tools/import/copy.bara.sky
index 2acf8cd..8353fd3 100644
--- a/Cronet/tools/import/copy.bara.sky
+++ b/Cronet/tools/import/copy.bara.sky
@@ -19,6 +19,7 @@
 
     # Exclude existing *OWNERS files
     "**/*OWNERS",
+    "**/.git/**",
 ]
 
 cronet_origin_files = glob(
@@ -35,6 +36,8 @@
         "crypto/**",
         "ipc/**",
         "net/**",
+        # Note: Only used for tests.
+        "testing/**",
         "url/**",
         "LICENSE",
     ],
@@ -48,6 +51,8 @@
         "components/cronet/ios/**",
         "components/cronet/native/**",
 
+        # Per aosp/2399270
+        "testing/buildbot/**",
 
         # Exclude all third-party directories. Those are specified explicitly
         # below, so no dependency can accidentally creep in.
@@ -65,14 +70,11 @@
         "base/third_party/icu/**",
         "base/third_party/nspr/**",
         "base/third_party/superfasthash/**",
-        # TODO: we should be able to remove this dependency.
-        "base/third_party/symbolize/**",
         "base/third_party/valgrind/**",
-        "base/third_party/xdg_user_dirs/**",
-        # Not present in source repo; requires gclient sync.
         "buildtools/third_party/libc++/**",
-        # Not present in source repo; requires gclient sync.
         "buildtools/third_party/libc++abi/**",
+        # Note: Only used for tests.
+        "net/third_party/nist-pkits/**",
         "net/third_party/quiche/**",
         "net/third_party/uri_template/**",
         "third_party/abseil-cpp/**",
@@ -80,12 +82,21 @@
         "third_party/ashmem/**",
         "third_party/boringssl/**",
         "third_party/brotli/**",
-        # Not present in source repo; requires gclient sync.
+        # Note: Only used for tests.
+        "third_party/ced/**",
+        # Note: Only used for tests.
+        "third_party/googletest/**",
         "third_party/icu/**",
         "third_party/libevent/**",
+        # Note: Only used for tests.
+        "third_party/libxml/**",
+        # Note: Only used for tests.
+        "third_party/lss/**",
         "third_party/metrics_proto/**",
         "third_party/modp_b64/**",
         "third_party/protobuf/**",
+        # Note: Only used for tests.
+        "third_party/quic_trace/**",
         "third_party/zlib/**",
     ],
     exclude = common_excludes,
@@ -94,12 +105,8 @@
 core.workflow(
     name = "import_cronet",
     authoring = authoring.overwrite("Cronet Mainline Eng <cronet-mainline-eng+copybara@google.com>"),
-    origin = git.origin(
-        url = "rpc://chromium/chromium/src",
-        # Source ref is set by the invoking script.
-        ref = "overwritten-by-script",
-        partial_fetch = True,
-    ),
+    # Origin folder is specified via source_ref argument, see import_cronet.sh
+    origin = folder.origin(),
     origin_files = cronet_origin_files,
     destination = git.destination(
         # The destination URL is set by the invoking script.
diff --git a/Cronet/tools/import/import_cronet.sh b/Cronet/tools/import/import_cronet.sh
index eb82551..d0c8deb 100755
--- a/Cronet/tools/import/import_cronet.sh
+++ b/Cronet/tools/import/import_cronet.sh
@@ -33,6 +33,8 @@
     exit 1
 }
 
+COPYBARA_FOLDER_ORIGIN="/tmp/copybara-origin"
+
 #######################################
 # Create upstream-import branch in external/cronet.
 # Globals:
@@ -49,22 +51,59 @@
 }
 
 #######################################
+# Setup folder.origin for copybara inside /tmp
+# Globals:
+#   COPYBARA_FOLDER_ORIGIN
+# Arguments:
+#   new_rev, string
+#######################################
+setup_folder_origin() {
+    local _new_rev=$1
+    mkdir -p "${COPYBARA_FOLDER_ORIGIN}"
+    cd "${COPYBARA_FOLDER_ORIGIN}"
+
+    # For this to work _new_rev must be a branch or a tag.
+    git clone --depth=1 --branch "${_new_rev}" https://chromium.googlesource.com/chromium/src.git
+
+    cat <<EOF >.gclient
+solutions = [
+  {
+    "name": "src",
+    "url": "https://chromium.googlesource.com/chromium/src.git",
+    "managed": False,
+    "custom_deps": {},
+    "custom_vars": {},
+  },
+]
+target_os = ["android"]
+EOF
+    cd src
+    # Set appropriate gclient flags to speed up syncing.
+    gclient sync \
+        --no-history
+        --shallow
+}
+
+#######################################
 # Runs the copybara import of Chromium
 # Globals:
 #   ANDROID_BUILD_TOP
+#   COPYBARA_FOLDER_ORIGIN
 # Arguments:
-#   new_rev, string
 #   last_rev, string or empty
 #   force, string or empty
 #######################################
 do_run_copybara() {
-    local _new_rev=$1
-    local _last_rev=$2
-    local _force=$3
+    local _last_rev=$1
+    local _force=$2
 
     local -a flags
     flags+=(--git-destination-url="file://${ANDROID_BUILD_TOP}/external/cronet")
-    flags+=(--repo-timeout 3h)
+    flags+=(--repo-timeout 3m)
+
+    # buildtools/third_party/libc++ contains an invalid symlink
+    flags+=(--folder-origin-ignore-invalid-symlinks)
+    flags+=(--git-no-verify)
 
     if [ ! -z "${_force}" ]; then
         flags+=(--force)
@@ -77,7 +116,7 @@
     /google/bin/releases/copybara/public/copybara/copybara \
         "${flags[@]}" \
         "${ANDROID_BUILD_TOP}/packages/modules/Connectivity/Cronet/tools/import/copy.bara.sky" \
-        import_cronet "${_new_rev}"
+        import_cronet "${COPYBARA_FOLDER_ORIGIN}/src"
 }
 
 while getopts $OPTSTRING opt; do
@@ -96,5 +135,6 @@
 fi
 
 setup_upstream_import_branch
-do_run_copybara "${new_rev}" "${last_rev}" "${force}"
+setup_folder_origin "${new_rev}"
+do_run_copybara "${last_rev}" "${force}"
 
diff --git a/Tethering/Android.bp b/Tethering/Android.bp
index d2f6d15..8810a8c 100644
--- a/Tethering/Android.bp
+++ b/Tethering/Android.bp
@@ -61,9 +61,13 @@
         "modules-utils-build",
         "modules-utils-statemachine",
         "networkstack-client",
+        // AIDL tetheroffload implementation
+        "android.hardware.tetheroffload-V1-java",
+        // HIDL tetheroffload implementation
         "android.hardware.tetheroffload.config-V1.0-java",
         "android.hardware.tetheroffload.control-V1.0-java",
         "android.hardware.tetheroffload.control-V1.1-java",
+        "android.hidl.manager-V1.2-java",
         "net-utils-framework-common",
         "net-utils-device-common",
         "net-utils-device-common-bpf",
diff --git a/Tethering/apex/Android.bp b/Tethering/apex/Android.bp
index 67206cd..ff5acf5 100644
--- a/Tethering/apex/Android.bp
+++ b/Tethering/apex/Android.bp
@@ -66,11 +66,19 @@
 
 apex_defaults {
     name: "CronetInTetheringApexDefaultsEnabled",
-    jni_libs: ["cronet_aml_components_cronet_android_cronet"],
+    jni_libs: [
+        "//external/cronet:cronet_aml_components_cronet_android_cronet",
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
+    ],
     arch: {
         riscv64: {
             // TODO: remove this when there is a riscv64 libcronet
-            exclude_jni_libs: ["cronet_aml_components_cronet_android_cronet"],
+            exclude_jni_libs: [
+                "//external/cronet:cronet_aml_components_cronet_android_cronet",
+                "//external/cronet/third_party/boringssl:libcrypto",
+                "//external/cronet/third_party/boringssl:libssl",
+            ],
         },
     },
 }
diff --git a/Tethering/common/TetheringLib/Android.bp b/Tethering/common/TetheringLib/Android.bp
index 4c677d0..a3756e0 100644
--- a/Tethering/common/TetheringLib/Android.bp
+++ b/Tethering/common/TetheringLib/Android.bp
@@ -65,6 +65,7 @@
 
     hostdex: true, // for hiddenapi check
     permitted_packages: ["android.net"],
+    lint: { strict_updatability_linting: true },
 }
 
 java_defaults {
@@ -74,27 +75,18 @@
 
 java_defaults {
     name: "CronetJavaDefaultsEnabled",
-    srcs: [":cronet_aml_api_sources"],
+    srcs: ["//external/cronet:cronet_aml_api_sources"],
     libs: [
         "androidx.annotation_annotation",
     ],
     impl_only_static_libs: [
-        "cronet_aml_java",
+        "//external/cronet:cronet_aml_java",
     ],
-    // STOPSHIP(b/265674359): fix all Cronet lint warnings and re-enable lint
-    // directly in framework-tethering
-    lint: {
-         enabled: false,
-    },
-    api_lint: {
-        enabled: false,
-    },
     api_dir: "cronet_enabled/api",
 }
 
 java_defaults {
   name: "CronetJavaDefaultsDisabled",
-  lint: { strict_updatability_linting: true },
 }
 
 java_defaults {
@@ -109,8 +101,8 @@
 java_defaults {
   name: "CronetJavaPrejarjarDefaultsEnabled",
   static_libs: [
-    "cronet_aml_api_java",
-    "cronet_aml_java"
+    "//external/cronet:cronet_aml_api_java",
+    "//external/cronet:cronet_aml_java"
   ],
 }
 
@@ -135,7 +127,7 @@
     out: ["framework_tethering_jarjar_rules.txt"],
     cmd: "$(location jarjar-rules-generator) " +
         "$(location :framework-tethering-pre-jarjar{.jar}) " +
-        "--apistubs $(location :framework-tethering.stubs.module_lib{.jar}) " + 
+        "--apistubs $(location :framework-tethering.stubs.module_lib{.jar}) " +
         "--prefix android.net.http.internal " +
         "--excludes $(location jarjar-excludes.txt) " +
         "--output $(out)",
@@ -159,6 +151,7 @@
 
 filegroup {
     name: "framework-tethering-srcs",
+    defaults: ["framework-sources-module-defaults"],
     srcs: [
         "src/**/*.aidl",
         "src/**/*.java",
diff --git a/Tethering/common/TetheringLib/cronet_enabled/api/current.txt b/Tethering/common/TetheringLib/cronet_enabled/api/current.txt
index 7bdc0e4..333ea1c 100644
--- a/Tethering/common/TetheringLib/cronet_enabled/api/current.txt
+++ b/Tethering/common/TetheringLib/cronet_enabled/api/current.txt
@@ -5,21 +5,18 @@
     ctor public BidirectionalStream();
     method public abstract void cancel();
     method public abstract void flush();
+    method @NonNull public abstract android.net.http.HeaderBlock getHeaders();
+    method @NonNull public abstract String getHttpMethod();
+    method public abstract int getPriority();
+    method public abstract int getTrafficStatsTag();
+    method public abstract int getTrafficStatsUid();
+    method public abstract boolean hasTrafficStatsTag();
+    method public abstract boolean hasTrafficStatsUid();
+    method public abstract boolean isDelayRequestHeadersUntilFirstFlushEnabled();
     method public abstract boolean isDone();
     method public abstract void read(@NonNull java.nio.ByteBuffer);
     method public abstract void start();
     method public abstract void write(@NonNull java.nio.ByteBuffer, boolean);
-  }
-
-  public abstract static class BidirectionalStream.Builder {
-    ctor public BidirectionalStream.Builder();
-    method @NonNull public abstract android.net.http.BidirectionalStream.Builder addHeader(@NonNull String, @NonNull String);
-    method @NonNull public abstract android.net.http.BidirectionalStream build();
-    method @NonNull public abstract android.net.http.BidirectionalStream.Builder delayRequestHeadersUntilFirstFlush(boolean);
-    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setHttpMethod(@NonNull String);
-    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setPriority(int);
-    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setTrafficStatsTag(int);
-    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setTrafficStatsUid(int);
     field public static final int STREAM_PRIORITY_HIGHEST = 4; // 0x4
     field public static final int STREAM_PRIORITY_IDLE = 0; // 0x0
     field public static final int STREAM_PRIORITY_LOW = 2; // 0x2
@@ -27,16 +24,26 @@
     field public static final int STREAM_PRIORITY_MEDIUM = 3; // 0x3
   }
 
-  public abstract static class BidirectionalStream.Callback {
-    ctor public BidirectionalStream.Callback();
+  public abstract static class BidirectionalStream.Builder {
+    ctor public BidirectionalStream.Builder();
+    method @NonNull public abstract android.net.http.BidirectionalStream.Builder addHeader(@NonNull String, @NonNull String);
+    method @NonNull public abstract android.net.http.BidirectionalStream build();
+    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setDelayRequestHeadersUntilFirstFlushEnabled(boolean);
+    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setHttpMethod(@NonNull String);
+    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setPriority(int);
+    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setTrafficStatsTag(int);
+    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setTrafficStatsUid(int);
+  }
+
+  public static interface BidirectionalStream.Callback {
     method public void onCanceled(@NonNull android.net.http.BidirectionalStream, @Nullable android.net.http.UrlResponseInfo);
-    method public abstract void onFailed(@NonNull android.net.http.BidirectionalStream, @Nullable android.net.http.UrlResponseInfo, @NonNull android.net.http.HttpException);
-    method public abstract void onReadCompleted(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer, boolean);
-    method public abstract void onResponseHeadersReceived(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo);
-    method public void onResponseTrailersReceived(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull android.net.http.UrlResponseInfo.HeaderBlock);
-    method public abstract void onStreamReady(@NonNull android.net.http.BidirectionalStream);
-    method public abstract void onSucceeded(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo);
-    method public abstract void onWriteCompleted(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer, boolean);
+    method public void onFailed(@NonNull android.net.http.BidirectionalStream, @Nullable android.net.http.UrlResponseInfo, @NonNull android.net.http.HttpException);
+    method public void onReadCompleted(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer, boolean);
+    method public void onResponseHeadersReceived(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo);
+    method public void onResponseTrailersReceived(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull android.net.http.HeaderBlock);
+    method public void onStreamReady(@NonNull android.net.http.BidirectionalStream);
+    method public void onSucceeded(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo);
+    method public void onWriteCompleted(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer, boolean);
   }
 
   public abstract class CallbackException extends android.net.http.HttpException {
@@ -44,53 +51,65 @@
   }
 
   public class ConnectionMigrationOptions {
-    method @Nullable public Boolean getAllowNonDefaultNetworkUsage();
-    method @Nullable public Boolean getEnableDefaultNetworkMigration();
-    method @Nullable public Boolean getEnablePathDegradationMigration();
+    method public int getAllowNonDefaultNetworkUsage();
+    method public int getDefaultNetworkMigration();
+    method public int getPathDegradationMigration();
+    field public static final int MIGRATION_OPTION_DISABLED = 2; // 0x2
+    field public static final int MIGRATION_OPTION_ENABLED = 1; // 0x1
+    field public static final int MIGRATION_OPTION_UNSPECIFIED = 0; // 0x0
   }
 
   public static final class ConnectionMigrationOptions.Builder {
     ctor public ConnectionMigrationOptions.Builder();
     method @NonNull public android.net.http.ConnectionMigrationOptions build();
-    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setAllowNonDefaultNetworkUsage(boolean);
-    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setEnableDefaultNetworkMigration(boolean);
-    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setEnablePathDegradationMigration(boolean);
+    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setAllowNonDefaultNetworkUsage(int);
+    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setDefaultNetworkMigration(int);
+    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setPathDegradationMigration(int);
   }
 
   public final class DnsOptions {
-    method @Nullable public Boolean getEnableStaleDns();
-    method @Nullable public Boolean getPersistHostCache();
+    method public int getPersistHostCache();
     method @Nullable public java.time.Duration getPersistHostCachePeriod();
-    method @Nullable public Boolean getPreestablishConnectionsToStaleDnsResults();
+    method public int getPreestablishConnectionsToStaleDnsResults();
+    method public int getStaleDns();
     method @Nullable public android.net.http.DnsOptions.StaleDnsOptions getStaleDnsOptions();
-    method @Nullable public Boolean getUseHttpStackDnsResolver();
+    method public int getUseHttpStackDnsResolver();
+    field public static final int DNS_OPTION_DISABLED = 2; // 0x2
+    field public static final int DNS_OPTION_ENABLED = 1; // 0x1
+    field public static final int DNS_OPTION_UNSPECIFIED = 0; // 0x0
   }
 
   public static final class DnsOptions.Builder {
     ctor public DnsOptions.Builder();
     method @NonNull public android.net.http.DnsOptions build();
-    method @NonNull public android.net.http.DnsOptions.Builder setEnableStaleDns(boolean);
-    method @NonNull public android.net.http.DnsOptions.Builder setPersistHostCache(boolean);
+    method @NonNull public android.net.http.DnsOptions.Builder setPersistHostCache(int);
     method @NonNull public android.net.http.DnsOptions.Builder setPersistHostCachePeriod(@NonNull java.time.Duration);
-    method @NonNull public android.net.http.DnsOptions.Builder setPreestablishConnectionsToStaleDnsResults(boolean);
+    method @NonNull public android.net.http.DnsOptions.Builder setPreestablishConnectionsToStaleDnsResults(int);
+    method @NonNull public android.net.http.DnsOptions.Builder setStaleDns(int);
     method @NonNull public android.net.http.DnsOptions.Builder setStaleDnsOptions(@NonNull android.net.http.DnsOptions.StaleDnsOptions);
-    method @NonNull public android.net.http.DnsOptions.Builder setUseHttpStackDnsResolver(boolean);
+    method @NonNull public android.net.http.DnsOptions.Builder setUseHttpStackDnsResolver(int);
   }
 
   public static class DnsOptions.StaleDnsOptions {
-    method @Nullable public Boolean getAllowCrossNetworkUsage();
-    method @Nullable public Long getFreshLookupTimeoutMillis();
-    method @Nullable public Long getMaxExpiredDelayMillis();
-    method @Nullable public Boolean getUseStaleOnNameNotResolved();
+    method public int getAllowCrossNetworkUsage();
+    method @Nullable public java.time.Duration getFreshLookupTimeout();
+    method @Nullable public java.time.Duration getMaxExpiredDelay();
+    method public int getUseStaleOnNameNotResolved();
   }
 
   public static final class DnsOptions.StaleDnsOptions.Builder {
     ctor public DnsOptions.StaleDnsOptions.Builder();
     method @NonNull public android.net.http.DnsOptions.StaleDnsOptions build();
-    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setAllowCrossNetworkUsage(boolean);
+    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setAllowCrossNetworkUsage(int);
     method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setFreshLookupTimeout(@NonNull java.time.Duration);
     method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setMaxExpiredDelay(@NonNull java.time.Duration);
-    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setUseStaleOnNameNotResolved(boolean);
+    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setUseStaleOnNameNotResolved(int);
+  }
+
+  public abstract class HeaderBlock {
+    ctor public HeaderBlock();
+    method @NonNull public abstract java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> getAsList();
+    method @NonNull public abstract java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAsMap();
   }
 
   public abstract class HttpEngine {
@@ -99,7 +118,6 @@
     method @NonNull public static String getVersionString();
     method @NonNull public abstract android.net.http.BidirectionalStream.Builder newBidirectionalStreamBuilder(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.net.http.BidirectionalStream.Callback);
     method @NonNull public abstract android.net.http.UrlRequest.Builder newUrlRequestBuilder(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.net.http.UrlRequest.Callback);
-    method @NonNull public android.net.http.UrlRequest.Builder newUrlRequestBuilder(@NonNull String, @NonNull android.net.http.UrlRequest.Callback, @NonNull java.util.concurrent.Executor);
     method @NonNull public abstract java.net.URLConnection openConnection(@NonNull java.net.URL) throws java.io.IOException;
     method public abstract void shutdown();
   }
@@ -156,9 +174,11 @@
   }
 
   public class QuicOptions {
+    method @NonNull public java.util.Set<java.lang.String> getAllowedQuicHosts();
     method @Nullable public String getHandshakeUserAgent();
-    method @Nullable public Integer getInMemoryServerConfigsCacheSize();
-    method @NonNull public java.util.Set<java.lang.String> getQuicHostAllowlist();
+    method @Nullable public java.time.Duration getIdleConnectionTimeout();
+    method public int getInMemoryServerConfigsCacheSize();
+    method public boolean hasInMemoryServerConfigsCacheSize();
   }
 
   public static final class QuicOptions.Builder {
@@ -189,23 +209,19 @@
   public abstract class UrlRequest {
     method public abstract void cancel();
     method public abstract void followRedirect();
+    method @NonNull public abstract android.net.http.HeaderBlock getHeaders();
+    method @Nullable public abstract String getHttpMethod();
+    method public abstract int getPriority();
     method public abstract void getStatus(@NonNull android.net.http.UrlRequest.StatusListener);
+    method public abstract int getTrafficStatsTag();
+    method public abstract int getTrafficStatsUid();
+    method public abstract boolean hasTrafficStatsTag();
+    method public abstract boolean hasTrafficStatsUid();
+    method public abstract boolean isCacheDisabled();
+    method public abstract boolean isDirectExecutorAllowed();
     method public abstract boolean isDone();
     method public abstract void read(@NonNull java.nio.ByteBuffer);
     method public abstract void start();
-  }
-
-  public abstract static class UrlRequest.Builder {
-    method @NonNull public abstract android.net.http.UrlRequest.Builder addHeader(@NonNull String, @NonNull String);
-    method @NonNull public abstract android.net.http.UrlRequest.Builder bindToNetwork(@Nullable android.net.Network);
-    method @NonNull public abstract android.net.http.UrlRequest build();
-    method @NonNull public abstract android.net.http.UrlRequest.Builder setAllowDirectExecutor(boolean);
-    method @NonNull public abstract android.net.http.UrlRequest.Builder setDisableCache(boolean);
-    method @NonNull public abstract android.net.http.UrlRequest.Builder setHttpMethod(@NonNull String);
-    method @NonNull public abstract android.net.http.UrlRequest.Builder setPriority(int);
-    method @NonNull public abstract android.net.http.UrlRequest.Builder setTrafficStatsTag(int);
-    method @NonNull public abstract android.net.http.UrlRequest.Builder setTrafficStatsUid(int);
-    method @NonNull public abstract android.net.http.UrlRequest.Builder setUploadDataProvider(@NonNull android.net.http.UploadDataProvider, @NonNull java.util.concurrent.Executor);
     field public static final int REQUEST_PRIORITY_HIGHEST = 4; // 0x4
     field public static final int REQUEST_PRIORITY_IDLE = 0; // 0x0
     field public static final int REQUEST_PRIORITY_LOW = 2; // 0x2
@@ -213,14 +229,26 @@
     field public static final int REQUEST_PRIORITY_MEDIUM = 3; // 0x3
   }
 
-  public abstract static class UrlRequest.Callback {
-    ctor public UrlRequest.Callback();
+  public abstract static class UrlRequest.Builder {
+    method @NonNull public abstract android.net.http.UrlRequest.Builder addHeader(@NonNull String, @NonNull String);
+    method @NonNull public abstract android.net.http.UrlRequest.Builder bindToNetwork(@Nullable android.net.Network);
+    method @NonNull public abstract android.net.http.UrlRequest build();
+    method @NonNull public abstract android.net.http.UrlRequest.Builder setCacheDisabled(boolean);
+    method @NonNull public abstract android.net.http.UrlRequest.Builder setDirectExecutorAllowed(boolean);
+    method @NonNull public abstract android.net.http.UrlRequest.Builder setHttpMethod(@NonNull String);
+    method @NonNull public abstract android.net.http.UrlRequest.Builder setPriority(int);
+    method @NonNull public abstract android.net.http.UrlRequest.Builder setTrafficStatsTag(int);
+    method @NonNull public abstract android.net.http.UrlRequest.Builder setTrafficStatsUid(int);
+    method @NonNull public abstract android.net.http.UrlRequest.Builder setUploadDataProvider(@NonNull android.net.http.UploadDataProvider, @NonNull java.util.concurrent.Executor);
+  }
+
+  public static interface UrlRequest.Callback {
     method public void onCanceled(@NonNull android.net.http.UrlRequest, @Nullable android.net.http.UrlResponseInfo);
-    method public abstract void onFailed(@NonNull android.net.http.UrlRequest, @Nullable android.net.http.UrlResponseInfo, @NonNull android.net.http.HttpException);
-    method public abstract void onReadCompleted(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer) throws java.lang.Exception;
-    method public abstract void onRedirectReceived(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo, @NonNull String) throws java.lang.Exception;
-    method public abstract void onResponseStarted(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo) throws java.lang.Exception;
-    method public abstract void onSucceeded(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo);
+    method public void onFailed(@NonNull android.net.http.UrlRequest, @Nullable android.net.http.UrlResponseInfo, @NonNull android.net.http.HttpException);
+    method public void onReadCompleted(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer) throws java.lang.Exception;
+    method public void onRedirectReceived(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo, @NonNull String) throws java.lang.Exception;
+    method public void onResponseStarted(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo) throws java.lang.Exception;
+    method public void onSucceeded(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo);
   }
 
   public static class UrlRequest.Status {
@@ -248,7 +276,7 @@
 
   public abstract class UrlResponseInfo {
     ctor public UrlResponseInfo();
-    method @NonNull public abstract android.net.http.UrlResponseInfo.HeaderBlock getHeaders();
+    method @NonNull public abstract android.net.http.HeaderBlock getHeaders();
     method public abstract int getHttpStatusCode();
     method @NonNull public abstract String getHttpStatusText();
     method @NonNull public abstract String getNegotiatedProtocol();
@@ -258,11 +286,5 @@
     method public abstract boolean wasCached();
   }
 
-  public abstract static class UrlResponseInfo.HeaderBlock {
-    ctor public UrlResponseInfo.HeaderBlock();
-    method @NonNull public abstract java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> getAsList();
-    method @NonNull public abstract java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAsMap();
-  }
-
 }
 
diff --git a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java
index 9f8d9b1..976f5df 100644
--- a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java
+++ b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java
@@ -37,6 +37,7 @@
 
 import android.app.usage.NetworkStatsManager;
 import android.net.INetd;
+import android.net.LinkProperties;
 import android.net.MacAddress;
 import android.net.NetworkStats;
 import android.net.NetworkStats.Entry;
@@ -878,6 +879,27 @@
         return true;
     }
 
+    private int getMtu(@NonNull final String ifaceName, @NonNull final LinkProperties lp) {
+        int mtu = INVALID_MTU;
+
+        if (ifaceName.equals(lp.getInterfaceName())) {
+            mtu = lp.getMtu();
+        }
+
+        // Get mtu via kernel if mtu is not found in LinkProperties.
+        if (mtu == INVALID_MTU) {
+            mtu = mDeps.getNetworkInterfaceMtu(ifaceName);
+        }
+
+        // Use default mtu if can't find any.
+        if (mtu == INVALID_MTU) mtu = NetworkStackConstants.ETHER_MTU;
+
+        // Clamp to minimum ipv4 mtu
+        if (mtu < IPV4_MIN_MTU) mtu = IPV4_MIN_MTU;
+
+        return mtu;
+    }
+
     /**
      * Call when UpstreamNetworkState may be changed.
      * If upstream has ipv4 for tethering, update this new UpstreamNetworkState
@@ -900,16 +922,7 @@
             final String ifaceName = ns.linkProperties.getInterfaceName();
             final InterfaceParams params = mDeps.getInterfaceParams(ifaceName);
             final boolean isVcn = isVcnInterface(ifaceName);
-            mtu = ns.linkProperties.getMtu();
-            if (mtu == INVALID_MTU) {
-                // Get mtu via kernel if mtu is not found in LinkProperties.
-                mtu = mDeps.getNetworkInterfaceMtu(ifaceName);
-            }
-
-            // Use default mtu if can't find any.
-            if (mtu == INVALID_MTU) mtu = NetworkStackConstants.ETHER_MTU;
-            // Clamp to minimum ipv4 mtu
-            if (mtu < IPV4_MIN_MTU) mtu = IPV4_MIN_MTU;
+            mtu = getMtu(ifaceName, ns.linkProperties);
 
             if (!isVcn && params != null && !params.hasMacAddress /* raw ip upstream only */) {
                 upstreamIndex = params.index;
diff --git a/Tethering/src/com/android/networkstack/tethering/IOffloadHal.java b/Tethering/src/com/android/networkstack/tethering/IOffloadHal.java
new file mode 100644
index 0000000..e66e7ae
--- /dev/null
+++ b/Tethering/src/com/android/networkstack/tethering/IOffloadHal.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.tethering;
+
+import android.annotation.NonNull;
+import android.os.NativeHandle;
+
+import com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;
+import com.android.networkstack.tethering.OffloadHardwareInterface.OffloadHalCallback;
+
+import java.util.ArrayList;
+
+/** Abstraction of Tetheroffload HAL interface */
+interface IOffloadHal {
+    /*
+     * Initialize the Tetheroffload HAL. Offload management process need to know conntrack rules to
+     * support NAT, but it may not have permission to create netlink netfilter sockets. Create two
+     * netlink netfilter sockets and share them with offload management process.
+     */
+    boolean initOffload(@NonNull NativeHandle handle1, @NonNull NativeHandle handle2,
+            @NonNull OffloadHalCallback callback);
+
+    /** Stop the Tetheroffload HAL. */
+    boolean stopOffload();
+
+    /** Get HAL interface version number. */
+    int getVersion();
+
+    /** Get Tx/Rx usage from last query. */
+    ForwardedStats getForwardedStats(@NonNull String upstream);
+
+    /** Set local prefixes to offload management process. */
+    boolean setLocalPrefixes(@NonNull ArrayList<String> localPrefixes);
+
+    /** Set data limit value to offload management process. */
+    boolean setDataLimit(@NonNull String iface, long limit);
+
+    /** Set data warning and limit value to offload management process. */
+    boolean setDataWarningAndLimit(@NonNull String iface, long warning, long limit);
+
+    /** Set upstream parameters to offload management process. */
+    boolean setUpstreamParameters(@NonNull String iface, @NonNull String v4addr,
+            @NonNull String v4gateway, @NonNull ArrayList<String> v6gws);
+
+    /** Add downstream prefix to offload management process. */
+    boolean addDownstream(@NonNull String ifname, @NonNull String prefix);
+
+    /** Remove downstream prefix from offload management process. */
+    boolean removeDownstream(@NonNull String ifname, @NonNull String prefix);
+}
diff --git a/Tethering/src/com/android/networkstack/tethering/OffloadController.java b/Tethering/src/com/android/networkstack/tethering/OffloadController.java
index d2f177d..5fa6b2d 100644
--- a/Tethering/src/com/android/networkstack/tethering/OffloadController.java
+++ b/Tethering/src/com/android/networkstack/tethering/OffloadController.java
@@ -26,8 +26,8 @@
 import static android.net.netstats.provider.NetworkStatsProvider.QUOTA_UNLIMITED;
 import static android.provider.Settings.Global.TETHER_OFFLOAD_DISABLED;
 
-import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_0;
-import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_1;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_0;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_1;
 import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_NONE;
 import static com.android.networkstack.tethering.TetheringConfiguration.DEFAULT_TETHER_OFFLOAD_POLL_INTERVAL_MS;
 
@@ -98,9 +98,8 @@
     private final OffloadTetheringStatsProvider mStatsProvider;
     private final SharedLog mLog;
     private final HashMap<String, LinkProperties> mDownstreams;
-    private boolean mConfigInitialized;
     @OffloadHardwareInterface.OffloadHalVersion
-    private int mControlHalVersion;
+    private int mOffloadHalVersion;
     private LinkProperties mUpstreamLinkProperties;
     // The complete set of offload-exempt prefixes passed in via Tethering from
     // all upstream and downstream sources.
@@ -205,20 +204,11 @@
             return false;
         }
 
-        if (!mConfigInitialized) {
-            mConfigInitialized = mHwInterface.initOffloadConfig();
-            if (!mConfigInitialized) {
-                mLog.i("tethering offload config not supported");
-                stop();
-                return false;
-            }
-        }
-
-        mControlHalVersion = mHwInterface.initOffloadControl(
+        mOffloadHalVersion = mHwInterface.initOffload(
                 // OffloadHardwareInterface guarantees that these callback
                 // methods are called on the handler passed to it, which is the
                 // same as mHandler, as coordinated by the setup in Tethering.
-                new OffloadHardwareInterface.ControlCallback() {
+                new OffloadHardwareInterface.OffloadHalCallback() {
                     @Override
                     public void onStarted() {
                         if (!started()) return;
@@ -305,11 +295,11 @@
 
         final boolean isStarted = started();
         if (!isStarted) {
-            mLog.i("tethering offload control not supported");
+            mLog.i("tethering offload not supported");
             stop();
         } else {
             mLog.log("tethering offload started, version: "
-                    + OffloadHardwareInterface.halVerToString(mControlHalVersion));
+                    + OffloadHardwareInterface.halVerToString(mOffloadHalVersion));
             mNatUpdateCallbacksReceived = 0;
             mNatUpdateNetlinkErrors = 0;
             maybeSchedulePollingStats();
@@ -325,9 +315,8 @@
         final boolean wasStarted = started();
         updateStatsForCurrentUpstream();
         mUpstreamLinkProperties = null;
-        mHwInterface.stopOffloadControl();
-        mControlHalVersion = OFFLOAD_HAL_VERSION_NONE;
-        mConfigInitialized = false;
+        mHwInterface.stopOffload();
+        mOffloadHalVersion = OFFLOAD_HAL_VERSION_NONE;
         if (mHandler.hasCallbacks(mScheduledPollingTask)) {
             mHandler.removeCallbacks(mScheduledPollingTask);
         }
@@ -335,7 +324,7 @@
     }
 
     private boolean started() {
-        return mConfigInitialized && mControlHalVersion != OFFLOAD_HAL_VERSION_NONE;
+        return mOffloadHalVersion != OFFLOAD_HAL_VERSION_NONE;
     }
 
     @VisibleForTesting
@@ -528,7 +517,7 @@
     }
 
     private boolean useStatsPolling() {
-        return mControlHalVersion == OFFLOAD_HAL_VERSION_1_0;
+        return mOffloadHalVersion == OFFLOAD_HAL_VERSION_HIDL_1_0;
     }
 
     private boolean maybeUpdateDataWarningAndLimit(String iface) {
@@ -540,7 +529,7 @@
 
         final InterfaceQuota quota = mInterfaceQuotas.getOrDefault(iface, InterfaceQuota.MAX_VALUE);
         final boolean ret;
-        if (mControlHalVersion >= OFFLOAD_HAL_VERSION_1_1) {
+        if (mOffloadHalVersion >= OFFLOAD_HAL_VERSION_HIDL_1_1) {
             ret = mHwInterface.setDataWarningAndLimit(iface, quota.warningBytes, quota.limitBytes);
         } else {
             ret = mHwInterface.setDataLimit(iface, quota.limitBytes);
@@ -611,7 +600,7 @@
         for (RouteInfo ri : oldRoutes) {
             if (shouldIgnoreDownstreamRoute(ri)) continue;
             if (!newRoutes.contains(ri)) {
-                mHwInterface.removeDownstreamPrefix(ifname, ri.getDestination().toString());
+                mHwInterface.removeDownstream(ifname, ri.getDestination().toString());
             }
         }
 
@@ -619,7 +608,7 @@
         for (RouteInfo ri : newRoutes) {
             if (shouldIgnoreDownstreamRoute(ri)) continue;
             if (!oldRoutes.contains(ri)) {
-                mHwInterface.addDownstreamPrefix(ifname, ri.getDestination().toString());
+                mHwInterface.addDownstream(ifname, ri.getDestination().toString());
             }
         }
     }
@@ -639,7 +628,7 @@
 
         for (RouteInfo route : lp.getRoutes()) {
             if (shouldIgnoreDownstreamRoute(route)) continue;
-            mHwInterface.removeDownstreamPrefix(ifname, route.getDestination().toString());
+            mHwInterface.removeDownstream(ifname, route.getDestination().toString());
         }
     }
 
@@ -768,7 +757,7 @@
         final boolean isStarted = started();
         pw.println("Offload HALs " + (isStarted ? "started" : "not started"));
         pw.println("Offload Control HAL version: "
-                + OffloadHardwareInterface.halVerToString(mControlHalVersion));
+                + OffloadHardwareInterface.halVerToString(mOffloadHalVersion));
         LinkProperties lp = mUpstreamLinkProperties;
         String upstream = (lp != null) ? lp.getInterfaceName() : null;
         pw.println("Current upstream: " + upstream);
diff --git a/Tethering/src/com/android/networkstack/tethering/OffloadHalAidlImpl.java b/Tethering/src/com/android/networkstack/tethering/OffloadHalAidlImpl.java
new file mode 100644
index 0000000..e7dc757
--- /dev/null
+++ b/Tethering/src/com/android/networkstack/tethering/OffloadHalAidlImpl.java
@@ -0,0 +1,304 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.tethering;
+
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_AIDL;
+
+import android.annotation.NonNull;
+import android.hardware.tetheroffload.ForwardedStats;
+import android.hardware.tetheroffload.IOffload;
+import android.hardware.tetheroffload.ITetheringOffloadCallback;
+import android.hardware.tetheroffload.NatTimeoutUpdate;
+import android.hardware.tetheroffload.NetworkProtocol;
+import android.hardware.tetheroffload.OffloadCallbackEvent;
+import android.os.Handler;
+import android.os.NativeHandle;
+import android.os.ParcelFileDescriptor;
+import android.os.ServiceManager;
+import android.system.OsConstants;
+
+import com.android.modules.utils.build.SdkLevel;
+import com.android.net.module.util.SharedLog;
+import com.android.networkstack.tethering.OffloadHardwareInterface.OffloadHalCallback;
+
+import java.util.ArrayList;
+
+/**
+ * The implementation of IOffloadHal which based on Stable AIDL interface
+ */
+public class OffloadHalAidlImpl implements IOffloadHal {
+    private static final String TAG = OffloadHalAidlImpl.class.getSimpleName();
+    private static final String HAL_INSTANCE_NAME = IOffload.DESCRIPTOR + "/default";
+
+    private final Handler mHandler;
+    private final SharedLog mLog;
+    private final IOffload mIOffload;
+    @OffloadHardwareInterface.OffloadHalVersion
+    private final int mOffloadVersion;
+
+    private TetheringOffloadCallback mTetheringOffloadCallback;
+
+    public OffloadHalAidlImpl(int version, @NonNull IOffload offload, @NonNull Handler handler,
+            @NonNull SharedLog log) {
+        mOffloadVersion = version;
+        mIOffload = offload;
+        mHandler = handler;
+        mLog = log.forSubComponent(TAG);
+    }
+
+    /**
+     * Initialize the Tetheroffload HAL. Provides bound netlink file descriptors for use in the
+     * management process.
+     */
+    public boolean initOffload(@NonNull NativeHandle handle1, @NonNull NativeHandle handle2,
+            @NonNull OffloadHalCallback callback) {
+        final String methodStr = String.format("initOffload(%d, %d, %s)",
+                handle1.getFileDescriptor().getInt$(), handle2.getFileDescriptor().getInt$(),
+                (callback == null) ? "null"
+                : "0x" + Integer.toHexString(System.identityHashCode(callback)));
+        mTetheringOffloadCallback = new TetheringOffloadCallback(mHandler, callback, mLog);
+        try {
+            mIOffload.initOffload(
+                    ParcelFileDescriptor.adoptFd(handle1.getFileDescriptor().getInt$()),
+                    ParcelFileDescriptor.adoptFd(handle2.getFileDescriptor().getInt$()),
+                    mTetheringOffloadCallback);
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+            return false;
+        }
+        mLog.i(methodStr);
+        return true;
+    }
+
+    /** Stop the Tetheroffload HAL. */
+    public boolean stopOffload() {
+        final String methodStr = "stopOffload()";
+        try {
+            mIOffload.stopOffload();
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+            return false;
+        }
+
+        mTetheringOffloadCallback = null;
+        mLog.i(methodStr);
+        return true;
+    }
+
+    /** Get HAL interface version number. */
+    public int getVersion() {
+        return mOffloadVersion;
+    }
+
+    /** Get Tx/Rx usage from last query. */
+    public OffloadHardwareInterface.ForwardedStats getForwardedStats(@NonNull String upstream) {
+        ForwardedStats stats = new ForwardedStats();
+        final String methodStr = String.format("getForwardedStats(%s)",  upstream);
+        try {
+            stats = mIOffload.getForwardedStats(upstream);
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+        }
+        mLog.i(methodStr);
+        return new OffloadHardwareInterface.ForwardedStats(stats.rxBytes, stats.txBytes);
+    }
+
+    /** Set local prefixes to offload management process. */
+    public boolean setLocalPrefixes(@NonNull ArrayList<String> localPrefixes) {
+        final String methodStr = String.format("setLocalPrefixes([%s])",
+                String.join(",", localPrefixes));
+        try {
+            mIOffload.setLocalPrefixes(localPrefixes.toArray(new String[localPrefixes.size()]));
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+            return false;
+        }
+        mLog.i(methodStr);
+        return true;
+    }
+
+    /**
+     * Set data limit value to offload management process.
+     * Method setDataLimit is deprecated in AIDL, so call setDataWarningAndLimit instead,
+     * with warningBytes set to its MAX_VALUE.
+     */
+    public boolean setDataLimit(@NonNull String iface, long limit) {
+        final long warning = Long.MAX_VALUE;
+        final String methodStr = String.format("setDataLimit(%s, %d)", iface, limit);
+        try {
+            mIOffload.setDataWarningAndLimit(iface, warning, limit);
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+            return false;
+        }
+        mLog.i(methodStr);
+        return true;
+    }
+
+    /** Set data warning and limit value to offload management process. */
+    public boolean setDataWarningAndLimit(@NonNull String iface, long warning, long limit) {
+        final String methodStr =
+                String.format("setDataWarningAndLimit(%s, %d, %d)", iface, warning, limit);
+        try {
+            mIOffload.setDataWarningAndLimit(iface, warning, limit);
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+            return false;
+        }
+        mLog.i(methodStr);
+        return true;
+    }
+
+    /** Set upstream parameters to offload management process. */
+    public boolean setUpstreamParameters(@NonNull String iface, @NonNull String v4addr,
+            @NonNull String v4gateway, @NonNull ArrayList<String> v6gws) {
+        final String methodStr = String.format("setUpstreamParameters(%s, %s, %s, [%s])",
+                iface, v4addr, v4gateway, String.join(",", v6gws));
+        try {
+            mIOffload.setUpstreamParameters(iface, v4addr, v4gateway,
+                    v6gws.toArray(new String[v6gws.size()]));
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+            return false;
+        }
+        mLog.i(methodStr);
+        return true;
+    }
+
+    /** Add downstream prefix to offload management process. */
+    public boolean addDownstream(@NonNull String ifname, @NonNull String prefix) {
+        final String methodStr = String.format("addDownstream(%s, %s)", ifname, prefix);
+        try {
+            mIOffload.addDownstream(ifname, prefix);
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+            return false;
+        }
+        mLog.i(methodStr);
+        return true;
+    }
+
+    /** Remove downstream prefix from offload management process. */
+    public boolean removeDownstream(@NonNull String ifname, @NonNull String prefix) {
+        final String methodStr = String.format("removeDownstream(%s, %s)", ifname, prefix);
+        try {
+            mIOffload.removeDownstream(ifname, prefix);
+        } catch (Exception e) {
+            logAndIgnoreException(e, methodStr);
+            return false;
+        }
+        mLog.i(methodStr);
+        return true;
+    }
+
+    /**
+     * Get {@link IOffloadHal} object from the AIDL service.
+     *
+     * @param handler {@link Handler} to specify the thread upon which the callback will be invoked.
+     * @param log Log to be used by the repository.
+     */
+    public static IOffloadHal getIOffloadHal(Handler handler, SharedLog log) {
+        // Tetheroffload AIDL interface is only supported after U.
+        if (!SdkLevel.isAtLeastU() || !ServiceManager.isDeclared(HAL_INSTANCE_NAME)) return null;
+
+        IOffload offload = IOffload.Stub.asInterface(
+                ServiceManager.waitForDeclaredService(HAL_INSTANCE_NAME));
+        if (offload == null) return null;
+
+        return new OffloadHalAidlImpl(OFFLOAD_HAL_VERSION_AIDL, offload, handler, log);
+    }
+
+    private void logAndIgnoreException(Exception e, final String methodStr) {
+        mLog.e(methodStr + " failed with " + e.getClass().getSimpleName() + ": ", e);
+    }
+
+    private static class TetheringOffloadCallback extends ITetheringOffloadCallback.Stub {
+        public final Handler handler;
+        public final OffloadHalCallback callback;
+        public final SharedLog log;
+
+        TetheringOffloadCallback(
+                Handler h, OffloadHalCallback cb, SharedLog sharedLog) {
+            handler = h;
+            callback = cb;
+            log = sharedLog;
+        }
+
+        private void handleOnEvent(int event) {
+            switch (event) {
+                case OffloadCallbackEvent.OFFLOAD_STARTED:
+                    callback.onStarted();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_STOPPED_ERROR:
+                    callback.onStoppedError();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_STOPPED_UNSUPPORTED:
+                    callback.onStoppedUnsupported();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_SUPPORT_AVAILABLE:
+                    callback.onSupportAvailable();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_STOPPED_LIMIT_REACHED:
+                    callback.onStoppedLimitReached();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_WARNING_REACHED:
+                    callback.onWarningReached();
+                    break;
+                default:
+                    log.e("Unsupported OffloadCallbackEvent: " + event);
+            }
+        }
+
+        @Override
+        public void onEvent(int event) {
+            handler.post(() -> {
+                handleOnEvent(event);
+            });
+        }
+
+        @Override
+        public void updateTimeout(NatTimeoutUpdate params) {
+            handler.post(() -> {
+                callback.onNatTimeoutUpdate(
+                        networkProtocolToOsConstant(params.proto),
+                        params.src.addr, params.src.port,
+                        params.dst.addr, params.dst.port);
+            });
+        }
+
+        @Override
+        public String getInterfaceHash() {
+            return ITetheringOffloadCallback.HASH;
+        }
+
+        @Override
+        public int getInterfaceVersion() {
+            return ITetheringOffloadCallback.VERSION;
+        }
+    }
+
+    private static int networkProtocolToOsConstant(int proto) {
+        switch (proto) {
+            case NetworkProtocol.TCP: return OsConstants.IPPROTO_TCP;
+            case NetworkProtocol.UDP: return OsConstants.IPPROTO_UDP;
+            default:
+                // The caller checks this value and will log an error. Just make
+                // sure it won't collide with valid OsConstants.IPPROTO_* values.
+                return -Math.abs(proto);
+        }
+    }
+}
diff --git a/Tethering/src/com/android/networkstack/tethering/OffloadHalHidlImpl.java b/Tethering/src/com/android/networkstack/tethering/OffloadHalHidlImpl.java
new file mode 100644
index 0000000..3e02543
--- /dev/null
+++ b/Tethering/src/com/android/networkstack/tethering/OffloadHalHidlImpl.java
@@ -0,0 +1,436 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.tethering;
+
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_0;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_1;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_NONE;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.halVerToString;
+import static com.android.networkstack.tethering.util.TetheringUtils.uint16;
+
+import android.annotation.NonNull;
+import android.hardware.tetheroffload.config.V1_0.IOffloadConfig;
+import android.hardware.tetheroffload.control.V1_0.IOffloadControl;
+import android.hardware.tetheroffload.control.V1_0.NatTimeoutUpdate;
+import android.hardware.tetheroffload.control.V1_0.NetworkProtocol;
+import android.hardware.tetheroffload.control.V1_0.OffloadCallbackEvent;
+import android.hardware.tetheroffload.control.V1_1.ITetheringOffloadCallback;
+import android.os.Handler;
+import android.os.NativeHandle;
+import android.os.RemoteException;
+import android.system.OsConstants;
+import android.util.Log;
+
+import com.android.net.module.util.SharedLog;
+import com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;
+import com.android.networkstack.tethering.OffloadHardwareInterface.OffloadHalCallback;
+
+import java.util.ArrayList;
+import java.util.NoSuchElementException;
+
+/**
+ * The implementation of IOffloadHal which based on HIDL interfaces
+ */
+public class OffloadHalHidlImpl implements IOffloadHal {
+    private static final String TAG = OffloadHalHidlImpl.class.getSimpleName();
+    private static final String YIELDS = " -> ";
+
+    private final Handler mHandler;
+    private final SharedLog mLog;
+    private final IOffloadConfig mIOffloadConfig;
+    private final IOffloadControl mIOffloadControl;
+    @OffloadHardwareInterface.OffloadHalVersion
+    private final int mOffloadControlVersion;
+
+    private OffloadHalCallback mOffloadHalCallback;
+    private TetheringOffloadCallback mTetheringOffloadCallback;
+
+    public OffloadHalHidlImpl(int version, @NonNull IOffloadConfig config,
+            @NonNull IOffloadControl control, @NonNull Handler handler, @NonNull SharedLog log) {
+        mOffloadControlVersion = version;
+        mIOffloadConfig = config;
+        mIOffloadControl = control;
+        mHandler = handler;
+        mLog = log.forSubComponent(TAG);
+    }
+
+    /**
+     * Initialize the Tetheroffload HAL. Provides bound netlink file descriptors for use in the
+     * management process.
+     */
+    public boolean initOffload(@NonNull NativeHandle handle1, @NonNull NativeHandle handle2,
+            @NonNull OffloadHalCallback callback) {
+        final String logmsg = String.format("initOffload(%d, %d, %s)",
+                handle1.getFileDescriptor().getInt$(), handle2.getFileDescriptor().getInt$(),
+                (callback == null) ? "null"
+                : "0x" + Integer.toHexString(System.identityHashCode(callback)));
+
+        mOffloadHalCallback = callback;
+        mTetheringOffloadCallback = new TetheringOffloadCallback(
+                mHandler, mOffloadHalCallback, mLog, mOffloadControlVersion);
+        final CbResults results = new CbResults();
+        try {
+            mIOffloadConfig.setHandles(handle1, handle2,
+                    (boolean success, String errMsg) -> {
+                        results.mSuccess = success;
+                        results.mErrMsg = errMsg;
+                    });
+            mIOffloadControl.initOffload(
+                    mTetheringOffloadCallback,
+                    (boolean success, String errMsg) -> {
+                        results.mSuccess = success;
+                        results.mErrMsg = errMsg;
+                    });
+        } catch (RemoteException e) {
+            record(logmsg, e);
+            return false;
+        }
+
+        record(logmsg, results);
+        return results.mSuccess;
+    }
+
+    /** Stop the Tetheroffload HAL. */
+    public boolean stopOffload() {
+        try {
+            mIOffloadControl.stopOffload(
+                    (boolean success, String errMsg) -> {
+                        if (!success) mLog.e("stopOffload failed: " + errMsg);
+                    });
+        } catch (RemoteException e) {
+            mLog.e("failed to stopOffload: " + e);
+        }
+        mOffloadHalCallback = null;
+        mTetheringOffloadCallback = null;
+        mLog.log("stopOffload()");
+        return true;
+    }
+
+    /** Get HAL interface version number. */
+    public int getVersion() {
+        return mOffloadControlVersion;
+    }
+
+    /** Get Tx/Rx usage from last query. */
+    public ForwardedStats getForwardedStats(@NonNull String upstream) {
+        final String logmsg = String.format("getForwardedStats(%s)",  upstream);
+
+        final ForwardedStats stats = new ForwardedStats();
+        try {
+            mIOffloadControl.getForwardedStats(
+                    upstream,
+                    (long rxBytes, long txBytes) -> {
+                        stats.rxBytes = (rxBytes > 0) ? rxBytes : 0;
+                        stats.txBytes = (txBytes > 0) ? txBytes : 0;
+                    });
+        } catch (RemoteException e) {
+            record(logmsg, e);
+            return stats;
+        }
+
+        return stats;
+    }
+
+    /** Set local prefixes to offload management process. */
+    public boolean setLocalPrefixes(@NonNull ArrayList<String> localPrefixes) {
+        final String logmsg = String.format("setLocalPrefixes([%s])",
+                String.join(",", localPrefixes));
+
+        final CbResults results = new CbResults();
+        try {
+            mIOffloadControl.setLocalPrefixes(localPrefixes,
+                    (boolean success, String errMsg) -> {
+                        results.mSuccess = success;
+                        results.mErrMsg = errMsg;
+                    });
+        } catch (RemoteException e) {
+            record(logmsg, e);
+            return false;
+        }
+
+        record(logmsg, results);
+        return results.mSuccess;
+    }
+
+    /** Set data limit value to offload management process. */
+    public boolean setDataLimit(@NonNull String iface, long limit) {
+
+        final String logmsg = String.format("setDataLimit(%s, %d)", iface, limit);
+
+        final CbResults results = new CbResults();
+        try {
+            mIOffloadControl.setDataLimit(
+                    iface, limit,
+                    (boolean success, String errMsg) -> {
+                        results.mSuccess = success;
+                        results.mErrMsg = errMsg;
+                    });
+        } catch (RemoteException e) {
+            record(logmsg, e);
+            return false;
+        }
+
+        record(logmsg, results);
+        return results.mSuccess;
+    }
+
+    /** Set data warning and limit value to offload management process. */
+    public boolean setDataWarningAndLimit(@NonNull String iface, long warning, long limit) {
+        if (mOffloadControlVersion < OFFLOAD_HAL_VERSION_HIDL_1_1) {
+            throw new UnsupportedOperationException(
+                    "setDataWarningAndLimit is not supported below HAL V1.1");
+        }
+        final String logmsg =
+                String.format("setDataWarningAndLimit(%s, %d, %d)", iface, warning, limit);
+
+        final CbResults results = new CbResults();
+        try {
+            ((android.hardware.tetheroffload.control.V1_1.IOffloadControl) mIOffloadControl)
+                    .setDataWarningAndLimit(
+                            iface, warning, limit,
+                            (boolean success, String errMsg) -> {
+                                results.mSuccess = success;
+                                results.mErrMsg = errMsg;
+                            });
+        } catch (RemoteException e) {
+            record(logmsg, e);
+            return false;
+        }
+
+        record(logmsg, results);
+        return results.mSuccess;
+    }
+
+    /** Set upstream parameters to offload management process. */
+    public boolean setUpstreamParameters(@NonNull String iface, @NonNull String v4addr,
+            @NonNull String v4gateway, @NonNull ArrayList<String> v6gws) {
+        final String logmsg = String.format("setUpstreamParameters(%s, %s, %s, [%s])",
+                iface, v4addr, v4gateway, String.join(",", v6gws));
+
+        final CbResults results = new CbResults();
+        try {
+            mIOffloadControl.setUpstreamParameters(
+                    iface, v4addr, v4gateway, v6gws,
+                    (boolean success, String errMsg) -> {
+                        results.mSuccess = success;
+                        results.mErrMsg = errMsg;
+                    });
+        } catch (RemoteException e) {
+            record(logmsg, e);
+            return false;
+        }
+
+        record(logmsg, results);
+        return results.mSuccess;
+    }
+
+    /** Add downstream prefix to offload management process. */
+    public boolean addDownstream(@NonNull String ifname, @NonNull String prefix) {
+        final String logmsg = String.format("addDownstream(%s, %s)", ifname, prefix);
+
+        final CbResults results = new CbResults();
+        try {
+            mIOffloadControl.addDownstream(ifname, prefix,
+                    (boolean success, String errMsg) -> {
+                        results.mSuccess = success;
+                        results.mErrMsg = errMsg;
+                    });
+        } catch (RemoteException e) {
+            record(logmsg, e);
+            return false;
+        }
+
+        record(logmsg, results);
+        return results.mSuccess;
+    }
+
+    /** Remove downstream prefix from offload management process. */
+    public boolean removeDownstream(@NonNull String ifname, @NonNull String prefix) {
+        final String logmsg = String.format("removeDownstream(%s, %s)", ifname, prefix);
+
+        final CbResults results = new CbResults();
+        try {
+            mIOffloadControl.removeDownstream(ifname, prefix,
+                    (boolean success, String errMsg) -> {
+                        results.mSuccess = success;
+                        results.mErrMsg = errMsg;
+                    });
+        } catch (RemoteException e) {
+            record(logmsg, e);
+            return false;
+        }
+
+        record(logmsg, results);
+        return results.mSuccess;
+    }
+
+    /**
+     * Get {@link IOffloadHal} object from the HIDL service.
+     *
+     * @param handler {@link Handler} to specify the thread upon which the callback will be invoked.
+     * @param log Log to be used by the repository.
+     */
+    public static IOffloadHal getIOffloadHal(Handler handler, SharedLog log) {
+        IOffloadConfig config = null;
+        try {
+            config = IOffloadConfig.getService(true /*retry*/);
+        } catch (RemoteException | NoSuchElementException e) {
+            log.e("getIOffloadConfig error " + e);
+            return null;
+        }
+
+        IOffloadControl control = null;
+        int version = OFFLOAD_HAL_VERSION_NONE;
+        try {
+            control = android.hardware.tetheroffload.control
+                    .V1_1.IOffloadControl.getService(true /*retry*/);
+            version = OFFLOAD_HAL_VERSION_HIDL_1_1;
+        } catch (NoSuchElementException e) {
+            // Unsupported by device.
+        } catch (RemoteException e) {
+            log.e("Unable to get offload control " + OFFLOAD_HAL_VERSION_HIDL_1_1);
+        }
+        if (control == null) {
+            try {
+                control = IOffloadControl.getService(true /*retry*/);
+                version = OFFLOAD_HAL_VERSION_HIDL_1_0;
+            } catch (NoSuchElementException e) {
+                // Unsupported by device.
+            } catch (RemoteException e) {
+                log.e("Unable to get offload control " + OFFLOAD_HAL_VERSION_HIDL_1_0);
+            }
+        }
+
+        if (config == null || control == null) return null;
+
+        return new OffloadHalHidlImpl(version, config, control, handler, log);
+    }
+
+    private void record(String msg, Throwable t) {
+        mLog.e(msg + YIELDS + "exception: " + t);
+    }
+
+    private void record(String msg, CbResults results) {
+        final String logmsg = msg + YIELDS + results;
+        if (!results.mSuccess) {
+            mLog.e(logmsg);
+        } else {
+            mLog.log(logmsg);
+        }
+    }
+
+    private static class TetheringOffloadCallback extends ITetheringOffloadCallback.Stub {
+        public final Handler handler;
+        public final OffloadHalCallback callback;
+        public final SharedLog log;
+        private final int mOffloadControlVersion;
+
+        TetheringOffloadCallback(
+                Handler h, OffloadHalCallback cb, SharedLog sharedLog, int offloadControlVersion) {
+            handler = h;
+            callback = cb;
+            log = sharedLog;
+            this.mOffloadControlVersion = offloadControlVersion;
+        }
+
+        private void handleOnEvent(int event) {
+            switch (event) {
+                case OffloadCallbackEvent.OFFLOAD_STARTED:
+                    callback.onStarted();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_STOPPED_ERROR:
+                    callback.onStoppedError();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_STOPPED_UNSUPPORTED:
+                    callback.onStoppedUnsupported();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_SUPPORT_AVAILABLE:
+                    callback.onSupportAvailable();
+                    break;
+                case OffloadCallbackEvent.OFFLOAD_STOPPED_LIMIT_REACHED:
+                    callback.onStoppedLimitReached();
+                    break;
+                case android.hardware.tetheroffload.control
+                        .V1_1.OffloadCallbackEvent.OFFLOAD_WARNING_REACHED:
+                    callback.onWarningReached();
+                    break;
+                default:
+                    log.e("Unsupported OffloadCallbackEvent: " + event);
+            }
+        }
+
+        @Override
+        public void onEvent(int event) {
+            // The implementation should never call onEvent()) if the event is already reported
+            // through newer callback.
+            if (mOffloadControlVersion > OFFLOAD_HAL_VERSION_HIDL_1_0) {
+                Log.wtf(TAG, "onEvent(" + event + ") fired on HAL "
+                        + halVerToString(mOffloadControlVersion));
+            }
+            handler.post(() -> {
+                handleOnEvent(event);
+            });
+        }
+
+        @Override
+        public void onEvent_1_1(int event) {
+            if (mOffloadControlVersion < OFFLOAD_HAL_VERSION_HIDL_1_1) {
+                Log.wtf(TAG, "onEvent_1_1(" + event + ") fired on HAL "
+                        + halVerToString(mOffloadControlVersion));
+                return;
+            }
+            handler.post(() -> {
+                handleOnEvent(event);
+            });
+        }
+
+        @Override
+        public void updateTimeout(NatTimeoutUpdate params) {
+            handler.post(() -> {
+                callback.onNatTimeoutUpdate(
+                        networkProtocolToOsConstant(params.proto),
+                        params.src.addr, uint16(params.src.port),
+                        params.dst.addr, uint16(params.dst.port));
+            });
+        }
+    }
+
+    private static int networkProtocolToOsConstant(int proto) {
+        switch (proto) {
+            case NetworkProtocol.TCP: return OsConstants.IPPROTO_TCP;
+            case NetworkProtocol.UDP: return OsConstants.IPPROTO_UDP;
+            default:
+                // The caller checks this value and will log an error. Just make
+                // sure it won't collide with valid OsConstants.IPPROTO_* values.
+                return -Math.abs(proto);
+        }
+    }
+
+    private static class CbResults {
+        boolean mSuccess;
+        String mErrMsg;
+
+        @Override
+        public String toString() {
+            if (mSuccess) {
+                return "ok";
+            } else {
+                return "fail: " + mErrMsg;
+            }
+        }
+    }
+}
diff --git a/Tethering/src/com/android/networkstack/tethering/OffloadHardwareInterface.java b/Tethering/src/com/android/networkstack/tethering/OffloadHardwareInterface.java
index 76ddfe5..ea20063 100644
--- a/Tethering/src/com/android/networkstack/tethering/OffloadHardwareInterface.java
+++ b/Tethering/src/com/android/networkstack/tethering/OffloadHardwareInterface.java
@@ -18,25 +18,15 @@
 
 import static com.android.net.module.util.netlink.StructNlMsgHdr.NLM_F_DUMP;
 import static com.android.net.module.util.netlink.StructNlMsgHdr.NLM_F_REQUEST;
-import static com.android.networkstack.tethering.util.TetheringUtils.uint16;
 
 import android.annotation.IntDef;
 import android.annotation.NonNull;
-import android.hardware.tetheroffload.config.V1_0.IOffloadConfig;
-import android.hardware.tetheroffload.control.V1_0.IOffloadControl;
-import android.hardware.tetheroffload.control.V1_0.NatTimeoutUpdate;
-import android.hardware.tetheroffload.control.V1_0.NetworkProtocol;
-import android.hardware.tetheroffload.control.V1_0.OffloadCallbackEvent;
-import android.hardware.tetheroffload.control.V1_1.ITetheringOffloadCallback;
 import android.net.util.SocketUtils;
 import android.os.Handler;
 import android.os.NativeHandle;
-import android.os.RemoteException;
 import android.system.ErrnoException;
 import android.system.Os;
 import android.system.OsConstants;
-import android.util.Log;
-import android.util.Pair;
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.net.module.util.SharedLog;
@@ -54,8 +44,6 @@
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.NoSuchElementException;
-
 
 /**
  * Capture tethering dependencies, for injection.
@@ -86,43 +74,43 @@
     private final Handler mHandler;
     private final SharedLog mLog;
     private final Dependencies mDeps;
-    private IOffloadControl mOffloadControl;
+    private IOffloadHal mIOffload;
 
     // TODO: Use major-minor version control to prevent from defining new constants.
     static final int OFFLOAD_HAL_VERSION_NONE = 0;
-    static final int OFFLOAD_HAL_VERSION_1_0 = 1;
-    static final int OFFLOAD_HAL_VERSION_1_1 = 2;
+    static final int OFFLOAD_HAL_VERSION_HIDL_1_0 = 1;
+    static final int OFFLOAD_HAL_VERSION_HIDL_1_1 = 2;
+    static final int OFFLOAD_HAL_VERSION_AIDL = 3;
     /** @hide */
     @Retention(RetentionPolicy.SOURCE)
     @IntDef(prefix = "OFFLOAD_HAL_VERSION_", value = {
             OFFLOAD_HAL_VERSION_NONE,
-            OFFLOAD_HAL_VERSION_1_0,
-            OFFLOAD_HAL_VERSION_1_1
+            OFFLOAD_HAL_VERSION_HIDL_1_0,
+            OFFLOAD_HAL_VERSION_HIDL_1_1,
+            OFFLOAD_HAL_VERSION_AIDL,
     })
     public @interface OffloadHalVersion {}
-    @OffloadHalVersion
-    private int mOffloadControlVersion = OFFLOAD_HAL_VERSION_NONE;
 
     @NonNull
     static String halVerToString(int version) {
         switch(version) {
-            case OFFLOAD_HAL_VERSION_1_0:
-                return "1.0";
-            case OFFLOAD_HAL_VERSION_1_1:
-                return "1.1";
+            case OFFLOAD_HAL_VERSION_HIDL_1_0:
+                return "HIDL 1.0";
+            case OFFLOAD_HAL_VERSION_HIDL_1_1:
+                return "HIDL 1.1";
+            case OFFLOAD_HAL_VERSION_AIDL:
+                return "AIDL";
             case OFFLOAD_HAL_VERSION_NONE:
                 return "None";
             default:
                 throw new IllegalArgumentException("Unsupported version int " + version);
         }
-
     }
 
-    private TetheringOffloadCallback mTetheringOffloadCallback;
-    private ControlCallback mControlCallback;
+    private OffloadHalCallback mOffloadHalCallback;
 
     /** The callback to notify status of offload management process. */
-    public static class ControlCallback {
+    public static class OffloadHalCallback {
         /** Offload started. */
         public void onStarted() {}
         /**
@@ -179,7 +167,7 @@
     }
 
     public OffloadHardwareInterface(Handler h, SharedLog log) {
-        this(h, log, new Dependencies(log));
+        this(h, log, new Dependencies(h, log));
     }
 
     OffloadHardwareInterface(Handler h, SharedLog log, Dependencies deps) {
@@ -190,45 +178,21 @@
 
     /** Capture OffloadHardwareInterface dependencies, for injection. */
     static class Dependencies {
+        private final Handler mHandler;
         private final SharedLog mLog;
 
-        Dependencies(SharedLog log) {
+        Dependencies(Handler handler, SharedLog log) {
+            mHandler = handler;
             mLog = log;
         }
 
-        public IOffloadConfig getOffloadConfig() {
-            try {
-                return IOffloadConfig.getService(true /*retry*/);
-            } catch (RemoteException | NoSuchElementException e) {
-                mLog.e("getIOffloadConfig error " + e);
-                return null;
-            }
-        }
-
-        @NonNull
-        public Pair<IOffloadControl, Integer> getOffloadControl() {
-            IOffloadControl hal = null;
-            int version = OFFLOAD_HAL_VERSION_NONE;
-            try {
-                hal = android.hardware.tetheroffload.control
-                        .V1_1.IOffloadControl.getService(true /*retry*/);
-                version = OFFLOAD_HAL_VERSION_1_1;
-            } catch (NoSuchElementException e) {
-                // Unsupported by device.
-            } catch (RemoteException e) {
-                mLog.e("Unable to get offload control " + OFFLOAD_HAL_VERSION_1_1);
-            }
+        public IOffloadHal getOffload() {
+            // Prefer AIDL implementation if its service is declared.
+            IOffloadHal hal = OffloadHalAidlImpl.getIOffloadHal(mHandler, mLog);
             if (hal == null) {
-                try {
-                    hal = IOffloadControl.getService(true /*retry*/);
-                    version = OFFLOAD_HAL_VERSION_1_0;
-                } catch (NoSuchElementException e) {
-                    // Unsupported by device.
-                } catch (RemoteException e) {
-                    mLog.e("Unable to get offload control " + OFFLOAD_HAL_VERSION_1_0);
-                }
+                hal = OffloadHalHidlImpl.getIOffloadHal(mHandler, mLog);
             }
-            return new Pair<IOffloadControl, Integer>(hal, version);
+            return hal;
         }
 
         public NativeHandle createConntrackSocket(final int groups) {
@@ -273,56 +237,6 @@
         return DEFAULT_TETHER_OFFLOAD_DISABLED;
     }
 
-    /**
-     * Offload management process need to know conntrack rules to support NAT, but it may not have
-     * permission to create netlink netfilter sockets. Create two netlink netfilter sockets and
-     * share them with offload management process.
-     */
-    public boolean initOffloadConfig() {
-        final IOffloadConfig offloadConfig = mDeps.getOffloadConfig();
-        if (offloadConfig == null) {
-            mLog.e("Could not find IOffloadConfig service");
-            return false;
-        }
-        // Per the IConfigOffload definition:
-        //
-        // h1    provides a file descriptor bound to the following netlink groups
-        //       (NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY).
-        //
-        // h2    provides a file descriptor bound to the following netlink groups
-        //       (NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY).
-        final NativeHandle h1 = mDeps.createConntrackSocket(
-                NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY);
-        if (h1 == null) return false;
-
-        requestSocketDump(h1);
-
-        final NativeHandle h2 = mDeps.createConntrackSocket(
-                NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY);
-        if (h2 == null) {
-            closeFdInNativeHandle(h1);
-            return false;
-        }
-
-        final CbResults results = new CbResults();
-        try {
-            offloadConfig.setHandles(h1, h2,
-                    (boolean success, String errMsg) -> {
-                        results.mSuccess = success;
-                        results.mErrMsg = errMsg;
-                    });
-        } catch (RemoteException e) {
-            record("initOffloadConfig, setHandles fail", e);
-            return false;
-        }
-        // Explicitly close FDs.
-        closeFdInNativeHandle(h1);
-        closeFdInNativeHandle(h2);
-
-        record("initOffloadConfig, setHandles results:", results);
-        return results.mSuccess;
-    }
-
     @VisibleForTesting
     void sendIpv4NfGenMsg(@NonNull NativeHandle handle, short type, short flags) {
         final int length = StructNlMsgHdr.STRUCT_SIZE + StructNfGenMsg.STRUCT_SIZE;
@@ -355,165 +269,107 @@
                 (short) (NLM_F_REQUEST | NLM_F_DUMP));
     }
 
-    private void closeFdInNativeHandle(final NativeHandle h) {
-        try {
-            h.close();
-        } catch (IOException | IllegalStateException e) {
-            // IllegalStateException means fd is already closed, do nothing here.
-            // Also nothing we can do if IOException.
+    private void maybeCloseFdInNativeHandles(final NativeHandle... handles) {
+        for (NativeHandle h : handles) {
+            if (h == null) continue;
+            try {
+                h.close();
+            } catch (IOException | IllegalStateException e) {
+                // IllegalStateException means fd is already closed, do nothing here.
+                // Also nothing we can do if IOException.
+            }
         }
     }
 
+    private int initWithHandles(NativeHandle h1, NativeHandle h2) {
+        if (h1 == null || h2 == null) {
+            mLog.e("Failed to create socket.");
+            return OFFLOAD_HAL_VERSION_NONE;
+        }
+
+        requestSocketDump(h1);
+        if (!mIOffload.initOffload(h1, h2, mOffloadHalCallback)) {
+            mIOffload.stopOffload();
+            mLog.e("Failed to initialize offload.");
+            return OFFLOAD_HAL_VERSION_NONE;
+        }
+
+        return mIOffload.getVersion();
+    }
+
     /**
      * Initialize the tethering offload HAL.
      *
      * @return one of {@code OFFLOAD_HAL_VERSION_*} represents the HAL version, or
      *         {@link #OFFLOAD_HAL_VERSION_NONE} if failed.
      */
-    public int initOffloadControl(ControlCallback controlCb) {
-        mControlCallback = controlCb;
-
-        if (mOffloadControl == null) {
-            final Pair<IOffloadControl, Integer> halAndVersion = mDeps.getOffloadControl();
-            mOffloadControl = halAndVersion.first;
-            mOffloadControlVersion = halAndVersion.second;
-            if (mOffloadControl == null) {
-                mLog.e("tethering IOffloadControl.getService() returned null");
+    public int initOffload(OffloadHalCallback offloadCb) {
+        if (mIOffload == null) {
+            mIOffload = mDeps.getOffload();
+            if (mIOffload == null) {
+                mLog.e("No tethering offload HAL service found.");
                 return OFFLOAD_HAL_VERSION_NONE;
             }
-            mLog.i("tethering offload control version "
-                    + halVerToString(mOffloadControlVersion) + " is supported.");
+            mLog.i("Tethering offload version "
+                    + halVerToString(mIOffload.getVersion()) + " is supported.");
         }
 
-        final String logmsg = String.format("initOffloadControl(%s)",
-                (controlCb == null) ? "null"
-                        : "0x" + Integer.toHexString(System.identityHashCode(controlCb)));
+        // Per the IOffload definition:
+        //
+        // h1    provides a file descriptor bound to the following netlink groups
+        //       (NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY).
+        //
+        // h2    provides a file descriptor bound to the following netlink groups
+        //       (NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY).
+        final NativeHandle h1 = mDeps.createConntrackSocket(
+                NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY);
+        final NativeHandle h2 = mDeps.createConntrackSocket(
+                NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY);
 
-        mTetheringOffloadCallback = new TetheringOffloadCallback(
-                mHandler, mControlCallback, mLog, mOffloadControlVersion);
-        final CbResults results = new CbResults();
-        try {
-            mOffloadControl.initOffload(
-                    mTetheringOffloadCallback,
-                    (boolean success, String errMsg) -> {
-                        results.mSuccess = success;
-                        results.mErrMsg = errMsg;
-                    });
-        } catch (RemoteException e) {
-            record(logmsg, e);
-            return OFFLOAD_HAL_VERSION_NONE;
+        mOffloadHalCallback = offloadCb;
+        final int version = initWithHandles(h1, h2);
+
+        // Explicitly close FDs for HIDL. AIDL will pass the original FDs to the service,
+        // they shouldn't be closed here.
+        if (version < OFFLOAD_HAL_VERSION_AIDL) {
+            maybeCloseFdInNativeHandles(h1, h2);
         }
-
-        record(logmsg, results);
-        return results.mSuccess ? mOffloadControlVersion : OFFLOAD_HAL_VERSION_NONE;
+        return version;
     }
 
-    /** Stop IOffloadControl. */
-    public void stopOffloadControl() {
-        if (mOffloadControl != null) {
-            try {
-                mOffloadControl.stopOffload(
-                        (boolean success, String errMsg) -> {
-                            if (!success) mLog.e("stopOffload failed: " + errMsg);
-                        });
-            } catch (RemoteException e) {
-                mLog.e("failed to stopOffload: " + e);
+    /** Stop the tethering offload HAL. */
+    public void stopOffload() {
+        if (mIOffload != null) {
+            if (!mIOffload.stopOffload()) {
+                mLog.e("Failed to stop offload.");
             }
         }
-        mOffloadControl = null;
-        mTetheringOffloadCallback = null;
-        mControlCallback = null;
-        mLog.log("stopOffloadControl()");
+        mIOffload = null;
+        mOffloadHalCallback = null;
     }
 
     /** Get Tx/Rx usage from last query. */
     public ForwardedStats getForwardedStats(String upstream) {
-        final String logmsg = String.format("getForwardedStats(%s)",  upstream);
-
-        final ForwardedStats stats = new ForwardedStats();
-        try {
-            mOffloadControl.getForwardedStats(
-                    upstream,
-                    (long rxBytes, long txBytes) -> {
-                        stats.rxBytes = (rxBytes > 0) ? rxBytes : 0;
-                        stats.txBytes = (txBytes > 0) ? txBytes : 0;
-                    });
-        } catch (RemoteException e) {
-            record(logmsg, e);
-            return stats;
-        }
-
-        return stats;
+        return mIOffload.getForwardedStats(upstream);
     }
 
     /** Set local prefixes to offload management process. */
     public boolean setLocalPrefixes(ArrayList<String> localPrefixes) {
-        final String logmsg = String.format("setLocalPrefixes([%s])",
-                String.join(",", localPrefixes));
-
-        final CbResults results = new CbResults();
-        try {
-            mOffloadControl.setLocalPrefixes(localPrefixes,
-                    (boolean success, String errMsg) -> {
-                        results.mSuccess = success;
-                        results.mErrMsg = errMsg;
-                    });
-        } catch (RemoteException e) {
-            record(logmsg, e);
-            return false;
-        }
-
-        record(logmsg, results);
-        return results.mSuccess;
+        return mIOffload.setLocalPrefixes(localPrefixes);
     }
 
     /** Set data limit value to offload management process. */
     public boolean setDataLimit(String iface, long limit) {
-
-        final String logmsg = String.format("setDataLimit(%s, %d)", iface, limit);
-
-        final CbResults results = new CbResults();
-        try {
-            mOffloadControl.setDataLimit(
-                    iface, limit,
-                    (boolean success, String errMsg) -> {
-                        results.mSuccess = success;
-                        results.mErrMsg = errMsg;
-                    });
-        } catch (RemoteException e) {
-            record(logmsg, e);
-            return false;
-        }
-
-        record(logmsg, results);
-        return results.mSuccess;
+        return mIOffload.setDataLimit(iface, limit);
     }
 
     /** Set data warning and limit value to offload management process. */
     public boolean setDataWarningAndLimit(String iface, long warning, long limit) {
-        if (mOffloadControlVersion < OFFLOAD_HAL_VERSION_1_1) {
-            throw new IllegalArgumentException(
+        if (mIOffload.getVersion() < OFFLOAD_HAL_VERSION_HIDL_1_1) {
+            throw new UnsupportedOperationException(
                     "setDataWarningAndLimit is not supported below HAL V1.1");
         }
-        final String logmsg =
-                String.format("setDataWarningAndLimit(%s, %d, %d)", iface, warning, limit);
-
-        final CbResults results = new CbResults();
-        try {
-            ((android.hardware.tetheroffload.control.V1_1.IOffloadControl) mOffloadControl)
-                    .setDataWarningAndLimit(
-                            iface, warning, limit,
-                            (boolean success, String errMsg) -> {
-                                results.mSuccess = success;
-                                results.mErrMsg = errMsg;
-                            });
-        } catch (RemoteException e) {
-            record(logmsg, e);
-            return false;
-        }
-
-        record(logmsg, results);
-        return results.mSuccess;
+        return mIOffload.setDataWarningAndLimit(iface, warning, limit);
     }
 
     /** Set upstream parameters to offload management process. */
@@ -523,178 +379,16 @@
         v4addr = (v4addr != null) ? v4addr : NO_IPV4_ADDRESS;
         v4gateway = (v4gateway != null) ? v4gateway : NO_IPV4_GATEWAY;
         v6gws = (v6gws != null) ? v6gws : new ArrayList<>();
-
-        final String logmsg = String.format("setUpstreamParameters(%s, %s, %s, [%s])",
-                iface, v4addr, v4gateway, String.join(",", v6gws));
-
-        final CbResults results = new CbResults();
-        try {
-            mOffloadControl.setUpstreamParameters(
-                    iface, v4addr, v4gateway, v6gws,
-                    (boolean success, String errMsg) -> {
-                        results.mSuccess = success;
-                        results.mErrMsg = errMsg;
-                    });
-        } catch (RemoteException e) {
-            record(logmsg, e);
-            return false;
-        }
-
-        record(logmsg, results);
-        return results.mSuccess;
+        return mIOffload.setUpstreamParameters(iface, v4addr, v4gateway, v6gws);
     }
 
     /** Add downstream prefix to offload management process. */
-    public boolean addDownstreamPrefix(String ifname, String prefix) {
-        final String logmsg = String.format("addDownstreamPrefix(%s, %s)", ifname, prefix);
-
-        final CbResults results = new CbResults();
-        try {
-            mOffloadControl.addDownstream(ifname, prefix,
-                    (boolean success, String errMsg) -> {
-                        results.mSuccess = success;
-                        results.mErrMsg = errMsg;
-                    });
-        } catch (RemoteException e) {
-            record(logmsg, e);
-            return false;
-        }
-
-        record(logmsg, results);
-        return results.mSuccess;
+    public boolean addDownstream(String ifname, String prefix) {
+        return  mIOffload.addDownstream(ifname, prefix);
     }
 
     /** Remove downstream prefix from offload management process. */
-    public boolean removeDownstreamPrefix(String ifname, String prefix) {
-        final String logmsg = String.format("removeDownstreamPrefix(%s, %s)", ifname, prefix);
-
-        final CbResults results = new CbResults();
-        try {
-            mOffloadControl.removeDownstream(ifname, prefix,
-                    (boolean success, String errMsg) -> {
-                        results.mSuccess = success;
-                        results.mErrMsg = errMsg;
-                    });
-        } catch (RemoteException e) {
-            record(logmsg, e);
-            return false;
-        }
-
-        record(logmsg, results);
-        return results.mSuccess;
-    }
-
-    private void record(String msg, Throwable t) {
-        mLog.e(msg + YIELDS + "exception: " + t);
-    }
-
-    private void record(String msg, CbResults results) {
-        final String logmsg = msg + YIELDS + results;
-        if (!results.mSuccess) {
-            mLog.e(logmsg);
-        } else {
-            mLog.log(logmsg);
-        }
-    }
-
-    private static class TetheringOffloadCallback extends ITetheringOffloadCallback.Stub {
-        public final Handler handler;
-        public final ControlCallback controlCb;
-        public final SharedLog log;
-        private final int mOffloadControlVersion;
-
-        TetheringOffloadCallback(
-                Handler h, ControlCallback cb, SharedLog sharedLog, int offloadControlVersion) {
-            handler = h;
-            controlCb = cb;
-            log = sharedLog;
-            this.mOffloadControlVersion = offloadControlVersion;
-        }
-
-        private void handleOnEvent(int event) {
-            switch (event) {
-                case OffloadCallbackEvent.OFFLOAD_STARTED:
-                    controlCb.onStarted();
-                    break;
-                case OffloadCallbackEvent.OFFLOAD_STOPPED_ERROR:
-                    controlCb.onStoppedError();
-                    break;
-                case OffloadCallbackEvent.OFFLOAD_STOPPED_UNSUPPORTED:
-                    controlCb.onStoppedUnsupported();
-                    break;
-                case OffloadCallbackEvent.OFFLOAD_SUPPORT_AVAILABLE:
-                    controlCb.onSupportAvailable();
-                    break;
-                case OffloadCallbackEvent.OFFLOAD_STOPPED_LIMIT_REACHED:
-                    controlCb.onStoppedLimitReached();
-                    break;
-                case android.hardware.tetheroffload.control
-                        .V1_1.OffloadCallbackEvent.OFFLOAD_WARNING_REACHED:
-                    controlCb.onWarningReached();
-                    break;
-                default:
-                    log.e("Unsupported OffloadCallbackEvent: " + event);
-            }
-        }
-
-        @Override
-        public void onEvent(int event) {
-            // The implementation should never call onEvent()) if the event is already reported
-            // through newer callback.
-            if (mOffloadControlVersion > OFFLOAD_HAL_VERSION_1_0) {
-                Log.wtf(TAG, "onEvent(" + event + ") fired on HAL "
-                        + halVerToString(mOffloadControlVersion));
-            }
-            handler.post(() -> {
-                handleOnEvent(event);
-            });
-        }
-
-        @Override
-        public void onEvent_1_1(int event) {
-            if (mOffloadControlVersion < OFFLOAD_HAL_VERSION_1_1) {
-                Log.wtf(TAG, "onEvent_1_1(" + event + ") fired on HAL "
-                        + halVerToString(mOffloadControlVersion));
-                return;
-            }
-            handler.post(() -> {
-                handleOnEvent(event);
-            });
-        }
-
-        @Override
-        public void updateTimeout(NatTimeoutUpdate params) {
-            handler.post(() -> {
-                controlCb.onNatTimeoutUpdate(
-                        networkProtocolToOsConstant(params.proto),
-                        params.src.addr, uint16(params.src.port),
-                        params.dst.addr, uint16(params.dst.port));
-            });
-        }
-    }
-
-    private static int networkProtocolToOsConstant(int proto) {
-        switch (proto) {
-            case NetworkProtocol.TCP: return OsConstants.IPPROTO_TCP;
-            case NetworkProtocol.UDP: return OsConstants.IPPROTO_UDP;
-            default:
-                // The caller checks this value and will log an error. Just make
-                // sure it won't collide with valid OsContants.IPPROTO_* values.
-                return -Math.abs(proto);
-        }
-    }
-
-    private static class CbResults {
-        boolean mSuccess;
-        String mErrMsg;
-
-        @Override
-        public String toString() {
-            if (mSuccess) {
-                return "ok";
-            } else {
-                return "fail: " + mErrMsg;
-            }
-        }
+    public boolean removeDownstream(String ifname, String prefix) {
+        return  mIOffload.removeDownstream(ifname, prefix);
     }
 }
diff --git a/Tethering/src/com/android/networkstack/tethering/Tethering.java b/Tethering/src/com/android/networkstack/tethering/Tethering.java
index 2e71fda..4c5bf4e 100644
--- a/Tethering/src/com/android/networkstack/tethering/Tethering.java
+++ b/Tethering/src/com/android/networkstack/tethering/Tethering.java
@@ -1861,6 +1861,7 @@
                 mNotificationUpdater.onUpstreamCapabilitiesChanged(
                         (ns != null) ? ns.networkCapabilities : null);
             }
+            mTetheringMetrics.maybeUpdateUpstreamType(ns);
         }
 
         protected void setUpstreamNetwork(UpstreamNetworkState ns) {
@@ -2090,6 +2091,7 @@
                     mNotificationUpdater.onUpstreamCapabilitiesChanged(null);
                 }
                 mBpfCoordinator.stopPolling();
+                mTetheringMetrics.cleanup();
             }
 
             private boolean updateUpstreamWanted() {
diff --git a/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java b/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
index ffcea4e..c181994 100644
--- a/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
+++ b/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
@@ -16,6 +16,13 @@
 
 package com.android.networkstack.tethering.metrics;
 
+import static android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH;
+import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
+import static android.net.NetworkCapabilities.TRANSPORT_ETHERNET;
+import static android.net.NetworkCapabilities.TRANSPORT_LOWPAN;
+import static android.net.NetworkCapabilities.TRANSPORT_VPN;
+import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
+import static android.net.NetworkCapabilities.TRANSPORT_WIFI_AWARE;
 import static android.net.TetheringManager.TETHERING_BLUETOOTH;
 import static android.net.TetheringManager.TETHERING_ETHERNET;
 import static android.net.TetheringManager.TETHERING_NCM;
@@ -39,6 +46,8 @@
 import static android.net.TetheringManager.TETHER_ERROR_UNSUPPORTED;
 import static android.net.TetheringManager.TETHER_ERROR_UNTETHER_IFACE_ERROR;
 
+import android.annotation.Nullable;
+import android.net.NetworkCapabilities;
 import android.stats.connectivity.DownstreamType;
 import android.stats.connectivity.ErrorCode;
 import android.stats.connectivity.UpstreamType;
@@ -49,6 +58,11 @@
 import androidx.annotation.NonNull;
 import androidx.annotation.VisibleForTesting;
 
+import com.android.networkstack.tethering.UpstreamNetworkState;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
 /**
  * Collection of utilities for tethering metrics.
  *
@@ -66,21 +80,58 @@
     private static final String SYSTEMUI_PKG_NAME = "com.android.systemui";
     private static final String GMS_PKG_NAME = "com.google.android.gms";
     private final SparseArray<NetworkTetheringReported.Builder> mBuilderMap = new SparseArray<>();
+    private final SparseArray<Long> mDownstreamStartTime = new SparseArray<Long>();
+    private final ArrayList<RecordUpstreamEvent> mUpstreamEventList = new ArrayList<>();
+    private UpstreamType mCurrentUpstream = null;
+    private Long mCurrentUpStreamStartTime = 0L;
 
-    /** Update Tethering stats about caller's package name and downstream type. */
-    public void createBuilder(final int downstreamType, final String callerPkg) {
-        NetworkTetheringReported.Builder statsBuilder =
-                    NetworkTetheringReported.newBuilder();
-        statsBuilder.setDownstreamType(downstreamTypeToEnum(downstreamType))
-                    .setUserType(userTypeToEnum(callerPkg))
-                    .setUpstreamType(UpstreamType.UT_UNKNOWN)
-                    .setErrorCode(ErrorCode.EC_NO_ERROR)
-                    .setUpstreamEvents(UpstreamEvents.newBuilder())
-                    .setDurationMillis(0);
-        mBuilderMap.put(downstreamType, statsBuilder);
+
+    /**
+     * Return the current system time in milliseconds.
+     * @return the current system time in milliseconds.
+     */
+    public long timeNow() {
+        return System.currentTimeMillis();
     }
 
-    /** Update error code of given downstreamType. */
+    private static class RecordUpstreamEvent {
+        public final long mStartTime;
+        public final long mStopTime;
+        public final UpstreamType mUpstreamType;
+
+        RecordUpstreamEvent(final long startTime, final long stopTime,
+                final UpstreamType upstream) {
+            mStartTime = startTime;
+            mStopTime = stopTime;
+            mUpstreamType = upstream;
+        }
+    }
+
+    /**
+     * Creates a |NetworkTetheringReported.Builder| object to update the tethering stats for the
+     * specified downstream type and caller's package name. Initializes the upstream events, error
+     * code, and duration to default values. Sets the start time for the downstream type in the
+     * |mDownstreamStartTime| map.
+     * @param downstreamType The type of downstream connection (e.g. Wifi, USB, Bluetooth).
+     * @param callerPkg The package name of the caller.
+     */
+    public void createBuilder(final int downstreamType, final String callerPkg) {
+        NetworkTetheringReported.Builder statsBuilder = NetworkTetheringReported.newBuilder()
+                .setDownstreamType(downstreamTypeToEnum(downstreamType))
+                .setUserType(userTypeToEnum(callerPkg))
+                .setUpstreamType(UpstreamType.UT_UNKNOWN)
+                .setErrorCode(ErrorCode.EC_NO_ERROR)
+                .setUpstreamEvents(UpstreamEvents.newBuilder())
+                .setDurationMillis(0);
+        mBuilderMap.put(downstreamType, statsBuilder);
+        mDownstreamStartTime.put(downstreamType, timeNow());
+    }
+
+    /**
+     * Update the error code of the given downstream type in the Tethering stats.
+     * @param downstreamType The downstream type whose error code to update.
+     * @param errCode The error code to set.
+     */
     public void updateErrorCode(final int downstreamType, final int errCode) {
         NetworkTetheringReported.Builder statsBuilder = mBuilderMap.get(downstreamType);
         if (statsBuilder == null) {
@@ -90,38 +141,155 @@
         statsBuilder.setErrorCode(errorCodeToEnum(errCode));
     }
 
-    /** Remove Tethering stats.
-     *  If Tethering stats is ready to write then write it before removing.
+    /**
+     * Update the list of upstream types and their duration whenever the current upstream type
+     * changes.
+     * @param ns The UpstreamNetworkState object representing the current upstream network state.
+     */
+    public void maybeUpdateUpstreamType(@Nullable final UpstreamNetworkState ns) {
+        UpstreamType upstream = transportTypeToUpstreamTypeEnum(ns);
+        if (upstream.equals(mCurrentUpstream)) return;
+
+        final long newTime = timeNow();
+        if (mCurrentUpstream != null) {
+            mUpstreamEventList.add(new RecordUpstreamEvent(mCurrentUpStreamStartTime, newTime,
+                    mCurrentUpstream));
+        }
+        mCurrentUpstream = upstream;
+        mCurrentUpStreamStartTime = newTime;
+    }
+
+    /**
+     * Returns the greater of two start times.
+     * @param first the first start time
+     * @param second the second start time
+     * @return the greater start time
+     */
+    private long getGreaterStartTime(long first, long second) {
+        return first > second ? first : second;
+    }
+
+    /**
+     * Updates the upstream events builder with a new upstream event.
+     * @param upstreamEventsBuilder the builder for the upstream events list
+     * @param start the start time of the upstream event
+     * @param stop the stop time of the upstream event
+     * @param upstream the type of upstream type (e.g. Wifi, Cellular, Bluetooth, ...)
+     */
+    private void updateUpstreamEvents(final UpstreamEvents.Builder upstreamEventsBuilder,
+            final long start, final long stop, @Nullable final UpstreamType upstream) {
+        final UpstreamEvent.Builder upstreamEventBuilder = UpstreamEvent.newBuilder()
+                .setUpstreamType(upstream == null ? UpstreamType.UT_NO_NETWORK : upstream)
+                .setDurationMillis(stop - start);
+        upstreamEventsBuilder.addUpstreamEvent(upstreamEventBuilder);
+    }
+
+    /**
+     * Updates the |NetworkTetheringReported.Builder| with relevant upstream events associated with
+     * the downstream event identified by the given downstream start time.
+     *
+     * This method iterates through the list of upstream events and adds any relevant events to a
+     * |UpstreamEvents.Builder|. Upstream events are considered relevant if their stop time is
+     * greater than or equal to the given downstream start time. The method also adds the last
+     * upstream event that occurred up until the current time.
+     *
+     * The resulting |UpstreamEvents.Builder| is then added to the
+     * |NetworkTetheringReported.Builder|, along with the duration of the downstream event
+     * (i.e., stop time minus downstream start time).
+     *
+     * @param statsBuilder the builder for the NetworkTetheringReported message
+     * @param downstreamStartTime the start time of the downstream event to find relevant upstream
+     * events for
+     */
+    private void updateStatsBuilderToWrite(final NetworkTetheringReported.Builder statsBuilder,
+                    final long downstreamStartTime) {
+        UpstreamEvents.Builder upstreamEventsBuilder = UpstreamEvents.newBuilder();
+        for (RecordUpstreamEvent event : mUpstreamEventList) {
+            if (downstreamStartTime > event.mStopTime) continue;
+
+            final long startTime = getGreaterStartTime(downstreamStartTime, event.mStartTime);
+            // Handle completed upstream events.
+            updateUpstreamEvents(upstreamEventsBuilder, startTime, event.mStopTime,
+                    event.mUpstreamType);
+        }
+        final long startTime = getGreaterStartTime(downstreamStartTime, mCurrentUpStreamStartTime);
+        final long stopTime = timeNow();
+        // Handle the last upstream event.
+        updateUpstreamEvents(upstreamEventsBuilder, startTime, stopTime, mCurrentUpstream);
+        statsBuilder.setUpstreamEvents(upstreamEventsBuilder);
+        statsBuilder.setDurationMillis(stopTime - downstreamStartTime);
+    }
+
+    /**
+     * Removes tethering statistics for the given downstream type. If there are any stats to write
+     * for the downstream event associated with the type, they are written before removing the
+     * statistics.
+     *
+     * If the given downstream type does not exist in the map, an error message is logged and the
+     * method returns without doing anything.
+     *
+     * @param downstreamType the type of downstream event to remove statistics for
      */
     public void sendReport(final int downstreamType) {
-        final NetworkTetheringReported.Builder statsBuilder =
-                mBuilderMap.get(downstreamType);
+        final NetworkTetheringReported.Builder statsBuilder = mBuilderMap.get(downstreamType);
         if (statsBuilder == null) {
             Log.e(TAG, "Given downstreamType does not exist, this is a bug!");
             return;
         }
+
+        updateStatsBuilderToWrite(statsBuilder, mDownstreamStartTime.get(downstreamType));
         write(statsBuilder.build());
+
         mBuilderMap.remove(downstreamType);
+        mDownstreamStartTime.remove(downstreamType);
     }
 
-    /** Collect Tethering stats and write metrics data to statsd pipeline. */
+    /**
+     * Collects tethering statistics and writes them to the statsd pipeline. This method takes in a
+     * NetworkTetheringReported object, extracts its fields and uses them to write statistics data
+     * to the statsd pipeline.
+     *
+     * @param reported a NetworkTetheringReported object containing statistics to write
+     */
     @VisibleForTesting
     public void write(@NonNull final NetworkTetheringReported reported) {
-        TetheringStatsLog.write(TetheringStatsLog.NETWORK_TETHERING_REPORTED,
+        final byte[] upstreamEvents = reported.getUpstreamEvents().toByteArray();
+
+        TetheringStatsLog.write(
+                TetheringStatsLog.NETWORK_TETHERING_REPORTED,
                 reported.getErrorCode().getNumber(),
                 reported.getDownstreamType().getNumber(),
                 reported.getUpstreamType().getNumber(),
                 reported.getUserType().getNumber(),
-                null, 0);
+                upstreamEvents,
+                reported.getDurationMillis());
         if (DBG) {
-            Log.d(TAG, "Write errorCode: " + reported.getErrorCode().getNumber()
-                    + ", downstreamType: " + reported.getDownstreamType().getNumber()
-                    + ", upstreamType: " + reported.getUpstreamType().getNumber()
-                    + ", userType: " + reported.getUserType().getNumber());
+            Log.d(
+                    TAG,
+                    "Write errorCode: "
+                    + reported.getErrorCode().getNumber()
+                    + ", downstreamType: "
+                    + reported.getDownstreamType().getNumber()
+                    + ", upstreamType: "
+                    + reported.getUpstreamType().getNumber()
+                    + ", userType: "
+                    + reported.getUserType().getNumber()
+                    + ", upstreamTypes: "
+                    + Arrays.toString(upstreamEvents)
+                    + ", durationMillis: "
+                    + reported.getDurationMillis());
         }
     }
 
-    /** Map {@link TetheringType} to {@link DownstreamType} */
+    /**
+     * Cleans up the variables related to upstream events when tethering is turned off.
+     */
+    public void cleanup() {
+        mUpstreamEventList.clear();
+        mCurrentUpstream = null;
+        mCurrentUpStreamStartTime = 0L;
+    }
+
     private DownstreamType downstreamTypeToEnum(final int ifaceType) {
         switch(ifaceType) {
             case TETHERING_WIFI:
@@ -141,7 +309,6 @@
         }
     }
 
-    /** Map {@link StartTetheringError} to {@link ErrorCode} */
     private ErrorCode errorCodeToEnum(final int lastError) {
         switch(lastError) {
             case TETHER_ERROR_NO_ERROR:
@@ -181,7 +348,6 @@
         }
     }
 
-    /** Map callerPkg to {@link UserType} */
     private UserType userTypeToEnum(final String callerPkg) {
         if (callerPkg.equals(SETTINGS_PKG_NAME)) {
             return UserType.USER_SETTINGS;
@@ -193,4 +359,40 @@
             return UserType.USER_UNKNOWN;
         }
     }
+
+    private UpstreamType transportTypeToUpstreamTypeEnum(final UpstreamNetworkState ns) {
+        final NetworkCapabilities nc = (ns != null) ? ns.networkCapabilities : null;
+        if (nc == null) return UpstreamType.UT_NO_NETWORK;
+
+        final int typeCount = nc.getTransportTypes().length;
+
+        boolean hasCellular = nc.hasTransport(TRANSPORT_CELLULAR);
+        boolean hasWifi = nc.hasTransport(TRANSPORT_WIFI);
+        boolean hasBT = nc.hasTransport(TRANSPORT_BLUETOOTH);
+        boolean hasEthernet = nc.hasTransport(TRANSPORT_ETHERNET);
+        boolean hasVpn = nc.hasTransport(TRANSPORT_VPN);
+        boolean hasWifiAware = nc.hasTransport(TRANSPORT_WIFI_AWARE);
+        boolean hasLopan = nc.hasTransport(TRANSPORT_LOWPAN);
+
+        if (typeCount == 3 && hasCellular && hasWifi && hasVpn) {
+            return UpstreamType.UT_WIFI_CELLULAR_VPN;
+        }
+
+        if (typeCount == 2 && hasVpn) {
+            if (hasCellular) return UpstreamType.UT_CELLULAR_VPN;
+            if (hasWifi) return UpstreamType.UT_WIFI_VPN;
+            if (hasBT) return UpstreamType.UT_BLUETOOTH_VPN;
+            if (hasEthernet) return UpstreamType.UT_ETHERNET_VPN;
+        }
+
+        if (typeCount == 1) {
+            if (hasCellular) return UpstreamType.UT_CELLULAR;
+            if (hasWifi) return UpstreamType.UT_WIFI;
+            if (hasBT) return UpstreamType.UT_BLUETOOTH;
+            if (hasEthernet) return UpstreamType.UT_ETHERNET;
+            if (hasWifiAware) return UpstreamType.UT_WIFI_AWARE;
+            if (hasLopan) return UpstreamType.UT_LOWPAN;
+        }
+        return UpstreamType.UT_UNKNOWN;
+    }
 }
diff --git a/Tethering/tests/integration/base/android/net/EthernetTetheringTestBase.java b/Tethering/tests/integration/base/android/net/EthernetTetheringTestBase.java
index 7685981..69eb58f 100644
--- a/Tethering/tests/integration/base/android/net/EthernetTetheringTestBase.java
+++ b/Tethering/tests/integration/base/android/net/EthernetTetheringTestBase.java
@@ -72,6 +72,8 @@
 
 import com.android.modules.utils.build.SdkLevel;
 import com.android.net.module.util.PacketBuilder;
+import com.android.net.module.util.Struct;
+import com.android.net.module.util.structs.Ipv6Header;
 import com.android.testutils.HandlerUtils;
 import com.android.testutils.TapPacketReader;
 import com.android.testutils.TestNetworkTracker;
@@ -251,6 +253,7 @@
             if (mRunTests) cleanUp();
         } finally {
             mHandlerThread.quitSafely();
+            mHandlerThread.join();
             mUiAutomation.dropShellPermissionIdentity();
         }
     }
@@ -1013,6 +1016,18 @@
         return new TetheringTester(mDownstreamReader, mUpstreamReader);
     }
 
+    @NonNull
+    protected Inet6Address getClatIpv6Address(TetheringTester tester, TetheredDevice tethered)
+            throws Exception {
+        // Send an IPv4 UDP packet from client and check that a CLAT translated IPv6 UDP packet can
+        // be found on upstream interface. Get CLAT IPv6 address from the CLAT translated IPv6 UDP
+        // packet.
+        byte[] expectedPacket = probeV4TetheringConnectivity(tester, tethered, true /* is4To6 */);
+
+        // Above has guaranteed that the found packet is an IPv6 packet without ether header.
+        return Struct.parse(Ipv6Header.class, ByteBuffer.wrap(expectedPacket)).srcIp;
+    }
+
     protected <T> List<T> toList(T... array) {
         return Arrays.asList(array);
     }
diff --git a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
index fb4b9fa..12ac454 100644
--- a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
+++ b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
@@ -62,7 +62,6 @@
 import com.android.net.module.util.structs.EthernetHeader;
 import com.android.net.module.util.structs.Icmpv4Header;
 import com.android.net.module.util.structs.Ipv4Header;
-import com.android.net.module.util.structs.Ipv6Header;
 import com.android.net.module.util.structs.UdpHeader;
 import com.android.testutils.DevSdkIgnoreRule;
 import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
@@ -522,18 +521,6 @@
         runUdp4Test();
     }
 
-    @NonNull
-    private Inet6Address getClatIpv6Address(TetheringTester tester, TetheredDevice tethered)
-            throws Exception {
-        // Send an IPv4 UDP packet from client and check that a CLAT translated IPv6 UDP packet can
-        // be found on upstream interface. Get CLAT IPv6 address from the CLAT translated IPv6 UDP
-        // packet.
-        byte[] expectedPacket = probeV4TetheringConnectivity(tester, tethered, true /* is4To6 */);
-
-        // Above has guaranteed that the found packet is an IPv6 packet without ether header.
-        return Struct.parse(Ipv6Header.class, ByteBuffer.wrap(expectedPacket)).srcIp;
-    }
-
     // Test network topology:
     //
     //            public network (rawip)                 private network
diff --git a/Tethering/tests/privileged/src/com/android/networkstack/tethering/ConntrackSocketTest.java b/Tethering/tests/privileged/src/com/android/networkstack/tethering/ConntrackSocketTest.java
index 706df4e..b3fb3e4 100644
--- a/Tethering/tests/privileged/src/com/android/networkstack/tethering/ConntrackSocketTest.java
+++ b/Tethering/tests/privileged/src/com/android/networkstack/tethering/ConntrackSocketTest.java
@@ -80,7 +80,7 @@
         // Looper must be prepared here since AndroidJUnitRunner runs tests on separate threads.
         if (Looper.myLooper() == null) Looper.prepare();
 
-        mDeps = new OffloadHardwareInterface.Dependencies(mLog);
+        mDeps = new OffloadHardwareInterface.Dependencies(mHandler, mLog);
         mOffloadHw = new OffloadHardwareInterface(mHandler, mLog, mDeps);
     }
 
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadControllerTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadControllerTest.java
index faca1c8..36c15a7 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadControllerTest.java
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadControllerTest.java
@@ -31,8 +31,8 @@
 import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_IFACE;
 import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_UID;
 import static com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;
-import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_0;
-import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_1;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_0;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_1;
 import static com.android.networkstack.tethering.TetheringConfiguration.DEFAULT_TETHER_OFFLOAD_POLL_INTERVAL_MS;
 import static com.android.testutils.MiscAsserts.assertContainsAll;
 import static com.android.testutils.MiscAsserts.assertThrows;
@@ -79,6 +79,7 @@
 
 import com.android.internal.util.test.FakeSettingsProvider;
 import com.android.net.module.util.SharedLog;
+import com.android.networkstack.tethering.OffloadHardwareInterface.OffloadHalCallback;
 import com.android.testutils.DevSdkIgnoreRule;
 import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
 import com.android.testutils.TestableNetworkStatsProviderCbBinder;
@@ -125,8 +126,8 @@
     private OffloadController.OffloadTetheringStatsProvider mTetherStatsProvider;
     private final ArgumentCaptor<ArrayList> mStringArrayCaptor =
             ArgumentCaptor.forClass(ArrayList.class);
-    private final ArgumentCaptor<OffloadHardwareInterface.ControlCallback> mControlCallbackCaptor =
-            ArgumentCaptor.forClass(OffloadHardwareInterface.ControlCallback.class);
+    private final ArgumentCaptor<OffloadHalCallback> mOffloadHalCallbackCaptor =
+            ArgumentCaptor.forClass(OffloadHalCallback.class);
     private MockContentResolver mContentResolver;
     private final TestLooper mTestLooper = new TestLooper();
     private OffloadController.Dependencies mDeps = new OffloadController.Dependencies() {
@@ -151,10 +152,9 @@
         FakeSettingsProvider.clearSettingsProvider();
     }
 
-    private void setupFunctioningHardwareInterface(int controlVersion) {
-        when(mHardware.initOffloadConfig()).thenReturn(true);
-        when(mHardware.initOffloadControl(mControlCallbackCaptor.capture()))
-                .thenReturn(controlVersion);
+    private void setupFunctioningHardwareInterface(int offloadHalVersion) {
+        when(mHardware.initOffload(mOffloadHalCallbackCaptor.capture()))
+                .thenReturn(offloadHalVersion);
         when(mHardware.setUpstreamParameters(anyString(), any(), any(), any())).thenReturn(true);
         when(mHardware.getForwardedStats(any())).thenReturn(new ForwardedStats());
         when(mHardware.setDataLimit(anyString(), anyLong())).thenReturn(true);
@@ -192,9 +192,9 @@
     @Test
     public void testStartStop() throws Exception {
         stopOffloadController(
-                startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/));
+                startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/));
         stopOffloadController(
-                startOffloadController(OFFLOAD_HAL_VERSION_1_1, true /*expectStart*/));
+                startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_1, true /*expectStart*/));
     }
 
     @NonNull
@@ -206,9 +206,8 @@
 
         final InOrder inOrder = inOrder(mHardware);
         inOrder.verify(mHardware, times(1)).getDefaultTetherOffloadDisabled();
-        inOrder.verify(mHardware, times(expectStart ? 1 : 0)).initOffloadConfig();
-        inOrder.verify(mHardware, times(expectStart ? 1 : 0)).initOffloadControl(
-                any(OffloadHardwareInterface.ControlCallback.class));
+        inOrder.verify(mHardware, times(expectStart ? 1 : 0)).initOffload(
+                any(OffloadHalCallback.class));
         inOrder.verifyNoMoreInteractions();
         // Clear counters only instead of whole mock to preserve the mocking setup.
         clearInvocations(mHardware);
@@ -218,7 +217,7 @@
     private void stopOffloadController(final OffloadController offload) throws Exception {
         final InOrder inOrder = inOrder(mHardware);
         offload.stop();
-        inOrder.verify(mHardware, times(1)).stopOffloadControl();
+        inOrder.verify(mHardware, times(1)).stopOffload();
         inOrder.verifyNoMoreInteractions();
         reset(mHardware);
     }
@@ -228,7 +227,7 @@
         when(mHardware.getDefaultTetherOffloadDisabled()).thenReturn(1);
         assertThrows(SettingNotFoundException.class, () ->
                 Settings.Global.getInt(mContentResolver, TETHER_OFFLOAD_DISABLED));
-        startOffloadController(OFFLOAD_HAL_VERSION_1_0, false /*expectStart*/);
+        startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, false /*expectStart*/);
     }
 
     @Test
@@ -236,26 +235,26 @@
         when(mHardware.getDefaultTetherOffloadDisabled()).thenReturn(0);
         assertThrows(SettingNotFoundException.class, () ->
                 Settings.Global.getInt(mContentResolver, TETHER_OFFLOAD_DISABLED));
-        startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+        startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
     }
 
     @Test
     public void testSettingsAllowsStart() throws Exception {
         Settings.Global.putInt(mContentResolver, TETHER_OFFLOAD_DISABLED, 0);
-        startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+        startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
     }
 
     @Test
     public void testSettingsDisablesStart() throws Exception {
         Settings.Global.putInt(mContentResolver, TETHER_OFFLOAD_DISABLED, 1);
-        startOffloadController(OFFLOAD_HAL_VERSION_1_0, false /*expectStart*/);
+        startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, false /*expectStart*/);
     }
 
     @Test
     public void testSetUpstreamLinkPropertiesWorking() throws Exception {
         enableOffload();
         final OffloadController offload =
-                startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+                startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
 
         // In reality, the UpstreamNetworkMonitor would have passed down to us
         // a covering set of local prefixes representing a minimum essential
@@ -426,7 +425,7 @@
     public void testGetForwardedStats() throws Exception {
         enableOffload();
         final OffloadController offload =
-                startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+                startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
 
         final String ethernetIface = "eth1";
         final String mobileIface = "rmnet_data0";
@@ -521,11 +520,11 @@
         // Verify the OffloadController is called by R framework, where the framework doesn't send
         // warning.
         // R only uses HAL 1.0.
-        checkSetDataWarningAndLimit(false, OFFLOAD_HAL_VERSION_1_0);
+        checkSetDataWarningAndLimit(false, OFFLOAD_HAL_VERSION_HIDL_1_0);
         // Verify the OffloadController is called by S+ framework, where the framework sends
         // warning along with limit.
-        checkSetDataWarningAndLimit(true, OFFLOAD_HAL_VERSION_1_0);
-        checkSetDataWarningAndLimit(true, OFFLOAD_HAL_VERSION_1_1);
+        checkSetDataWarningAndLimit(true, OFFLOAD_HAL_VERSION_HIDL_1_0);
+        checkSetDataWarningAndLimit(true, OFFLOAD_HAL_VERSION_HIDL_1_1);
     }
 
     private void checkSetDataWarningAndLimit(boolean isProviderSetWarning, int controlVersion)
@@ -550,7 +549,7 @@
         when(mHardware.setDataWarningAndLimit(anyString(), anyLong(), anyLong())).thenReturn(true);
         offload.setUpstreamLinkProperties(lp);
         // Applying an interface sends the initial quota to the hardware.
-        if (controlVersion >= OFFLOAD_HAL_VERSION_1_1) {
+        if (controlVersion >= OFFLOAD_HAL_VERSION_HIDL_1_1) {
             inOrder.verify(mHardware).setDataWarningAndLimit(ethernetIface, Long.MAX_VALUE,
                     Long.MAX_VALUE);
         } else {
@@ -576,7 +575,7 @@
             mTetherStatsProvider.onSetLimit(ethernetIface, ethernetLimit);
         }
         waitForIdle();
-        if (controlVersion >= OFFLOAD_HAL_VERSION_1_1) {
+        if (controlVersion >= OFFLOAD_HAL_VERSION_HIDL_1_1) {
             inOrder.verify(mHardware).setDataWarningAndLimit(ethernetIface, Long.MAX_VALUE,
                     ethernetLimit);
         } else {
@@ -591,7 +590,7 @@
             mTetherStatsProvider.onSetLimit(mobileIface, mobileLimit);
         }
         waitForIdle();
-        if (controlVersion >= OFFLOAD_HAL_VERSION_1_1) {
+        if (controlVersion >= OFFLOAD_HAL_VERSION_HIDL_1_1) {
             inOrder.verify(mHardware, never()).setDataWarningAndLimit(anyString(), anyLong(),
                     anyLong());
         } else {
@@ -603,7 +602,7 @@
         lp.setInterfaceName(mobileIface);
         offload.setUpstreamLinkProperties(lp);
         waitForIdle();
-        if (controlVersion >= OFFLOAD_HAL_VERSION_1_1) {
+        if (controlVersion >= OFFLOAD_HAL_VERSION_HIDL_1_1) {
             inOrder.verify(mHardware).setDataWarningAndLimit(mobileIface,
                     isProviderSetWarning ? mobileWarning : Long.MAX_VALUE,
                     mobileLimit);
@@ -620,7 +619,7 @@
             mTetherStatsProvider.onSetLimit(mobileIface, NetworkStatsProvider.QUOTA_UNLIMITED);
         }
         waitForIdle();
-        if (controlVersion >= OFFLOAD_HAL_VERSION_1_1) {
+        if (controlVersion >= OFFLOAD_HAL_VERSION_HIDL_1_1) {
             inOrder.verify(mHardware).setDataWarningAndLimit(mobileIface, Long.MAX_VALUE,
                     Long.MAX_VALUE);
         } else {
@@ -655,15 +654,15 @@
         }
         waitForIdle();
         inOrder.verify(mHardware).getForwardedStats(ethernetIface);
-        inOrder.verify(mHardware).stopOffloadControl();
+        inOrder.verify(mHardware).stopOffload();
     }
 
     @Test
     public void testDataWarningAndLimitCallback_LimitReached() throws Exception {
         enableOffload();
-        startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+        startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
 
-        final OffloadHardwareInterface.ControlCallback callback = mControlCallbackCaptor.getValue();
+        final OffloadHalCallback callback = mOffloadHalCallbackCaptor.getValue();
         callback.onStoppedLimitReached();
         mTetherStatsProviderCb.expectNotifyStatsUpdated();
 
@@ -679,8 +678,8 @@
     @Test
     @IgnoreUpTo(Build.VERSION_CODES.R)  // HAL 1.1 is only supported from S
     public void testDataWarningAndLimitCallback_WarningReached() throws Exception {
-        startOffloadController(OFFLOAD_HAL_VERSION_1_1, true /*expectStart*/);
-        final OffloadHardwareInterface.ControlCallback callback = mControlCallbackCaptor.getValue();
+        startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_1, true /*expectStart*/);
+        final OffloadHalCallback callback = mOffloadHalCallbackCaptor.getValue();
         callback.onWarningReached();
         mTetherStatsProviderCb.expectNotifyStatsUpdated();
 
@@ -695,7 +694,7 @@
     public void testAddRemoveDownstreams() throws Exception {
         enableOffload();
         final OffloadController offload =
-                startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+                startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
         final InOrder inOrder = inOrder(mHardware);
 
         // Tethering makes several calls to setLocalPrefixes() before add/remove
@@ -710,14 +709,14 @@
         usbLinkProperties.addRoute(
                 new RouteInfo(new IpPrefix(USB_PREFIX), null, null, RTN_UNICAST));
         offload.notifyDownstreamLinkProperties(usbLinkProperties);
-        inOrder.verify(mHardware, times(1)).addDownstreamPrefix(RNDIS0, USB_PREFIX);
+        inOrder.verify(mHardware, times(1)).addDownstream(RNDIS0, USB_PREFIX);
         inOrder.verifyNoMoreInteractions();
 
         // [2] Routes for IPv6 link-local prefixes should never be added.
         usbLinkProperties.addRoute(
                 new RouteInfo(new IpPrefix(IPV6_LINKLOCAL), null, null, RTN_UNICAST));
         offload.notifyDownstreamLinkProperties(usbLinkProperties);
-        inOrder.verify(mHardware, never()).addDownstreamPrefix(eq(RNDIS0), anyString());
+        inOrder.verify(mHardware, never()).addDownstream(eq(RNDIS0), anyString());
         inOrder.verifyNoMoreInteractions();
 
         // [3] Add an IPv6 prefix for good measure. Only new offload-able
@@ -726,14 +725,14 @@
         usbLinkProperties.addRoute(
                 new RouteInfo(new IpPrefix(IPV6_DOC_PREFIX), null, null, RTN_UNICAST));
         offload.notifyDownstreamLinkProperties(usbLinkProperties);
-        inOrder.verify(mHardware, times(1)).addDownstreamPrefix(RNDIS0, IPV6_DOC_PREFIX);
+        inOrder.verify(mHardware, times(1)).addDownstream(RNDIS0, IPV6_DOC_PREFIX);
         inOrder.verifyNoMoreInteractions();
 
         // [4] Adding addresses doesn't affect notifyDownstreamLinkProperties().
         // The address is passed in by a separate setLocalPrefixes() invocation.
         usbLinkProperties.addLinkAddress(new LinkAddress("2001:db8::2/64"));
         offload.notifyDownstreamLinkProperties(usbLinkProperties);
-        inOrder.verify(mHardware, never()).addDownstreamPrefix(eq(RNDIS0), anyString());
+        inOrder.verify(mHardware, never()).addDownstream(eq(RNDIS0), anyString());
 
         // [5] Differences in local routes are converted into addDownstream()
         // and removeDownstream() invocations accordingly.
@@ -742,8 +741,8 @@
         usbLinkProperties.addRoute(
                 new RouteInfo(new IpPrefix(IPV6_DISCARD_PREFIX), null, null, RTN_UNICAST));
         offload.notifyDownstreamLinkProperties(usbLinkProperties);
-        inOrder.verify(mHardware, times(1)).removeDownstreamPrefix(RNDIS0, IPV6_DOC_PREFIX);
-        inOrder.verify(mHardware, times(1)).addDownstreamPrefix(RNDIS0, IPV6_DISCARD_PREFIX);
+        inOrder.verify(mHardware, times(1)).removeDownstream(RNDIS0, IPV6_DOC_PREFIX);
+        inOrder.verify(mHardware, times(1)).addDownstream(RNDIS0, IPV6_DISCARD_PREFIX);
         inOrder.verifyNoMoreInteractions();
 
         // [6] Removing a downstream interface which was never added causes no
@@ -753,8 +752,8 @@
 
         // [7] Removing an active downstream removes all remaining prefixes.
         offload.removeDownstreamInterface(RNDIS0);
-        inOrder.verify(mHardware, times(1)).removeDownstreamPrefix(RNDIS0, USB_PREFIX);
-        inOrder.verify(mHardware, times(1)).removeDownstreamPrefix(RNDIS0, IPV6_DISCARD_PREFIX);
+        inOrder.verify(mHardware, times(1)).removeDownstream(RNDIS0, USB_PREFIX);
+        inOrder.verify(mHardware, times(1)).removeDownstream(RNDIS0, IPV6_DISCARD_PREFIX);
         inOrder.verifyNoMoreInteractions();
     }
 
@@ -762,7 +761,7 @@
     public void testControlCallbackOnStoppedUnsupportedFetchesAllStats() throws Exception {
         enableOffload();
         final OffloadController offload =
-                startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+                startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
 
         // Pretend to set a few different upstreams (only the interface name
         // matters for this test; we're ignoring IP and route information).
@@ -776,7 +775,7 @@
         // that happen with setUpstreamParameters().
         clearInvocations(mHardware);
 
-        OffloadHardwareInterface.ControlCallback callback = mControlCallbackCaptor.getValue();
+        OffloadHalCallback callback = mOffloadHalCallbackCaptor.getValue();
         callback.onStoppedUnsupported();
 
         // Verify forwarded stats behaviour.
@@ -793,7 +792,7 @@
             throws Exception {
         enableOffload();
         final OffloadController offload =
-                startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+                startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
 
         // Pretend to set a few different upstreams (only the interface name
         // matters for this test; we're ignoring IP and route information).
@@ -840,7 +839,7 @@
         // that happen with setUpstreamParameters().
         clearInvocations(mHardware);
 
-        OffloadHardwareInterface.ControlCallback callback = mControlCallbackCaptor.getValue();
+        OffloadHalCallback callback = mOffloadHalCallbackCaptor.getValue();
         callback.onSupportAvailable();
 
         // Verify forwarded stats behaviour.
@@ -859,8 +858,8 @@
                 // into OffloadController proper. After this, also check for:
                 //     "192.168.43.1/32", "2001:2::1/128", "2001:2::2/128"
                 "127.0.0.0/8", "192.0.2.0/24", "fe80::/64", "2001:db8::/64");
-        verify(mHardware, times(1)).addDownstreamPrefix(WLAN0, "192.168.43.0/24");
-        verify(mHardware, times(1)).addDownstreamPrefix(WLAN0, "2001:2::/64");
+        verify(mHardware, times(1)).addDownstream(WLAN0, "192.168.43.0/24");
+        verify(mHardware, times(1)).addDownstream(WLAN0, "2001:2::/64");
         verify(mHardware, times(1)).setUpstreamParameters(eq(RMNET0), any(), any(), any());
         verify(mHardware, times(1)).setDataLimit(eq(RMNET0), anyLong());
         verifyNoMoreInteractions(mHardware);
@@ -871,7 +870,7 @@
         enableOffload();
         setOffloadPollInterval(DEFAULT_TETHER_OFFLOAD_POLL_INTERVAL_MS);
         final OffloadController offload =
-                startOffloadController(OFFLOAD_HAL_VERSION_1_0, true /*expectStart*/);
+                startOffloadController(OFFLOAD_HAL_VERSION_HIDL_1_0, true /*expectStart*/);
 
         // Initialize with fake eth upstream.
         final String ethernetIface = "eth1";
@@ -925,7 +924,7 @@
         offload.setUpstreamLinkProperties(makeEthernetLinkProperties());
         mTetherStatsProvider.onSetAlert(0);
         waitForIdle();
-        if (controlVersion >= OFFLOAD_HAL_VERSION_1_1) {
+        if (controlVersion >= OFFLOAD_HAL_VERSION_HIDL_1_1) {
             mTetherStatsProviderCb.assertNoCallback();
         } else {
             mTetherStatsProviderCb.expectNotifyAlertReached();
@@ -935,7 +934,7 @@
 
     @Test
     public void testSoftwarePollingUsed() throws Exception {
-        checkSoftwarePollingUsed(OFFLOAD_HAL_VERSION_1_0);
-        checkSoftwarePollingUsed(OFFLOAD_HAL_VERSION_1_1);
+        checkSoftwarePollingUsed(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        checkSoftwarePollingUsed(OFFLOAD_HAL_VERSION_HIDL_1_1);
     }
 }
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHalAidlImplTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHalAidlImplTest.java
new file mode 100644
index 0000000..c9ce64f
--- /dev/null
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHalAidlImplTest.java
@@ -0,0 +1,390 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.tethering;
+
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_AIDL;
+
+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.eq;
+import static org.mockito.Mockito.anyLong;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.hardware.tetheroffload.ForwardedStats;
+import android.hardware.tetheroffload.IOffload;
+import android.hardware.tetheroffload.IPv4AddrPortPair;
+import android.hardware.tetheroffload.ITetheringOffloadCallback;
+import android.hardware.tetheroffload.NatTimeoutUpdate;
+import android.hardware.tetheroffload.NetworkProtocol;
+import android.hardware.tetheroffload.OffloadCallbackEvent;
+import android.os.Handler;
+import android.os.NativeHandle;
+import android.os.ParcelFileDescriptor;
+import android.os.ServiceSpecificException;
+import android.os.test.TestLooper;
+import android.system.OsConstants;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.net.module.util.SharedLog;
+import com.android.networkstack.tethering.OffloadHardwareInterface.OffloadHalCallback;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InOrder;
+import org.mockito.MockitoAnnotations;
+
+import java.io.FileDescriptor;
+import java.util.ArrayList;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public final class OffloadHalAidlImplTest {
+    private static final String RMNET0 = "test_rmnet_data0";
+
+    private final SharedLog mLog = new SharedLog("test");
+    private final TestLooper mTestLooper = new TestLooper();
+
+    private IOffload mIOffloadMock;
+    private OffloadHalAidlImpl mIOffloadHal;
+    private ITetheringOffloadCallback mTetheringOffloadCallback;
+    private OffloadHalCallback mOffloadHalCallback;
+
+    private void initAndValidateOffloadHal(boolean initSuccess)
+            throws Exception {
+        final FileDescriptor fd1 = new FileDescriptor();
+        final FileDescriptor fd2 = new FileDescriptor();
+        final NativeHandle handle1 = new NativeHandle(fd1, true);
+        final NativeHandle handle2 = new NativeHandle(fd2, true);
+        final ArgumentCaptor<ParcelFileDescriptor> fdCaptor1 =
+                ArgumentCaptor.forClass(ParcelFileDescriptor.class);
+        final ArgumentCaptor<ParcelFileDescriptor> fdCaptor2 =
+                ArgumentCaptor.forClass(ParcelFileDescriptor.class);
+        final ArgumentCaptor<ITetheringOffloadCallback> offloadCallbackCaptor =
+                ArgumentCaptor.forClass(ITetheringOffloadCallback.class);
+        if (initSuccess) {
+            doNothing().when(mIOffloadMock).initOffload(any(), any(), any());
+        } else {
+            doThrow(new IllegalStateException()).when(mIOffloadMock).initOffload(any(), any(),
+                    any());
+        }
+        assertEquals(mIOffloadHal.initOffload(handle1, handle2, mOffloadHalCallback),
+                     initSuccess);
+        verify(mIOffloadMock).initOffload(fdCaptor1.capture(), fdCaptor2.capture(),
+                                          offloadCallbackCaptor.capture());
+        assertEquals(fdCaptor1.getValue().getFd(), fd1.getInt$());
+        assertEquals(fdCaptor2.getValue().getFd(), fd2.getInt$());
+        mTetheringOffloadCallback = offloadCallbackCaptor.getValue();
+    }
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mIOffloadMock = mock(IOffload.class);
+        mIOffloadHal = new OffloadHalAidlImpl(OFFLOAD_HAL_VERSION_AIDL, mIOffloadMock,
+                new Handler(mTestLooper.getLooper()), mLog);
+        mOffloadHalCallback = spy(new OffloadHalCallback());
+    }
+
+    @Test
+    public void testInitOffloadSuccess() throws Exception {
+        initAndValidateOffloadHal(true /* initSuccess */);
+    }
+
+    @Test
+    public void testInitOffloadFailure() throws Exception {
+        initAndValidateOffloadHal(false /* initSuccess */);
+    }
+
+    @Test
+    public void testStopOffloadSuccess() throws Exception {
+        initAndValidateOffloadHal(true);
+        doNothing().when(mIOffloadMock).stopOffload();
+        assertTrue(mIOffloadHal.stopOffload());
+        verify(mIOffloadMock).stopOffload();
+    }
+
+    @Test
+    public void testStopOffloadFailure() throws Exception {
+        initAndValidateOffloadHal(true);
+        doThrow(new IllegalStateException()).when(mIOffloadMock).stopOffload();
+        assertFalse(mIOffloadHal.stopOffload());
+    }
+
+    private void doTestGetForwardedStats(boolean expectSuccess) throws Exception {
+        initAndValidateOffloadHal(true);
+        final ForwardedStats returnStats = new ForwardedStats();
+        if (expectSuccess) {
+            returnStats.rxBytes = 12345;
+            returnStats.txBytes = 67890;
+            when(mIOffloadMock.getForwardedStats(anyString())).thenReturn(returnStats);
+        } else {
+            when(mIOffloadMock.getForwardedStats(anyString()))
+                    .thenThrow(new ServiceSpecificException(IOffload.ERROR_CODE_UNUSED));
+        }
+        final OffloadHardwareInterface.ForwardedStats stats =
+                mIOffloadHal.getForwardedStats(RMNET0);
+        verify(mIOffloadMock).getForwardedStats(eq(RMNET0));
+        assertNotNull(stats);
+        assertEquals(stats.rxBytes, returnStats.rxBytes);
+        assertEquals(stats.txBytes, returnStats.txBytes);
+    }
+
+    @Test
+    public void testGetForwardedStatsSuccess() throws Exception {
+        doTestGetForwardedStats(true);
+    }
+
+    @Test
+    public void testGetForwardedStatsFailure() throws Exception {
+        doTestGetForwardedStats(false);
+    }
+
+    private void doTestSetLocalPrefixes(boolean expectSuccess) throws Exception {
+        initAndValidateOffloadHal(true);
+        final ArrayList<String> localPrefixes = new ArrayList<>();
+        localPrefixes.add("127.0.0.0/8");
+        localPrefixes.add("fe80::/64");
+        final String[] localPrefixesArray =
+                localPrefixes.toArray(new String[localPrefixes.size()]);
+        if (expectSuccess) {
+            doNothing().when(mIOffloadMock).setLocalPrefixes(any());
+        } else {
+            doThrow(new IllegalArgumentException()).when(mIOffloadMock).setLocalPrefixes(any());
+        }
+        assertEquals(expectSuccess, mIOffloadHal.setLocalPrefixes(localPrefixes));
+        verify(mIOffloadMock).setLocalPrefixes(eq(localPrefixesArray));
+    }
+
+    @Test
+    public void testSetLocalPrefixesSuccess() throws Exception {
+        doTestSetLocalPrefixes(true);
+    }
+
+    @Test
+    public void testSetLocalPrefixesFailure() throws Exception {
+        doTestSetLocalPrefixes(false);
+    }
+
+    private void doTestSetDataLimit(boolean expectSuccess) throws Exception {
+        initAndValidateOffloadHal(true);
+        final long limit = 12345;
+        if (expectSuccess) {
+            doNothing().when(mIOffloadMock).setDataWarningAndLimit(anyString(), anyLong(),
+                    anyLong());
+        } else {
+            doThrow(new IllegalArgumentException())
+                    .when(mIOffloadMock).setDataWarningAndLimit(anyString(), anyLong(), anyLong());
+        }
+        assertEquals(expectSuccess, mIOffloadHal.setDataLimit(RMNET0, limit));
+        verify(mIOffloadMock).setDataWarningAndLimit(eq(RMNET0), eq(Long.MAX_VALUE), eq(limit));
+    }
+
+    @Test
+    public void testSetDataLimitSuccess() throws Exception {
+        doTestSetDataLimit(true);
+    }
+
+    @Test
+    public void testSetDataLimitFailure() throws Exception {
+        doTestSetDataLimit(false);
+    }
+
+    private void doTestSetDataWarningAndLimit(boolean expectSuccess) throws Exception {
+        initAndValidateOffloadHal(true);
+        final long warning = 12345;
+        final long limit = 67890;
+        if (expectSuccess) {
+            doNothing().when(mIOffloadMock).setDataWarningAndLimit(anyString(), anyLong(),
+                    anyLong());
+        } else {
+            doThrow(new IllegalArgumentException())
+                    .when(mIOffloadMock).setDataWarningAndLimit(anyString(), anyLong(), anyLong());
+        }
+        assertEquals(expectSuccess, mIOffloadHal.setDataWarningAndLimit(RMNET0, warning, limit));
+        verify(mIOffloadMock).setDataWarningAndLimit(eq(RMNET0), eq(warning), eq(limit));
+    }
+
+    @Test
+    public void testSetDataWarningAndLimitSuccess() throws Exception {
+        doTestSetDataWarningAndLimit(true);
+    }
+
+    @Test
+    public void testSetDataWarningAndLimitFailure() throws Exception {
+        doTestSetDataWarningAndLimit(false);
+    }
+
+    private void doTestSetUpstreamParameters(boolean expectSuccess) throws Exception {
+        initAndValidateOffloadHal(true);
+        final String v4addr = "192.168.10.1";
+        final String v4gateway = "192.168.10.255";
+        final ArrayList<String> v6gws = new ArrayList<>(0);
+        v6gws.add("2001:db8::1");
+        String[] v6gwsArray = v6gws.toArray(new String[v6gws.size()]);
+        if (expectSuccess) {
+            doNothing().when(mIOffloadMock).setUpstreamParameters(anyString(), anyString(),
+                    anyString(), any());
+        } else {
+            doThrow(new IllegalArgumentException()).when(mIOffloadMock).setUpstreamParameters(
+                    anyString(), anyString(), anyString(), any());
+        }
+        assertEquals(expectSuccess, mIOffloadHal.setUpstreamParameters(RMNET0, v4addr, v4gateway,
+                  v6gws));
+        verify(mIOffloadMock).setUpstreamParameters(eq(RMNET0), eq(v4addr), eq(v4gateway),
+                  eq(v6gwsArray));
+    }
+
+    @Test
+    public void testSetUpstreamParametersSuccess() throws Exception {
+        doTestSetUpstreamParameters(true);
+    }
+
+    @Test
+    public void testSetUpstreamParametersFailure() throws Exception {
+        doTestSetUpstreamParameters(false);
+    }
+
+    private void doTestAddDownstream(boolean expectSuccess) throws Exception {
+        initAndValidateOffloadHal(true);
+        final String ifName = "wlan1";
+        final String prefix = "192.168.43.0/24";
+        if (expectSuccess) {
+            doNothing().when(mIOffloadMock).addDownstream(anyString(), anyString());
+        } else {
+            doThrow(new IllegalStateException()).when(mIOffloadMock).addDownstream(anyString(),
+                    anyString());
+        }
+        assertEquals(expectSuccess, mIOffloadHal.addDownstream(ifName, prefix));
+        verify(mIOffloadMock).addDownstream(eq(ifName), eq(prefix));
+    }
+
+    @Test
+    public void testAddDownstreamSuccess() throws Exception {
+        doTestAddDownstream(true);
+    }
+
+    @Test
+    public void testAddDownstreamFailure() throws Exception {
+        doTestAddDownstream(false);
+    }
+
+    private void doTestRemoveDownstream(boolean expectSuccess) throws Exception {
+        initAndValidateOffloadHal(true);
+        final String ifName = "wlan1";
+        final String prefix = "192.168.43.0/24";
+        if (expectSuccess) {
+            doNothing().when(mIOffloadMock).removeDownstream(anyString(), anyString());
+        } else {
+            doThrow(new IllegalArgumentException()).when(mIOffloadMock).removeDownstream(
+                    anyString(), anyString());
+        }
+        assertEquals(expectSuccess, mIOffloadHal.removeDownstream(ifName, prefix));
+        verify(mIOffloadMock).removeDownstream(eq(ifName), eq(prefix));
+    }
+
+    @Test
+    public void testRemoveDownstreamSuccess() throws Exception {
+        doTestRemoveDownstream(true);
+    }
+
+    @Test
+    public void testRemoveDownstreamFailure() throws Exception {
+        doTestRemoveDownstream(false);
+    }
+
+    @Test
+    public void testTetheringOffloadCallback() throws Exception {
+        initAndValidateOffloadHal(true);
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STARTED);
+        mTestLooper.dispatchAll();
+        final InOrder inOrder = inOrder(mOffloadHalCallback);
+        inOrder.verify(mOffloadHalCallback).onStarted();
+        inOrder.verifyNoMoreInteractions();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_ERROR);
+        mTestLooper.dispatchAll();
+        inOrder.verify(mOffloadHalCallback).onStoppedError();
+        inOrder.verifyNoMoreInteractions();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_UNSUPPORTED);
+        mTestLooper.dispatchAll();
+        inOrder.verify(mOffloadHalCallback).onStoppedUnsupported();
+        inOrder.verifyNoMoreInteractions();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_SUPPORT_AVAILABLE);
+        mTestLooper.dispatchAll();
+        inOrder.verify(mOffloadHalCallback).onSupportAvailable();
+        inOrder.verifyNoMoreInteractions();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_LIMIT_REACHED);
+        mTestLooper.dispatchAll();
+        inOrder.verify(mOffloadHalCallback).onStoppedLimitReached();
+        inOrder.verifyNoMoreInteractions();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_WARNING_REACHED);
+        mTestLooper.dispatchAll();
+        inOrder.verify(mOffloadHalCallback).onWarningReached();
+        inOrder.verifyNoMoreInteractions();
+
+        final NatTimeoutUpdate tcpParams = buildNatTimeoutUpdate(NetworkProtocol.TCP);
+        mTetheringOffloadCallback.updateTimeout(tcpParams);
+        mTestLooper.dispatchAll();
+        inOrder.verify(mOffloadHalCallback).onNatTimeoutUpdate(eq(OsConstants.IPPROTO_TCP),
+                eq(tcpParams.src.addr),
+                eq(tcpParams.src.port),
+                eq(tcpParams.dst.addr),
+                eq(tcpParams.dst.port));
+        inOrder.verifyNoMoreInteractions();
+
+        final NatTimeoutUpdate udpParams = buildNatTimeoutUpdate(NetworkProtocol.UDP);
+        mTetheringOffloadCallback.updateTimeout(udpParams);
+        mTestLooper.dispatchAll();
+        inOrder.verify(mOffloadHalCallback).onNatTimeoutUpdate(eq(OsConstants.IPPROTO_UDP),
+                eq(udpParams.src.addr),
+                eq(udpParams.src.port),
+                eq(udpParams.dst.addr),
+                eq(udpParams.dst.port));
+        inOrder.verifyNoMoreInteractions();
+    }
+
+    private NatTimeoutUpdate buildNatTimeoutUpdate(final int proto) {
+        final NatTimeoutUpdate params = new NatTimeoutUpdate();
+        params.proto = proto;
+        params.src = new IPv4AddrPortPair();
+        params.dst = new IPv4AddrPortPair();
+        params.src.addr = "192.168.43.200";
+        params.src.port = 100;
+        params.dst.addr = "172.50.46.169";
+        params.dst.port = 150;
+        return params;
+    }
+}
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHalHidlImplTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHalHidlImplTest.java
new file mode 100644
index 0000000..6fdab5a
--- /dev/null
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHalHidlImplTest.java
@@ -0,0 +1,359 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.tethering;
+
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_0;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_1;
+import static com.android.networkstack.tethering.util.TetheringUtils.uint16;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+import android.hardware.tetheroffload.config.V1_0.IOffloadConfig;
+import android.hardware.tetheroffload.control.V1_0.IOffloadControl;
+import android.hardware.tetheroffload.control.V1_0.NatTimeoutUpdate;
+import android.hardware.tetheroffload.control.V1_0.NetworkProtocol;
+import android.hardware.tetheroffload.control.V1_1.ITetheringOffloadCallback;
+import android.hardware.tetheroffload.control.V1_1.OffloadCallbackEvent;
+import android.os.Handler;
+import android.os.NativeHandle;
+import android.os.test.TestLooper;
+import android.system.OsConstants;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.net.module.util.SharedLog;
+import com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;
+import com.android.networkstack.tethering.OffloadHardwareInterface.OffloadHalCallback;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InOrder;
+import org.mockito.MockitoAnnotations;
+
+import java.io.FileDescriptor;
+import java.util.ArrayList;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public final class OffloadHalHidlImplTest {
+    private static final String RMNET0 = "test_rmnet_data0";
+
+    private final SharedLog mLog = new SharedLog("test");
+    private final TestLooper mTestLooper = new TestLooper();
+
+    private OffloadHalHidlImpl mIOffloadHal;
+    private IOffloadConfig mIOffloadConfigMock;
+    private IOffloadControl mIOffloadControlMock;
+    private ITetheringOffloadCallback mTetheringOffloadCallback;
+    private OffloadHalCallback mOffloadHalCallback;
+
+    private void createAndInitOffloadHal(int version) throws Exception {
+        final FileDescriptor fd1 = new FileDescriptor();
+        final FileDescriptor fd2 = new FileDescriptor();
+        final NativeHandle handle1 = new NativeHandle(fd1, true);
+        final NativeHandle handle2 = new NativeHandle(fd2, true);
+        mIOffloadConfigMock = mock(IOffloadConfig.class);
+        switch (version) {
+            case OFFLOAD_HAL_VERSION_HIDL_1_0:
+                mIOffloadControlMock = mock(IOffloadControl.class);
+                break;
+            case OFFLOAD_HAL_VERSION_HIDL_1_1:
+                mIOffloadControlMock = mock(
+                        android.hardware.tetheroffload.control.V1_1.IOffloadControl.class);
+                break;
+            default:
+                fail("Nonexistent HAL version");
+                return;
+        }
+        mIOffloadHal = new OffloadHalHidlImpl(version, mIOffloadConfigMock,
+                mIOffloadControlMock, new Handler(mTestLooper.getLooper()), mLog);
+        mIOffloadHal.initOffload(handle1, handle2, mOffloadHalCallback);
+
+        final ArgumentCaptor<NativeHandle> nativeHandleCaptor1 =
+                ArgumentCaptor.forClass(NativeHandle.class);
+        final ArgumentCaptor<NativeHandle> nativeHandleCaptor2 =
+                ArgumentCaptor.forClass(NativeHandle.class);
+        final ArgumentCaptor<ITetheringOffloadCallback> offloadCallbackCaptor =
+                ArgumentCaptor.forClass(ITetheringOffloadCallback.class);
+        verify(mIOffloadConfigMock).setHandles(nativeHandleCaptor1.capture(),
+                nativeHandleCaptor2.capture(), any());
+        verify(mIOffloadControlMock).initOffload(offloadCallbackCaptor.capture(), any());
+        assertEquals(nativeHandleCaptor1.getValue().getFileDescriptor().getInt$(),
+                handle1.getFileDescriptor().getInt$());
+        assertEquals(nativeHandleCaptor2.getValue().getFileDescriptor().getInt$(),
+                handle2.getFileDescriptor().getInt$());
+        mTetheringOffloadCallback = offloadCallbackCaptor.getValue();
+    }
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mOffloadHalCallback = spy(new OffloadHalCallback());
+    }
+
+    @Test
+    public void testGetForwardedStats() throws Exception {
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        final long rxBytes = 12345;
+        final long txBytes = 67890;
+        doAnswer(invocation -> {
+            ((IOffloadControl.getForwardedStatsCallback) invocation.getArgument(1))
+                    .onValues(rxBytes, txBytes);
+            return null;
+        }).when(mIOffloadControlMock).getForwardedStats(eq(RMNET0), any());
+        final ForwardedStats stats = mIOffloadHal.getForwardedStats(RMNET0);
+        verify(mIOffloadControlMock).getForwardedStats(eq(RMNET0), any());
+        assertNotNull(stats);
+        assertEquals(rxBytes, stats.rxBytes);
+        assertEquals(txBytes, stats.txBytes);
+    }
+
+    private void doTestSetLocalPrefixes(boolean expectSuccess) throws Exception {
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        final ArrayList<String> localPrefixes = new ArrayList<>();
+        localPrefixes.add("127.0.0.0/8");
+        localPrefixes.add("fe80::/64");
+        doAnswer(invocation -> {
+            ((IOffloadControl.setLocalPrefixesCallback) invocation.getArgument(1))
+                    .onValues(expectSuccess, "");
+            return null;
+        }).when(mIOffloadControlMock).setLocalPrefixes(eq(localPrefixes), any());
+        assertEquals(expectSuccess, mIOffloadHal.setLocalPrefixes(localPrefixes));
+        verify(mIOffloadControlMock).setLocalPrefixes(eq(localPrefixes), any());
+    }
+
+    @Test
+    public void testSetLocalPrefixesSuccess() throws Exception {
+        doTestSetLocalPrefixes(true);
+    }
+
+    @Test
+    public void testSetLocalPrefixesFailure() throws Exception {
+        doTestSetLocalPrefixes(false);
+    }
+
+    private void doTestSetDataLimit(boolean expectSuccess) throws Exception {
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        final long limit = 12345;
+        doAnswer(invocation -> {
+            ((IOffloadControl.setDataLimitCallback) invocation.getArgument(2))
+                    .onValues(expectSuccess, "");
+            return null;
+        }).when(mIOffloadControlMock).setDataLimit(eq(RMNET0), eq(limit), any());
+        assertEquals(expectSuccess, mIOffloadHal.setDataLimit(RMNET0, limit));
+        verify(mIOffloadControlMock).setDataLimit(eq(RMNET0), eq(limit), any());
+    }
+
+    @Test
+    public void testSetDataLimitSuccess() throws Exception {
+        doTestSetDataLimit(true);
+    }
+
+    @Test
+    public void testSetDataLimitFailure() throws Exception {
+        doTestSetDataLimit(false);
+    }
+
+    private void doTestSetDataWarningAndLimit(boolean expectSuccess) throws Exception {
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_1);
+        final long warning = 12345;
+        final long limit = 67890;
+        doAnswer(invocation -> {
+            ((android.hardware.tetheroffload.control.V1_1.IOffloadControl
+                    .setDataWarningAndLimitCallback) invocation.getArgument(3))
+                    .onValues(expectSuccess, "");
+            return null;
+        }).when((android.hardware.tetheroffload.control.V1_1.IOffloadControl) mIOffloadControlMock)
+                .setDataWarningAndLimit(eq(RMNET0), eq(warning), eq(limit), any());
+        assertEquals(expectSuccess, mIOffloadHal.setDataWarningAndLimit(RMNET0, warning, limit));
+        verify((android.hardware.tetheroffload.control.V1_1.IOffloadControl) mIOffloadControlMock)
+                .setDataWarningAndLimit(eq(RMNET0), eq(warning), eq(limit), any());
+    }
+
+    @Test
+    public void testSetDataWarningAndLimitSuccess() throws Exception {
+        doTestSetDataWarningAndLimit(true);
+    }
+
+    @Test
+    public void testSetDataWarningAndLimitFailure() throws Exception {
+        // Verify that V1.0 control HAL would reject the function call with exception.
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        final long warning = 12345;
+        final long limit = 67890;
+        assertThrows(UnsupportedOperationException.class,
+                () -> mIOffloadHal.setDataWarningAndLimit(RMNET0, warning, limit));
+
+        doTestSetDataWarningAndLimit(false);
+    }
+
+    private void doTestSetUpstreamParameters(boolean expectSuccess) throws Exception {
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        final String v4addr = "192.168.10.1";
+        final String v4gateway = "192.168.10.255";
+        final ArrayList<String> v6gws = new ArrayList<>(0);
+        v6gws.add("2001:db8::1");
+        doAnswer(invocation -> {
+            ((IOffloadControl.setUpstreamParametersCallback) invocation.getArgument(4))
+                    .onValues(expectSuccess, "");
+            return null;
+        }).when(mIOffloadControlMock).setUpstreamParameters(eq(RMNET0), eq(v4addr), eq(v4gateway),
+                eq(v6gws), any());
+        assertEquals(expectSuccess, mIOffloadHal.setUpstreamParameters(RMNET0, v4addr, v4gateway,
+                v6gws));
+        verify(mIOffloadControlMock).setUpstreamParameters(eq(RMNET0), eq(v4addr), eq(v4gateway),
+                eq(v6gws), any());
+    }
+
+    @Test
+    public void testSetUpstreamParametersSuccess() throws Exception {
+        doTestSetUpstreamParameters(true);
+    }
+
+    @Test
+    public void testSetUpstreamParametersFailure() throws Exception {
+        doTestSetUpstreamParameters(false);
+    }
+
+    private void doTestAddDownstream(boolean expectSuccess) throws Exception {
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        final String ifName = "wlan1";
+        final String prefix = "192.168.43.0/24";
+        doAnswer(invocation -> {
+            ((IOffloadControl.addDownstreamCallback) invocation.getArgument(2))
+                    .onValues(expectSuccess, "");
+            return null;
+        }).when(mIOffloadControlMock).addDownstream(eq(ifName), eq(prefix), any());
+        assertEquals(expectSuccess, mIOffloadHal.addDownstream(ifName, prefix));
+        verify(mIOffloadControlMock).addDownstream(eq(ifName), eq(prefix), any());
+    }
+
+    @Test
+    public void testAddDownstreamSuccess() throws Exception {
+        doTestAddDownstream(true);
+    }
+
+    @Test
+    public void testAddDownstreamFailure() throws Exception {
+        doTestAddDownstream(false);
+    }
+
+    private void doTestRemoveDownstream(boolean expectSuccess) throws Exception {
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        final String ifName = "wlan1";
+        final String prefix = "192.168.43.0/24";
+        doAnswer(invocation -> {
+            ((IOffloadControl.removeDownstreamCallback) invocation.getArgument(2))
+                    .onValues(expectSuccess, "");
+            return null;
+        }).when(mIOffloadControlMock).removeDownstream(eq(ifName), eq(prefix), any());
+        assertEquals(expectSuccess, mIOffloadHal.removeDownstream(ifName, prefix));
+        verify(mIOffloadControlMock).removeDownstream(eq(ifName), eq(prefix), any());
+    }
+
+    @Test
+    public void testRemoveDownstreamSuccess() throws Exception {
+        doTestRemoveDownstream(true);
+    }
+
+    @Test
+    public void testRemoveDownstreamFailure() throws Exception {
+        doTestRemoveDownstream(false);
+    }
+
+    @Test
+    public void testTetheringOffloadCallback() throws Exception {
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_0);
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STARTED);
+        mTestLooper.dispatchAll();
+        verify(mOffloadHalCallback).onStarted();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_ERROR);
+        mTestLooper.dispatchAll();
+        verify(mOffloadHalCallback).onStoppedError();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_UNSUPPORTED);
+        mTestLooper.dispatchAll();
+        verify(mOffloadHalCallback).onStoppedUnsupported();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_SUPPORT_AVAILABLE);
+        mTestLooper.dispatchAll();
+        verify(mOffloadHalCallback).onSupportAvailable();
+
+        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_LIMIT_REACHED);
+        mTestLooper.dispatchAll();
+        verify(mOffloadHalCallback).onStoppedLimitReached();
+
+        final NatTimeoutUpdate tcpParams = buildNatTimeoutUpdate(NetworkProtocol.TCP);
+        mTetheringOffloadCallback.updateTimeout(tcpParams);
+        mTestLooper.dispatchAll();
+        verify(mOffloadHalCallback).onNatTimeoutUpdate(eq(OsConstants.IPPROTO_TCP),
+                eq(tcpParams.src.addr),
+                eq(uint16(tcpParams.src.port)),
+                eq(tcpParams.dst.addr),
+                eq(uint16(tcpParams.dst.port)));
+
+        final NatTimeoutUpdate udpParams = buildNatTimeoutUpdate(NetworkProtocol.UDP);
+        mTetheringOffloadCallback.updateTimeout(udpParams);
+        mTestLooper.dispatchAll();
+        verify(mOffloadHalCallback).onNatTimeoutUpdate(eq(OsConstants.IPPROTO_UDP),
+                eq(udpParams.src.addr),
+                eq(uint16(udpParams.src.port)),
+                eq(udpParams.dst.addr),
+                eq(uint16(udpParams.dst.port)));
+        reset(mOffloadHalCallback);
+
+        createAndInitOffloadHal(OFFLOAD_HAL_VERSION_HIDL_1_1);
+
+        // Verify the interface will process the events that comes from V1.1 HAL.
+        mTetheringOffloadCallback.onEvent_1_1(OffloadCallbackEvent.OFFLOAD_STARTED);
+        mTestLooper.dispatchAll();
+        final InOrder inOrder = inOrder(mOffloadHalCallback);
+        inOrder.verify(mOffloadHalCallback).onStarted();
+        inOrder.verifyNoMoreInteractions();
+
+        mTetheringOffloadCallback.onEvent_1_1(OffloadCallbackEvent.OFFLOAD_WARNING_REACHED);
+        mTestLooper.dispatchAll();
+        inOrder.verify(mOffloadHalCallback).onWarningReached();
+        inOrder.verifyNoMoreInteractions();
+    }
+
+    private NatTimeoutUpdate buildNatTimeoutUpdate(final int proto) {
+        final NatTimeoutUpdate params = new NatTimeoutUpdate();
+        params.proto = proto;
+        params.src.addr = "192.168.43.200";
+        params.src.port = 100;
+        params.dst.addr = "172.50.46.169";
+        params.dst.port = 150;
+        return params;
+    }
+}
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHardwareInterfaceTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHardwareInterfaceTest.java
index 36b439b..b1f875b 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHardwareInterfaceTest.java
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHardwareInterfaceTest.java
@@ -20,36 +20,29 @@
 import static android.system.OsConstants.AF_UNIX;
 import static android.system.OsConstants.SOCK_STREAM;
 
-import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_0;
-import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_1;
-import static com.android.networkstack.tethering.util.TetheringUtils.uint16;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_AIDL;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_0;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_1;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_NONE;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.hardware.tetheroffload.config.V1_0.IOffloadConfig;
-import android.hardware.tetheroffload.control.V1_0.IOffloadControl;
-import android.hardware.tetheroffload.control.V1_0.NatTimeoutUpdate;
-import android.hardware.tetheroffload.control.V1_0.NetworkProtocol;
-import android.hardware.tetheroffload.control.V1_1.ITetheringOffloadCallback;
-import android.hardware.tetheroffload.control.V1_1.OffloadCallbackEvent;
 import android.os.Handler;
 import android.os.NativeHandle;
 import android.os.test.TestLooper;
 import android.system.ErrnoException;
 import android.system.Os;
-import android.system.OsConstants;
-import android.util.Pair;
 
 import androidx.test.filters.SmallTest;
 import androidx.test.runner.AndroidJUnit4;
@@ -57,12 +50,13 @@
 import com.android.net.module.util.SharedLog;
 import com.android.net.module.util.netlink.StructNfGenMsg;
 import com.android.net.module.util.netlink.StructNlMsgHdr;
+import com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;
+import com.android.networkstack.tethering.OffloadHardwareInterface.OffloadHalCallback;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
-import org.mockito.InOrder;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
@@ -79,11 +73,9 @@
     private final TestLooper mTestLooper = new TestLooper();
 
     private OffloadHardwareInterface mOffloadHw;
-    private ITetheringOffloadCallback mTetheringOffloadCallback;
-    private OffloadHardwareInterface.ControlCallback mControlCallback;
+    private OffloadHalCallback mOffloadHalCallback;
 
-    @Mock private IOffloadConfig mIOffloadConfig;
-    private IOffloadControl mIOffloadControl;
+    @Mock private IOffloadHal mIOffload;
     @Mock private NativeHandle mNativeHandle;
 
     // Random values to test Netlink message.
@@ -91,32 +83,16 @@
     private static final short TEST_FLAGS = 263;
 
     class MyDependencies extends OffloadHardwareInterface.Dependencies {
-        private final int mMockControlVersion;
-        MyDependencies(SharedLog log, final int mockControlVersion) {
-            super(log);
-            mMockControlVersion = mockControlVersion;
+        private final int mMockOffloadHalVersion;
+        MyDependencies(Handler handler, SharedLog log, final int mockOffloadHalVersion) {
+            super(handler, log);
+            mMockOffloadHalVersion = mockOffloadHalVersion;
+            when(mIOffload.getVersion()).thenReturn(mMockOffloadHalVersion);
         }
 
         @Override
-        public IOffloadConfig getOffloadConfig() {
-            return mIOffloadConfig;
-        }
-
-        @Override
-        public Pair<IOffloadControl, Integer> getOffloadControl() {
-            switch (mMockControlVersion) {
-                case OFFLOAD_HAL_VERSION_1_0:
-                    mIOffloadControl = mock(IOffloadControl.class);
-                    break;
-                case OFFLOAD_HAL_VERSION_1_1:
-                    mIOffloadControl =
-                            mock(android.hardware.tetheroffload.control.V1_1.IOffloadControl.class);
-                    break;
-                default:
-                    throw new IllegalArgumentException("Invalid offload control version "
-                            + mMockControlVersion);
-            }
-            return new Pair<IOffloadControl, Integer>(mIOffloadControl, mMockControlVersion);
+        public IOffloadHal getOffload() {
+            return mMockOffloadHalVersion == OFFLOAD_HAL_VERSION_NONE ? null : mIOffload;
         }
 
         @Override
@@ -128,156 +104,140 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mControlCallback = spy(new OffloadHardwareInterface.ControlCallback());
+        mOffloadHalCallback = new OffloadHalCallback();
+        when(mIOffload.initOffload(any(NativeHandle.class), any(NativeHandle.class),
+                any(OffloadHalCallback.class))).thenReturn(true);
     }
 
-    private void startOffloadHardwareInterface(int controlVersion) throws Exception {
+    private void startOffloadHardwareInterface(int offloadHalVersion)
+            throws Exception {
         final SharedLog log = new SharedLog("test");
-        mOffloadHw = new OffloadHardwareInterface(new Handler(mTestLooper.getLooper()), log,
-                new MyDependencies(log, controlVersion));
-        mOffloadHw.initOffloadConfig();
-        mOffloadHw.initOffloadControl(mControlCallback);
-        final ArgumentCaptor<ITetheringOffloadCallback> mOffloadCallbackCaptor =
-                ArgumentCaptor.forClass(ITetheringOffloadCallback.class);
-        verify(mIOffloadControl).initOffload(mOffloadCallbackCaptor.capture(), any());
-        mTetheringOffloadCallback = mOffloadCallbackCaptor.getValue();
+        final Handler handler = new Handler(mTestLooper.getLooper());
+        final int num = offloadHalVersion != OFFLOAD_HAL_VERSION_NONE ? 1 : 0;
+        mOffloadHw = new OffloadHardwareInterface(handler, log,
+                new MyDependencies(handler, log, offloadHalVersion));
+        assertEquals(offloadHalVersion, mOffloadHw.initOffload(mOffloadHalCallback));
+        verify(mIOffload, times(num)).initOffload(any(NativeHandle.class), any(NativeHandle.class),
+                eq(mOffloadHalCallback));
+    }
+
+    @Test
+    public void testInitFailureWithNoHal() throws Exception {
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_NONE);
+    }
+
+    @Test
+    public void testInitSuccessWithAidl() throws Exception {
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_AIDL);
+    }
+
+    @Test
+    public void testInitSuccessWithHidl_1_0() throws Exception {
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_0);
+    }
+
+    @Test
+    public void testInitSuccessWithHidl_1_1() throws Exception {
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_1);
     }
 
     @Test
     public void testGetForwardedStats() throws Exception {
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_0);
-        final OffloadHardwareInterface.ForwardedStats stats = mOffloadHw.getForwardedStats(RMNET0);
-        verify(mIOffloadControl).getForwardedStats(eq(RMNET0), any());
-        assertNotNull(stats);
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        ForwardedStats stats = new ForwardedStats(12345, 56780);
+        when(mIOffload.getForwardedStats(anyString())).thenReturn(stats);
+        assertEquals(mOffloadHw.getForwardedStats(RMNET0), stats);
+        verify(mIOffload).getForwardedStats(eq(RMNET0));
     }
 
     @Test
     public void testSetLocalPrefixes() throws Exception {
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_0);
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_0);
         final ArrayList<String> localPrefixes = new ArrayList<>();
         localPrefixes.add("127.0.0.0/8");
         localPrefixes.add("fe80::/64");
-        mOffloadHw.setLocalPrefixes(localPrefixes);
-        verify(mIOffloadControl).setLocalPrefixes(eq(localPrefixes), any());
+        when(mIOffload.setLocalPrefixes(any())).thenReturn(true);
+        assertTrue(mOffloadHw.setLocalPrefixes(localPrefixes));
+        verify(mIOffload).setLocalPrefixes(eq(localPrefixes));
+        when(mIOffload.setLocalPrefixes(any())).thenReturn(false);
+        assertFalse(mOffloadHw.setLocalPrefixes(localPrefixes));
     }
 
     @Test
     public void testSetDataLimit() throws Exception {
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_0);
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_0);
         final long limit = 12345;
-        mOffloadHw.setDataLimit(RMNET0, limit);
-        verify(mIOffloadControl).setDataLimit(eq(RMNET0), eq(limit), any());
+        when(mIOffload.setDataLimit(anyString(), anyLong())).thenReturn(true);
+        assertTrue(mOffloadHw.setDataLimit(RMNET0, limit));
+        verify(mIOffload).setDataLimit(eq(RMNET0), eq(limit));
+        when(mIOffload.setDataLimit(anyString(), anyLong())).thenReturn(false);
+        assertFalse(mOffloadHw.setDataLimit(RMNET0, limit));
+    }
+
+    @Test
+    public void testSetDataWarningAndLimitFailureWithHidl_1_0() throws Exception {
+        // Verify V1.0 control HAL would reject the function call with exception.
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_0);
+        final long warning = 12345;
+        final long limit = 67890;
+        assertThrows(UnsupportedOperationException.class,
+                () -> mOffloadHw.setDataWarningAndLimit(RMNET0, warning, limit));
     }
 
     @Test
     public void testSetDataWarningAndLimit() throws Exception {
-        // Verify V1.0 control HAL would reject the function call with exception.
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_0);
+        // Verify V1.1 control HAL could receive this function call.
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_1);
         final long warning = 12345;
         final long limit = 67890;
-        assertThrows(IllegalArgumentException.class,
-                () -> mOffloadHw.setDataWarningAndLimit(RMNET0, warning, limit));
-        reset(mIOffloadControl);
-
-        // Verify V1.1 control HAL could receive this function call.
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_1);
-        mOffloadHw.setDataWarningAndLimit(RMNET0, warning, limit);
-        verify((android.hardware.tetheroffload.control.V1_1.IOffloadControl) mIOffloadControl)
-                .setDataWarningAndLimit(eq(RMNET0), eq(warning), eq(limit), any());
+        when(mIOffload.setDataWarningAndLimit(anyString(), anyLong(), anyLong())).thenReturn(true);
+        assertTrue(mOffloadHw.setDataWarningAndLimit(RMNET0, warning, limit));
+        verify(mIOffload).setDataWarningAndLimit(eq(RMNET0), eq(warning), eq(limit));
+        when(mIOffload.setDataWarningAndLimit(anyString(), anyLong(), anyLong())).thenReturn(false);
+        assertFalse(mOffloadHw.setDataWarningAndLimit(RMNET0, warning, limit));
     }
 
     @Test
     public void testSetUpstreamParameters() throws Exception {
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_0);
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_0);
         final String v4addr = "192.168.10.1";
         final String v4gateway = "192.168.10.255";
         final ArrayList<String> v6gws = new ArrayList<>(0);
         v6gws.add("2001:db8::1");
-        mOffloadHw.setUpstreamParameters(RMNET0, v4addr, v4gateway, v6gws);
-        verify(mIOffloadControl).setUpstreamParameters(eq(RMNET0), eq(v4addr), eq(v4gateway),
-                eq(v6gws), any());
+        when(mIOffload.setUpstreamParameters(anyString(), anyString(), anyString(), any()))
+                .thenReturn(true);
+        assertTrue(mOffloadHw.setUpstreamParameters(RMNET0, v4addr, v4gateway, v6gws));
+        verify(mIOffload).setUpstreamParameters(eq(RMNET0), eq(v4addr), eq(v4gateway), eq(v6gws));
 
         final ArgumentCaptor<ArrayList<String>> mArrayListCaptor =
                 ArgumentCaptor.forClass(ArrayList.class);
-        mOffloadHw.setUpstreamParameters(null, null, null, null);
-        verify(mIOffloadControl).setUpstreamParameters(eq(""), eq(""), eq(""),
-                mArrayListCaptor.capture(), any());
+        when(mIOffload.setUpstreamParameters(anyString(), anyString(), anyString(), any()))
+                .thenReturn(false);
+        assertFalse(mOffloadHw.setUpstreamParameters(null, null, null, null));
+        verify(mIOffload).setUpstreamParameters(eq(""), eq(""), eq(""), mArrayListCaptor.capture());
         assertEquals(mArrayListCaptor.getValue().size(), 0);
     }
 
     @Test
-    public void testUpdateDownstreamPrefix() throws Exception {
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_0);
+    public void testUpdateDownstream() throws Exception {
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_0);
         final String ifName = "wlan1";
         final String prefix = "192.168.43.0/24";
-        mOffloadHw.addDownstreamPrefix(ifName, prefix);
-        verify(mIOffloadControl).addDownstream(eq(ifName), eq(prefix), any());
-
-        mOffloadHw.removeDownstreamPrefix(ifName, prefix);
-        verify(mIOffloadControl).removeDownstream(eq(ifName), eq(prefix), any());
-    }
-
-    @Test
-    public void testTetheringOffloadCallback() throws Exception {
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_0);
-
-        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STARTED);
-        mTestLooper.dispatchAll();
-        verify(mControlCallback).onStarted();
-
-        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_ERROR);
-        mTestLooper.dispatchAll();
-        verify(mControlCallback).onStoppedError();
-
-        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_UNSUPPORTED);
-        mTestLooper.dispatchAll();
-        verify(mControlCallback).onStoppedUnsupported();
-
-        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_SUPPORT_AVAILABLE);
-        mTestLooper.dispatchAll();
-        verify(mControlCallback).onSupportAvailable();
-
-        mTetheringOffloadCallback.onEvent(OffloadCallbackEvent.OFFLOAD_STOPPED_LIMIT_REACHED);
-        mTestLooper.dispatchAll();
-        verify(mControlCallback).onStoppedLimitReached();
-
-        final NatTimeoutUpdate tcpParams = buildNatTimeoutUpdate(NetworkProtocol.TCP);
-        mTetheringOffloadCallback.updateTimeout(tcpParams);
-        mTestLooper.dispatchAll();
-        verify(mControlCallback).onNatTimeoutUpdate(eq(OsConstants.IPPROTO_TCP),
-                eq(tcpParams.src.addr),
-                eq(uint16(tcpParams.src.port)),
-                eq(tcpParams.dst.addr),
-                eq(uint16(tcpParams.dst.port)));
-
-        final NatTimeoutUpdate udpParams = buildNatTimeoutUpdate(NetworkProtocol.UDP);
-        mTetheringOffloadCallback.updateTimeout(udpParams);
-        mTestLooper.dispatchAll();
-        verify(mControlCallback).onNatTimeoutUpdate(eq(OsConstants.IPPROTO_UDP),
-                eq(udpParams.src.addr),
-                eq(uint16(udpParams.src.port)),
-                eq(udpParams.dst.addr),
-                eq(uint16(udpParams.dst.port)));
-        reset(mControlCallback);
-
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_1);
-
-        // Verify the interface will process the events that comes from V1.1 HAL.
-        mTetheringOffloadCallback.onEvent_1_1(OffloadCallbackEvent.OFFLOAD_STARTED);
-        mTestLooper.dispatchAll();
-        final InOrder inOrder = inOrder(mControlCallback);
-        inOrder.verify(mControlCallback).onStarted();
-        inOrder.verifyNoMoreInteractions();
-
-        mTetheringOffloadCallback.onEvent_1_1(OffloadCallbackEvent.OFFLOAD_WARNING_REACHED);
-        mTestLooper.dispatchAll();
-        inOrder.verify(mControlCallback).onWarningReached();
-        inOrder.verifyNoMoreInteractions();
+        when(mIOffload.addDownstream(anyString(), anyString())).thenReturn(true);
+        assertTrue(mOffloadHw.addDownstream(ifName, prefix));
+        verify(mIOffload).addDownstream(eq(ifName), eq(prefix));
+        when(mIOffload.addDownstream(anyString(), anyString())).thenReturn(false);
+        assertFalse(mOffloadHw.addDownstream(ifName, prefix));
+        when(mIOffload.removeDownstream(anyString(), anyString())).thenReturn(true);
+        assertTrue(mOffloadHw.removeDownstream(ifName, prefix));
+        verify(mIOffload).removeDownstream(eq(ifName), eq(prefix));
+        when(mIOffload.removeDownstream(anyString(), anyString())).thenReturn(false);
+        assertFalse(mOffloadHw.removeDownstream(ifName, prefix));
     }
 
     @Test
     public void testSendIpv4NfGenMsg() throws Exception {
-        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_1_0);
+        startOffloadHardwareInterface(OFFLOAD_HAL_VERSION_HIDL_1_0);
         FileDescriptor writeSocket = new FileDescriptor();
         FileDescriptor readSocket = new FileDescriptor();
         try {
@@ -308,14 +268,4 @@
         assertEquals(0 /* error */, buffer.getShort());  // res_id
         assertEquals(expectedLen, buffer.position());
     }
-
-    private NatTimeoutUpdate buildNatTimeoutUpdate(final int proto) {
-        final NatTimeoutUpdate params = new NatTimeoutUpdate();
-        params.proto = proto;
-        params.src.addr = "192.168.43.200";
-        params.src.port = 100;
-        params.dst.addr = "172.50.46.169";
-        params.dst.port = 150;
-        return params;
-    }
 }
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringNotificationUpdaterTest.kt b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringNotificationUpdaterTest.kt
index 75c819b..ac3d713 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringNotificationUpdaterTest.kt
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringNotificationUpdaterTest.kt
@@ -156,6 +156,7 @@
     @After
     fun tearDown() {
         fakeTetheringThread.quitSafely()
+        fakeTetheringThread.join()
     }
 
     private fun verifyActivityPendingIntent(intent: Intent, flags: Int) {
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 79590b7..c15b85e 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
@@ -68,7 +68,7 @@
 import static com.android.modules.utils.build.SdkLevel.isAtLeastT;
 import static com.android.net.module.util.Inet4AddressUtils.inet4AddressToIntHTH;
 import static com.android.net.module.util.Inet4AddressUtils.intToInet4AddressHTH;
-import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_0;
+import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_HIDL_1_0;
 import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_NONE;
 import static com.android.networkstack.tethering.TestConnectivityManager.BROADCAST_FIRST;
 import static com.android.networkstack.tethering.TestConnectivityManager.CALLBACKS_FIRST;
@@ -649,8 +649,7 @@
         mInterfaceConfiguration.flags = new String[0];
         when(mRouterAdvertisementDaemon.start())
                 .thenReturn(true);
-        initOffloadConfiguration(true /* offloadConfig */, OFFLOAD_HAL_VERSION_1_0,
-                0 /* defaultDisabled */);
+        initOffloadConfiguration(OFFLOAD_HAL_VERSION_HIDL_1_0, 0 /* defaultDisabled */);
         when(mOffloadHardwareInterface.getForwardedStats(any())).thenReturn(mForwardedStats);
 
         mServiceContext = new TestContext(mContext);
@@ -2001,6 +2000,7 @@
         verify(mWifiManager).updateInterfaceIpState(
                 TEST_WLAN_IFNAME, WifiManager.IFACE_IP_MODE_CONFIGURATION_ERROR);
 
+        verify(mTetheringMetrics, times(0)).maybeUpdateUpstreamType(any());
         verify(mTetheringMetrics, times(2)).updateErrorCode(eq(TETHERING_WIFI),
                 eq(TETHER_ERROR_INTERNAL_ERROR));
         verify(mTetheringMetrics, times(2)).sendReport(eq(TETHERING_WIFI));
@@ -2345,25 +2345,15 @@
         mLooper.dispatchAll();
         callback.expectOffloadStatusChanged(TETHER_HARDWARE_OFFLOAD_STOPPED);
 
-        // 1. Offload fail if no OffloadConfig.
-        initOffloadConfiguration(false /* offloadConfig */, OFFLOAD_HAL_VERSION_1_0,
-                0 /* defaultDisabled */);
+        // 1. Offload fail if no IOffloadHal.
+        initOffloadConfiguration(OFFLOAD_HAL_VERSION_NONE, 0 /* defaultDisabled */);
         runUsbTethering(upstreamState);
         callback.expectOffloadStatusChanged(TETHER_HARDWARE_OFFLOAD_FAILED);
         runStopUSBTethering();
         callback.expectOffloadStatusChanged(TETHER_HARDWARE_OFFLOAD_STOPPED);
         reset(mUsbManager, mIPv6TetheringCoordinator);
-        // 2. Offload fail if no OffloadControl.
-        initOffloadConfiguration(true /* offloadConfig */, OFFLOAD_HAL_VERSION_NONE,
-                0 /* defaultDisabled */);
-        runUsbTethering(upstreamState);
-        callback.expectOffloadStatusChanged(TETHER_HARDWARE_OFFLOAD_FAILED);
-        runStopUSBTethering();
-        callback.expectOffloadStatusChanged(TETHER_HARDWARE_OFFLOAD_STOPPED);
-        reset(mUsbManager, mIPv6TetheringCoordinator);
-        // 3. Offload fail if disabled by settings.
-        initOffloadConfiguration(true /* offloadConfig */, OFFLOAD_HAL_VERSION_1_0,
-                1 /* defaultDisabled */);
+        // 2. Offload fail if disabled by settings.
+        initOffloadConfiguration(OFFLOAD_HAL_VERSION_HIDL_1_0, 1 /* defaultDisabled */);
         runUsbTethering(upstreamState);
         callback.expectOffloadStatusChanged(TETHER_HARDWARE_OFFLOAD_FAILED);
         runStopUSBTethering();
@@ -2378,11 +2368,10 @@
         verify(mUsbManager).setCurrentFunctions(UsbManager.FUNCTION_NONE);
     }
 
-    private void initOffloadConfiguration(final boolean offloadConfig,
-            @OffloadHardwareInterface.OffloadHalVersion final int offloadControlVersion,
+    private void initOffloadConfiguration(
+            @OffloadHardwareInterface.OffloadHalVersion final int offloadHalVersion,
             final int defaultDisabled) {
-        when(mOffloadHardwareInterface.initOffloadConfig()).thenReturn(offloadConfig);
-        when(mOffloadHardwareInterface.initOffloadControl(any())).thenReturn(offloadControlVersion);
+        when(mOffloadHardwareInterface.initOffload(any())).thenReturn(offloadHalVersion);
         when(mOffloadHardwareInterface.getDefaultTetherOffloadDisabled()).thenReturn(
                 defaultDisabled);
     }
@@ -3377,6 +3366,7 @@
         verify(mDhcpServer, timeout(DHCPSERVER_START_TIMEOUT_MS).times(1)).startWithCallbacks(
                 any(), any());
         verify(mTetheringMetrics).createBuilder(eq(TETHERING_NCM), anyString());
+        verify(mTetheringMetrics, times(1)).maybeUpdateUpstreamType(any());
 
         // Change the USB tethering function to NCM. Because the USB tethering function was set to
         // RNDIS (the default), tethering is stopped.
@@ -3393,6 +3383,7 @@
         mLooper.dispatchAll();
         ncmResult.assertHasResult();
         verify(mTetheringMetrics, times(2)).createBuilder(eq(TETHERING_NCM), anyString());
+        verify(mTetheringMetrics, times(1)).maybeUpdateUpstreamType(any());
         verify(mTetheringMetrics).updateErrorCode(eq(TETHERING_NCM),
                 eq(TETHER_ERROR_SERVICE_UNAVAIL));
         verify(mTetheringMetrics, times(2)).sendReport(eq(TETHERING_NCM));
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/metrics/TetheringMetricsTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/metrics/TetheringMetricsTest.java
index 7fdde97..a570736 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/metrics/TetheringMetricsTest.java
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/metrics/TetheringMetricsTest.java
@@ -16,6 +16,13 @@
 
 package com.android.networkstack.tethering.metrics;
 
+import static android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH;
+import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
+import static android.net.NetworkCapabilities.TRANSPORT_ETHERNET;
+import static android.net.NetworkCapabilities.TRANSPORT_LOWPAN;
+import static android.net.NetworkCapabilities.TRANSPORT_VPN;
+import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
+import static android.net.NetworkCapabilities.TRANSPORT_WIFI_AWARE;
 import static android.net.TetheringManager.TETHERING_BLUETOOTH;
 import static android.net.TetheringManager.TETHERING_ETHERNET;
 import static android.net.TetheringManager.TETHERING_NCM;
@@ -44,15 +51,17 @@
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 
+import android.net.NetworkCapabilities;
 import android.stats.connectivity.DownstreamType;
 import android.stats.connectivity.ErrorCode;
 import android.stats.connectivity.UpstreamType;
 import android.stats.connectivity.UserType;
-import android.util.Pair;
 
 import androidx.test.filters.SmallTest;
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.networkstack.tethering.UpstreamNetworkState;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -65,138 +74,291 @@
     private static final String SETTINGS_PKG = "com.android.settings";
     private static final String SYSTEMUI_PKG = "com.android.systemui";
     private static final String GMS_PKG = "com.google.android.gms";
-    private TetheringMetrics mTetheringMetrics;
+    private static final long TEST_START_TIME = 1670395936033L;
+    private static final long SECOND_IN_MILLIS = 1_000L;
 
+    private TetheringMetrics mTetheringMetrics;
     private final NetworkTetheringReported.Builder mStatsBuilder =
             NetworkTetheringReported.newBuilder();
 
+    private long mElapsedRealtime;
+
     private class MockTetheringMetrics extends TetheringMetrics {
         @Override
-        public void write(final NetworkTetheringReported reported) { }
+        public void write(final NetworkTetheringReported reported) {}
+        @Override
+        public long timeNow() {
+            return currentTimeMillis();
+        }
+    }
+
+    private long currentTimeMillis() {
+        return TEST_START_TIME + mElapsedRealtime;
+    }
+
+    private void incrementCurrentTime(final long duration) {
+        mElapsedRealtime += duration;
+        mTetheringMetrics.timeNow();
+    }
+
+    private long getElapsedRealtime() {
+        return mElapsedRealtime;
+    }
+
+    private void clearElapsedRealtime() {
+        mElapsedRealtime = 0;
     }
 
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
         mTetheringMetrics = spy(new MockTetheringMetrics());
+        mElapsedRealtime = 0L;
     }
 
-    private void verifyReport(DownstreamType downstream, ErrorCode error, UserType user)
+    private void verifyReport(final DownstreamType downstream, final ErrorCode error,
+            final UserType user, final UpstreamEvents.Builder upstreamEvents, final long duration)
             throws Exception {
         final NetworkTetheringReported expectedReport =
                 mStatsBuilder.setDownstreamType(downstream)
                 .setUserType(user)
                 .setUpstreamType(UpstreamType.UT_UNKNOWN)
                 .setErrorCode(error)
-                .setUpstreamEvents(UpstreamEvents.newBuilder())
-                .setDurationMillis(0)
+                .setUpstreamEvents(upstreamEvents)
+                .setDurationMillis(duration)
                 .build();
         verify(mTetheringMetrics).write(expectedReport);
     }
 
-    private void updateErrorAndSendReport(int downstream, int error) {
+    private void updateErrorAndSendReport(final int downstream, final int error) {
         mTetheringMetrics.updateErrorCode(downstream, error);
         mTetheringMetrics.sendReport(downstream);
     }
 
-    private void runDownstreamTypesTest(final Pair<Integer, DownstreamType>... testPairs)
-            throws Exception {
-        for (Pair<Integer, DownstreamType> testPair : testPairs) {
-            final int type = testPair.first;
-            final DownstreamType expectedResult = testPair.second;
-
-            mTetheringMetrics.createBuilder(type, TEST_CALLER_PKG);
-            updateErrorAndSendReport(type, TETHER_ERROR_NO_ERROR);
-            verifyReport(expectedResult, ErrorCode.EC_NO_ERROR, UserType.USER_UNKNOWN);
-            reset(mTetheringMetrics);
+    private static NetworkCapabilities buildUpstreamCapabilities(final int[] transports) {
+        final NetworkCapabilities nc = new NetworkCapabilities();
+        for (int type: transports) {
+            nc.addTransportType(type);
         }
+        return nc;
+    }
+
+    private static UpstreamNetworkState buildUpstreamState(final int... transports) {
+        return new UpstreamNetworkState(
+                null,
+                buildUpstreamCapabilities(transports),
+                null);
+    }
+
+    private void addUpstreamEvent(UpstreamEvents.Builder upstreamEvents,
+            final UpstreamType expectedResult, final long duration) {
+        UpstreamEvent.Builder upstreamEvent = UpstreamEvent.newBuilder()
+                .setUpstreamType(expectedResult)
+                .setDurationMillis(duration);
+        upstreamEvents.addUpstreamEvent(upstreamEvent);
+    }
+
+    private void runDownstreamTypesTest(final int type, final DownstreamType expectedResult)
+            throws Exception {
+        mTetheringMetrics.createBuilder(type, TEST_CALLER_PKG);
+        final long duration = 2 * SECOND_IN_MILLIS;
+        incrementCurrentTime(duration);
+        UpstreamEvents.Builder upstreamEvents = UpstreamEvents.newBuilder();
+        // Set UpstreamType as NO_NETWORK because the upstream type has not been changed.
+        addUpstreamEvent(upstreamEvents, UpstreamType.UT_NO_NETWORK, duration);
+        updateErrorAndSendReport(type, TETHER_ERROR_NO_ERROR);
+
+        verifyReport(expectedResult, ErrorCode.EC_NO_ERROR, UserType.USER_UNKNOWN,
+                upstreamEvents, getElapsedRealtime());
+        reset(mTetheringMetrics);
+        clearElapsedRealtime();
+        mTetheringMetrics.cleanup();
     }
 
     @Test
     public void testDownstreamTypes() throws Exception {
-        runDownstreamTypesTest(new Pair<>(TETHERING_WIFI, DownstreamType.DS_TETHERING_WIFI),
-                new Pair<>(TETHERING_WIFI_P2P, DownstreamType.DS_TETHERING_WIFI_P2P),
-                new Pair<>(TETHERING_BLUETOOTH, DownstreamType.DS_TETHERING_BLUETOOTH),
-                new Pair<>(TETHERING_USB, DownstreamType.DS_TETHERING_USB),
-                new Pair<>(TETHERING_NCM, DownstreamType.DS_TETHERING_NCM),
-                new Pair<>(TETHERING_ETHERNET, DownstreamType.DS_TETHERING_ETHERNET));
+        runDownstreamTypesTest(TETHERING_WIFI, DownstreamType.DS_TETHERING_WIFI);
+        runDownstreamTypesTest(TETHERING_WIFI_P2P, DownstreamType.DS_TETHERING_WIFI_P2P);
+        runDownstreamTypesTest(TETHERING_BLUETOOTH, DownstreamType.DS_TETHERING_BLUETOOTH);
+        runDownstreamTypesTest(TETHERING_USB, DownstreamType.DS_TETHERING_USB);
+        runDownstreamTypesTest(TETHERING_NCM, DownstreamType.DS_TETHERING_NCM);
+        runDownstreamTypesTest(TETHERING_ETHERNET, DownstreamType.DS_TETHERING_ETHERNET);
     }
 
-    private void runErrorCodesTest(final Pair<Integer, ErrorCode>... testPairs)
+    private void runErrorCodesTest(final int errorCode, final ErrorCode expectedResult)
             throws Exception {
-        for (Pair<Integer, ErrorCode> testPair : testPairs) {
-            final int errorCode = testPair.first;
-            final ErrorCode expectedResult = testPair.second;
+        mTetheringMetrics.createBuilder(TETHERING_WIFI, TEST_CALLER_PKG);
+        mTetheringMetrics.maybeUpdateUpstreamType(buildUpstreamState(TRANSPORT_WIFI));
+        final long duration = 2 * SECOND_IN_MILLIS;
+        incrementCurrentTime(duration);
+        updateErrorAndSendReport(TETHERING_WIFI, errorCode);
 
-            mTetheringMetrics.createBuilder(TETHERING_WIFI, TEST_CALLER_PKG);
-            updateErrorAndSendReport(TETHERING_WIFI, errorCode);
-            verifyReport(DownstreamType.DS_TETHERING_WIFI, expectedResult, UserType.USER_UNKNOWN);
-            reset(mTetheringMetrics);
-        }
+        UpstreamEvents.Builder upstreamEvents = UpstreamEvents.newBuilder();
+        addUpstreamEvent(upstreamEvents, UpstreamType.UT_WIFI, duration);
+        verifyReport(DownstreamType.DS_TETHERING_WIFI, expectedResult, UserType.USER_UNKNOWN,
+                    upstreamEvents, getElapsedRealtime());
+        reset(mTetheringMetrics);
+        clearElapsedRealtime();
+        mTetheringMetrics.cleanup();
     }
 
     @Test
     public void testErrorCodes() throws Exception {
-        runErrorCodesTest(new Pair<>(TETHER_ERROR_NO_ERROR, ErrorCode.EC_NO_ERROR),
-                new Pair<>(TETHER_ERROR_UNKNOWN_IFACE, ErrorCode.EC_UNKNOWN_IFACE),
-                new Pair<>(TETHER_ERROR_SERVICE_UNAVAIL, ErrorCode.EC_SERVICE_UNAVAIL),
-                new Pair<>(TETHER_ERROR_UNSUPPORTED, ErrorCode.EC_UNSUPPORTED),
-                new Pair<>(TETHER_ERROR_UNAVAIL_IFACE, ErrorCode.EC_UNAVAIL_IFACE),
-                new Pair<>(TETHER_ERROR_INTERNAL_ERROR, ErrorCode.EC_INTERNAL_ERROR),
-                new Pair<>(TETHER_ERROR_TETHER_IFACE_ERROR, ErrorCode.EC_TETHER_IFACE_ERROR),
-                new Pair<>(TETHER_ERROR_UNTETHER_IFACE_ERROR, ErrorCode.EC_UNTETHER_IFACE_ERROR),
-                new Pair<>(TETHER_ERROR_ENABLE_FORWARDING_ERROR,
-                ErrorCode.EC_ENABLE_FORWARDING_ERROR),
-                new Pair<>(TETHER_ERROR_DISABLE_FORWARDING_ERROR,
-                ErrorCode.EC_DISABLE_FORWARDING_ERROR),
-                new Pair<>(TETHER_ERROR_IFACE_CFG_ERROR, ErrorCode.EC_IFACE_CFG_ERROR),
-                new Pair<>(TETHER_ERROR_PROVISIONING_FAILED, ErrorCode.EC_PROVISIONING_FAILED),
-                new Pair<>(TETHER_ERROR_DHCPSERVER_ERROR, ErrorCode.EC_DHCPSERVER_ERROR),
-                new Pair<>(TETHER_ERROR_ENTITLEMENT_UNKNOWN, ErrorCode.EC_ENTITLEMENT_UNKNOWN),
-                new Pair<>(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION,
-                ErrorCode.EC_NO_CHANGE_TETHERING_PERMISSION),
-                new Pair<>(TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION,
-                ErrorCode.EC_NO_ACCESS_TETHERING_PERMISSION),
-                new Pair<>(TETHER_ERROR_UNKNOWN_TYPE, ErrorCode.EC_UNKNOWN_TYPE));
+        runErrorCodesTest(TETHER_ERROR_NO_ERROR, ErrorCode.EC_NO_ERROR);
+        runErrorCodesTest(TETHER_ERROR_UNKNOWN_IFACE, ErrorCode.EC_UNKNOWN_IFACE);
+        runErrorCodesTest(TETHER_ERROR_SERVICE_UNAVAIL, ErrorCode.EC_SERVICE_UNAVAIL);
+        runErrorCodesTest(TETHER_ERROR_UNSUPPORTED, ErrorCode.EC_UNSUPPORTED);
+        runErrorCodesTest(TETHER_ERROR_UNAVAIL_IFACE, ErrorCode.EC_UNAVAIL_IFACE);
+        runErrorCodesTest(TETHER_ERROR_INTERNAL_ERROR, ErrorCode.EC_INTERNAL_ERROR);
+        runErrorCodesTest(TETHER_ERROR_TETHER_IFACE_ERROR, ErrorCode.EC_TETHER_IFACE_ERROR);
+        runErrorCodesTest(TETHER_ERROR_UNTETHER_IFACE_ERROR, ErrorCode.EC_UNTETHER_IFACE_ERROR);
+        runErrorCodesTest(TETHER_ERROR_ENABLE_FORWARDING_ERROR,
+                ErrorCode.EC_ENABLE_FORWARDING_ERROR);
+        runErrorCodesTest(TETHER_ERROR_DISABLE_FORWARDING_ERROR,
+                ErrorCode.EC_DISABLE_FORWARDING_ERROR);
+        runErrorCodesTest(TETHER_ERROR_IFACE_CFG_ERROR, ErrorCode.EC_IFACE_CFG_ERROR);
+        runErrorCodesTest(TETHER_ERROR_PROVISIONING_FAILED, ErrorCode.EC_PROVISIONING_FAILED);
+        runErrorCodesTest(TETHER_ERROR_DHCPSERVER_ERROR, ErrorCode.EC_DHCPSERVER_ERROR);
+        runErrorCodesTest(TETHER_ERROR_ENTITLEMENT_UNKNOWN, ErrorCode.EC_ENTITLEMENT_UNKNOWN);
+        runErrorCodesTest(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION,
+                ErrorCode.EC_NO_CHANGE_TETHERING_PERMISSION);
+        runErrorCodesTest(TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION,
+                ErrorCode.EC_NO_ACCESS_TETHERING_PERMISSION);
+        runErrorCodesTest(TETHER_ERROR_UNKNOWN_TYPE, ErrorCode.EC_UNKNOWN_TYPE);
     }
 
-    private void runUserTypesTest(final Pair<String, UserType>... testPairs)
+    private void runUserTypesTest(final String callerPkg, final UserType expectedResult)
             throws Exception {
-        for (Pair<String, UserType> testPair : testPairs) {
-            final String callerPkg = testPair.first;
-            final UserType expectedResult = testPair.second;
+        mTetheringMetrics.createBuilder(TETHERING_WIFI, callerPkg);
+        final long duration = 1 * SECOND_IN_MILLIS;
+        incrementCurrentTime(duration);
+        updateErrorAndSendReport(TETHERING_WIFI, TETHER_ERROR_NO_ERROR);
 
-            mTetheringMetrics.createBuilder(TETHERING_WIFI, callerPkg);
-            updateErrorAndSendReport(TETHERING_WIFI, TETHER_ERROR_NO_ERROR);
-            verifyReport(DownstreamType.DS_TETHERING_WIFI, ErrorCode.EC_NO_ERROR, expectedResult);
-            reset(mTetheringMetrics);
-        }
+        UpstreamEvents.Builder upstreamEvents = UpstreamEvents.newBuilder();
+        // Set UpstreamType as NO_NETWORK because the upstream type has not been changed.
+        addUpstreamEvent(upstreamEvents, UpstreamType.UT_NO_NETWORK, duration);
+        verifyReport(DownstreamType.DS_TETHERING_WIFI, ErrorCode.EC_NO_ERROR, expectedResult,
+                    upstreamEvents, getElapsedRealtime());
+        reset(mTetheringMetrics);
+        clearElapsedRealtime();
+        mTetheringMetrics.cleanup();
     }
 
     @Test
     public void testUserTypes() throws Exception {
-        runUserTypesTest(new Pair<>(TEST_CALLER_PKG, UserType.USER_UNKNOWN),
-                new Pair<>(SETTINGS_PKG, UserType.USER_SETTINGS),
-                new Pair<>(SYSTEMUI_PKG, UserType.USER_SYSTEMUI),
-                new Pair<>(GMS_PKG, UserType.USER_GMS));
+        runUserTypesTest(TEST_CALLER_PKG, UserType.USER_UNKNOWN);
+        runUserTypesTest(SETTINGS_PKG, UserType.USER_SETTINGS);
+        runUserTypesTest(SYSTEMUI_PKG, UserType.USER_SYSTEMUI);
+        runUserTypesTest(GMS_PKG, UserType.USER_GMS);
+    }
+
+    private void runUpstreamTypesTest(final UpstreamNetworkState ns,
+            final UpstreamType expectedResult) throws Exception {
+        mTetheringMetrics.createBuilder(TETHERING_WIFI, TEST_CALLER_PKG);
+        mTetheringMetrics.maybeUpdateUpstreamType(ns);
+        final long duration = 2 * SECOND_IN_MILLIS;
+        incrementCurrentTime(duration);
+        updateErrorAndSendReport(TETHERING_WIFI, TETHER_ERROR_NO_ERROR);
+
+        UpstreamEvents.Builder upstreamEvents = UpstreamEvents.newBuilder();
+        addUpstreamEvent(upstreamEvents, expectedResult, duration);
+        verifyReport(DownstreamType.DS_TETHERING_WIFI, ErrorCode.EC_NO_ERROR,
+                UserType.USER_UNKNOWN, upstreamEvents, getElapsedRealtime());
+        reset(mTetheringMetrics);
+        clearElapsedRealtime();
+        mTetheringMetrics.cleanup();
+    }
+
+    @Test
+    public void testUpstreamTypes() throws Exception {
+        runUpstreamTypesTest(null , UpstreamType.UT_NO_NETWORK);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_CELLULAR), UpstreamType.UT_CELLULAR);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_WIFI), UpstreamType.UT_WIFI);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_BLUETOOTH), UpstreamType.UT_BLUETOOTH);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_ETHERNET), UpstreamType.UT_ETHERNET);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_WIFI_AWARE), UpstreamType.UT_WIFI_AWARE);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_LOWPAN), UpstreamType.UT_LOWPAN);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_CELLULAR, TRANSPORT_VPN),
+                UpstreamType.UT_CELLULAR_VPN);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_WIFI, TRANSPORT_VPN),
+                UpstreamType.UT_WIFI_VPN);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_BLUETOOTH, TRANSPORT_VPN),
+                UpstreamType.UT_BLUETOOTH_VPN);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_ETHERNET, TRANSPORT_VPN),
+                UpstreamType.UT_ETHERNET_VPN);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_CELLULAR, TRANSPORT_WIFI, TRANSPORT_VPN),
+                UpstreamType.UT_WIFI_CELLULAR_VPN);
+        runUpstreamTypesTest(buildUpstreamState(TRANSPORT_CELLULAR, TRANSPORT_WIFI, TRANSPORT_VPN,
+                TRANSPORT_BLUETOOTH), UpstreamType.UT_UNKNOWN);
     }
 
     @Test
     public void testMultiBuildersCreatedBeforeSendReport() throws Exception {
         mTetheringMetrics.createBuilder(TETHERING_WIFI, SETTINGS_PKG);
+        final long wifiTetheringStartTime = currentTimeMillis();
+        incrementCurrentTime(1 * SECOND_IN_MILLIS);
         mTetheringMetrics.createBuilder(TETHERING_USB, SYSTEMUI_PKG);
+        final long usbTetheringStartTime = currentTimeMillis();
+        incrementCurrentTime(2 * SECOND_IN_MILLIS);
         mTetheringMetrics.createBuilder(TETHERING_BLUETOOTH, GMS_PKG);
-
+        final long bluetoothTetheringStartTime = currentTimeMillis();
+        incrementCurrentTime(3 * SECOND_IN_MILLIS);
         updateErrorAndSendReport(TETHERING_WIFI, TETHER_ERROR_DHCPSERVER_ERROR);
+
+        UpstreamEvents.Builder wifiTetheringUpstreamEvents = UpstreamEvents.newBuilder();
+        addUpstreamEvent(wifiTetheringUpstreamEvents, UpstreamType.UT_NO_NETWORK,
+                currentTimeMillis() - wifiTetheringStartTime);
         verifyReport(DownstreamType.DS_TETHERING_WIFI, ErrorCode.EC_DHCPSERVER_ERROR,
-                UserType.USER_SETTINGS);
-
+                UserType.USER_SETTINGS, wifiTetheringUpstreamEvents,
+                currentTimeMillis() - wifiTetheringStartTime);
+        incrementCurrentTime(1 * SECOND_IN_MILLIS);
         updateErrorAndSendReport(TETHERING_USB, TETHER_ERROR_ENABLE_FORWARDING_ERROR);
-        verifyReport(DownstreamType.DS_TETHERING_USB, ErrorCode.EC_ENABLE_FORWARDING_ERROR,
-                UserType.USER_SYSTEMUI);
 
+        UpstreamEvents.Builder usbTetheringUpstreamEvents = UpstreamEvents.newBuilder();
+        addUpstreamEvent(usbTetheringUpstreamEvents, UpstreamType.UT_NO_NETWORK,
+                currentTimeMillis() - usbTetheringStartTime);
+
+        verifyReport(DownstreamType.DS_TETHERING_USB, ErrorCode.EC_ENABLE_FORWARDING_ERROR,
+                UserType.USER_SYSTEMUI, usbTetheringUpstreamEvents,
+                currentTimeMillis() - usbTetheringStartTime);
+        incrementCurrentTime(1 * SECOND_IN_MILLIS);
         updateErrorAndSendReport(TETHERING_BLUETOOTH, TETHER_ERROR_TETHER_IFACE_ERROR);
+
+        UpstreamEvents.Builder bluetoothTetheringUpstreamEvents = UpstreamEvents.newBuilder();
+        addUpstreamEvent(bluetoothTetheringUpstreamEvents, UpstreamType.UT_NO_NETWORK,
+                currentTimeMillis() - bluetoothTetheringStartTime);
         verifyReport(DownstreamType.DS_TETHERING_BLUETOOTH, ErrorCode.EC_TETHER_IFACE_ERROR,
-                UserType.USER_GMS);
+                UserType.USER_GMS, bluetoothTetheringUpstreamEvents,
+                currentTimeMillis() - bluetoothTetheringStartTime);
+    }
+
+    @Test
+    public void testUpstreamsWithMultipleDownstreams() throws Exception {
+        mTetheringMetrics.createBuilder(TETHERING_WIFI, SETTINGS_PKG);
+        final long wifiTetheringStartTime = currentTimeMillis();
+        incrementCurrentTime(1 * SECOND_IN_MILLIS);
+        mTetheringMetrics.maybeUpdateUpstreamType(buildUpstreamState(TRANSPORT_WIFI));
+        final long wifiUpstreamStartTime = currentTimeMillis();
+        incrementCurrentTime(5 * SECOND_IN_MILLIS);
+        mTetheringMetrics.createBuilder(TETHERING_USB, SYSTEMUI_PKG);
+        final long usbTetheringStartTime = currentTimeMillis();
+        incrementCurrentTime(5 * SECOND_IN_MILLIS);
+        updateErrorAndSendReport(TETHERING_USB, TETHER_ERROR_NO_ERROR);
+
+        UpstreamEvents.Builder usbTetheringUpstreamEvents = UpstreamEvents.newBuilder();
+        addUpstreamEvent(usbTetheringUpstreamEvents, UpstreamType.UT_WIFI,
+                currentTimeMillis() - usbTetheringStartTime);
+        verifyReport(DownstreamType.DS_TETHERING_USB, ErrorCode.EC_NO_ERROR,
+                UserType.USER_SYSTEMUI, usbTetheringUpstreamEvents,
+                currentTimeMillis() - usbTetheringStartTime);
+        incrementCurrentTime(7 * SECOND_IN_MILLIS);
+        updateErrorAndSendReport(TETHERING_WIFI, TETHER_ERROR_NO_ERROR);
+
+        UpstreamEvents.Builder wifiTetheringUpstreamEvents = UpstreamEvents.newBuilder();
+        addUpstreamEvent(wifiTetheringUpstreamEvents, UpstreamType.UT_WIFI,
+                currentTimeMillis() - wifiUpstreamStartTime);
+        verifyReport(DownstreamType.DS_TETHERING_WIFI, ErrorCode.EC_NO_ERROR,
+                UserType.USER_SETTINGS, wifiTetheringUpstreamEvents,
+                currentTimeMillis() - wifiTetheringStartTime);
     }
 }
diff --git a/bpf_progs/clatd.c b/bpf_progs/clatd.c
index 7350209..7c6811a 100644
--- a/bpf_progs/clatd.c
+++ b/bpf_progs/clatd.c
@@ -91,6 +91,12 @@
     if (ip6->version != 6) return TC_ACT_PIPE;
 
     // Maximum IPv6 payload length that can be translated to IPv4
+    // Note: technically this check is too strict for an IPv6 fragment,
+    // which by virtue of stripping the extra 8 byte fragment extension header,
+    // could thus be 8 bytes larger and still fit in an ipv4 packet post
+    // translation.  However... who ever heard of receiving ~64KB frags...
+    // fragments are kind of by definition smaller than ingress device mtu,
+    // and thus, on the internet, very very unlikely to exceed 1500 bytes.
     if (ntohs(ip6->payload_len) > 0xFFFF - sizeof(struct iphdr)) return TC_ACT_PIPE;
 
     ClatIngress6Key k = {
diff --git a/framework-t/Sources.bp b/framework-t/Sources.bp
index 391a562..b8eb1f6 100644
--- a/framework-t/Sources.bp
+++ b/framework-t/Sources.bp
@@ -16,15 +16,13 @@
 
 filegroup {
     name: "framework-connectivity-tiramisu-updatable-sources",
+    defaults: ["framework-sources-module-defaults"],
     srcs: [
         "src/**/*.java",
         "src/**/*.aidl",
     ],
     path: "src",
-    visibility: [
-        "//frameworks/base",
-        "//packages/modules/Connectivity:__subpackages__",
-    ],
+    visibility: ["//packages/modules/Connectivity:__subpackages__"],
 }
 
 cc_library_shared {
diff --git a/framework-t/src/android/net/NetworkIdentity.java b/framework-t/src/android/net/NetworkIdentity.java
index edfd21c..947a092 100644
--- a/framework-t/src/android/net/NetworkIdentity.java
+++ b/framework-t/src/android/net/NetworkIdentity.java
@@ -32,6 +32,7 @@
 import android.net.wifi.WifiInfo;
 import android.service.NetworkIdentityProto;
 import android.telephony.TelephonyManager;
+import android.util.Log;
 import android.util.proto.ProtoOutputStream;
 
 import com.android.net.module.util.BitUtils;
@@ -406,10 +407,18 @@
             setOemManaged(getOemBitfield(snapshot.getNetworkCapabilities()));
 
             if (mType == TYPE_WIFI) {
-                final TransportInfo transportInfo = snapshot.getNetworkCapabilities()
-                        .getTransportInfo();
+                final NetworkCapabilities nc = snapshot.getNetworkCapabilities();
+                final TransportInfo transportInfo = nc.getTransportInfo();
                 if (transportInfo instanceof WifiInfo) {
                     final WifiInfo info = (WifiInfo) transportInfo;
+                    // Log.wtf to catch trying to set a null wifiNetworkKey into NetworkIdentity.
+                    // See b/266598304. The problematic data that has null wifi network key is
+                    // thrown out when storing data, which is handled by the service.
+                    if (info.getNetworkKey() == null) {
+                        Log.wtf(TAG, "WifiInfo contains a null wifiNetworkKey and it will"
+                                + " be set into NetworkIdentity, netId=" + snapshot.getNetwork()
+                                + "NetworkCapabilities=" + nc);
+                    }
                     setWifiNetworkKey(info.getNetworkKey());
                 }
             } else if (mType == TYPE_TEST) {
diff --git a/framework-t/src/android/net/NetworkTemplate.java b/framework-t/src/android/net/NetworkTemplate.java
index 55fcc4a..d90bd8d 100644
--- a/framework-t/src/android/net/NetworkTemplate.java
+++ b/framework-t/src/android/net/NetworkTemplate.java
@@ -700,7 +700,15 @@
      *                  to know details about the key.
      */
     private boolean matchesWifiNetworkKey(@NonNull String wifiNetworkKey) {
-        Objects.requireNonNull(wifiNetworkKey);
+        // Note that this code accepts null wifi network keys because of a past bug where wifi
+        // code was sending a null network key for some connected networks, which isn't expected
+        // and ended up stored in the data on many devices.
+        // A null network key in the data matches a wildcard template (one where
+        // {@code mMatchWifiNetworkKeys} is empty), but not one where {@code MatchWifiNetworkKeys}
+        // contains null. See b/266598304.
+        if (wifiNetworkKey == null) {
+            return CollectionUtils.isEmpty(mMatchWifiNetworkKeys);
+        }
         return CollectionUtils.isEmpty(mMatchWifiNetworkKeys)
                 || CollectionUtils.contains(mMatchWifiNetworkKeys, wifiNetworkKey);
     }
diff --git a/framework-t/src/android/net/nsd/INsdManager.aidl b/framework-t/src/android/net/nsd/INsdManager.aidl
index 89e9cdb..9d14b1a 100644
--- a/framework-t/src/android/net/nsd/INsdManager.aidl
+++ b/framework-t/src/android/net/nsd/INsdManager.aidl
@@ -26,5 +26,5 @@
  * {@hide}
  */
 interface INsdManager {
-    INsdServiceConnector connect(INsdManagerCallback cb);
+    INsdServiceConnector connect(INsdManagerCallback cb, boolean useJavaBackend);
 }
diff --git a/framework-t/src/android/net/nsd/NsdManager.java b/framework-t/src/android/net/nsd/NsdManager.java
index 36808cf..96f2f80 100644
--- a/framework-t/src/android/net/nsd/NsdManager.java
+++ b/framework-t/src/android/net/nsd/NsdManager.java
@@ -16,6 +16,7 @@
 
 package android.net.nsd;
 
+import static android.net.connectivity.ConnectivityCompatChanges.ENABLE_PLATFORM_MDNS_BACKEND;
 import static android.net.connectivity.ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER;
 
 import android.annotation.IntDef;
@@ -510,7 +511,8 @@
         mHandler = new ServiceHandler(t.getLooper());
 
         try {
-            mService = service.connect(new NsdCallbackImpl(mHandler));
+            mService = service.connect(new NsdCallbackImpl(mHandler), CompatChanges.isChangeEnabled(
+                    ENABLE_PLATFORM_MDNS_BACKEND));
         } catch (RemoteException e) {
             throw new RuntimeException("Failed to connect to NsdService");
         }
diff --git a/framework/Android.bp b/framework/Android.bp
index 3950dba..2d729c5 100644
--- a/framework/Android.bp
+++ b/framework/Android.bp
@@ -45,14 +45,12 @@
 // TODO: use a java_library in the bootclasspath instead
 filegroup {
     name: "framework-connectivity-sources",
+    defaults: ["framework-sources-module-defaults"],
     srcs: [
         ":framework-connectivity-internal-sources",
         ":framework-connectivity-aidl-export-sources",
     ],
-    visibility: [
-        "//frameworks/base",
-        "//packages/modules/Connectivity:__subpackages__",
-    ],
+    visibility: ["//packages/modules/Connectivity:__subpackages__"],
 }
 
 java_defaults {
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index 196e023..4a2ed8a 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -470,7 +470,7 @@
   }
 
   public abstract class SocketKeepalive implements java.lang.AutoCloseable {
-    method public final void start(@IntRange(from=0xa, to=0xe10) int, int, @NonNull android.net.Network);
+    method public final void start(@IntRange(from=0xa, to=0xe10) int, int, @Nullable android.net.Network);
     field public static final int ERROR_NO_SUCH_SLOT = -33; // 0xffffffdf
     field public static final int FLAG_AUTOMATIC_ON_OFF = 1; // 0x1
     field public static final int SUCCESS = 0; // 0x0
diff --git a/framework/src/android/net/SocketKeepalive.java b/framework/src/android/net/SocketKeepalive.java
index 311126e..10daf17 100644
--- a/framework/src/android/net/SocketKeepalive.java
+++ b/framework/src/android/net/SocketKeepalive.java
@@ -21,6 +21,7 @@
 import android.annotation.IntDef;
 import android.annotation.IntRange;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.os.Binder;
 import android.os.ParcelFileDescriptor;
@@ -374,12 +375,14 @@
      *                    the supplied {@link Callback} will see a call to
      *                    {@link Callback#onError(int)} with {@link #ERROR_INVALID_INTERVAL}.
      * @param flags Flags to enable/disable available options on this keepalive.
-     * @param underpinnedNetwork The underpinned network of this keepalive.
+     * @param underpinnedNetwork an optional network running over mNetwork that this
+     *                           keepalive is intended to keep up, e.g. an IPSec
+     *                           tunnel running over mNetwork.
      * @hide
      */
     @SystemApi(client = PRIVILEGED_APPS)
     public final void start(@IntRange(from = MIN_INTERVAL_SEC, to = MAX_INTERVAL_SEC)
-            int intervalSec, @StartFlags int flags, @NonNull Network underpinnedNetwork) {
+            int intervalSec, @StartFlags int flags, @Nullable Network underpinnedNetwork) {
         startImpl(intervalSec, flags, underpinnedNetwork);
     }
 
diff --git a/framework/src/android/net/TcpSocketKeepalive.java b/framework/src/android/net/TcpSocketKeepalive.java
index b548f6d..696889f 100644
--- a/framework/src/android/net/TcpSocketKeepalive.java
+++ b/framework/src/android/net/TcpSocketKeepalive.java
@@ -55,6 +55,12 @@
             throw new IllegalArgumentException("Illegal flag value for "
                     + this.getClass().getSimpleName() + " : " + flags);
         }
+
+        if (underpinnedNetwork != null) {
+            throw new IllegalArgumentException("Illegal underpinned network for "
+                    + this.getClass().getSimpleName() + " : " + underpinnedNetwork);
+        }
+
         mExecutor.execute(() -> {
             try {
                 mService.startTcpKeepalive(mNetwork, mPfd, intervalSec, mCallback);
diff --git a/framework/src/android/net/connectivity/ConnectivityCompatChanges.java b/framework/src/android/net/connectivity/ConnectivityCompatChanges.java
index 2cfda9e..dfe5867 100644
--- a/framework/src/android/net/connectivity/ConnectivityCompatChanges.java
+++ b/framework/src/android/net/connectivity/ConnectivityCompatChanges.java
@@ -73,6 +73,17 @@
     @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.TIRAMISU)
     public static final long ENABLE_SELF_CERTIFIED_CAPABILITIES_DECLARATION = 266524688;
 
+    /**
+     * Apps targeting < Android 14 use a legacy NSD backend.
+     *
+     * The legacy apps use a legacy native daemon as NsdManager backend, but other apps use a
+     * platform-integrated mDNS implementation as backend.
+     *
+     * @hide
+     */
+    @ChangeId
+    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.TIRAMISU)
+    public static final long ENABLE_PLATFORM_MDNS_BACKEND = 270306772L;
     private ConnectivityCompatChanges() {
     }
 }
diff --git a/nearby/framework/Android.bp b/nearby/framework/Android.bp
index e223b54..f6e0995 100644
--- a/nearby/framework/Android.bp
+++ b/nearby/framework/Android.bp
@@ -32,10 +32,10 @@
 
 filegroup {
     name: "framework-nearby-sources",
+    defaults: ["framework-sources-module-defaults"],
     srcs: [
         ":framework-nearby-java-sources",
     ],
-    visibility: ["//frameworks/base"],
 }
 
 // Build of only framework-nearby (not as part of connectivity) for
diff --git a/nearby/halfsheet/src/com/android/nearby/halfsheet/HalfSheetActivity.java b/nearby/halfsheet/src/com/android/nearby/halfsheet/HalfSheetActivity.java
index 2a38b8a..07e5776 100644
--- a/nearby/halfsheet/src/com/android/nearby/halfsheet/HalfSheetActivity.java
+++ b/nearby/halfsheet/src/com/android/nearby/halfsheet/HalfSheetActivity.java
@@ -16,6 +16,8 @@
 
 package com.android.nearby.halfsheet;
 
+import static android.Manifest.permission.ACCESS_FINE_LOCATION;
+
 import static com.android.nearby.halfsheet.fragment.DevicePairingFragment.APP_LAUNCH_FRAGMENT_TYPE;
 import static com.android.server.nearby.common.bluetooth.fastpair.FastPairConstants.EXTRA_MODEL_ID;
 import static com.android.server.nearby.common.fastpair.service.UserActionHandlerBase.EXTRA_MAC_ADDRESS;
@@ -226,7 +228,8 @@
                                     EXTRA_HALF_SHEET_IS_RETROACTIVE,
                                     getIntent().getBooleanExtra(EXTRA_HALF_SHEET_IS_RETROACTIVE,
                                             false))
-                            .putExtra(EXTRA_MAC_ADDRESS, mScanFastPairStoreItem.getAddress()));
+                            .putExtra(EXTRA_MAC_ADDRESS, mScanFastPairStoreItem.getAddress()),
+                    ACCESS_FINE_LOCATION);
         }
     }
 
diff --git a/nearby/halfsheet/src/com/android/nearby/halfsheet/utils/BroadcastUtils.java b/nearby/halfsheet/src/com/android/nearby/halfsheet/utils/BroadcastUtils.java
index 467997c..2f1e90a 100644
--- a/nearby/halfsheet/src/com/android/nearby/halfsheet/utils/BroadcastUtils.java
+++ b/nearby/halfsheet/src/com/android/nearby/halfsheet/utils/BroadcastUtils.java
@@ -31,6 +31,13 @@
         context.sendBroadcast(intent);
     }
 
+    /**
+     * Helps send a broadcast with specified receiver permission.
+     */
+    public static void sendBroadcast(Context context, Intent intent, String receiverPermission) {
+        context.sendBroadcast(intent, receiverPermission);
+    }
+
     private BroadcastUtils() {
     }
 }
diff --git a/nearby/tests/multidevices/clients/test_support/snippet_helper/tests/Android.bp b/nearby/tests/multidevices/clients/test_support/snippet_helper/tests/Android.bp
index 284d5c2..ec0392c 100644
--- a/nearby/tests/multidevices/clients/test_support/snippet_helper/tests/Android.bp
+++ b/nearby/tests/multidevices/clients/test_support/snippet_helper/tests/Android.bp
@@ -35,4 +35,5 @@
         // timeout in seconds.
         timeout: 36000,
     },
-}
\ No newline at end of file
+    upstream: true,
+}
diff --git a/nearby/tests/robotests/Android.bp b/nearby/tests/robotests/Android.bp
index 56c0107..70fa0c3 100644
--- a/nearby/tests/robotests/Android.bp
+++ b/nearby/tests/robotests/Android.bp
@@ -42,15 +42,14 @@
         "androidx.lifecycle_lifecycle-runtime",
         "androidx.mediarouter_mediarouter-nodeps",
         "error_prone_annotations",
-        "mockito-robolectric-prebuilt",
         "service-nearby-pre-jarjar",
         "truth-prebuilt",
         "robolectric_android-all-stub",
-        "Robolectric_all-target",
     ],
 
     test_options: {
         // timeout in seconds.
         timeout: 36000,
     },
+    upstream: true,
 }
diff --git a/service-t/native/libs/libnetworkstats/Android.bp b/service-t/native/libs/libnetworkstats/Android.bp
index aa1ee41..f40d388 100644
--- a/service-t/native/libs/libnetworkstats/Android.bp
+++ b/service-t/native/libs/libnetworkstats/Android.bp
@@ -26,6 +26,7 @@
     srcs: [
         "BpfNetworkStats.cpp",
         "NetworkTraceHandler.cpp",
+        "NetworkTracePoller.cpp",
     ],
     shared_libs: [
         "libbase",
@@ -62,6 +63,7 @@
     srcs: [
         "BpfNetworkStatsTest.cpp",
         "NetworkTraceHandlerTest.cpp",
+        "NetworkTracePollerTest.cpp",
     ],
     cflags: [
         "-Wall",
@@ -73,6 +75,8 @@
         "libgmock",
         "libnetworkstats",
         "libperfetto_client_experimental",
+        "libprotobuf-cpp-lite",
+        "perfetto_trace_protos",
     ],
     shared_libs: [
         "libbase",
diff --git a/service-t/native/libs/libnetworkstats/NetworkTraceHandler.cpp b/service-t/native/libs/libnetworkstats/NetworkTraceHandler.cpp
index be4ffe3..696a29a 100644
--- a/service-t/native/libs/libnetworkstats/NetworkTraceHandler.cpp
+++ b/service-t/native/libs/libnetworkstats/NetworkTraceHandler.cpp
@@ -33,11 +33,62 @@
 
 namespace android {
 namespace bpf {
+using ::android::bpf::internal::NetworkTracePoller;
+using ::perfetto::protos::pbzero::NetworkPacketBundle;
 using ::perfetto::protos::pbzero::NetworkPacketEvent;
 using ::perfetto::protos::pbzero::NetworkPacketTraceConfig;
 using ::perfetto::protos::pbzero::TracePacket;
 using ::perfetto::protos::pbzero::TrafficDirection;
 
+// Bundling takes groups of packets with similar contextual fields (generally,
+// all fields except timestamp and length) and summarises them in a single trace
+// packet. For example, rather than
+//
+//   {.timestampNs = 1, .uid = 1000, .tag = 123, .len = 72}
+//   {.timestampNs = 2, .uid = 1000, .tag = 123, .len = 100}
+//   {.timestampNs = 5, .uid = 1000, .tag = 123, .len = 456}
+//
+// The output will be something like
+//   {
+//     .timestamp = 1
+//     .ctx = {.uid = 1000, .tag = 123}
+//     .timestamp = [0, 1, 4], // delta encoded
+//     .length = [72, 100, 456], // should be zipped with timestamps
+//   }
+//
+// Most workloads have many packets from few contexts. Bundling greatly reduces
+// the amount of redundant information written, thus reducing the overall trace
+// size. Interning ids are similarly based on unique bundle contexts.
+
+// Based on boost::hash_combine
+template <typename T, typename... Rest>
+void HashCombine(std::size_t& seed, const T& val, const Rest&... rest) {
+  seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+  (HashCombine(seed, rest), ...);
+}
+
+// Details summarises the timestamp and lengths of packets in a bundle.
+struct BundleDetails {
+  std::vector<std::pair<uint64_t, uint32_t>> time_and_len;
+  uint64_t minTs = std::numeric_limits<uint64_t>::max();
+  uint64_t maxTs = std::numeric_limits<uint64_t>::min();
+  uint32_t bytes = 0;
+};
+
+#define AGG_FIELDS(x)                                              \
+  (x).ifindex, (x).uid, (x).tag, (x).sport, (x).dport, (x).egress, \
+      (x).ipProto, (x).tcpFlags
+
+std::size_t BundleHash::operator()(const BundleKey& a) const {
+  std::size_t seed = 0;
+  HashCombine(seed, AGG_FIELDS(a));
+  return seed;
+}
+
+bool BundleEq::operator()(const BundleKey& a, const BundleKey& b) const {
+  return std::tie(AGG_FIELDS(a)) == std::tie(AGG_FIELDS(b));
+}
+
 // static
 void NetworkTraceHandler::RegisterDataSource() {
   ALOGD("Registering Perfetto data source");
@@ -56,11 +107,16 @@
 }
 
 // static
-NetworkTracePoller NetworkTraceHandler::sPoller([](const PacketTrace& pkt) {
-  NetworkTraceHandler::Trace([pkt](NetworkTraceHandler::TraceContext ctx) {
-    NetworkTraceHandler::Fill(pkt, *ctx.NewTracePacket());
-  });
-});
+NetworkTracePoller NetworkTraceHandler::sPoller(
+    [](const std::vector<PacketTrace>& packets) {
+      // Trace calls the provided callback for each active session. The context
+      // gets a reference to the NetworkTraceHandler instance associated with
+      // the session and delegates writing. The corresponding handler will write
+      // with the setting specified in the trace config.
+      NetworkTraceHandler::Trace([&](NetworkTraceHandler::TraceContext ctx) {
+        ctx.GetDataSourceLocked()->Write(packets, ctx);
+      });
+    });
 
 void NetworkTraceHandler::OnSetup(const SetupArgs& args) {
   const std::string& raw = args.config->network_packet_trace_config_raw();
@@ -71,6 +127,12 @@
     ALOGI("poll_ms is missing or below the 100ms minimum. Increasing to 100ms");
     mPollMs = 100;
   }
+
+  mInternLimit = config.intern_limit();
+  mAggregationThreshold = config.aggregation_threshold();
+  mDropLocalPort = config.drop_local_port();
+  mDropRemotePort = config.drop_remote_port();
+  mDropTcpFlags = config.drop_tcp_flags();
 }
 
 void NetworkTraceHandler::OnStart(const StartArgs&) {
@@ -82,33 +144,98 @@
   mStarted = false;
 }
 
-void NetworkTracePoller::SchedulePolling() {
-  // Schedules another run of ourselves to recursively poll periodically.
-  mTaskRunner->PostDelayedTask(
-      [this]() {
-        mMutex.lock();
-        SchedulePolling();
-        ConsumeAllLocked();
-        mMutex.unlock();
-      },
-      mPollMs);
+void NetworkTraceHandler::Write(const std::vector<PacketTrace>& packets,
+                                NetworkTraceHandler::TraceContext& ctx) {
+  // TODO: remove this fallback once Perfetto stable has support for bundles.
+  if (!mInternLimit && !mAggregationThreshold) {
+    for (const PacketTrace& pkt : packets) {
+      auto dst = ctx.NewTracePacket();
+      dst->set_timestamp(pkt.timestampNs);
+      auto* event = dst->set_network_packet();
+      event->set_length(pkt.length);
+      Fill(pkt, event);
+    }
+    return;
+  }
+
+  uint64_t minTs = std::numeric_limits<uint64_t>::max();
+  std::unordered_map<BundleKey, BundleDetails, BundleHash, BundleEq> bundles;
+  for (const PacketTrace& pkt : packets) {
+    BundleKey key = pkt;
+
+    // Dropping fields should remove them from the output and remove them from
+    // the aggregation key. In order to do the latter without changing the hash
+    // function, set the dropped fields to zero.
+    if (mDropTcpFlags) key.tcpFlags = 0;
+    if (mDropLocalPort) (key.egress ? key.sport : key.dport) = 0;
+    if (mDropRemotePort) (key.egress ? key.dport : key.sport) = 0;
+
+    minTs = std::min(minTs, pkt.timestampNs);
+
+    BundleDetails& bundle = bundles[key];
+    bundle.time_and_len.emplace_back(pkt.timestampNs, pkt.length);
+    bundle.minTs = std::min(bundle.minTs, pkt.timestampNs);
+    bundle.maxTs = std::max(bundle.maxTs, pkt.timestampNs);
+    bundle.bytes += pkt.length;
+  }
+
+  // If state was cleared, emit a separate packet to indicate it. This uses the
+  // overall minTs so it is sorted before any packets that follow.
+  NetworkTraceState* incr_state = ctx.GetIncrementalState();
+  if (!bundles.empty() && mInternLimit && incr_state->cleared) {
+    auto clear = ctx.NewTracePacket();
+    clear->set_sequence_flags(TracePacket::SEQ_INCREMENTAL_STATE_CLEARED);
+    clear->set_timestamp(minTs);
+    incr_state->cleared = false;
+  }
+
+  for (const auto& kv : bundles) {
+    const BundleKey& key = kv.first;
+    const BundleDetails& details = kv.second;
+
+    auto dst = ctx.NewTracePacket();
+    dst->set_sequence_flags(TracePacket::SEQ_NEEDS_INCREMENTAL_STATE);
+    dst->set_timestamp(details.minTs);
+
+    auto* event = FillWithInterning(incr_state, key, dst.get());
+
+    int count = details.time_and_len.size();
+    if (!mAggregationThreshold || count < mAggregationThreshold) {
+      protozero::PackedVarInt offsets;
+      protozero::PackedVarInt lengths;
+      for (const auto& kv : details.time_and_len) {
+        offsets.Append(kv.first - details.minTs);
+        lengths.Append(kv.second);
+      }
+
+      event->set_packet_timestamps(offsets);
+      event->set_packet_lengths(lengths);
+    } else {
+      event->set_total_duration(details.maxTs - details.minTs);
+      event->set_total_length(details.bytes);
+      event->set_total_packets(count);
+    }
+  }
 }
 
-// static class method
-void NetworkTraceHandler::Fill(const PacketTrace& src, TracePacket& dst) {
-  dst.set_timestamp(src.timestampNs);
-  auto* event = dst.set_network_packet();
+void NetworkTraceHandler::Fill(const PacketTrace& src,
+                               NetworkPacketEvent* event) {
   event->set_direction(src.egress ? TrafficDirection::DIR_EGRESS
                                   : TrafficDirection::DIR_INGRESS);
-  event->set_length(src.length);
   event->set_uid(src.uid);
   event->set_tag(src.tag);
 
-  event->set_local_port(src.egress ? ntohs(src.sport) : ntohs(src.dport));
-  event->set_remote_port(src.egress ? ntohs(src.dport) : ntohs(src.sport));
+  if (!mDropLocalPort) {
+    event->set_local_port(ntohs(src.egress ? src.sport : src.dport));
+  }
+  if (!mDropRemotePort) {
+    event->set_remote_port(ntohs(src.egress ? src.dport : src.sport));
+  }
+  if (!mDropTcpFlags) {
+    event->set_tcp_flags(src.tcpFlags);
+  }
 
   event->set_ip_proto(src.ipProto);
-  event->set_tcp_flags(src.tcpFlags);
 
   char ifname[IF_NAMESIZE] = {};
   if (if_indextoname(src.ifindex, ifname) == ifname) {
@@ -118,90 +245,38 @@
   }
 }
 
-bool NetworkTracePoller::Start(uint32_t pollMs) {
-  ALOGD("Starting datasource");
+NetworkPacketBundle* NetworkTraceHandler::FillWithInterning(
+    NetworkTraceState* state, const BundleKey& key, TracePacket* dst) {
+  uint64_t iid = 0;
+  bool found = false;
 
-  std::scoped_lock<std::mutex> lock(mMutex);
-  if (mSessionCount > 0) {
-    if (mPollMs != pollMs) {
-      // Nothing technical prevents mPollMs from changing, it's just unclear
-      // what the right behavior is. Taking the min of active values could poll
-      // too frequently giving some sessions too much data. Taking the max could
-      // be too infrequent. For now, do nothing.
-      ALOGI("poll_ms can't be changed while running, ignoring poll_ms=%d",
-            pollMs);
+  if (state->iids.size() < mInternLimit) {
+    auto [iter, success] = state->iids.try_emplace(key, state->iids.size() + 1);
+    iid = iter->second;
+    found = true;
+
+    if (success) {
+      // If we successfully empaced, record the newly interned data.
+      auto* packet_context = dst->set_interned_data()->add_packet_context();
+      Fill(key, packet_context->set_ctx());
+      packet_context->set_iid(iid);
     }
-    mSessionCount++;
-    return true;
+  } else {
+    auto iter = state->iids.find(key);
+    if (iter != state->iids.end()) {
+      iid = iter->second;
+      found = true;
+    }
   }
 
-  auto status = mConfigurationMap.init(PACKET_TRACE_ENABLED_MAP_PATH);
-  if (!status.ok()) {
-    ALOGW("Failed to bind config map: %s", status.error().message().c_str());
-    return false;
+  auto* event = dst->set_network_packet_bundle();
+  if (found) {
+    event->set_iid(iid);
+  } else {
+    Fill(key, event->set_ctx());
   }
 
-  auto rb = BpfRingbuf<PacketTrace>::Create(PACKET_TRACE_RINGBUF_PATH);
-  if (!rb.ok()) {
-    ALOGW("Failed to create ringbuf: %s", rb.error().message().c_str());
-    return false;
-  }
-
-  mRingBuffer = std::move(*rb);
-
-  auto res = mConfigurationMap.writeValue(0, true, BPF_ANY);
-  if (!res.ok()) {
-    ALOGW("Failed to enable tracing: %s", res.error().message().c_str());
-    return false;
-  }
-
-  // Start a task runner to run ConsumeAll every mPollMs milliseconds.
-  mTaskRunner = perfetto::Platform::GetDefaultPlatform()->CreateTaskRunner({});
-  mPollMs = pollMs;
-  SchedulePolling();
-
-  mSessionCount++;
-  return true;
-}
-
-bool NetworkTracePoller::Stop() {
-  ALOGD("Stopping datasource");
-
-  std::scoped_lock<std::mutex> lock(mMutex);
-  if (mSessionCount == 0) return false;  // This should never happen
-
-  // If this isn't the last session, don't clean up yet.
-  if (--mSessionCount > 0) return true;
-
-  auto res = mConfigurationMap.writeValue(0, false, BPF_ANY);
-  if (!res.ok()) {
-    ALOGW("Failed to disable tracing: %s", res.error().message().c_str());
-  }
-
-  mTaskRunner.reset();
-  mRingBuffer.reset();
-
-  return res.ok();
-}
-
-bool NetworkTracePoller::ConsumeAll() {
-  std::scoped_lock<std::mutex> lock(mMutex);
-  return ConsumeAllLocked();
-}
-
-bool NetworkTracePoller::ConsumeAllLocked() {
-  if (mRingBuffer == nullptr) {
-    ALOGW("Tracing is not active");
-    return false;
-  }
-
-  base::Result<int> ret = mRingBuffer->ConsumeAll(mCallback);
-  if (!ret.ok()) {
-    ALOGW("Failed to poll ringbuf: %s", ret.error().message().c_str());
-    return false;
-  }
-
-  return true;
+  return event;
 }
 
 }  // namespace bpf
diff --git a/service-t/native/libs/libnetworkstats/NetworkTraceHandlerTest.cpp b/service-t/native/libs/libnetworkstats/NetworkTraceHandlerTest.cpp
index 543be21..c9eb183 100644
--- a/service-t/native/libs/libnetworkstats/NetworkTraceHandlerTest.cpp
+++ b/service-t/native/libs/libnetworkstats/NetworkTraceHandlerTest.cpp
@@ -14,208 +14,380 @@
  * limitations under the License.
  */
 
-#include <android-base/unique_fd.h>
-#include <android/multinetwork.h>
-#include <arpa/inet.h>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
-#include <inttypes.h>
-#include <net/if.h>
-#include <netinet/tcp.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <unistd.h>
 
 #include <vector>
 
 #include "netdbpf/NetworkTraceHandler.h"
-
-using ::testing::AllOf;
-using ::testing::AnyOf;
-using ::testing::Each;
-using ::testing::Eq;
-using ::testing::Field;
-using ::testing::Test;
+#include "protos/perfetto/config/android/network_trace_config.gen.h"
+#include "protos/perfetto/trace/android/network_trace.pb.h"
+#include "protos/perfetto/trace/trace.pb.h"
+#include "protos/perfetto/trace/trace_packet.pb.h"
 
 namespace android {
 namespace bpf {
-// Use uint32 max to cause the handler to never Loop. Instead, the tests will
-// manually drive things by calling ConsumeAll explicitly.
-constexpr uint32_t kNeverPoll = std::numeric_limits<uint32_t>::max();
+using ::perfetto::protos::NetworkPacketEvent;
+using ::perfetto::protos::NetworkPacketTraceConfig;
+using ::perfetto::protos::Trace;
+using ::perfetto::protos::TracePacket;
+using ::perfetto::protos::TrafficDirection;
 
-__be16 bindAndListen(int s) {
-  sockaddr_in sin = {.sin_family = AF_INET};
-  socklen_t len = sizeof(sin);
-  if (bind(s, (sockaddr*)&sin, sizeof(sin))) return 0;
-  if (listen(s, 1)) return 0;
-  if (getsockname(s, (sockaddr*)&sin, &len)) return 0;
-  return sin.sin_port;
-}
+// This handler makes OnStart and OnStop a no-op so that tracing is not really
+// started on the device.
+class HandlerForTest : public NetworkTraceHandler {
+ public:
+  void OnStart(const StartArgs&) override {}
+  void OnStop(const StopArgs&) override {}
+};
 
-// This takes tcp flag constants from the standard library and makes them usable
-// with the flags we get from BPF. The standard library flags are big endian
-// whereas the BPF flags are reported in host byte order. BPF also trims the
-// flags down to the 8 single-bit flag bits (fin, syn, rst, etc).
-constexpr inline uint8_t FlagToHost(__be32 be_unix_flags) {
-  return ntohl(be_unix_flags) >> 16;
-}
+class NetworkTraceHandlerTest : public testing::Test {
+ protected:
+  // Starts a tracing session with the handler under test.
+  std::unique_ptr<perfetto::TracingSession> StartTracing(
+      NetworkPacketTraceConfig settings) {
+    perfetto::TracingInitArgs args;
+    args.backends = perfetto::kInProcessBackend;
+    perfetto::Tracing::Initialize(args);
 
-// Pretty prints all fields for a list of packets (useful for debugging).
-struct PacketPrinter {
-  const std::vector<PacketTrace>& data;
-  static constexpr char kTcpFlagNames[] = "FSRPAUEC";
+    perfetto::DataSourceDescriptor dsd;
+    dsd.set_name("test.network_packets");
+    HandlerForTest::Register(dsd);
 
-  friend std::ostream& operator<<(std::ostream& os, const PacketPrinter& d) {
-    os << "Packet count: " << d.data.size();
-    for (const PacketTrace& info : d.data) {
-      os << "\nifidx=" << info.ifindex;
-      os << ", len=" << info.length;
-      os << ", uid=" << info.uid;
-      os << ", tag=" << info.tag;
-      os << ", sport=" << info.sport;
-      os << ", dport=" << info.dport;
-      os << ", direction=" << (info.egress ? "egress" : "ingress");
-      os << ", proto=" << static_cast<int>(info.ipProto);
-      os << ", ip=" << static_cast<int>(info.ipVersion);
-      os << ", flags=";
-      for (int i = 0; i < 8; i++) {
-        os << ((info.tcpFlags & (1 << i)) ? kTcpFlagNames[i] : '.');
+    perfetto::TraceConfig cfg;
+    cfg.add_buffers()->set_size_kb(1024);
+    auto* config = cfg.add_data_sources()->mutable_config();
+    config->set_name("test.network_packets");
+    config->set_network_packet_trace_config_raw(settings.SerializeAsString());
+
+    auto session = perfetto::Tracing::NewTrace(perfetto::kInProcessBackend);
+    session->Setup(cfg);
+    session->StartBlocking();
+    return session;
+  }
+
+  // Stops the trace session and reports all relevant trace packets.
+  bool StopTracing(perfetto::TracingSession* session,
+                   std::vector<TracePacket>* output) {
+    session->StopBlocking();
+
+    Trace trace;
+    std::vector<char> raw_trace = session->ReadTraceBlocking();
+    if (!trace.ParseFromArray(raw_trace.data(), raw_trace.size())) {
+      ADD_FAILURE() << "trace.ParseFromArray failed";
+      return false;
+    }
+
+    // This is a real trace and includes irrelevant trace packets such as trace
+    // metadata. The following strips the results to just the packets we want.
+    for (const auto& pkt : trace.packet()) {
+      if (pkt.has_network_packet() || pkt.has_network_packet_bundle()) {
+        output->emplace_back(pkt);
       }
     }
-    return os;
+
+    return true;
+  }
+
+  // This runs a trace with a single call to Write.
+  bool TraceAndSortPackets(const std::vector<PacketTrace>& input,
+                           std::vector<TracePacket>* output,
+                           NetworkPacketTraceConfig config = {}) {
+    auto session = StartTracing(config);
+    HandlerForTest::Trace([&](HandlerForTest::TraceContext ctx) {
+      ctx.GetDataSourceLocked()->Write(input, ctx);
+      ctx.Flush();
+    });
+
+    if (!StopTracing(session.get(), output)) {
+      return false;
+    }
+
+    // Sort to provide deterministic ordering regardless of Perfetto internals
+    // or implementation-defined (e.g. hash map) reshuffling.
+    std::sort(output->begin(), output->end(),
+              [](const TracePacket& a, const TracePacket& b) {
+                return a.timestamp() < b.timestamp();
+              });
+
+    return true;
   }
 };
 
-class NetworkTracePollerTest : public testing::Test {
- protected:
-  void SetUp() {
-    if (access(PACKET_TRACE_RINGBUF_PATH, R_OK)) {
-      GTEST_SKIP() << "Network tracing is not enabled/loaded on this build.";
-    }
-    if (sizeof(void*) != 8) {
-      GTEST_SKIP() << "Network tracing requires 64-bit build.";
-    }
-  }
-};
+TEST_F(NetworkTraceHandlerTest, WriteBasicFields) {
+  std::vector<PacketTrace> input = {
+      PacketTrace{
+          .timestampNs = 1000,
+          .length = 100,
+          .uid = 10,
+          .tag = 123,
+          .ipProto = 6,
+          .tcpFlags = 1,
+      },
+  };
 
-TEST_F(NetworkTracePollerTest, PollWhileInactive) {
-  NetworkTracePoller handler([&](const PacketTrace& pkt) {});
+  std::vector<TracePacket> events;
+  ASSERT_TRUE(TraceAndSortPackets(input, &events));
 
-  // One succeed after start and before stop.
-  EXPECT_FALSE(handler.ConsumeAll());
-  ASSERT_TRUE(handler.Start(kNeverPoll));
-  EXPECT_TRUE(handler.ConsumeAll());
-  ASSERT_TRUE(handler.Stop());
-  EXPECT_FALSE(handler.ConsumeAll());
+  ASSERT_EQ(events.size(), 1);
+  EXPECT_THAT(events[0].timestamp(), 1000);
+  EXPECT_THAT(events[0].network_packet().uid(), 10);
+  EXPECT_THAT(events[0].network_packet().tag(), 123);
+  EXPECT_THAT(events[0].network_packet().ip_proto(), 6);
+  EXPECT_THAT(events[0].network_packet().tcp_flags(), 1);
+  EXPECT_THAT(events[0].network_packet().length(), 100);
 }
 
-TEST_F(NetworkTracePollerTest, ConcurrentSessions) {
-  // Simulate two concurrent sessions (two starts followed by two stops). Check
-  // that tracing is stopped only after both sessions finish.
-  NetworkTracePoller handler([&](const PacketTrace& pkt) {});
+TEST_F(NetworkTraceHandlerTest, WriteDirectionAndPorts) {
+  std::vector<PacketTrace> input = {
+      PacketTrace{
+          .timestampNs = 1,
+          .sport = htons(8080),
+          .dport = htons(443),
+          .egress = true,
+      },
+      PacketTrace{
+          .timestampNs = 2,
+          .sport = htons(443),
+          .dport = htons(8080),
+          .egress = false,
+      },
+  };
 
-  ASSERT_TRUE(handler.Start(kNeverPoll));
-  EXPECT_TRUE(handler.ConsumeAll());
+  std::vector<TracePacket> events;
+  ASSERT_TRUE(TraceAndSortPackets(input, &events));
 
-  ASSERT_TRUE(handler.Start(kNeverPoll));
-  EXPECT_TRUE(handler.ConsumeAll());
-
-  ASSERT_TRUE(handler.Stop());
-  EXPECT_TRUE(handler.ConsumeAll());
-
-  ASSERT_TRUE(handler.Stop());
-  EXPECT_FALSE(handler.ConsumeAll());
+  ASSERT_EQ(events.size(), 2);
+  EXPECT_THAT(events[0].network_packet().local_port(), 8080);
+  EXPECT_THAT(events[0].network_packet().remote_port(), 443);
+  EXPECT_THAT(events[0].network_packet().direction(),
+              TrafficDirection::DIR_EGRESS);
+  EXPECT_THAT(events[1].network_packet().local_port(), 8080);
+  EXPECT_THAT(events[1].network_packet().remote_port(), 443);
+  EXPECT_THAT(events[1].network_packet().direction(),
+              TrafficDirection::DIR_INGRESS);
 }
 
-TEST_F(NetworkTracePollerTest, TraceTcpSession) {
-  __be16 server_port = 0;
-  std::vector<PacketTrace> packets;
+TEST_F(NetworkTraceHandlerTest, BasicBundling) {
+  // TODO: remove this once bundling becomes default. Until then, set arbitrary
+  // aggregation threshold to enable bundling.
+  NetworkPacketTraceConfig config;
+  config.set_aggregation_threshold(10);
 
-  // Record all packets with the bound address and current uid. This callback is
-  // involked only within ConsumeAll, at which point the port should have
-  // already been filled in and all packets have been processed.
-  NetworkTracePoller handler([&](const PacketTrace& pkt) {
-    if (pkt.sport != server_port && pkt.dport != server_port) return;
-    if (pkt.uid != getuid()) return;
-    packets.push_back(pkt);
+  std::vector<PacketTrace> input = {
+      PacketTrace{.uid = 123, .timestampNs = 2, .length = 200},
+      PacketTrace{.uid = 123, .timestampNs = 1, .length = 100},
+      PacketTrace{.uid = 123, .timestampNs = 4, .length = 300},
+
+      PacketTrace{.uid = 456, .timestampNs = 2, .length = 400},
+      PacketTrace{.uid = 456, .timestampNs = 4, .length = 100},
+  };
+
+  std::vector<TracePacket> events;
+  ASSERT_TRUE(TraceAndSortPackets(input, &events, config));
+
+  ASSERT_EQ(events.size(), 2);
+
+  EXPECT_THAT(events[0].timestamp(), 1);
+  EXPECT_THAT(events[0].network_packet_bundle().ctx().uid(), 123);
+  EXPECT_THAT(events[0].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(200, 100, 300));
+  EXPECT_THAT(events[0].network_packet_bundle().packet_timestamps(),
+              testing::ElementsAre(1, 0, 3));
+
+  EXPECT_THAT(events[1].timestamp(), 2);
+  EXPECT_THAT(events[1].network_packet_bundle().ctx().uid(), 456);
+  EXPECT_THAT(events[1].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(400, 100));
+  EXPECT_THAT(events[1].network_packet_bundle().packet_timestamps(),
+              testing::ElementsAre(0, 2));
+}
+
+TEST_F(NetworkTraceHandlerTest, AggregationThreshold) {
+  // With an aggregation threshold of 3, the set of packets with uid=123 will
+  // be aggregated (3>=3) whereas packets with uid=456 get per-packet info.
+  NetworkPacketTraceConfig config;
+  config.set_aggregation_threshold(3);
+
+  std::vector<PacketTrace> input = {
+      PacketTrace{.uid = 123, .timestampNs = 2, .length = 200},
+      PacketTrace{.uid = 123, .timestampNs = 1, .length = 100},
+      PacketTrace{.uid = 123, .timestampNs = 4, .length = 300},
+
+      PacketTrace{.uid = 456, .timestampNs = 2, .length = 400},
+      PacketTrace{.uid = 456, .timestampNs = 4, .length = 100},
+  };
+
+  std::vector<TracePacket> events;
+  ASSERT_TRUE(TraceAndSortPackets(input, &events, config));
+
+  ASSERT_EQ(events.size(), 2);
+
+  EXPECT_EQ(events[0].timestamp(), 1);
+  EXPECT_EQ(events[0].network_packet_bundle().ctx().uid(), 123);
+  EXPECT_EQ(events[0].network_packet_bundle().total_duration(), 3);
+  EXPECT_EQ(events[0].network_packet_bundle().total_packets(), 3);
+  EXPECT_EQ(events[0].network_packet_bundle().total_length(), 600);
+
+  EXPECT_EQ(events[1].timestamp(), 2);
+  EXPECT_EQ(events[1].network_packet_bundle().ctx().uid(), 456);
+  EXPECT_THAT(events[1].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(400, 100));
+  EXPECT_THAT(events[1].network_packet_bundle().packet_timestamps(),
+              testing::ElementsAre(0, 2));
+}
+
+TEST_F(NetworkTraceHandlerTest, DropLocalPort) {
+  NetworkPacketTraceConfig config;
+  config.set_drop_local_port(true);
+  config.set_aggregation_threshold(10);
+
+  __be16 a = htons(10000);
+  __be16 b = htons(10001);
+  std::vector<PacketTrace> input = {
+      // Recall that local is `src` for egress and `dst` for ingress.
+      PacketTrace{.timestampNs = 1, .length = 2, .egress = true, .sport = a},
+      PacketTrace{.timestampNs = 2, .length = 4, .egress = false, .dport = a},
+      PacketTrace{.timestampNs = 3, .length = 6, .egress = true, .sport = b},
+      PacketTrace{.timestampNs = 4, .length = 8, .egress = false, .dport = b},
+  };
+
+  std::vector<TracePacket> events;
+  ASSERT_TRUE(TraceAndSortPackets(input, &events, config));
+  ASSERT_EQ(events.size(), 2);
+
+  // Despite having different local ports, drop and bundle by remaining fields.
+  EXPECT_EQ(events[0].network_packet_bundle().ctx().direction(),
+            TrafficDirection::DIR_EGRESS);
+  EXPECT_THAT(events[0].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(2, 6));
+
+  EXPECT_EQ(events[1].network_packet_bundle().ctx().direction(),
+            TrafficDirection::DIR_INGRESS);
+  EXPECT_THAT(events[1].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(4, 8));
+
+  // Local port shouldn't be in output.
+  EXPECT_FALSE(events[0].network_packet_bundle().ctx().has_local_port());
+  EXPECT_FALSE(events[1].network_packet_bundle().ctx().has_local_port());
+}
+
+TEST_F(NetworkTraceHandlerTest, DropRemotePort) {
+  NetworkPacketTraceConfig config;
+  config.set_drop_remote_port(true);
+  config.set_aggregation_threshold(10);
+
+  __be16 a = htons(443);
+  __be16 b = htons(80);
+  std::vector<PacketTrace> input = {
+      // Recall that remote is `dst` for egress and `src` for ingress.
+      PacketTrace{.timestampNs = 1, .length = 2, .egress = true, .dport = a},
+      PacketTrace{.timestampNs = 2, .length = 4, .egress = false, .sport = a},
+      PacketTrace{.timestampNs = 3, .length = 6, .egress = true, .dport = b},
+      PacketTrace{.timestampNs = 4, .length = 8, .egress = false, .sport = b},
+  };
+
+  std::vector<TracePacket> events;
+  ASSERT_TRUE(TraceAndSortPackets(input, &events, config));
+  ASSERT_EQ(events.size(), 2);
+
+  // Despite having different remote ports, drop and bundle by remaining fields.
+  EXPECT_EQ(events[0].network_packet_bundle().ctx().direction(),
+            TrafficDirection::DIR_EGRESS);
+  EXPECT_THAT(events[0].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(2, 6));
+
+  EXPECT_EQ(events[1].network_packet_bundle().ctx().direction(),
+            TrafficDirection::DIR_INGRESS);
+  EXPECT_THAT(events[1].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(4, 8));
+
+  // Remote port shouldn't be in output.
+  EXPECT_FALSE(events[0].network_packet_bundle().ctx().has_remote_port());
+  EXPECT_FALSE(events[1].network_packet_bundle().ctx().has_remote_port());
+}
+
+TEST_F(NetworkTraceHandlerTest, DropTcpFlags) {
+  NetworkPacketTraceConfig config;
+  config.set_drop_tcp_flags(true);
+  config.set_aggregation_threshold(10);
+
+  std::vector<PacketTrace> input = {
+      PacketTrace{.timestampNs = 1, .uid = 123, .length = 1, .tcpFlags = 1},
+      PacketTrace{.timestampNs = 2, .uid = 123, .length = 2, .tcpFlags = 2},
+      PacketTrace{.timestampNs = 3, .uid = 456, .length = 3, .tcpFlags = 1},
+      PacketTrace{.timestampNs = 4, .uid = 456, .length = 4, .tcpFlags = 2},
+  };
+
+  std::vector<TracePacket> events;
+  ASSERT_TRUE(TraceAndSortPackets(input, &events, config));
+
+  ASSERT_EQ(events.size(), 2);
+
+  // Despite having different tcp flags, drop and bundle by remaining fields.
+  EXPECT_EQ(events[0].network_packet_bundle().ctx().uid(), 123);
+  EXPECT_THAT(events[0].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(1, 2));
+
+  EXPECT_EQ(events[1].network_packet_bundle().ctx().uid(), 456);
+  EXPECT_THAT(events[1].network_packet_bundle().packet_lengths(),
+              testing::ElementsAre(3, 4));
+
+  // Tcp flags shouldn't be in output.
+  EXPECT_FALSE(events[0].network_packet_bundle().ctx().has_tcp_flags());
+  EXPECT_FALSE(events[1].network_packet_bundle().ctx().has_tcp_flags());
+}
+
+TEST_F(NetworkTraceHandlerTest, Interning) {
+  NetworkPacketTraceConfig config;
+  config.set_intern_limit(2);
+
+  // The test writes 4 packets coming from three sources (uids). With an intern
+  // limit of 2, the first two sources should be interned. This test splits this
+  // into individual writes since internally an unordered map is used and would
+  // otherwise non-deterministically choose what to intern (this is fine for
+  // real use, but not good for test assertions).
+  std::vector<std::vector<PacketTrace>> inputs = {
+      {PacketTrace{.timestampNs = 1, .uid = 123}},
+      {PacketTrace{.timestampNs = 2, .uid = 456}},
+      {PacketTrace{.timestampNs = 3, .uid = 789}},
+      {PacketTrace{.timestampNs = 4, .uid = 123}},
+  };
+
+  auto session = StartTracing(config);
+
+  HandlerForTest::Trace([&](HandlerForTest::TraceContext ctx) {
+    ctx.GetDataSourceLocked()->Write(inputs[0], ctx);
+    ctx.GetDataSourceLocked()->Write(inputs[1], ctx);
+    ctx.GetDataSourceLocked()->Write(inputs[2], ctx);
+    ctx.GetDataSourceLocked()->Write(inputs[3], ctx);
+    ctx.Flush();
   });
 
-  ASSERT_TRUE(handler.Start(kNeverPoll));
-  const uint32_t kClientTag = 2468;
-  const uint32_t kServerTag = 1357;
+  std::vector<TracePacket> events;
+  ASSERT_TRUE(StopTracing(session.get(), &events));
 
-  // Go through a typical connection sequence between two v4 sockets using tcp.
-  // This covers connection handshake, shutdown, and one data packet.
-  {
-    android::base::unique_fd clientsocket(socket(AF_INET, SOCK_STREAM, 0));
-    ASSERT_NE(-1, clientsocket) << "Failed to open client socket";
-    ASSERT_EQ(android_tag_socket(clientsocket, kClientTag), 0);
+  ASSERT_EQ(events.size(), 4);
 
-    android::base::unique_fd serversocket(socket(AF_INET, SOCK_STREAM, 0));
-    ASSERT_NE(-1, serversocket) << "Failed to open server socket";
-    ASSERT_EQ(android_tag_socket(serversocket, kServerTag), 0);
+  // First time seen, emit new interned data, bundle uses iid instead of ctx.
+  EXPECT_EQ(events[0].network_packet_bundle().iid(), 1);
+  ASSERT_EQ(events[0].interned_data().packet_context().size(), 1);
+  EXPECT_EQ(events[0].interned_data().packet_context(0).iid(), 1);
+  EXPECT_EQ(events[0].interned_data().packet_context(0).ctx().uid(), 123);
 
-    server_port = bindAndListen(serversocket);
-    ASSERT_NE(0, server_port) << "Can't bind to server port";
+  // First time seen, emit new interned data, bundle uses iid instead of ctx.
+  EXPECT_EQ(events[1].network_packet_bundle().iid(), 2);
+  ASSERT_EQ(events[1].interned_data().packet_context().size(), 1);
+  EXPECT_EQ(events[1].interned_data().packet_context(0).iid(), 2);
+  EXPECT_EQ(events[1].interned_data().packet_context(0).ctx().uid(), 456);
 
-    sockaddr_in addr = {.sin_family = AF_INET, .sin_port = server_port};
-    ASSERT_EQ(0, connect(clientsocket, (sockaddr*)&addr, sizeof(addr)))
-        << "connect to loopback failed: " << strerror(errno);
+  // Not enough room in intern table (limit 2), inline the context.
+  EXPECT_EQ(events[2].network_packet_bundle().ctx().uid(), 789);
+  EXPECT_EQ(events[2].interned_data().packet_context().size(), 0);
 
-    int accepted = accept(serversocket, nullptr, nullptr);
-    ASSERT_NE(-1, accepted) << "accept connection failed: " << strerror(errno);
-
-    const char data[] = "abcdefghijklmnopqrstuvwxyz";
-    EXPECT_EQ(send(clientsocket, data, sizeof(data), 0), sizeof(data))
-        << "failed to send message: " << strerror(errno);
-
-    char buff[100] = {};
-    EXPECT_EQ(recv(accepted, buff, sizeof(buff), 0), sizeof(data))
-        << "failed to receive message: " << strerror(errno);
-
-    EXPECT_EQ(std::string(data), std::string(buff));
-  }
-
-  ASSERT_TRUE(handler.ConsumeAll());
-  ASSERT_TRUE(handler.Stop());
-
-  // There are 12 packets in total (6 messages: each seen by client & server):
-  // 1. Client connects to server with syn
-  // 2. Server responds with syn ack
-  // 3. Client responds with ack
-  // 4. Client sends data with psh ack
-  // 5. Server acks the data packet
-  // 6. Client closes connection with fin ack
-  ASSERT_EQ(packets.size(), 12) << PacketPrinter{packets};
-
-  // All packets should be TCP packets.
-  EXPECT_THAT(packets, Each(Field(&PacketTrace::ipProto, Eq(IPPROTO_TCP))));
-
-  // Packet 1: client requests connection with server.
-  EXPECT_EQ(packets[0].egress, 1) << PacketPrinter{packets};
-  EXPECT_EQ(packets[0].dport, server_port) << PacketPrinter{packets};
-  EXPECT_EQ(packets[0].tag, kClientTag) << PacketPrinter{packets};
-  EXPECT_EQ(packets[0].tcpFlags, FlagToHost(TCP_FLAG_SYN))
-      << PacketPrinter{packets};
-
-  // Packet 2: server receives request from client.
-  EXPECT_EQ(packets[1].egress, 0) << PacketPrinter{packets};
-  EXPECT_EQ(packets[1].dport, server_port) << PacketPrinter{packets};
-  EXPECT_EQ(packets[1].tag, kServerTag) << PacketPrinter{packets};
-  EXPECT_EQ(packets[1].tcpFlags, FlagToHost(TCP_FLAG_SYN))
-      << PacketPrinter{packets};
-
-  // Packet 3: server replies back with syn ack.
-  EXPECT_EQ(packets[2].egress, 1) << PacketPrinter{packets};
-  EXPECT_EQ(packets[2].sport, server_port) << PacketPrinter{packets};
-  EXPECT_EQ(packets[2].tcpFlags, FlagToHost(TCP_FLAG_SYN | TCP_FLAG_ACK))
-      << PacketPrinter{packets};
-
-  // Packet 4: client receives the server's syn ack.
-  EXPECT_EQ(packets[3].egress, 0) << PacketPrinter{packets};
-  EXPECT_EQ(packets[3].sport, server_port) << PacketPrinter{packets};
-  EXPECT_EQ(packets[3].tcpFlags, FlagToHost(TCP_FLAG_SYN | TCP_FLAG_ACK))
-      << PacketPrinter{packets};
+  // Second time seen, no need to re-emit interned data, only record iid.
+  EXPECT_EQ(events[3].network_packet_bundle().iid(), 1);
+  EXPECT_EQ(events[3].interned_data().packet_context().size(), 0);
 }
 
 }  // namespace bpf
diff --git a/service-t/native/libs/libnetworkstats/NetworkTracePoller.cpp b/service-t/native/libs/libnetworkstats/NetworkTracePoller.cpp
new file mode 100644
index 0000000..3abb49a
--- /dev/null
+++ b/service-t/native/libs/libnetworkstats/NetworkTracePoller.cpp
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+#define LOG_TAG "NetworkTrace"
+
+#include "netdbpf/NetworkTracePoller.h"
+
+#include <bpf/BpfUtils.h>
+#include <log/log.h>
+#include <perfetto/tracing/platform.h>
+#include <perfetto/tracing/tracing.h>
+
+namespace android {
+namespace bpf {
+namespace internal {
+
+void NetworkTracePoller::SchedulePolling() {
+  // Schedules another run of ourselves to recursively poll periodically.
+  mTaskRunner->PostDelayedTask(
+      [this]() {
+        mMutex.lock();
+        SchedulePolling();
+        ConsumeAllLocked();
+        mMutex.unlock();
+      },
+      mPollMs);
+}
+
+bool NetworkTracePoller::Start(uint32_t pollMs) {
+  ALOGD("Starting datasource");
+
+  std::scoped_lock<std::mutex> lock(mMutex);
+  if (mSessionCount > 0) {
+    if (mPollMs != pollMs) {
+      // Nothing technical prevents mPollMs from changing, it's just unclear
+      // what the right behavior is. Taking the min of active values could poll
+      // too frequently giving some sessions too much data. Taking the max could
+      // be too infrequent. For now, do nothing.
+      ALOGI("poll_ms can't be changed while running, ignoring poll_ms=%d",
+            pollMs);
+    }
+    mSessionCount++;
+    return true;
+  }
+
+  auto status = mConfigurationMap.init(PACKET_TRACE_ENABLED_MAP_PATH);
+  if (!status.ok()) {
+    ALOGW("Failed to bind config map: %s", status.error().message().c_str());
+    return false;
+  }
+
+  auto rb = BpfRingbuf<PacketTrace>::Create(PACKET_TRACE_RINGBUF_PATH);
+  if (!rb.ok()) {
+    ALOGW("Failed to create ringbuf: %s", rb.error().message().c_str());
+    return false;
+  }
+
+  mRingBuffer = std::move(*rb);
+
+  auto res = mConfigurationMap.writeValue(0, true, BPF_ANY);
+  if (!res.ok()) {
+    ALOGW("Failed to enable tracing: %s", res.error().message().c_str());
+    return false;
+  }
+
+  // Start a task runner to run ConsumeAll every mPollMs milliseconds.
+  mTaskRunner = perfetto::Platform::GetDefaultPlatform()->CreateTaskRunner({});
+  mPollMs = pollMs;
+  SchedulePolling();
+
+  mSessionCount++;
+  return true;
+}
+
+bool NetworkTracePoller::Stop() {
+  ALOGD("Stopping datasource");
+
+  std::scoped_lock<std::mutex> lock(mMutex);
+  if (mSessionCount == 0) return false;  // This should never happen
+
+  // If this isn't the last session, don't clean up yet.
+  if (--mSessionCount > 0) return true;
+
+  auto res = mConfigurationMap.writeValue(0, false, BPF_ANY);
+  if (!res.ok()) {
+    ALOGW("Failed to disable tracing: %s", res.error().message().c_str());
+  }
+
+  mTaskRunner.reset();
+  mRingBuffer.reset();
+
+  return res.ok();
+}
+
+bool NetworkTracePoller::ConsumeAll() {
+  std::scoped_lock<std::mutex> lock(mMutex);
+  return ConsumeAllLocked();
+}
+
+bool NetworkTracePoller::ConsumeAllLocked() {
+  if (mRingBuffer == nullptr) {
+    ALOGW("Tracing is not active");
+    return false;
+  }
+
+  std::vector<PacketTrace> packets;
+  base::Result<int> ret = mRingBuffer->ConsumeAll(
+      [&](const PacketTrace& pkt) { packets.push_back(pkt); });
+  if (!ret.ok()) {
+    ALOGW("Failed to poll ringbuf: %s", ret.error().message().c_str());
+    return false;
+  }
+
+  mCallback(packets);
+
+  return true;
+}
+
+}  // namespace internal
+}  // namespace bpf
+}  // namespace android
diff --git a/service-t/native/libs/libnetworkstats/NetworkTracePollerTest.cpp b/service-t/native/libs/libnetworkstats/NetworkTracePollerTest.cpp
new file mode 100644
index 0000000..df07bbe
--- /dev/null
+++ b/service-t/native/libs/libnetworkstats/NetworkTracePollerTest.cpp
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+#include <android-base/unique_fd.h>
+#include <android/multinetwork.h>
+#include <arpa/inet.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <inttypes.h>
+#include <net/if.h>
+#include <netinet/tcp.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <chrono>
+#include <thread>
+#include <vector>
+
+#include "netdbpf/NetworkTracePoller.h"
+
+using ::testing::AllOf;
+using ::testing::AnyOf;
+using ::testing::Each;
+using ::testing::Eq;
+using ::testing::Field;
+using ::testing::Test;
+
+namespace android {
+namespace bpf {
+namespace internal {
+// Use uint32 max to cause the handler to never Loop. Instead, the tests will
+// manually drive things by calling ConsumeAll explicitly.
+constexpr uint32_t kNeverPoll = std::numeric_limits<uint32_t>::max();
+
+__be16 bindAndListen(int s) {
+  sockaddr_in sin = {.sin_family = AF_INET};
+  socklen_t len = sizeof(sin);
+  if (bind(s, (sockaddr*)&sin, sizeof(sin))) return 0;
+  if (listen(s, 1)) return 0;
+  if (getsockname(s, (sockaddr*)&sin, &len)) return 0;
+  return sin.sin_port;
+}
+
+// This takes tcp flag constants from the standard library and makes them usable
+// with the flags we get from BPF. The standard library flags are big endian
+// whereas the BPF flags are reported in host byte order. BPF also trims the
+// flags down to the 8 single-bit flag bits (fin, syn, rst, etc).
+constexpr inline uint8_t FlagToHost(__be32 be_unix_flags) {
+  return ntohl(be_unix_flags) >> 16;
+}
+
+// Pretty prints all fields for a list of packets (useful for debugging).
+struct PacketPrinter {
+  const std::vector<PacketTrace>& data;
+  static constexpr char kTcpFlagNames[] = "FSRPAUEC";
+
+  friend std::ostream& operator<<(std::ostream& os, const PacketPrinter& d) {
+    os << "Packet count: " << d.data.size();
+    for (const PacketTrace& info : d.data) {
+      os << "\nifidx=" << info.ifindex;
+      os << ", len=" << info.length;
+      os << ", uid=" << info.uid;
+      os << ", tag=" << info.tag;
+      os << ", sport=" << info.sport;
+      os << ", dport=" << info.dport;
+      os << ", direction=" << (info.egress ? "egress" : "ingress");
+      os << ", proto=" << static_cast<int>(info.ipProto);
+      os << ", ip=" << static_cast<int>(info.ipVersion);
+      os << ", flags=";
+      for (int i = 0; i < 8; i++) {
+        os << ((info.tcpFlags & (1 << i)) ? kTcpFlagNames[i] : '.');
+      }
+    }
+    return os;
+  }
+};
+
+class NetworkTracePollerTest : public testing::Test {
+ protected:
+  void SetUp() {
+    if (access(PACKET_TRACE_RINGBUF_PATH, R_OK)) {
+      GTEST_SKIP() << "Network tracing is not enabled/loaded on this build.";
+    }
+    if (sizeof(void*) != 8) {
+      GTEST_SKIP() << "Network tracing requires 64-bit build.";
+    }
+  }
+};
+
+TEST_F(NetworkTracePollerTest, PollWhileInactive) {
+  NetworkTracePoller handler([&](const std::vector<PacketTrace>& pkt) {});
+
+  // One succeed after start and before stop.
+  EXPECT_FALSE(handler.ConsumeAll());
+  ASSERT_TRUE(handler.Start(kNeverPoll));
+  EXPECT_TRUE(handler.ConsumeAll());
+  ASSERT_TRUE(handler.Stop());
+  EXPECT_FALSE(handler.ConsumeAll());
+}
+
+TEST_F(NetworkTracePollerTest, ConcurrentSessions) {
+  // Simulate two concurrent sessions (two starts followed by two stops). Check
+  // that tracing is stopped only after both sessions finish.
+  NetworkTracePoller handler([&](const std::vector<PacketTrace>& pkt) {});
+
+  ASSERT_TRUE(handler.Start(kNeverPoll));
+  EXPECT_TRUE(handler.ConsumeAll());
+
+  ASSERT_TRUE(handler.Start(kNeverPoll));
+  EXPECT_TRUE(handler.ConsumeAll());
+
+  ASSERT_TRUE(handler.Stop());
+  EXPECT_TRUE(handler.ConsumeAll());
+
+  ASSERT_TRUE(handler.Stop());
+  EXPECT_FALSE(handler.ConsumeAll());
+}
+
+TEST_F(NetworkTracePollerTest, TraceTcpSession) {
+  __be16 server_port = 0;
+  std::vector<PacketTrace> packets, unmatched;
+
+  // Record all packets with the bound address and current uid. This callback is
+  // involked only within ConsumeAll, at which point the port should have
+  // already been filled in and all packets have been processed.
+  NetworkTracePoller handler([&](const std::vector<PacketTrace>& pkts) {
+    for (const PacketTrace& pkt : pkts) {
+      if ((pkt.sport == server_port || pkt.dport == server_port) &&
+          pkt.uid == getuid()) {
+        packets.push_back(pkt);
+      } else {
+        // There may be spurious packets not caused by the test. These are only
+        // captured so that we can report them to help debug certain errors.
+        unmatched.push_back(pkt);
+      }
+    }
+  });
+
+  ASSERT_TRUE(handler.Start(kNeverPoll));
+  const uint32_t kClientTag = 2468;
+  const uint32_t kServerTag = 1357;
+
+  // Go through a typical connection sequence between two v4 sockets using tcp.
+  // This covers connection handshake, shutdown, and one data packet.
+  {
+    android::base::unique_fd clientsocket(socket(AF_INET, SOCK_STREAM, 0));
+    ASSERT_NE(-1, clientsocket) << "Failed to open client socket";
+    ASSERT_EQ(android_tag_socket(clientsocket, kClientTag), 0);
+
+    android::base::unique_fd serversocket(socket(AF_INET, SOCK_STREAM, 0));
+    ASSERT_NE(-1, serversocket) << "Failed to open server socket";
+    ASSERT_EQ(android_tag_socket(serversocket, kServerTag), 0);
+
+    server_port = bindAndListen(serversocket);
+    ASSERT_NE(0, server_port) << "Can't bind to server port";
+
+    sockaddr_in addr = {.sin_family = AF_INET, .sin_port = server_port};
+    ASSERT_EQ(0, connect(clientsocket, (sockaddr*)&addr, sizeof(addr)))
+        << "connect to loopback failed: " << strerror(errno);
+
+    int accepted = accept(serversocket, nullptr, nullptr);
+    ASSERT_NE(-1, accepted) << "accept connection failed: " << strerror(errno);
+
+    const char data[] = "abcdefghijklmnopqrstuvwxyz";
+    EXPECT_EQ(send(clientsocket, data, sizeof(data), 0), sizeof(data))
+        << "failed to send message: " << strerror(errno);
+
+    char buff[100] = {};
+    EXPECT_EQ(recv(accepted, buff, sizeof(buff), 0), sizeof(data))
+        << "failed to receive message: " << strerror(errno);
+
+    EXPECT_EQ(std::string(data), std::string(buff));
+  }
+
+  // Poll until we get all the packets (typically we get it first try).
+  for (int attempt = 0; attempt < 10; attempt++) {
+    ASSERT_TRUE(handler.ConsumeAll());
+    if (packets.size() >= 12) break;
+    std::this_thread::sleep_for(std::chrono::milliseconds(5));
+  }
+
+  ASSERT_TRUE(handler.Stop());
+
+  // There are 12 packets in total (6 messages: each seen by client & server):
+  // 1. Client connects to server with syn
+  // 2. Server responds with syn ack
+  // 3. Client responds with ack
+  // 4. Client sends data with psh ack
+  // 5. Server acks the data packet
+  // 6. Client closes connection with fin ack
+  ASSERT_EQ(packets.size(), 12)
+      << PacketPrinter{packets}
+      << "\nUnmatched packets: " << PacketPrinter{unmatched};
+
+  // All packets should be TCP packets.
+  EXPECT_THAT(packets, Each(Field(&PacketTrace::ipProto, Eq(IPPROTO_TCP))));
+
+  // Packet 1: client requests connection with server.
+  EXPECT_EQ(packets[0].egress, 1) << PacketPrinter{packets};
+  EXPECT_EQ(packets[0].dport, server_port) << PacketPrinter{packets};
+  EXPECT_EQ(packets[0].tag, kClientTag) << PacketPrinter{packets};
+  EXPECT_EQ(packets[0].tcpFlags, FlagToHost(TCP_FLAG_SYN))
+      << PacketPrinter{packets};
+
+  // Packet 2: server receives request from client.
+  EXPECT_EQ(packets[1].egress, 0) << PacketPrinter{packets};
+  EXPECT_EQ(packets[1].dport, server_port) << PacketPrinter{packets};
+  EXPECT_EQ(packets[1].tag, kServerTag) << PacketPrinter{packets};
+  EXPECT_EQ(packets[1].tcpFlags, FlagToHost(TCP_FLAG_SYN))
+      << PacketPrinter{packets};
+
+  // Packet 3: server replies back with syn ack.
+  EXPECT_EQ(packets[2].egress, 1) << PacketPrinter{packets};
+  EXPECT_EQ(packets[2].sport, server_port) << PacketPrinter{packets};
+  EXPECT_EQ(packets[2].tcpFlags, FlagToHost(TCP_FLAG_SYN | TCP_FLAG_ACK))
+      << PacketPrinter{packets};
+
+  // Packet 4: client receives the server's syn ack.
+  EXPECT_EQ(packets[3].egress, 0) << PacketPrinter{packets};
+  EXPECT_EQ(packets[3].sport, server_port) << PacketPrinter{packets};
+  EXPECT_EQ(packets[3].tcpFlags, FlagToHost(TCP_FLAG_SYN | TCP_FLAG_ACK))
+      << PacketPrinter{packets};
+}
+
+}  // namespace internal
+}  // namespace bpf
+}  // namespace android
diff --git a/service-t/native/libs/libnetworkstats/include/netdbpf/NetworkTraceHandler.h b/service-t/native/libs/libnetworkstats/include/netdbpf/NetworkTraceHandler.h
index 3f244b3..80871c6 100644
--- a/service-t/native/libs/libnetworkstats/include/netdbpf/NetworkTraceHandler.h
+++ b/service-t/native/libs/libnetworkstats/include/netdbpf/NetworkTraceHandler.h
@@ -22,9 +22,7 @@
 #include <string>
 #include <unordered_map>
 
-#include "android-base/thread_annotations.h"
-#include "bpf/BpfMap.h"
-#include "bpf/BpfRingbuf.h"
+#include "netdbpf/NetworkTracePoller.h"
 
 // For PacketTrace struct definition
 #include "netd.h"
@@ -32,57 +30,39 @@
 namespace android {
 namespace bpf {
 
-// NetworkTracePoller is responsible for interactions with the BPF ring buffer
-// including polling. This class is an internal helper for NetworkTraceHandler,
-// it is not meant to be used elsewhere.
-class NetworkTracePoller {
- public:
-  // Testonly: initialize with a callback capable of intercepting data.
-  NetworkTracePoller(std::function<void(const PacketTrace&)> callback)
-      : mCallback(std::move(callback)) {}
+// BundleKeys are PacketTraces where timestamp and length are ignored.
+using BundleKey = PacketTrace;
 
-  // Starts tracing with the given poll interval.
-  bool Start(uint32_t pollMs) EXCLUDES(mMutex);
+// BundleKeys are hashed using all fields except timestamp/length.
+struct BundleHash {
+  std::size_t operator()(const BundleKey& a) const;
+};
 
-  // Stops tracing and release any held state.
-  bool Stop() EXCLUDES(mMutex);
+// BundleKeys are equal if all fields except timestamp/length are equal.
+struct BundleEq {
+  bool operator()(const BundleKey& a, const BundleKey& b) const;
+};
 
-  // Consumes all available events from the ringbuffer.
-  bool ConsumeAll() EXCLUDES(mMutex);
+// Track the bundles we've interned and their corresponding intern id (iid). We
+// use IncrementalState (rather than state in the Handler) so that we stay in
+// sync with Perfetto's periodic state clearing (which helps recover from packet
+// loss). When state is cleared, the state object is replaced with a new default
+// constructed instance.
+struct NetworkTraceState {
+  bool cleared;
+  std::unordered_map<BundleKey, uint64_t, BundleHash, BundleEq> iids;
+};
 
- private:
-  void SchedulePolling() REQUIRES(mMutex);
-  bool ConsumeAllLocked() REQUIRES(mMutex);
-
-  std::mutex mMutex;
-
-  // Records the number of successfully started active sessions so that only the
-  // first active session attempts setup and only the last cleans up. Note that
-  // the session count will remain zero if Start fails. It is expected that Stop
-  // will not be called for any trace session where Start fails.
-  int mSessionCount GUARDED_BY(mMutex);
-
-  // How often to poll the ring buffer, defined by the trace config.
-  uint32_t mPollMs GUARDED_BY(mMutex);
-
-  // The function to process PacketTrace, typically a Perfetto sink.
-  std::function<void(const PacketTrace&)> mCallback GUARDED_BY(mMutex);
-
-  // The BPF ring buffer handle.
-  std::unique_ptr<BpfRingbuf<PacketTrace>> mRingBuffer GUARDED_BY(mMutex);
-
-  // The packet tracing config map (really a 1-element array).
-  BpfMap<uint32_t, bool> mConfigurationMap GUARDED_BY(mMutex);
-
-  // This must be the last member, causing it to be the first deleted. If it is
-  // not, members required for callbacks can be deleted before it's stopped.
-  std::unique_ptr<perfetto::base::TaskRunner> mTaskRunner GUARDED_BY(mMutex);
+// Inject our custom incremental state type using type traits.
+struct NetworkTraceTraits : public perfetto::DefaultDataSourceTraits {
+  using IncrementalStateType = NetworkTraceState;
 };
 
 // NetworkTraceHandler implements the android.network_packets data source. This
 // class is registered with Perfetto and is instantiated when tracing starts and
 // destroyed when tracing ends. There is one instance per trace session.
-class NetworkTraceHandler : public perfetto::DataSource<NetworkTraceHandler> {
+class NetworkTraceHandler
+    : public perfetto::DataSource<NetworkTraceHandler, NetworkTraceTraits> {
  public:
   // Registers this DataSource.
   static void RegisterDataSource();
@@ -95,14 +75,31 @@
   void OnStart(const StartArgs&) override;
   void OnStop(const StopArgs&) override;
 
+  // Writes the packets as Perfetto TracePackets, creating packets as needed
+  // using the provided callback (which allows easy testing).
+  void Write(const std::vector<PacketTrace>& packets,
+             NetworkTraceHandler::TraceContext& ctx);
+
  private:
   // Convert a PacketTrace into a Perfetto trace packet.
-  static void Fill(const PacketTrace& src,
-                   ::perfetto::protos::pbzero::TracePacket& dst);
+  void Fill(const PacketTrace& src,
+            ::perfetto::protos::pbzero::NetworkPacketEvent* event);
 
-  static NetworkTracePoller sPoller;
-  uint32_t mPollMs;
+  // Fills in contextual information either inline or via interning.
+  ::perfetto::protos::pbzero::NetworkPacketBundle* FillWithInterning(
+      NetworkTraceState* state, const BundleKey& key,
+      ::perfetto::protos::pbzero::TracePacket* dst);
+
+  static internal::NetworkTracePoller sPoller;
   bool mStarted;
+
+  // Values from config, see proto for details.
+  uint32_t mPollMs;
+  uint32_t mInternLimit;
+  uint32_t mAggregationThreshold;
+  bool mDropLocalPort;
+  bool mDropRemotePort;
+  bool mDropTcpFlags;
 };
 
 }  // namespace bpf
diff --git a/service-t/native/libs/libnetworkstats/include/netdbpf/NetworkTracePoller.h b/service-t/native/libs/libnetworkstats/include/netdbpf/NetworkTracePoller.h
new file mode 100644
index 0000000..adde51e
--- /dev/null
+++ b/service-t/native/libs/libnetworkstats/include/netdbpf/NetworkTracePoller.h
@@ -0,0 +1,86 @@
+/**
+ * Copyright (c) 2023, 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.
+ */
+
+#pragma once
+
+#include <perfetto/base/task_runner.h>
+#include <perfetto/tracing.h>
+
+#include <string>
+#include <unordered_map>
+
+#include "android-base/thread_annotations.h"
+#include "bpf/BpfMap.h"
+#include "bpf/BpfRingbuf.h"
+
+// For PacketTrace struct definition
+#include "netd.h"
+
+namespace android {
+namespace bpf {
+namespace internal {
+
+// NetworkTracePoller is responsible for interactions with the BPF ring buffer
+// including polling. This class is an internal helper for NetworkTraceHandler,
+// it is not meant to be used elsewhere.
+class NetworkTracePoller {
+ public:
+  using EventSink = std::function<void(const std::vector<PacketTrace>&)>;
+
+  // Testonly: initialize with a callback capable of intercepting data.
+  NetworkTracePoller(EventSink callback) : mCallback(std::move(callback)) {}
+
+  // Starts tracing with the given poll interval.
+  bool Start(uint32_t pollMs) EXCLUDES(mMutex);
+
+  // Stops tracing and release any held state.
+  bool Stop() EXCLUDES(mMutex);
+
+  // Consumes all available events from the ringbuffer.
+  bool ConsumeAll() EXCLUDES(mMutex);
+
+ private:
+  void SchedulePolling() REQUIRES(mMutex);
+  bool ConsumeAllLocked() REQUIRES(mMutex);
+
+  std::mutex mMutex;
+
+  // Records the number of successfully started active sessions so that only the
+  // first active session attempts setup and only the last cleans up. Note that
+  // the session count will remain zero if Start fails. It is expected that Stop
+  // will not be called for any trace session where Start fails.
+  int mSessionCount GUARDED_BY(mMutex);
+
+  // How often to poll the ring buffer, defined by the trace config.
+  uint32_t mPollMs GUARDED_BY(mMutex);
+
+  // The function to process PacketTrace, typically a Perfetto sink.
+  EventSink mCallback GUARDED_BY(mMutex);
+
+  // The BPF ring buffer handle.
+  std::unique_ptr<BpfRingbuf<PacketTrace>> mRingBuffer GUARDED_BY(mMutex);
+
+  // The packet tracing config map (really a 1-element array).
+  BpfMap<uint32_t, bool> mConfigurationMap GUARDED_BY(mMutex);
+
+  // This must be the last member, causing it to be the first deleted. If it is
+  // not, members required for callbacks can be deleted before it's stopped.
+  std::unique_ptr<perfetto::base::TaskRunner> mTaskRunner GUARDED_BY(mMutex);
+};
+
+}  // namespace internal
+}  // namespace bpf
+}  // namespace android
diff --git a/service-t/src/com/android/server/NsdService.java b/service-t/src/com/android/server/NsdService.java
index c92e9a9..cbe6691 100644
--- a/service-t/src/com/android/server/NsdService.java
+++ b/service-t/src/com/android/server/NsdService.java
@@ -53,7 +53,6 @@
 import android.os.UserHandle;
 import android.text.TextUtils;
 import android.util.Log;
-import android.util.Pair;
 import android.util.SparseArray;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -397,13 +396,12 @@
                 final int clientId = msg.arg2;
                 switch (msg.what) {
                     case NsdManager.REGISTER_CLIENT:
-                        final Pair<NsdServiceConnector, INsdManagerCallback> arg =
-                                (Pair<NsdServiceConnector, INsdManagerCallback>) msg.obj;
-                        final INsdManagerCallback cb = arg.second;
+                        final ConnectorArgs arg = (ConnectorArgs) msg.obj;
+                        final INsdManagerCallback cb = arg.callback;
                         try {
-                            cb.asBinder().linkToDeath(arg.first, 0);
-                            cInfo = new ClientInfo(cb);
-                            mClients.put(arg.first, cInfo);
+                            cb.asBinder().linkToDeath(arg.connector, 0);
+                            cInfo = new ClientInfo(cb, arg.useJavaBackend);
+                            mClients.put(arg.connector, cInfo);
                         } catch (RemoteException e) {
                             Log.w(TAG, "Client " + clientId + " has already died");
                         }
@@ -608,7 +606,8 @@
                         final NsdServiceInfo info = args.serviceInfo;
                         id = getUniqueId();
                         final String serviceType = constructServiceType(info.getServiceType());
-                        if (mDeps.isMdnsDiscoveryManagerEnabled(mContext)
+                        if (clientInfo.mUseJavaBackend
+                                || mDeps.isMdnsDiscoveryManagerEnabled(mContext)
                                 || useDiscoveryManagerForType(serviceType)) {
                             if (serviceType == null) {
                                 clientInfo.onDiscoverServicesFailed(clientId,
@@ -702,7 +701,8 @@
                         final NsdServiceInfo serviceInfo = args.serviceInfo;
                         final String serviceType = serviceInfo.getServiceType();
                         final String registerServiceType = constructServiceType(serviceType);
-                        if (mDeps.isMdnsAdvertiserEnabled(mContext)
+                        if (clientInfo.mUseJavaBackend
+                                || mDeps.isMdnsAdvertiserEnabled(mContext)
                                 || useAdvertiserForType(registerServiceType)) {
                             if (registerServiceType == null) {
                                 Log.e(TAG, "Invalid service type: " + serviceType);
@@ -782,7 +782,8 @@
                         final NsdServiceInfo info = args.serviceInfo;
                         id = getUniqueId();
                         final String serviceType = constructServiceType(info.getServiceType());
-                        if (mDeps.isMdnsDiscoveryManagerEnabled(mContext)
+                        if (clientInfo.mUseJavaBackend
+                                ||  mDeps.isMdnsDiscoveryManagerEnabled(mContext)
                                 || useDiscoveryManagerForType(serviceType)) {
                             if (serviceType == null) {
                                 clientInfo.onResolveServiceFailed(clientId,
@@ -1532,12 +1533,27 @@
         }
     }
 
+    private static class ConnectorArgs {
+        @NonNull public final NsdServiceConnector connector;
+        @NonNull public final INsdManagerCallback callback;
+        public final boolean useJavaBackend;
+
+        ConnectorArgs(@NonNull NsdServiceConnector connector, @NonNull INsdManagerCallback callback,
+                boolean useJavaBackend) {
+            this.connector = connector;
+            this.callback = callback;
+            this.useJavaBackend = useJavaBackend;
+        }
+    }
+
     @Override
-    public INsdServiceConnector connect(INsdManagerCallback cb) {
+    public INsdServiceConnector connect(INsdManagerCallback cb, boolean useJavaBackend) {
         mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERNET, "NsdService");
+        if (DBG) Log.d(TAG, "New client connect. useJavaBackend=" + useJavaBackend);
         final INsdServiceConnector connector = new NsdServiceConnector();
         mNsdStateMachine.sendMessage(mNsdStateMachine.obtainMessage(
-                NsdManager.REGISTER_CLIENT, new Pair<>(connector, cb)));
+                NsdManager.REGISTER_CLIENT,
+                new ConnectorArgs((NsdServiceConnector) connector, cb, useJavaBackend)));
         return connector;
     }
 
@@ -1793,9 +1809,12 @@
 
         // The target SDK of this client < Build.VERSION_CODES.S
         private boolean mIsPreSClient = false;
+        // The flag of using java backend if the client's target SDK >= U
+        private final boolean mUseJavaBackend;
 
-        private ClientInfo(INsdManagerCallback cb) {
+        private ClientInfo(INsdManagerCallback cb, boolean useJavaBackend) {
             mCb = cb;
+            mUseJavaBackend = useJavaBackend;
             if (DBG) Log.d(TAG, "New client");
         }
 
diff --git a/service-t/src/com/android/server/connectivity/mdns/MdnsResponse.java b/service-t/src/com/android/server/connectivity/mdns/MdnsResponse.java
index be2555b..e0100f6 100644
--- a/service-t/src/com/android/server/connectivity/mdns/MdnsResponse.java
+++ b/service-t/src/com/android/server/connectivity/mdns/MdnsResponse.java
@@ -81,6 +81,21 @@
         return a == null || a.getTtl() == b.getTtl();
     }
 
+    private <T extends MdnsRecord> boolean addOrReplaceRecord(@NonNull T record,
+            @NonNull List<T> recordsList) {
+        final int existing = recordsList.indexOf(record);
+        if (existing >= 0) {
+            if (recordsAreSame(record, recordsList.get(existing))) {
+                return false;
+            }
+            final MdnsRecord existedRecord = recordsList.remove(existing);
+            records.remove(existedRecord);
+        }
+        recordsList.add(record);
+        records.add(record);
+        return true;
+    }
+
     /**
      * Adds a pointer record.
      *
@@ -92,17 +107,7 @@
             throw new IllegalArgumentException(
                     "Pointer records for different service names cannot be added");
         }
-        final int existing = pointerRecords.indexOf(pointerRecord);
-        if (existing >= 0) {
-            if (recordsAreSame(pointerRecord, pointerRecords.get(existing))) {
-                return false;
-            }
-            final MdnsRecord record = pointerRecords.remove(existing);
-            records.remove(record);
-        }
-        pointerRecords.add(pointerRecord);
-        records.add(pointerRecord);
-        return true;
+        return addOrReplaceRecord(pointerRecord, pointerRecords);
     }
 
     /** Gets the pointer records. */
@@ -207,17 +212,7 @@
     /** Add the IPv4 address record. */
     public synchronized boolean addInet4AddressRecord(
             @NonNull MdnsInetAddressRecord newInet4AddressRecord) {
-        final int existing = inet4AddressRecords.indexOf(newInet4AddressRecord);
-        if (existing >= 0) {
-            if (recordsAreSame(newInet4AddressRecord, inet4AddressRecords.get(existing))) {
-                return false;
-            }
-            final MdnsRecord record = inet4AddressRecords.remove(existing);
-            records.remove(record);
-        }
-        inet4AddressRecords.add(newInet4AddressRecord);
-        records.add(newInet4AddressRecord);
-        return true;
+        return addOrReplaceRecord(newInet4AddressRecord, inet4AddressRecords);
     }
 
     /** Gets the IPv4 address records. */
@@ -248,17 +243,7 @@
     /** Sets the IPv6 address records. */
     public synchronized boolean addInet6AddressRecord(
             @NonNull MdnsInetAddressRecord newInet6AddressRecord) {
-        final int existing = inet6AddressRecords.indexOf(newInet6AddressRecord);
-        if (existing >= 0) {
-            if (recordsAreSame(newInet6AddressRecord, inet6AddressRecords.get(existing))) {
-                return false;
-            }
-            final MdnsRecord record = inet6AddressRecords.remove(existing);
-            records.remove(record);
-        }
-        inet6AddressRecords.add(newInet6AddressRecord);
-        records.add(newInet6AddressRecord);
-        return true;
+        return addOrReplaceRecord(newInet6AddressRecord, inet6AddressRecords);
     }
 
     /**
diff --git a/service-t/src/com/android/server/connectivity/mdns/MdnsResponseDecoder.java b/service-t/src/com/android/server/connectivity/mdns/MdnsResponseDecoder.java
index 0151202..129db7e 100644
--- a/service-t/src/com/android/server/connectivity/mdns/MdnsResponseDecoder.java
+++ b/service-t/src/com/android/server/connectivity/mdns/MdnsResponseDecoder.java
@@ -220,9 +220,10 @@
                         // This bit, the cache-flush bit, tells neighboring hosts
                         // that this is not a shared record type.  Instead of merging this new
                         // record additively into the cache in addition to any previous records with
-                        // the same name, rrtype, and rrclass, all old records with that name,
-                        // rrtype, and rrclass that were received more than one second ago are
-                        // declared invalid, and marked to expire from the cache in one second.
+                        // the same name, rrtype, and rrclass.
+                        // TODO: All old records with that name, rrtype, and rrclass that were
+                        //       received more than one second ago are declared invalid, and marked
+                        //       to expire from the cache in one second.
                         if (inetRecord.getCacheFlush()) {
                             response.clearInet4AddressRecords();
                             response.clearInet6AddressRecords();
@@ -236,9 +237,10 @@
                         // This bit, the cache-flush bit, tells neighboring hosts
                         // that this is not a shared record type.  Instead of merging this new
                         // record additively into the cache in addition to any previous records with
-                        // the same name, rrtype, and rrclass, all old records with that name,
-                        // rrtype, and rrclass that were received more than one second ago are
-                        // declared invalid, and marked to expire from the cache in one second.
+                        // the same name, rrtype, and rrclass.
+                        // TODO: All old records with that name, rrtype, and rrclass that were
+                        //       received more than one second ago are declared invalid, and marked
+                        //       to expire from the cache in one second.
                         if (inetRecord.getCacheFlush()) {
                             response.clearInet4AddressRecords();
                             response.clearInet6AddressRecords();
diff --git a/service-t/src/com/android/server/ethernet/EthernetServiceImpl.java b/service-t/src/com/android/server/ethernet/EthernetServiceImpl.java
index f6a55c8..e7af569 100644
--- a/service-t/src/com/android/server/ethernet/EthernetServiceImpl.java
+++ b/service-t/src/com/android/server/ethernet/EthernetServiceImpl.java
@@ -92,7 +92,7 @@
     @Override
     public String[] getAvailableInterfaces() throws RemoteException {
         PermissionUtils.enforceAccessNetworkStatePermission(mContext, TAG);
-        return mTracker.getInterfaces(checkUseRestrictedNetworksPermission());
+        return mTracker.getClientModeInterfaces(checkUseRestrictedNetworksPermission());
     }
 
     /**
diff --git a/service-t/src/com/android/server/ethernet/EthernetTracker.java b/service-t/src/com/android/server/ethernet/EthernetTracker.java
index 852cf42..d520757 100644
--- a/service-t/src/com/android/server/ethernet/EthernetTracker.java
+++ b/service-t/src/com/android/server/ethernet/EthernetTracker.java
@@ -385,7 +385,7 @@
         return mFactory.hasInterface(iface);
     }
 
-    String[] getInterfaces(boolean includeRestricted) {
+    String[] getClientModeInterfaces(boolean includeRestricted) {
         return mFactory.getAvailableInterfaces(includeRestricted);
     }
 
@@ -428,9 +428,12 @@
                 // Remote process has already died
                 return;
             }
-            for (String iface : getInterfaces(canUseRestrictedNetworks)) {
+            for (String iface : getClientModeInterfaces(canUseRestrictedNetworks)) {
                 unicastInterfaceStateChange(listener, iface);
             }
+            if (mTetheringInterfaceMode == INTERFACE_MODE_SERVER) {
+                unicastInterfaceStateChange(listener, mTetheringInterface);
+            }
 
             unicastEthernetStateChange(listener, mEthernetState);
         });
diff --git a/service-t/src/com/android/server/net/NetworkStatsService.java b/service-t/src/com/android/server/net/NetworkStatsService.java
index c7b089d..961337d 100644
--- a/service-t/src/com/android/server/net/NetworkStatsService.java
+++ b/service-t/src/com/android/server/net/NetworkStatsService.java
@@ -106,6 +106,7 @@
 import android.net.TetherStatsParcel;
 import android.net.TetheringManager;
 import android.net.TrafficStats;
+import android.net.TransportInfo;
 import android.net.UnderlyingNetworkInfo;
 import android.net.Uri;
 import android.net.netstats.IUsageCallback;
@@ -113,6 +114,7 @@
 import android.net.netstats.provider.INetworkStatsProvider;
 import android.net.netstats.provider.INetworkStatsProviderCallback;
 import android.net.netstats.provider.NetworkStatsProvider;
+import android.net.wifi.WifiInfo;
 import android.os.Binder;
 import android.os.Build;
 import android.os.Bundle;
@@ -2122,6 +2124,14 @@
             final NetworkIdentity ident = NetworkIdentity.buildNetworkIdentity(mContext, snapshot,
                     isDefault, ratType);
 
+            // If WifiInfo contains a null network key then this identity should not be added into
+            // the network identity set. See b/266598304.
+            final TransportInfo transportInfo = snapshot.getNetworkCapabilities()
+                    .getTransportInfo();
+            if (transportInfo instanceof WifiInfo) {
+                final WifiInfo info = (WifiInfo) transportInfo;
+                if (info.getNetworkKey() == null) continue;
+            }
             // Traffic occurring on the base interface is always counted for
             // both total usage and UID details.
             final String baseIface = snapshot.getLinkProperties().getInterfaceName();
diff --git a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
index 5b42659..062d272 100644
--- a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
+++ b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
@@ -177,17 +177,24 @@
                                                                               jobject clazz) {
     // Will eventually be bound to htons(ETH_P_IPV6) protocol,
     // but only after appropriate bpf filter is attached.
-    int sock = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+    const int sock = socket(AF_PACKET, SOCK_RAW | SOCK_CLOEXEC, 0);
     if (sock < 0) {
         throwIOException(env, "packet socket failed", errno);
         return -1;
     }
-    int on = 1;
+    const int on = 1;
+    // enable tpacket_auxdata cmsg delivery, which includes L2 header length
     if (setsockopt(sock, SOL_PACKET, PACKET_AUXDATA, &on, sizeof(on))) {
         throwIOException(env, "packet socket auxdata enablement failed", errno);
         close(sock);
         return -1;
     }
+    // needed for virtio_net_hdr prepending, which includes checksum metadata
+    if (setsockopt(sock, SOL_PACKET, PACKET_VNET_HDR, &on, sizeof(on))) {
+        throwIOException(env, "packet socket vnet_hdr enablement failed", errno);
+        close(sock);
+        return -1;
+    }
     return sock;
 }
 
diff --git a/service/native/libs/libclat/Android.bp b/service/native/libs/libclat/Android.bp
index 54d40ac..996706e 100644
--- a/service/native/libs/libclat/Android.bp
+++ b/service/native/libs/libclat/Android.bp
@@ -23,6 +23,9 @@
         "clatutils.cpp",
     ],
     stl: "libc++_static",
+    header_libs: [
+        "bpf_headers",
+    ],
     static_libs: [
         "libip_checksum",
     ],
diff --git a/service/native/libs/libclat/clatutils.cpp b/service/native/libs/libclat/clatutils.cpp
index c6a9781..6c5c9e3 100644
--- a/service/native/libs/libclat/clatutils.cpp
+++ b/service/native/libs/libclat/clatutils.cpp
@@ -25,6 +25,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <bpf/BpfClassic.h>
+
 extern "C" {
 #include "checksum.h"
 }
@@ -33,11 +35,9 @@
 namespace net {
 namespace clat {
 
-bool isIpv4AddressFree(in_addr_t addr) {
-    int s = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
-    if (s == -1) {
-        return 0;
-    }
+bool isIpv4AddressFree(const in_addr_t addr) {
+    const int s = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+    if (s == -1) return 0;
 
     // Attempt to connect to the address. If the connection succeeds and getsockname returns the
     // same then the address is already assigned to the system and we can't use it.
@@ -47,9 +47,10 @@
             .sin_addr = {addr},
     };
     socklen_t len = sizeof(sin);
-    bool inuse = connect(s, (struct sockaddr*)&sin, sizeof(sin)) == 0 &&
-                 getsockname(s, (struct sockaddr*)&sin, &len) == 0 && (size_t)len >= sizeof(sin) &&
-                 sin.sin_addr.s_addr == addr;
+    const bool inuse = !connect(s, (struct sockaddr*)&sin, sizeof(sin)) &&
+                       !getsockname(s, (struct sockaddr*)&sin, &len) &&
+                       len == (socklen_t)sizeof(sin) &&
+                       sin.sin_addr.s_addr == addr;
 
     close(s);
     return !inuse;
@@ -59,36 +60,30 @@
 //   ip        - the IP address from the configuration file
 //   prefixlen - the length of the prefix from which addresses may be selected.
 //   returns: the IPv4 address, or INADDR_NONE if no addresses were available
-in_addr_t selectIpv4Address(const in_addr ip, int16_t prefixlen) {
+in_addr_t selectIpv4Address(const in_addr ip, const int16_t prefixlen) {
     return selectIpv4AddressInternal(ip, prefixlen, isIpv4AddressFree);
 }
 
 // Only allow testing to use this function directly. Otherwise call selectIpv4Address(ip, pfxlen)
 // which has applied valid isIpv4AddressFree function pointer.
-in_addr_t selectIpv4AddressInternal(const in_addr ip, int16_t prefixlen,
-                                    isIpv4AddrFreeFn isIpv4AddressFreeFunc) {
+in_addr_t selectIpv4AddressInternal(const in_addr ip, const int16_t prefixlen,
+                                    const isIpv4AddrFreeFn isIpv4AddressFreeFunc) {
     // Impossible! Only test allows to apply fn.
-    if (isIpv4AddressFreeFunc == nullptr) {
-        return INADDR_NONE;
-    }
+    if (isIpv4AddressFreeFunc == nullptr) return INADDR_NONE;
 
     // Don't accept prefixes that are too large because we scan addresses one by one.
-    if (prefixlen < 16 || prefixlen > 32) {
-        return INADDR_NONE;
-    }
+    if (prefixlen < 16 || prefixlen > 32) return INADDR_NONE;
 
     // All these are in host byte order.
-    in_addr_t mask = 0xffffffff >> (32 - prefixlen) << (32 - prefixlen);
-    in_addr_t ipv4 = ntohl(ip.s_addr);
-    in_addr_t first_ipv4 = ipv4;
-    in_addr_t prefix = ipv4 & mask;
+    const uint32_t mask = 0xffffffff >> (32 - prefixlen) << (32 - prefixlen);
+    uint32_t ipv4 = ntohl(ip.s_addr);
+    const uint32_t first_ipv4 = ipv4;
+    const uint32_t prefix = ipv4 & mask;
 
     // Pick the first IPv4 address in the pool, wrapping around if necessary.
     // So, for example, 192.0.0.4 -> 192.0.0.5 -> 192.0.0.6 -> 192.0.0.7 -> 192.0.0.0.
     do {
-        if (isIpv4AddressFreeFunc(htonl(ipv4))) {
-            return htonl(ipv4);
-        }
+        if (isIpv4AddressFreeFunc(htonl(ipv4))) return htonl(ipv4);
         ipv4 = prefix | ((ipv4 + 1) & ~mask);
     } while (ipv4 != first_ipv4);
 
@@ -96,7 +91,7 @@
 }
 
 // Alters the bits in the IPv6 address to make them checksum neutral with v4 and nat64Prefix.
-void makeChecksumNeutral(in6_addr* v6, const in_addr v4, const in6_addr& nat64Prefix) {
+void makeChecksumNeutral(in6_addr* const v6, const in_addr v4, const in6_addr& nat64Prefix) {
     // Fill last 8 bytes of IPv6 address with random bits.
     arc4random_buf(&v6->s6_addr[8], 8);
 
@@ -118,33 +113,35 @@
 }
 
 // Picks a random interface ID that is checksum neutral with the IPv4 address and the NAT64 prefix.
-int generateIpv6Address(const char* iface, const in_addr v4, const in6_addr& nat64Prefix,
-                        in6_addr* v6, uint32_t mark) {
-    int s = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+int generateIpv6Address(const char* const iface, const in_addr v4, const in6_addr& nat64Prefix,
+                        in6_addr* const v6, const uint32_t mark) {
+    const int s = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0);
     if (s == -1) return -errno;
 
     // Socket's mark affects routing decisions (network selection)
     // An fwmark is necessary for clat to bypass the VPN during initialization.
     if (setsockopt(s, SOL_SOCKET, SO_MARK, &mark, sizeof(mark))) {
-        int ret = errno;
-        ALOGE("setsockopt(SOL_SOCKET, SO_MARK) failed: %s", strerror(errno));
+        const int err = errno;
+        ALOGE("setsockopt(SOL_SOCKET, SO_MARK) failed: %s", strerror(err));
         close(s);
-        return -ret;
+        return -err;
     }
 
-    if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, iface, strlen(iface) + 1) == -1) {
+    if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, iface, strlen(iface) + 1)) {
+        const int err = errno;
+        ALOGE("setsockopt(SOL_SOCKET, SO_BINDTODEVICE, '%s') failed: %s", iface, strerror(err));
         close(s);
-        return -errno;
+        return -err;
     }
 
     sockaddr_in6 sin6 = {.sin6_family = AF_INET6, .sin6_addr = nat64Prefix};
-    if (connect(s, reinterpret_cast<struct sockaddr*>(&sin6), sizeof(sin6)) == -1) {
+    if (connect(s, reinterpret_cast<struct sockaddr*>(&sin6), sizeof(sin6))) {
         close(s);
         return -errno;
     }
 
     socklen_t len = sizeof(sin6);
-    if (getsockname(s, reinterpret_cast<struct sockaddr*>(&sin6), &len) == -1) {
+    if (getsockname(s, reinterpret_cast<struct sockaddr*>(&sin6), &len)) {
         close(s);
         return -errno;
     }
@@ -163,21 +160,22 @@
     return 0;
 }
 
-int detect_mtu(const struct in6_addr* plat_subnet, uint32_t plat_suffix, uint32_t mark) {
+int detect_mtu(const struct in6_addr* const plat_subnet, const uint32_t plat_suffix,
+               const uint32_t mark) {
     // Create an IPv6 UDP socket.
-    int s = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+    const int s = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0);
     if (s < 0) {
-        int ret = errno;
-        ALOGE("socket(AF_INET6, SOCK_DGRAM, 0) failed: %s", strerror(errno));
-        return -ret;
+        const int err = errno;
+        ALOGE("socket(AF_INET6, SOCK_DGRAM, 0) failed: %s", strerror(err));
+        return -err;
     }
 
     // Socket's mark affects routing decisions (network selection)
     if (setsockopt(s, SOL_SOCKET, SO_MARK, &mark, sizeof(mark))) {
-        int ret = errno;
-        ALOGE("setsockopt(SOL_SOCKET, SO_MARK) failed: %s", strerror(errno));
+        const int err = errno;
+        ALOGE("setsockopt(SOL_SOCKET, SO_MARK) failed: %s", strerror(err));
         close(s);
-        return -ret;
+        return -err;
     }
 
     // Try to connect udp socket to plat_subnet(96 bits):plat_suffix(32 bits)
@@ -187,20 +185,20 @@
     };
     dst.sin6_addr.s6_addr32[3] = plat_suffix;
     if (connect(s, (struct sockaddr*)&dst, sizeof(dst))) {
-        int ret = errno;
-        ALOGE("connect() failed: %s", strerror(errno));
+        const int err = errno;
+        ALOGE("connect() failed: %s", strerror(err));
         close(s);
-        return -ret;
+        return -err;
     }
 
     // Fetch the socket's IPv6 mtu - this is effectively fetching mtu from routing table
     int mtu;
     socklen_t sz_mtu = sizeof(mtu);
     if (getsockopt(s, SOL_IPV6, IPV6_MTU, &mtu, &sz_mtu)) {
-        int ret = errno;
-        ALOGE("getsockopt(SOL_IPV6, IPV6_MTU) failed: %s", strerror(errno));
+        const int err = errno;
+        ALOGE("getsockopt(SOL_IPV6, IPV6_MTU) failed: %s", strerror(err));
         close(s);
-        return -ret;
+        return -err;
     }
     if (sz_mtu != sizeof(mtu)) {
         ALOGE("getsockopt(SOL_IPV6, IPV6_MTU) returned unexpected size: %d", sz_mtu);
@@ -219,34 +217,26 @@
  *   ifindex - index of interface to add the filter to
  * returns: 0 on success, -errno on failure
  */
-int configure_packet_socket(int sock, in6_addr* addr, int ifindex) {
-    uint32_t* ipv6 = addr->s6_addr32;
-
+int configure_packet_socket(const int sock, const in6_addr* const addr, const int ifindex) {
     // clang-format off
     struct sock_filter filter_code[] = {
-    // Load the first four bytes of the IPv6 destination address (starts 24 bytes in).
-    // Compare it against the first four bytes of our IPv6 address, in host byte order (BPF loads
-    // are always in host byte order). If it matches, continue with next instruction (JMP 0). If it
-    // doesn't match, jump ahead to statement that returns 0 (ignore packet). Repeat for the other
-    // three words of the IPv6 address, and if they all match, return full packet (accept packet).
-        BPF_STMT(BPF_LD  | BPF_W   | BPF_ABS,  24),
-        BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,    htonl(ipv6[0]), 0, 7),
-        BPF_STMT(BPF_LD  | BPF_W   | BPF_ABS,  28),
-        BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,    htonl(ipv6[1]), 0, 5),
-        BPF_STMT(BPF_LD  | BPF_W   | BPF_ABS,  32),
-        BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,    htonl(ipv6[2]), 0, 3),
-        BPF_STMT(BPF_LD  | BPF_W   | BPF_ABS,  36),
-        BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,    htonl(ipv6[3]), 0, 1),
-        BPF_STMT(BPF_RET | BPF_K,              0xFFFFFFFF),
-        BPF_STMT(BPF_RET | BPF_K,              0),
+        BPF_LOAD_IPV6_BE32(daddr.s6_addr32[0]),
+        BPF2_REJECT_IF_NOT_EQUAL(ntohl(addr->s6_addr32[0])),
+        BPF_LOAD_IPV6_BE32(daddr.s6_addr32[1]),
+        BPF2_REJECT_IF_NOT_EQUAL(ntohl(addr->s6_addr32[1])),
+        BPF_LOAD_IPV6_BE32(daddr.s6_addr32[2]),
+        BPF2_REJECT_IF_NOT_EQUAL(ntohl(addr->s6_addr32[2])),
+        BPF_LOAD_IPV6_BE32(daddr.s6_addr32[3]),
+        BPF2_REJECT_IF_NOT_EQUAL(ntohl(addr->s6_addr32[3])),
+        BPF_ACCEPT,
     };
     // clang-format on
     struct sock_fprog filter = {sizeof(filter_code) / sizeof(filter_code[0]), filter_code};
 
     if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter))) {
-        int res = errno;
-        ALOGE("attach packet filter failed: %s", strerror(errno));
-        return -res;
+        const int err = errno;
+        ALOGE("attach packet filter failed: %s", strerror(err));
+        return -err;
     }
 
     struct sockaddr_ll sll = {
@@ -257,9 +247,9 @@
                     PACKET_OTHERHOST,  // The 464xlat IPv6 address is not assigned to the kernel.
     };
     if (bind(sock, (struct sockaddr*)&sll, sizeof(sll))) {
-        int res = errno;
-        ALOGE("binding packet socket: %s", strerror(errno));
-        return -res;
+        const int err = errno;
+        ALOGE("binding packet socket: %s", strerror(err));
+        return -err;
     }
 
     return 0;
diff --git a/service/native/libs/libclat/clatutils_test.cpp b/service/native/libs/libclat/clatutils_test.cpp
index abd4e81..f4f97db 100644
--- a/service/native/libs/libclat/clatutils_test.cpp
+++ b/service/native/libs/libclat/clatutils_test.cpp
@@ -165,7 +165,7 @@
     TunInterface v6Iface;
     ASSERT_EQ(0, v6Iface.init());
 
-    int s = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC, htons(ETH_P_IPV6));
+    const int s = socket(AF_PACKET, SOCK_RAW | SOCK_CLOEXEC, htons(ETH_P_IPV6));
     EXPECT_LE(0, s);
     struct in6_addr addr6;
     EXPECT_EQ(1, inet_pton(AF_INET6, "2001:db8::f00", &addr6));
diff --git a/service/native/libs/libclat/include/libclat/clatutils.h b/service/native/libs/libclat/include/libclat/clatutils.h
index 991b193..6e17e67 100644
--- a/service/native/libs/libclat/include/libclat/clatutils.h
+++ b/service/native/libs/libclat/include/libclat/clatutils.h
@@ -20,17 +20,19 @@
 namespace net {
 namespace clat {
 
-bool isIpv4AddressFree(in_addr_t addr);
-in_addr_t selectIpv4Address(const in_addr ip, int16_t prefixlen);
-void makeChecksumNeutral(in6_addr* v6, const in_addr v4, const in6_addr& nat64Prefix);
-int generateIpv6Address(const char* iface, const in_addr v4, const in6_addr& nat64Prefix,
-                        in6_addr* v6, uint32_t mark);
-int detect_mtu(const struct in6_addr* plat_subnet, uint32_t plat_suffix, uint32_t mark);
-int configure_packet_socket(int sock, in6_addr* addr, int ifindex);
+bool isIpv4AddressFree(const in_addr_t addr);
+in_addr_t selectIpv4Address(const in_addr ip, const int16_t prefixlen);
+void makeChecksumNeutral(in6_addr* const v6, const in_addr v4, const in6_addr& nat64Prefix);
+int generateIpv6Address(const char* const iface, const in_addr v4, const in6_addr& nat64Prefix,
+                        in6_addr* const v6, const uint32_t mark);
+int detect_mtu(const struct in6_addr* const plat_subnet, const uint32_t plat_suffix,
+               const uint32_t mark);
+int configure_packet_socket(const int sock, const in6_addr* const addr, const int ifindex);
 
 // For testing
-typedef bool (*isIpv4AddrFreeFn)(in_addr_t);
-in_addr_t selectIpv4AddressInternal(const in_addr ip, int16_t prefixlen, isIpv4AddrFreeFn fn);
+typedef bool (*isIpv4AddrFreeFn)(const in_addr_t);
+in_addr_t selectIpv4AddressInternal(const in_addr ip, const int16_t prefixlen,
+                                    const isIpv4AddrFreeFn fn);
 
 }  // namespace clat
 }  // namespace net
diff --git a/service/src/com/android/metrics/stats.proto b/service/src/com/android/metrics/stats.proto
index 8104632..006d20a 100644
--- a/service/src/com/android/metrics/stats.proto
+++ b/service/src/com/android/metrics/stats.proto
@@ -347,3 +347,89 @@
     // How long(in seconds) this slice has been connected
     optional int32 slice_connection_duration_sec = 6;
 }
+
+/**
+ *  Logs DailykeepaliveInfoReported
+ *
+ * Logs from: packages/modules/Connectivity/service/src/com/android/
+ *            server/connectivity/AutomaticOnOffKeepaliveTracker.
+ */
+message DailykeepaliveInfoReported{
+    // Daily duration per number of concurrent keepalive
+    optional DurationPerNumOfKeepalive duration_per_num_of_keepalive = 1;
+
+    // Daily keepalive registered/active duration on each list of keepalive session, in
+    // milli-seconds
+    optional KeepaliveLifetimePerCarrier keepalive_lifetime_per_carrier = 2;
+
+    // Daily number of keepalive requests
+    optional int32 keepalive_requests = 3;
+
+    // Daily number of automatic keepalive requests
+    optional int32 automatic_keepalive_requests = 4;
+
+    // Daily number of distinct apps that requested keepalives
+    optional int32 distinct_user_count = 5;
+
+    // Daily distinct apps uid list that requested keepalives
+    repeated int32 uid = 6;
+}
+
+/**
+ * Daily duration per number of concurrent keepalive
+ *
+ * Logs from: packages/modules/Connectivity/service/src/com/android/
+ *            server/connectivity/AutomaticOnOffKeepaliveTracker.
+ */
+message DurationPerNumOfKeepalive {
+    repeated DurationForNumOfKeepalive duration_for_num_of_keepalive = 1;
+}
+
+message DurationForNumOfKeepalive {
+    // The number of concurrent keepalives is in the device
+    optional int32 num_of_keepalive = 1;
+
+    // How many milliseconds the device has keepalive registration number is num_of_keepalive
+    optional int32 keepalive_registered_durations_msec = 2;
+
+    // How many milliseconds the device has keepalive active(not paused) number is num_of_keepalive
+    optional int32 keepalive_active_durations_msec = 3;
+}
+
+/**
+ * Daily keepalive registered/active duration on each list of Keepalive session, in milli-seconds
+ *
+ * Logs from: packages/modules/Connectivity/service/src/com/android/
+ *            server/connectivity/AutomaticOnOffKeepaliveTracker.
+ */
+message KeepaliveLifetimePerCarrier {
+    // The number of network count on each list of carriers
+    repeated KeepaliveLifetimeForCarrier keepalive_lifetime_for_carrier = 1;
+}
+
+/**
+ * Logs the keepalive registered/active duration in milli-seconds and carrier
+ * info(carrier id, transport, keepalive interval).
+ *
+ * Logs from: packages/modules/Connectivity/service/src/com/android/
+ *            server/connectivity/AutomaticOnOffKeepaliveTracker.
+ */
+message KeepaliveLifetimeForCarrier {
+    // The carrier ID for each keepalive, or TelephonyManager.UNKNOWN_CARRIER_ID(-1) if not cell
+    optional int32 carrier_id = 1;
+
+    // The transport types of the underlying network for each keepalive. A network may include
+    // multiple transport types. Each transfer type is represented by a different bit, defined in
+    // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
+    optional int32 transport_types = 2;
+
+    // The keepalive interval for each keepalive
+    optional int32 intervals_msec = 3;
+
+    // The lifetime of the keepalive registered today
+    optional int32 lifetime_msec = 4;
+
+    // The duration for which the keepalive was active (not suspended)
+    optional int32 active_lifetime_msec = 5;
+}
+
diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java
index 5f51971..2af30dd 100755
--- a/service/src/com/android/server/ConnectivityService.java
+++ b/service/src/com/android/server/ConnectivityService.java
@@ -911,7 +911,7 @@
 
     // This is the cache for the packageName -> ApplicationSelfCertifiedNetworkCapabilities. This
     // value can be accessed from both handler thread and any random binder thread. Therefore,
-    // accessing this value requires holding a lock.
+    // accessing this value requires holding a lock. The cache is the same across all the users.
     @GuardedBy("mSelfCertifiedCapabilityCache")
     private final Map<String, ApplicationSelfCertifiedNetworkCapabilities>
             mSelfCertifiedCapabilityCache = new HashMap<>();
@@ -7001,6 +7001,7 @@
             return;
         }
         ApplicationSelfCertifiedNetworkCapabilities applicationNetworkCapabilities;
+        final long ident = Binder.clearCallingIdentity();
         try {
             synchronized (mSelfCertifiedCapabilityCache) {
                 applicationNetworkCapabilities = mSelfCertifiedCapabilityCache.get(
@@ -7027,6 +7028,8 @@
                             + " property");
         } catch (XmlPullParserException | IOException | InvalidTagException e) {
             throw new SecurityException(e.getMessage());
+        } finally {
+            Binder.restoreCallingIdentity(ident);
         }
 
         applicationNetworkCapabilities.enforceSelfCertifiedNetworkCapabilitiesDeclared(
@@ -8467,6 +8470,7 @@
         exemptUids[1] = nai.networkCapabilities.getOwnerUid();
         UidRangeParcel[] ranges = toUidRangeStableParcels(uidRanges);
 
+        // Close sockets before modifying uid ranges so that RST packets can reach to the server.
         maybeCloseSockets(nai, ranges, exemptUids);
         try {
             if (add) {
@@ -8480,6 +8484,7 @@
             loge("Exception while " + (add ? "adding" : "removing") + " uid ranges " + uidRanges +
                     " on netId " + nai.network.netId + ". " + e);
         }
+        // Close sockets that established connection while requesting netd.
         maybeCloseSockets(nai, ranges, exemptUids);
     }
 
@@ -10729,6 +10734,18 @@
                         callback));
     }
 
+    private boolean hasUnderlyingTestNetworks(NetworkCapabilities nc) {
+        final List<Network> underlyingNetworks = nc.getUnderlyingNetworks();
+        if (underlyingNetworks == null) return false;
+
+        for (Network network : underlyingNetworks) {
+            if (getNetworkCapabilitiesInternal(network).hasTransport(TRANSPORT_TEST)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     @Override
     public void simulateDataStall(int detectionMethod, long timestampMillis,
             @NonNull Network network, @NonNull PersistableBundle extras) {
@@ -10739,14 +10756,18 @@
                 android.Manifest.permission.MANAGE_TEST_NETWORKS,
                 android.Manifest.permission.NETWORK_STACK);
         final NetworkCapabilities nc = getNetworkCapabilitiesInternal(network);
-        if (!nc.hasTransport(TRANSPORT_TEST)) {
-            throw new SecurityException("Data Stall simulation is only possible for test networks");
+        if (!nc.hasTransport(TRANSPORT_TEST) && !hasUnderlyingTestNetworks(nc)) {
+            throw new SecurityException(
+                    "Data Stall simulation is only possible for test networks or networks built on"
+                            + " top of test networks");
         }
 
         final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(network);
-        if (nai == null || nai.creatorUid != mDeps.getCallingUid()) {
-            throw new SecurityException("Data Stall simulation is only possible for network "
-                + "creators");
+        if (nai == null
+                || (nai.creatorUid != mDeps.getCallingUid()
+                        && nai.creatorUid != Process.SYSTEM_UID)) {
+            throw new SecurityException(
+                    "Data Stall simulation is only possible for network " + "creators");
         }
 
         // Instead of passing the data stall directly to the ConnectivityDiagnostics handler, treat
diff --git a/service/src/com/android/server/connectivity/AutomaticOnOffKeepaliveTracker.java b/service/src/com/android/server/connectivity/AutomaticOnOffKeepaliveTracker.java
index 9f9b496..6b7222a 100644
--- a/service/src/com/android/server/connectivity/AutomaticOnOffKeepaliveTracker.java
+++ b/service/src/com/android/server/connectivity/AutomaticOnOffKeepaliveTracker.java
@@ -88,7 +88,6 @@
 public class AutomaticOnOffKeepaliveTracker {
     private static final String TAG = "AutomaticOnOffKeepaliveTracker";
     private static final int[] ADDRESS_FAMILIES = new int[] {AF_INET6, AF_INET};
-    private static final String EXTRA_BINDER_TOKEN = "token";
     private static final long DEFAULT_TCP_POLLING_INTERVAL_MS = 120_000L;
     private static final long LOW_TCP_POLLING_INTERVAL_MS = 1_000L;
     private static final String AUTOMATIC_ON_OFF_KEEPALIVE_VERSION =
diff --git a/tests/common/java/android/net/NetworkProviderTest.kt b/tests/common/java/android/net/NetworkProviderTest.kt
index c0e7f61..fcbb0dd 100644
--- a/tests/common/java/android/net/NetworkProviderTest.kt
+++ b/tests/common/java/android/net/NetworkProviderTest.kt
@@ -79,6 +79,7 @@
     @After
     fun tearDown() {
         mHandlerThread.quitSafely()
+        mHandlerThread.join()
         instrumentation.getUiAutomation().dropShellPermissionIdentity()
     }
 
diff --git a/tests/cts/hostside/TEST_MAPPING b/tests/cts/hostside/TEST_MAPPING
index ab6de82..2cfd7af 100644
--- a/tests/cts/hostside/TEST_MAPPING
+++ b/tests/cts/hostside/TEST_MAPPING
@@ -8,6 +8,9 @@
         },
         {
           "exclude-annotation": "android.platform.test.annotations.FlakyTest"
+        },
+        {
+          "exclude-annotation": "android.platform.test.annotations.RequiresDevice"
         }
       ]
     }
diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyVpnService.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyVpnService.java
index 449454e..fe522a0 100644
--- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyVpnService.java
+++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyVpnService.java
@@ -32,6 +32,7 @@
 import com.android.networkstack.apishim.VpnServiceBuilderShimImpl;
 import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
 import com.android.networkstack.apishim.common.VpnServiceBuilderShim;
+import com.android.testutils.PacketReflector;
 
 import java.io.IOException;
 import java.net.InetAddress;
diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/PacketReflector.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/PacketReflector.java
deleted file mode 100644
index 124c2c3..0000000
--- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/PacketReflector.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (C) 2014 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.cts.net.hostside;
-
-import static android.system.OsConstants.ICMP6_ECHO_REPLY;
-import static android.system.OsConstants.ICMP6_ECHO_REQUEST;
-import static android.system.OsConstants.ICMP_ECHO;
-import static android.system.OsConstants.ICMP_ECHOREPLY;
-
-import android.system.ErrnoException;
-import android.system.Os;
-import android.util.Log;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-
-public class PacketReflector extends Thread {
-
-    private static int IPV4_HEADER_LENGTH = 20;
-    private static int IPV6_HEADER_LENGTH = 40;
-
-    private static int IPV4_ADDR_OFFSET = 12;
-    private static int IPV6_ADDR_OFFSET = 8;
-    private static int IPV4_ADDR_LENGTH = 4;
-    private static int IPV6_ADDR_LENGTH = 16;
-
-    private static int IPV4_PROTO_OFFSET = 9;
-    private static int IPV6_PROTO_OFFSET = 6;
-
-    private static final byte IPPROTO_ICMP = 1;
-    private static final byte IPPROTO_TCP = 6;
-    private static final byte IPPROTO_UDP = 17;
-    private static final byte IPPROTO_ICMPV6 = 58;
-
-    private static int ICMP_HEADER_LENGTH = 8;
-    private static int TCP_HEADER_LENGTH = 20;
-    private static int UDP_HEADER_LENGTH = 8;
-
-    private static final byte ICMP_ECHO = 8;
-    private static final byte ICMP_ECHOREPLY = 0;
-
-    private static String TAG = "PacketReflector";
-
-    private FileDescriptor mFd;
-    private byte[] mBuf;
-
-    public PacketReflector(FileDescriptor fd, int mtu) {
-        super("PacketReflector");
-        mFd = fd;
-        mBuf = new byte[mtu];
-    }
-
-    private static void swapBytes(byte[] buf, int pos1, int pos2, int len) {
-        for (int i = 0; i < len; i++) {
-            byte b = buf[pos1 + i];
-            buf[pos1 + i] = buf[pos2 + i];
-            buf[pos2 + i] = b;
-        }
-    }
-
-    private static void swapAddresses(byte[] buf, int version) {
-        int addrPos, addrLen;
-        switch(version) {
-            case 4:
-                addrPos = IPV4_ADDR_OFFSET;
-                addrLen = IPV4_ADDR_LENGTH;
-                break;
-            case 6:
-                addrPos = IPV6_ADDR_OFFSET;
-                addrLen = IPV6_ADDR_LENGTH;
-                break;
-            default:
-                throw new IllegalArgumentException();
-        }
-        swapBytes(buf, addrPos, addrPos + addrLen, addrLen);
-    }
-
-    // Reflect TCP packets: swap the source and destination addresses, but don't change the ports.
-    // This is used by the test to "connect to itself" through the VPN.
-    private void processTcpPacket(byte[] buf, int version, int len, int hdrLen) {
-        if (len < hdrLen + TCP_HEADER_LENGTH) {
-            return;
-        }
-
-        // Swap src and dst IP addresses.
-        swapAddresses(buf, version);
-
-        // Send the packet back.
-        writePacket(buf, len);
-    }
-
-    // Echo UDP packets: swap source and destination addresses, and source and destination ports.
-    // This is used by the test to check that the bytes it sends are echoed back.
-    private void processUdpPacket(byte[] buf, int version, int len, int hdrLen) {
-        if (len < hdrLen + UDP_HEADER_LENGTH) {
-            return;
-        }
-
-        // Swap src and dst IP addresses.
-        swapAddresses(buf, version);
-
-        // Swap dst and src ports.
-        int portOffset = hdrLen;
-        swapBytes(buf, portOffset, portOffset + 2, 2);
-
-        // Send the packet back.
-        writePacket(buf, len);
-    }
-
-    private void processIcmpPacket(byte[] buf, int version, int len, int hdrLen) {
-        if (len < hdrLen + ICMP_HEADER_LENGTH) {
-            return;
-        }
-
-        byte type = buf[hdrLen];
-        if (!(version == 4 && type == ICMP_ECHO) &&
-            !(version == 6 && type == (byte) ICMP6_ECHO_REQUEST)) {
-            return;
-        }
-
-        // Save the ping packet we received.
-        byte[] request = buf.clone();
-
-        // Swap src and dst IP addresses, and send the packet back.
-        // This effectively pings the device to see if it replies.
-        swapAddresses(buf, version);
-        writePacket(buf, len);
-
-        // The device should have replied, and buf should now contain a ping response.
-        int received = readPacket(buf);
-        if (received != len) {
-            Log.i(TAG, "Reflecting ping did not result in ping response: " +
-                       "read=" + received + " expected=" + len);
-            return;
-        }
-
-        byte replyType = buf[hdrLen];
-        if ((type == ICMP_ECHO && replyType != ICMP_ECHOREPLY)
-                || (type == (byte) ICMP6_ECHO_REQUEST && replyType != (byte) ICMP6_ECHO_REPLY)) {
-            Log.i(TAG, "Received unexpected ICMP reply: original " + type
-                    + ", reply " + replyType);
-            return;
-        }
-
-        // Compare the response we got with the original packet.
-        // The only thing that should have changed are addresses, type and checksum.
-        // Overwrite them with the received bytes and see if the packet is otherwise identical.
-        request[hdrLen] = buf[hdrLen];          // Type
-        request[hdrLen + 2] = buf[hdrLen + 2];  // Checksum byte 1.
-        request[hdrLen + 3] = buf[hdrLen + 3];  // Checksum byte 2.
-
-        // Since Linux kernel 4.2, net.ipv6.auto_flowlabels is set by default, and therefore
-        // the request and reply may have different IPv6 flow label: ignore that as well.
-        if (version == 6) {
-            request[1] = (byte)(request[1] & 0xf0 | buf[1] & 0x0f);
-            request[2] = buf[2];
-            request[3] = buf[3];
-        }
-
-        for (int i = 0; i < len; i++) {
-            if (buf[i] != request[i]) {
-                Log.i(TAG, "Received non-matching packet when expecting ping response.");
-                return;
-            }
-        }
-
-        // Now swap the addresses again and reflect the packet. This sends a ping reply.
-        swapAddresses(buf, version);
-        writePacket(buf, len);
-    }
-
-    private void writePacket(byte[] buf, int len) {
-        try {
-            Os.write(mFd, buf, 0, len);
-        } catch (ErrnoException|IOException e) {
-            Log.e(TAG, "Error writing packet: " + e.getMessage());
-        }
-    }
-
-    private int readPacket(byte[] buf) {
-        int len;
-        try {
-            len = Os.read(mFd, buf, 0, buf.length);
-        } catch (ErrnoException|IOException e) {
-            Log.e(TAG, "Error reading packet: " + e.getMessage());
-            len = -1;
-        }
-        return len;
-    }
-
-    // Reads one packet from our mFd, and possibly writes the packet back.
-    private void processPacket() {
-        int len = readPacket(mBuf);
-        if (len < 1) {
-            return;
-        }
-
-        int version = mBuf[0] >> 4;
-        int addrPos, protoPos, hdrLen, addrLen;
-        if (version == 4) {
-            hdrLen = IPV4_HEADER_LENGTH;
-            protoPos = IPV4_PROTO_OFFSET;
-            addrPos = IPV4_ADDR_OFFSET;
-            addrLen = IPV4_ADDR_LENGTH;
-        } else if (version == 6) {
-            hdrLen = IPV6_HEADER_LENGTH;
-            protoPos = IPV6_PROTO_OFFSET;
-            addrPos = IPV6_ADDR_OFFSET;
-            addrLen = IPV6_ADDR_LENGTH;
-        } else {
-            return;
-        }
-
-        if (len < hdrLen) {
-            return;
-        }
-
-        byte proto = mBuf[protoPos];
-        switch (proto) {
-            case IPPROTO_ICMP:
-            case IPPROTO_ICMPV6:
-                processIcmpPacket(mBuf, version, len, hdrLen);
-                break;
-            case IPPROTO_TCP:
-                processTcpPacket(mBuf, version, len, hdrLen);
-                break;
-            case IPPROTO_UDP:
-                processUdpPacket(mBuf, version, len, hdrLen);
-                break;
-        }
-    }
-
-    public void run() {
-        Log.i(TAG, "PacketReflector starting fd=" + mFd + " valid=" + mFd.valid());
-        while (!interrupted() && mFd.valid()) {
-            processPacket();
-        }
-        Log.i(TAG, "PacketReflector exiting fd=" + mFd + " valid=" + mFd.valid());
-    }
-}
diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java
index a5bf000..b6902b5 100755
--- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java
+++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java
@@ -18,6 +18,8 @@
 
 import static android.Manifest.permission.MANAGE_TEST_NETWORKS;
 import static android.Manifest.permission.NETWORK_SETTINGS;
+import static android.Manifest.permission.READ_DEVICE_CONFIG;
+import static android.Manifest.permission.WRITE_DEVICE_CONFIG;
 import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
 import static android.content.pm.PackageManager.FEATURE_WIFI;
 import static android.net.ConnectivityManager.TYPE_VPN;
@@ -36,6 +38,12 @@
 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 
 import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
+import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_DATA_RECEIVED;
+import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_ERROR;
+import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_PAUSED;
+import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_RESUMED;
+import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_STARTED;
+import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_STOPPED;
 import static com.android.networkstack.apishim.ConstantsShim.BLOCKED_REASON_LOCKDOWN_VPN;
 import static com.android.networkstack.apishim.ConstantsShim.BLOCKED_REASON_NONE;
 import static com.android.networkstack.apishim.ConstantsShim.RECEIVER_EXPORTED;
@@ -64,6 +72,7 @@
 import android.database.Cursor;
 import android.net.ConnectivityManager;
 import android.net.ConnectivityManager.NetworkCallback;
+import android.net.IpSecManager;
 import android.net.LinkAddress;
 import android.net.LinkProperties;
 import android.net.Network;
@@ -71,6 +80,7 @@
 import android.net.NetworkRequest;
 import android.net.Proxy;
 import android.net.ProxyInfo;
+import android.net.SocketKeepalive;
 import android.net.TestNetworkInterface;
 import android.net.TestNetworkManager;
 import android.net.TransportInfo;
@@ -79,6 +89,7 @@
 import android.net.VpnService;
 import android.net.VpnTransportInfo;
 import android.net.cts.util.CtsNetUtils;
+import android.net.util.KeepaliveUtils;
 import android.net.wifi.WifiManager;
 import android.os.Build;
 import android.os.Handler;
@@ -87,6 +98,7 @@
 import android.os.Process;
 import android.os.SystemProperties;
 import android.os.UserHandle;
+import android.provider.DeviceConfig;
 import android.provider.Settings;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject;
@@ -105,6 +117,8 @@
 
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 import com.android.modules.utils.build.SdkLevel;
+import com.android.net.module.util.ArrayTrackRecord;
+import com.android.net.module.util.CollectionUtils;
 import com.android.net.module.util.PacketBuilder;
 import com.android.testutils.DevSdkIgnoreRule;
 import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
@@ -141,6 +155,7 @@
 import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -190,6 +205,12 @@
     public static int SOCKET_TIMEOUT_MS = 100;
     public static String TEST_HOST = "connectivitycheck.gstatic.com";
 
+    private static final String AUTOMATIC_ON_OFF_KEEPALIVE_VERSION =
+                "automatic_on_off_keepalive_version";
+    // Enabled since version 1 means it's always enabled because the version is always above 1
+    private static final String AUTOMATIC_ON_OFF_KEEPALIVE_ENABLED = "1";
+    private static final long TEST_TCP_POLLING_TIMER_EXPIRED_PERIOD_MS = 60_000L;
+
     private UiDevice mDevice;
     private MyActivity mActivity;
     private String mPackageName;
@@ -201,13 +222,15 @@
     private Context mTestContext;
     private Context mTargetContext;
     Network mNetwork;
-    NetworkCallback mCallback;
     final Object mLock = new Object();
     final Object mLockShutdown = new Object();
 
     private String mOldPrivateDnsMode;
     private String mOldPrivateDnsSpecifier;
 
+    // The registered callbacks.
+    private List<NetworkCallback> mRegisteredCallbacks = new ArrayList<>();
+
     @Rule
     public final DevSdkIgnoreRule mDevSdkIgnoreRule = new DevSdkIgnoreRule();
 
@@ -228,7 +251,6 @@
     @Before
     public void setUp() throws Exception {
         mNetwork = null;
-        mCallback = null;
         mTestContext = getInstrumentation().getContext();
         mTargetContext = getInstrumentation().getTargetContext();
         storePrivateDnsSetting();
@@ -248,15 +270,40 @@
     public void tearDown() throws Exception {
         restorePrivateDnsSetting();
         mRemoteSocketFactoryClient.unbind();
-        if (mCallback != null) {
-            mCM.unregisterNetworkCallback(mCallback);
-        }
         mCtsNetUtils.tearDown();
         Log.i(TAG, "Stopping VPN");
         stopVpn();
+        unregisterRegisteredCallbacks();
         mActivity.finish();
     }
 
+    private void registerNetworkCallback(NetworkRequest request, NetworkCallback callback) {
+        mCM.registerNetworkCallback(request, callback);
+        mRegisteredCallbacks.add(callback);
+    }
+
+    private void registerDefaultNetworkCallback(NetworkCallback callback) {
+        mCM.registerDefaultNetworkCallback(callback);
+        mRegisteredCallbacks.add(callback);
+    }
+
+    private void registerSystemDefaultNetworkCallback(NetworkCallback callback, Handler h) {
+        mCM.registerSystemDefaultNetworkCallback(callback, h);
+        mRegisteredCallbacks.add(callback);
+    }
+
+    private void registerDefaultNetworkCallbackForUid(int uid, NetworkCallback callback,
+            Handler h) {
+        mCM.registerDefaultNetworkCallbackForUid(uid, callback, h);
+        mRegisteredCallbacks.add(callback);
+    }
+
+    private void unregisterRegisteredCallbacks() {
+        for (NetworkCallback callback: mRegisteredCallbacks) {
+            mCM.unregisterNetworkCallback(callback);
+        }
+    }
+
     private void prepareVpn() throws Exception {
         final int REQUEST_ID = 42;
 
@@ -372,7 +419,7 @@
                 .removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
                 .removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                 .build();
-        mCallback = new NetworkCallback() {
+        final NetworkCallback callback = new NetworkCallback() {
             public void onAvailable(Network network) {
                 synchronized (mLock) {
                     Log.i(TAG, "Got available callback for network=" + network);
@@ -381,7 +428,7 @@
                 }
             }
         };
-        mCM.registerNetworkCallback(request, mCallback);  // Unregistered in tearDown.
+        registerNetworkCallback(request, callback);
 
         // Start the service and wait up for TIMEOUT_MS ms for the VPN to come up.
         establishVpn(addresses, routes, excludedRoutes, allowedApplications, disallowedApplications,
@@ -406,7 +453,7 @@
                 .removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
                 .removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                 .build();
-        mCallback = new NetworkCallback() {
+        final NetworkCallback callback = new NetworkCallback() {
             public void onLost(Network network) {
                 synchronized (mLockShutdown) {
                     Log.i(TAG, "Got lost callback for network=" + network
@@ -417,7 +464,7 @@
                 }
             }
        };
-        mCM.registerNetworkCallback(request, mCallback);  // Unregistered in tearDown.
+        registerNetworkCallback(request, callback);
         // Simply calling mActivity.stopService() won't stop the service, because the system binds
         // to the service for the purpose of sending it a revoke command if another VPN comes up,
         // and stopping a bound service has no effect. Instead, "start" the service again with an
@@ -778,14 +825,10 @@
             }
         };
 
-        mCM.registerNetworkCallback(request, callback);
+        registerNetworkCallback(request, callback);
 
-        try {
-            assertTrue("Private DNS hostname was not " + hostname + " after " + TIMEOUT_MS + "ms",
-                    latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
-        } finally {
-            mCM.unregisterNetworkCallback(callback);
-        }
+        assertTrue("Private DNS hostname was not " + hostname + " after " + TIMEOUT_MS + "ms",
+                latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
     }
 
     private void setAndVerifyPrivateDns(boolean strictMode) throws Exception {
@@ -872,7 +915,7 @@
                     false /* isAlwaysMetered */);
             // Acquire the NETWORK_SETTINGS permission for getting the underlying networks.
             runWithShellPermissionIdentity(() -> {
-                mCM.registerNetworkCallback(makeVpnNetworkRequest(), callback);
+                registerNetworkCallback(makeVpnNetworkRequest(), callback);
                 // Check that this VPN doesn't have any underlying networks.
                 expectUnderlyingNetworks(callback, new ArrayList<Network>());
 
@@ -905,8 +948,6 @@
                 } else {
                     mCtsNetUtils.ensureWifiDisconnected(null);
                 }
-            }, () -> {
-                mCM.unregisterNetworkCallback(callback);
             });
     }
 
@@ -940,9 +981,9 @@
                     UserHandle.of(5 /* userId */).getUid(Process.FIRST_APPLICATION_UID);
             final Handler h = new Handler(Looper.getMainLooper());
             runWithShellPermissionIdentity(() -> {
-                mCM.registerSystemDefaultNetworkCallback(systemDefaultCallback, h);
-                mCM.registerDefaultNetworkCallbackForUid(otherUid, otherUidCallback, h);
-                mCM.registerDefaultNetworkCallbackForUid(Process.myUid(), myUidCallback, h);
+                registerSystemDefaultNetworkCallback(systemDefaultCallback, h);
+                registerDefaultNetworkCallbackForUid(otherUid, otherUidCallback, h);
+                registerDefaultNetworkCallbackForUid(Process.myUid(), myUidCallback, h);
             }, NETWORK_SETTINGS);
             for (TestableNetworkCallback callback :
                     List.of(systemDefaultCallback, otherUidCallback, myUidCallback)) {
@@ -993,9 +1034,6 @@
             // fail and could cause the default network to switch (e.g., from wifi to cellular).
             systemDefaultCallback.assertNoCallback();
             otherUidCallback.assertNoCallback();
-            mCM.unregisterNetworkCallback(systemDefaultCallback);
-            mCM.unregisterNetworkCallback(otherUidCallback);
-            mCM.unregisterNetworkCallback(myUidCallback);
         }
 
         checkStrictModePrivateDns();
@@ -1024,6 +1062,183 @@
         checkStrictModePrivateDns();
     }
 
+    private int getSupportedKeepalives(NetworkCapabilities nc) throws Exception {
+        // Get number of supported concurrent keepalives for testing network.
+        final int[] keepalivesPerTransport = KeepaliveUtils.getSupportedKeepalives(
+                mTargetContext);
+        return KeepaliveUtils.getSupportedKeepalivesForNetworkCapabilities(
+                keepalivesPerTransport, nc);
+    }
+
+    // This class can't be private, otherwise the constants can't be static imported.
+    static class TestSocketKeepaliveCallback extends SocketKeepalive.Callback {
+        // This must be larger than the alarm delay in AutomaticOnOffKeepaliveTracker.
+        private static final int KEEPALIVE_TIMEOUT_MS = 10_000;
+        public enum CallbackType {
+            ON_STARTED,
+            ON_RESUMED,
+            ON_STOPPED,
+            ON_PAUSED,
+            ON_ERROR,
+            ON_DATA_RECEIVED
+        }
+        private ArrayTrackRecord<CallbackType> mHistory = new ArrayTrackRecord<>();
+        private ArrayTrackRecord<CallbackType>.ReadHead mEvents = mHistory.newReadHead();
+
+        @Override
+        public void onStarted() {
+            mHistory.add(ON_STARTED);
+        }
+
+        @Override
+        public void onResumed() {
+            mHistory.add(ON_RESUMED);
+        }
+
+        @Override
+        public void onStopped() {
+            mHistory.add(ON_STOPPED);
+        }
+
+        @Override
+        public void onPaused() {
+            mHistory.add(ON_PAUSED);
+        }
+
+        @Override
+        public void onError(final int error) {
+            mHistory.add(ON_ERROR);
+        }
+
+        @Override
+        public void onDataReceived() {
+            mHistory.add(ON_DATA_RECEIVED);
+        }
+
+        public CallbackType poll() {
+            return mEvents.poll(KEEPALIVE_TIMEOUT_MS, it -> true);
+        }
+    }
+
+    private InetAddress getV4AddrByName(final String hostname) throws Exception {
+        final InetAddress[] allAddrs = InetAddress.getAllByName(hostname);
+        for (InetAddress addr : allAddrs) {
+            if (addr instanceof Inet4Address) return addr;
+        }
+        return null;
+    }
+
+    @Test
+    public void testAutomaticOnOffKeepaliveModeNoClose() throws Exception {
+        doTestAutomaticOnOffKeepaliveMode(false);
+    }
+
+    @Test
+    public void testAutomaticOnOffKeepaliveModeClose() throws Exception {
+        doTestAutomaticOnOffKeepaliveMode(true);
+    }
+
+    private void startKeepalive(SocketKeepalive kp, TestSocketKeepaliveCallback callback) {
+        runWithShellPermissionIdentity(() -> {
+            // Only SocketKeepalive.start() requires READ_DEVICE_CONFIG because feature is protected
+            // by a feature flag. But also verify ON_STARTED callback received here to ensure
+            // keepalive is indeed started because start() runs in the executor thread and shell
+            // permission may be dropped before reading DeviceConfig.
+            kp.start(10 /* intervalSec */, SocketKeepalive.FLAG_AUTOMATIC_ON_OFF, mNetwork);
+
+            // Verify callback status.
+            assertEquals(ON_STARTED, callback.poll());
+        }, READ_DEVICE_CONFIG);
+    }
+
+    private void doTestAutomaticOnOffKeepaliveMode(final boolean closeSocket) throws Exception {
+        assumeTrue(supportedHardware());
+
+        // Get default network first before starting VPN
+        final Network defaultNetwork = mCM.getActiveNetwork();
+        final TestableNetworkCallback cb = new TestableNetworkCallback();
+        registerDefaultNetworkCallback(cb);
+        cb.expect(CallbackEntry.AVAILABLE, defaultNetwork);
+        final NetworkCapabilities cap =
+                cb.expect(CallbackEntry.NETWORK_CAPS_UPDATED, defaultNetwork).getCaps();
+        final LinkProperties lp =
+                cb.expect(CallbackEntry.LINK_PROPERTIES_CHANGED, defaultNetwork).getLp();
+        cb.expect(CallbackEntry.BLOCKED_STATUS, defaultNetwork);
+
+        // Setup VPN
+        final FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
+        final String allowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName;
+        startVpn(new String[]{"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
+                new String[]{"192.0.2.0/24", "2001:db8::/32"},
+                allowedApps, "" /* disallowedApplications */, null /* proxyInfo */,
+                null /* underlyingNetworks */, false /* isAlwaysMetered */);
+        assertSocketClosed(fd, TEST_HOST);
+
+        // Decrease the TCP polling timer for testing.
+        runWithShellPermissionIdentity(() -> mCM.setTestLowTcpPollingTimerForKeepalive(
+                System.currentTimeMillis() + TEST_TCP_POLLING_TIMER_EXPIRED_PERIOD_MS),
+                NETWORK_SETTINGS);
+
+        // Setup keepalive
+        final int supported = getSupportedKeepalives(cap);
+        assumeTrue("Network " + defaultNetwork + " does not support keepalive", supported != 0);
+        final InetAddress srcAddr = CollectionUtils.findFirst(lp.getAddresses(),
+                it -> it instanceof Inet4Address);
+        assumeTrue("This test requires native IPv4", srcAddr != null);
+
+        final TestSocketKeepaliveCallback callback = new TestSocketKeepaliveCallback();
+
+        final String origMode = runWithShellPermissionIdentity(() -> {
+            final String mode = DeviceConfig.getProperty(
+                    DeviceConfig.NAMESPACE_CONNECTIVITY, AUTOMATIC_ON_OFF_KEEPALIVE_VERSION);
+            DeviceConfig.setProperty(DeviceConfig.NAMESPACE_CONNECTIVITY,
+                    AUTOMATIC_ON_OFF_KEEPALIVE_VERSION,
+                    AUTOMATIC_ON_OFF_KEEPALIVE_ENABLED, false /* makeDefault */);
+            return mode;
+        }, READ_DEVICE_CONFIG, WRITE_DEVICE_CONFIG);
+
+        final IpSecManager ipSec = mTargetContext.getSystemService(IpSecManager.class);
+        SocketKeepalive kp = null;
+        try (IpSecManager.UdpEncapsulationSocket nattSocket = ipSec.openUdpEncapsulationSocket()) {
+            final InetAddress dstAddr = getV4AddrByName(TEST_HOST);
+            assertNotNull(dstAddr);
+
+            // Start keepalive with dynamic keepalive mode enabled.
+            final Executor executor = mTargetContext.getMainExecutor();
+            kp = mCM.createSocketKeepalive(defaultNetwork, nattSocket,
+                    srcAddr, dstAddr, executor, callback);
+            startKeepalive(kp, callback);
+
+            // There should be no open sockets on the VPN network, because any
+            // open sockets were closed when startVpn above was called. So the
+            // first TCP poll should trigger ON_PAUSED.
+            assertEquals(ON_PAUSED, callback.poll());
+
+            final Socket s = new Socket();
+            mNetwork.bindSocket(s);
+            s.connect(new InetSocketAddress(dstAddr, 80));
+            assertEquals(ON_RESUMED, callback.poll());
+
+            if (closeSocket) {
+                s.close();
+                assertEquals(ON_PAUSED, callback.poll());
+            }
+
+            kp.stop();
+            assertEquals(ON_STOPPED, callback.poll());
+        } finally {
+            if (kp != null) kp.stop();
+
+            runWithShellPermissionIdentity(() -> {
+                DeviceConfig.setProperty(
+                                DeviceConfig.NAMESPACE_CONNECTIVITY,
+                                AUTOMATIC_ON_OFF_KEEPALIVE_VERSION,
+                                origMode, false);
+                mCM.setTestLowTcpPollingTimerForKeepalive(0);
+            }, WRITE_DEVICE_CONFIG, NETWORK_SETTINGS);
+        }
+    }
+
     @Test
     public void testAppDisallowed() throws Exception {
         assumeTrue(supportedHardware());
@@ -1623,7 +1838,7 @@
 
         testAndCleanup(() -> {
             runWithShellPermissionIdentity(() -> {
-                mCM.registerDefaultNetworkCallbackForUid(remoteUid, remoteUidCallback,
+                registerDefaultNetworkCallbackForUid(remoteUid, remoteUidCallback,
                         new Handler(Looper.getMainLooper()));
             }, NETWORK_SETTINGS);
             remoteUidCallback.expectAvailableCallbacksWithBlockedReasonNone(network);
@@ -1659,8 +1874,6 @@
 
             checkBlockIncomingPacket(tunFd, remoteUdpFd, EXPECT_BLOCK);
         }, /* cleanup */ () -> {
-                mCM.unregisterNetworkCallback(remoteUidCallback);
-            }, /* cleanup */ () -> {
                 Os.close(tunFd);
             }, /* cleanup */ () -> {
                 Os.close(remoteUdpFd);
@@ -1684,7 +1897,7 @@
         final int myUid = Process.myUid();
 
         testAndCleanup(() -> {
-            mCM.registerDefaultNetworkCallback(defaultNetworkCallback);
+            registerDefaultNetworkCallback(defaultNetworkCallback);
             defaultNetworkCallback.expectAvailableCallbacks(defaultNetwork);
 
             final Range<Integer> myUidRange = new Range<>(myUid, myUid);
@@ -1716,8 +1929,6 @@
                 defaultNetworkCallback.eventuallyExpect(CallbackEntry.AVAILABLE,
                         NETWORK_CALLBACK_TIMEOUT_MS,
                         entry -> defaultNetwork.equals(entry.getNetwork()));
-            }, /* cleanup */ () -> {
-                mCM.unregisterNetworkCallback(defaultNetworkCallback);
             });
     }
 
diff --git a/tests/cts/hostside/src/com/android/cts/net/HostsideVpnTests.java b/tests/cts/hostside/src/com/android/cts/net/HostsideVpnTests.java
index 10a2821..603779d 100644
--- a/tests/cts/hostside/src/com/android/cts/net/HostsideVpnTests.java
+++ b/tests/cts/hostside/src/com/android/cts/net/HostsideVpnTests.java
@@ -16,6 +16,8 @@
 
 package com.android.cts.net;
 
+import android.platform.test.annotations.RequiresDevice;
+
 public class HostsideVpnTests extends HostsideNetworkTestCase {
 
     @Override
@@ -89,6 +91,18 @@
                 TEST_PKG, TEST_PKG + ".VpnTest", "testAlwaysMeteredVpnWithNullUnderlyingNetwork");
     }
 
+    @RequiresDevice // Keepalive is not supported on virtual hardware
+    public void testAutomaticOnOffKeepaliveModeClose() throws Exception {
+        runDeviceTests(
+                TEST_PKG, TEST_PKG + ".VpnTest", "testAutomaticOnOffKeepaliveModeClose");
+    }
+
+    @RequiresDevice // Keepalive is not supported on virtual hardware
+    public void testAutomaticOnOffKeepaliveModeNoClose() throws Exception {
+        runDeviceTests(
+                TEST_PKG, TEST_PKG + ".VpnTest", "testAutomaticOnOffKeepaliveModeNoClose");
+    }
+
     public void testAlwaysMeteredVpnWithNonNullUnderlyingNetwork() throws Exception {
         runDeviceTests(
                 TEST_PKG,
diff --git a/tests/cts/net/src/android/net/cts/CaptivePortalTest.kt b/tests/cts/net/src/android/net/cts/CaptivePortalTest.kt
index 7c24c95..dc22369 100644
--- a/tests/cts/net/src/android/net/cts/CaptivePortalTest.kt
+++ b/tests/cts/net/src/android/net/cts/CaptivePortalTest.kt
@@ -37,8 +37,6 @@
 import android.net.cts.NetworkValidationTestUtil.setHttpsUrlDeviceConfig
 import android.net.cts.NetworkValidationTestUtil.setUrlExpirationDeviceConfig
 import android.net.cts.util.CtsNetUtils
-import com.android.net.module.util.NetworkStackConstants.TEST_CAPTIVE_PORTAL_HTTPS_URL
-import com.android.net.module.util.NetworkStackConstants.TEST_CAPTIVE_PORTAL_HTTP_URL
 import android.platform.test.annotations.AppModeFull
 import android.provider.DeviceConfig
 import android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY
@@ -47,28 +45,30 @@
 import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
 import androidx.test.runner.AndroidJUnit4
 import com.android.modules.utils.build.SdkLevel.isAtLeastR
+import com.android.net.module.util.NetworkStackConstants.TEST_CAPTIVE_PORTAL_HTTPS_URL
+import com.android.net.module.util.NetworkStackConstants.TEST_CAPTIVE_PORTAL_HTTP_URL
 import com.android.testutils.DeviceConfigRule
-import com.android.testutils.RecorderCallback
+import com.android.testutils.RecorderCallback.CallbackEntry.CapabilitiesChanged
 import com.android.testutils.TestHttpServer
 import com.android.testutils.TestHttpServer.Request
 import com.android.testutils.TestableNetworkCallback
 import com.android.testutils.runAsShell
 import fi.iki.elonen.NanoHTTPD.Response.Status
-import junit.framework.AssertionFailedError
-import org.junit.After
-import org.junit.Assume.assumeTrue
-import org.junit.Assume.assumeFalse
-import org.junit.Before
-import org.junit.BeforeClass
-import org.junit.Rule
-import org.junit.runner.RunWith
 import java.util.concurrent.CompletableFuture
 import java.util.concurrent.TimeUnit
 import java.util.concurrent.TimeoutException
+import junit.framework.AssertionFailedError
 import kotlin.test.Test
 import kotlin.test.assertNotEquals
 import kotlin.test.assertNotNull
 import kotlin.test.assertTrue
+import org.junit.After
+import org.junit.Assume.assumeFalse
+import org.junit.Assume.assumeTrue
+import org.junit.Before
+import org.junit.BeforeClass
+import org.junit.Rule
+import org.junit.runner.RunWith
 
 private const val TEST_HTTPS_URL_PATH = "/https_path"
 private const val TEST_HTTP_URL_PATH = "/http_path"
@@ -151,8 +151,8 @@
                 .build()
         val cellCb = TestableNetworkCallback(timeoutMs = TEST_TIMEOUT_MS)
         cm.registerNetworkCallback(cellReq, cellCb)
-        val cb = cellCb.eventuallyExpectOrNull<RecorderCallback.CallbackEntry.CapabilitiesChanged> {
-            it.network == cellNetwork && it.caps.hasCapability(NET_CAPABILITY_VALIDATED)
+        val cb = cellCb.poll { it.network == cellNetwork &&
+                it is CapabilitiesChanged && it.caps.hasCapability(NET_CAPABILITY_VALIDATED)
         }
         assertNotNull(cb, "Mobile network $cellNetwork has no access to the internet. " +
                 "Check the mobile data connection.")
diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
index 0bb6000..774176f 100644
--- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -2708,6 +2708,7 @@
         // Cannot use @IgnoreUpTo(Build.VERSION_CODES.R) because this test also requires API 31
         // shims, and @IgnoreUpTo does not check that.
         assumeTrue(TestUtils.shouldTestSApis());
+        assumeTrue(mPackageManager.hasSystemFeature(FEATURE_WIFI));
 
         final TestNetworkTracker tnt = callWithShellPermissionIdentity(
                 () -> initTestNetwork(mContext, TEST_LINKADDR, NETWORK_CALLBACK_TIMEOUT_MS));
@@ -2721,7 +2722,8 @@
                     OemNetworkPreferences.OEM_NETWORK_PREFERENCE_TEST_ONLY);
             registerTestOemNetworkPreferenceCallbacks(defaultCallback, systemDefaultCallback);
             waitForAvailable(defaultCallback, tnt.getNetwork());
-            waitForAvailable(systemDefaultCallback, wifiNetwork);
+            systemDefaultCallback.eventuallyExpect(CallbackEntry.AVAILABLE,
+                    NETWORK_CALLBACK_TIMEOUT_MS, cb -> wifiNetwork.equals(cb.getNetwork()));
         }, /* cleanup */ () -> {
                 runWithShellPermissionIdentity(tnt::teardown);
                 defaultCallback.expect(CallbackEntry.LOST, tnt, NETWORK_CALLBACK_TIMEOUT_MS);
@@ -3406,6 +3408,9 @@
 
     private static final boolean EXPECT_PASS = false;
     private static final boolean EXPECT_BLOCK = true;
+
+    // ALLOWLIST means the firewall denies all by default, uids must be explicitly allowed
+    // DENYLIST means the firewall allows all by default, uids must be explicitly denyed
     private static final boolean ALLOWLIST = true;
     private static final boolean DENYLIST = false;
 
@@ -3471,17 +3476,49 @@
 
     @Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
     @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testFirewallBlocking() {
-        // ALLOWLIST means the firewall denies all by default, uids must be explicitly allowed
+    public void testFirewallBlockingDozable() {
         doTestFirewallBlocking(FIREWALL_CHAIN_DOZABLE, ALLOWLIST);
-        doTestFirewallBlocking(FIREWALL_CHAIN_POWERSAVE, ALLOWLIST);
-        doTestFirewallBlocking(FIREWALL_CHAIN_RESTRICTED, ALLOWLIST);
-        doTestFirewallBlocking(FIREWALL_CHAIN_LOW_POWER_STANDBY, ALLOWLIST);
+    }
 
-        // DENYLIST means the firewall allows all by default, uids must be explicitly denyed
+    @Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
+    @AppModeFull(reason = "Socket cannot bind in instant app mode")
+    public void testFirewallBlockingPowersave() {
+        doTestFirewallBlocking(FIREWALL_CHAIN_POWERSAVE, ALLOWLIST);
+    }
+
+    @Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
+    @AppModeFull(reason = "Socket cannot bind in instant app mode")
+    public void testFirewallBlockingRestricted() {
+        doTestFirewallBlocking(FIREWALL_CHAIN_RESTRICTED, ALLOWLIST);
+    }
+
+    @Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
+    @AppModeFull(reason = "Socket cannot bind in instant app mode")
+    public void testFirewallBlockingLowPowerStandby() {
+        doTestFirewallBlocking(FIREWALL_CHAIN_LOW_POWER_STANDBY, ALLOWLIST);
+    }
+
+    @Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
+    @AppModeFull(reason = "Socket cannot bind in instant app mode")
+    public void testFirewallBlockingStandby() {
         doTestFirewallBlocking(FIREWALL_CHAIN_STANDBY, DENYLIST);
+    }
+
+    @Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
+    @AppModeFull(reason = "Socket cannot bind in instant app mode")
+    public void testFirewallBlockingOemDeny1() {
         doTestFirewallBlocking(FIREWALL_CHAIN_OEM_DENY_1, DENYLIST);
+    }
+
+    @Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
+    @AppModeFull(reason = "Socket cannot bind in instant app mode")
+    public void testFirewallBlockingOemDeny2() {
         doTestFirewallBlocking(FIREWALL_CHAIN_OEM_DENY_2, DENYLIST);
+    }
+
+    @Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
+    @AppModeFull(reason = "Socket cannot bind in instant app mode")
+    public void testFirewallBlockingOemDeny3() {
         doTestFirewallBlocking(FIREWALL_CHAIN_OEM_DENY_3, DENYLIST);
     }
 
diff --git a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
index b924f65..67bdd17 100644
--- a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
+++ b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
@@ -644,10 +644,9 @@
 
         val listener = EthernetStateListener()
         addInterfaceStateListener(listener)
-        // TODO(b/236895792): THIS IS A BUG! Existing server mode interfaces are not reported when
-        // an InterfaceStateListener is registered.
         // Note: using eventuallyExpect as there may be other interfaces present.
-        // listener.eventuallyExpect(iface, STATE_LINK_UP, ROLE_SERVER)
+        listener.eventuallyExpect(InterfaceStateChanged(iface.name,
+                STATE_LINK_UP, ROLE_SERVER, /* IpConfiguration */ null))
 
         releaseTetheredInterface()
         listener.eventuallyExpect(iface, STATE_LINK_UP, ROLE_CLIENT)
diff --git a/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt b/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt
index f578ff3..b535a8f 100644
--- a/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt
+++ b/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt
@@ -191,6 +191,7 @@
         callbacksToCleanUp.forEach { mCM.unregisterNetworkCallback(it) }
         qosTestSocket?.close()
         mHandlerThread.quitSafely()
+        mHandlerThread.join()
         instrumentation.getUiAutomation().dropShellPermissionIdentity()
     }
 
diff --git a/tests/cts/net/src/android/net/cts/NetworkScoreTest.kt b/tests/cts/net/src/android/net/cts/NetworkScoreTest.kt
index eb41d71..fcfecad 100644
--- a/tests/cts/net/src/android/net/cts/NetworkScoreTest.kt
+++ b/tests/cts/net/src/android/net/cts/NetworkScoreTest.kt
@@ -90,6 +90,7 @@
         mCm.unregisterNetworkCallback(agentCleanUpCb)
 
         mHandlerThread.quitSafely()
+        mHandlerThread.join()
         callbacksToCleanUp.forEach { mCm.unregisterNetworkCallback(it) }
     }
 
diff --git a/tests/cts/net/src/android/net/cts/NetworkValidationTest.kt b/tests/cts/net/src/android/net/cts/NetworkValidationTest.kt
index 8e98dba..621af23 100644
--- a/tests/cts/net/src/android/net/cts/NetworkValidationTest.kt
+++ b/tests/cts/net/src/android/net/cts/NetworkValidationTest.kt
@@ -146,6 +146,7 @@
         httpServer.stop()
         handlerThread.threadHandler.post { reader.stop() }
         handlerThread.quitSafely()
+        handlerThread.join()
 
         iface.fileDescriptor.close()
     }
diff --git a/tests/cts/net/src/android/net/cts/NsdManagerTest.kt b/tests/cts/net/src/android/net/cts/NsdManagerTest.kt
index 9b589d8..db4f937 100644
--- a/tests/cts/net/src/android/net/cts/NsdManagerTest.kt
+++ b/tests/cts/net/src/android/net/cts/NsdManagerTest.kt
@@ -68,6 +68,7 @@
 import android.system.ErrnoException
 import android.system.Os
 import android.system.OsConstants.AF_INET6
+import android.system.OsConstants.EADDRNOTAVAIL
 import android.system.OsConstants.ENETUNREACH
 import android.system.OsConstants.IPPROTO_UDP
 import android.system.OsConstants.SOCK_DGRAM
@@ -404,7 +405,7 @@
                 Os.connect(sock, parseNumericAddress("ff02::fb%$ifaceName"), 12345)
                 true
             }.catch<ErrnoException> {
-                if (it.errno != ENETUNREACH) {
+                if (it.errno != ENETUNREACH && it.errno != EADDRNOTAVAIL) {
                     throw it
                 }
                 false
@@ -431,6 +432,7 @@
         }
         handlerThread.waitForIdle(TIMEOUT_MS)
         handlerThread.quitSafely()
+        handlerThread.join()
     }
 
     @Test
@@ -934,9 +936,7 @@
         // This test requires shims supporting U+ APIs (NsdManager.registerServiceInfoCallback)
         assumeTrue(TestUtils.shouldTestUApis())
 
-        // Ensure Wi-Fi network connected and get addresses
-        val wifiNetwork = ctsNetUtils.ensureWifiConnected()
-        val lp = cm.getLinkProperties(wifiNetwork)
+        val lp = cm.getLinkProperties(testNetwork1.network)
         assertNotNull(lp)
         val addresses = lp.addresses
         assertFalse(addresses.isEmpty())
@@ -944,24 +944,24 @@
         val si = NsdServiceInfo().apply {
             serviceType = this@NsdManagerTest.serviceType
             serviceName = this@NsdManagerTest.serviceName
-            network = wifiNetwork
+            network = testNetwork1.network
             port = 12345 // Test won't try to connect so port does not matter
         }
 
-        // Register service on Wi-Fi network
+        // Register service on the network
         val registrationRecord = NsdRegistrationRecord()
         registerService(registrationRecord, si)
 
         val discoveryRecord = NsdDiscoveryRecord()
         val cbRecord = NsdServiceInfoCallbackRecord()
         tryTest {
-            // Discover service on Wi-Fi network.
+            // Discover service on the network.
             nsdShim.discoverServices(nsdManager, serviceType, NsdManager.PROTOCOL_DNS_SD,
-                    wifiNetwork, Executor { it.run() }, discoveryRecord)
+                    testNetwork1.network, Executor { it.run() }, discoveryRecord)
             val foundInfo = discoveryRecord.waitForServiceDiscovered(
-                    serviceName, wifiNetwork)
+                    serviceName, testNetwork1.network)
 
-            // Register service callback and check the addresses are the same as Wi-Fi addresses
+            // Register service callback and check the addresses are the same as network addresses
             nsdShim.registerServiceInfoCallback(nsdManager, foundInfo, { it.run() }, cbRecord)
             val serviceInfoCb = cbRecord.expectCallback<ServiceUpdated>()
             assertEquals(foundInfo.serviceName, serviceInfoCb.serviceInfo.serviceName)
diff --git a/tests/unit/java/android/net/NetworkTemplateTest.kt b/tests/unit/java/android/net/NetworkTemplateTest.kt
index edbcea9..fc25fd8 100644
--- a/tests/unit/java/android/net/NetworkTemplateTest.kt
+++ b/tests/unit/java/android/net/NetworkTemplateTest.kt
@@ -130,10 +130,17 @@
                 mockContext, buildWifiNetworkState(null, TEST_WIFI_KEY1), true, 0)
         val identWifiImsi1Key1 = buildNetworkIdentity(
                 mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_WIFI_KEY1), true, 0)
+        // This identity with a null wifiNetworkKey is to test matchesWifiNetworkKey won't crash
+        // the system when a null wifiNetworkKey is provided, which happens because of a bug in wifi
+        // and it should still match the wifi wildcard template. See b/266598304.
+        val identWifiNullKey = buildNetworkIdentity(
+                mockContext, buildWifiNetworkState(null /* subscriberId */,
+                null /* wifiNetworkKey */), true, 0)
 
         templateWifiWildcard.assertDoesNotMatch(identMobileImsi1)
         templateWifiWildcard.assertMatches(identWifiImsiNullKey1)
         templateWifiWildcard.assertMatches(identWifiImsi1Key1)
+        templateWifiWildcard.assertMatches(identWifiNullKey)
     }
 
     @Test
@@ -148,6 +155,9 @@
                 .setWifiNetworkKeys(setOf(TEST_WIFI_KEY1)).build()
         val templateWifiKeyAllImsi1 = NetworkTemplate.Builder(MATCH_WIFI)
                 .setSubscriberIds(setOf(TEST_IMSI1)).build()
+        val templateNullWifiKey = NetworkTemplate(MATCH_WIFI,
+                emptyArray<String>() /* subscriberIds */, arrayOf(null) /* wifiNetworkKeys */,
+                METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
 
         val identMobile1 = buildNetworkIdentity(mockContext, buildMobileNetworkState(TEST_IMSI1),
                 false, TelephonyManager.NETWORK_TYPE_UMTS)
@@ -159,6 +169,12 @@
                 mockContext, buildWifiNetworkState(TEST_IMSI2, TEST_WIFI_KEY1), true, 0)
         val identWifiImsi1Key2 = buildNetworkIdentity(
                 mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_WIFI_KEY2), true, 0)
+        // This identity with a null wifiNetworkKey is to test the matchesWifiNetworkKey won't crash
+        // the system when a null wifiNetworkKey is provided, which would happen in some unknown
+        // cases, see b/266598304.
+        val identWifiNullKey = buildNetworkIdentity(
+                mockContext, buildWifiNetworkState(null /* subscriberId */,
+                null /* wifiNetworkKey */), true, 0)
 
         // Verify that template with WiFi Network Key only matches any subscriberId and
         // specific WiFi Network Key.
@@ -191,6 +207,12 @@
         templateWifiKeyAllImsi1.assertMatches(identWifiImsi1Key1)
         templateWifiKeyAllImsi1.assertDoesNotMatch(identWifiImsi2Key1)
         templateWifiKeyAllImsi1.assertMatches(identWifiImsi1Key2)
+
+        // Test a network identity with null wifiNetworkKey won't crash.
+        // It should not match a template with wifiNetworkKeys is non-null.
+        // Also, it should not match a template with wifiNetworkKeys that contains null.
+        templateWifiKey1.assertDoesNotMatch(identWifiNullKey)
+        templateNullWifiKey.assertDoesNotMatch(identWifiNullKey)
     }
 
     @Test
diff --git a/tests/unit/java/android/net/nsd/NsdManagerTest.java b/tests/unit/java/android/net/nsd/NsdManagerTest.java
index da65b62..0965193 100644
--- a/tests/unit/java/android/net/nsd/NsdManagerTest.java
+++ b/tests/unit/java/android/net/nsd/NsdManagerTest.java
@@ -21,6 +21,7 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -73,11 +74,11 @@
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
 
-        doReturn(mServiceConn).when(mService).connect(any());
+        doReturn(mServiceConn).when(mService).connect(any(), anyBoolean());
         mManager = new NsdManager(mContext, mService);
         final ArgumentCaptor<INsdManagerCallback> cbCaptor = ArgumentCaptor.forClass(
                 INsdManagerCallback.class);
-        verify(mService).connect(cbCaptor.capture());
+        verify(mService).connect(cbCaptor.capture(), anyBoolean());
         mCallback = cbCaptor.getValue();
     }
 
diff --git a/tests/unit/java/com/android/server/ConnectivityServiceTest.java b/tests/unit/java/com/android/server/ConnectivityServiceTest.java
index c1c6a8a..6c89c38 100755
--- a/tests/unit/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/unit/java/com/android/server/ConnectivityServiceTest.java
@@ -2219,7 +2219,9 @@
         ConnectivityResources.setResourcesContextForTest(null);
 
         mCsHandlerThread.quitSafely();
+        mCsHandlerThread.join();
         mAlarmManagerThread.quitSafely();
+        mAlarmManagerThread.join();
     }
 
     private void mockDefaultPackages() throws Exception {
@@ -10126,6 +10128,7 @@
         b2.expectBroadcast();
 
         VMSHandlerThread.quitSafely();
+        VMSHandlerThread.join();
     }
 
     @Test @IgnoreUpTo(Build.VERSION_CODES.S_V2)
@@ -16974,6 +16977,7 @@
         } finally {
             cellFactory.terminate();
             handlerThread.quitSafely();
+            handlerThread.join();
         }
     }
 
diff --git a/tests/unit/java/com/android/server/NsdServiceTest.java b/tests/unit/java/com/android/server/NsdServiceTest.java
index 0b48e08..2ed989e 100644
--- a/tests/unit/java/com/android/server/NsdServiceTest.java
+++ b/tests/unit/java/com/android/server/NsdServiceTest.java
@@ -17,6 +17,8 @@
 package com.android.server;
 
 import static android.net.InetAddresses.parseNumericAddress;
+import static android.net.connectivity.ConnectivityCompatChanges.ENABLE_PLATFORM_MDNS_BACKEND;
+import static android.net.connectivity.ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER;
 import static android.net.nsd.NsdManager.FAILURE_BAD_PARAMETERS;
 import static android.net.nsd.NsdManager.FAILURE_INTERNAL_ERROR;
 import static android.net.nsd.NsdManager.FAILURE_OPERATION_NOT_RUNNING;
@@ -54,7 +56,6 @@
 import android.content.Context;
 import android.net.INetd;
 import android.net.Network;
-import android.net.connectivity.ConnectivityCompatChanges;
 import android.net.mdns.aidl.DiscoveryInfo;
 import android.net.mdns.aidl.GetAddressInfo;
 import android.net.mdns.aidl.IMDnsEventListener;
@@ -190,7 +191,9 @@
     }
 
     @Test
-    @DisableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+    @DisableCompatChanges({
+            RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER,
+            ENABLE_PLATFORM_MDNS_BACKEND})
     public void testPreSClients() throws Exception {
         // Pre S client connected, the daemon should be started.
         connectClient(mService);
@@ -217,7 +220,8 @@
     }
 
     @Test
-    @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+    @EnableCompatChanges(RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testNoDaemonStartedWhenClientsConnect() throws Exception {
         // Creating an NsdManager will not cause daemon startup.
         connectClient(mService);
@@ -251,7 +255,8 @@
     }
 
     @Test
-    @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+    @EnableCompatChanges(RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testClientRequestsAreGCedAtDisconnection() throws Exception {
         final NsdManager client = connectClient(mService);
         final INsdManagerCallback cb1 = getCallback();
@@ -294,7 +299,8 @@
     }
 
     @Test
-    @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+    @EnableCompatChanges(RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testCleanupDelayNoRequestActive() throws Exception {
         final NsdManager client = connectClient(mService);
 
@@ -330,6 +336,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testDiscoverOnTetheringDownstream() throws Exception {
         final NsdManager client = connectClient(mService);
         final int interfaceIdx = 123;
@@ -420,6 +427,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testDiscoverOnBlackholeNetwork() throws Exception {
         final NsdManager client = connectClient(mService);
         final DiscoveryListener discListener = mock(DiscoveryListener.class);
@@ -449,6 +457,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testServiceRegistrationSuccessfulAndFailed() throws Exception {
         final NsdManager client = connectClient(mService);
         final NsdServiceInfo request = new NsdServiceInfo(SERVICE_NAME, SERVICE_TYPE);
@@ -495,6 +504,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testServiceDiscoveryFailed() throws Exception {
         final NsdManager client = connectClient(mService);
         final DiscoveryListener discListener = mock(DiscoveryListener.class);
@@ -521,6 +531,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testServiceResolutionFailed() throws Exception {
         final NsdManager client = connectClient(mService);
         final NsdServiceInfo request = new NsdServiceInfo(SERVICE_NAME, SERVICE_TYPE);
@@ -551,6 +562,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testGettingAddressFailed() throws Exception {
         final NsdManager client = connectClient(mService);
         final NsdServiceInfo request = new NsdServiceInfo(SERVICE_NAME, SERVICE_TYPE);
@@ -597,6 +609,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testNoCrashWhenProcessResolutionAfterBinderDied() throws Exception {
         final NsdManager client = connectClient(mService);
         final INsdManagerCallback cb = getCallback();
@@ -616,6 +629,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testStopServiceResolution() {
         final NsdManager client = connectClient(mService);
         final NsdServiceInfo request = new NsdServiceInfo(SERVICE_NAME, SERVICE_TYPE);
@@ -638,6 +652,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testStopResolutionFailed() {
         final NsdManager client = connectClient(mService);
         final NsdServiceInfo request = new NsdServiceInfo(SERVICE_NAME, SERVICE_TYPE);
@@ -662,6 +677,7 @@
     }
 
     @Test @DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.TIRAMISU)
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testStopResolutionDuringGettingAddress() throws RemoteException {
         final NsdManager client = connectClient(mService);
         final NsdServiceInfo request = new NsdServiceInfo(SERVICE_NAME, SERVICE_TYPE);
@@ -823,6 +839,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testMdnsDiscoveryManagerFeature() {
         // Create NsdService w/o feature enabled.
         final NsdManager client = connectClient(mService);
@@ -1012,6 +1029,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testMdnsAdvertiserFeatureFlagging() {
         // Create NsdService w/o feature enabled.
         final NsdManager client = connectClient(mService);
@@ -1047,6 +1065,7 @@
     }
 
     @Test
+    @DisableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
     public void testTypeSpecificFeatureFlagging() {
         doReturn("_type1._tcp:flag1,_type2._tcp:flag2").when(mDeps).getTypeAllowlistFlags();
         doReturn(true).when(mDeps).isFeatureEnabled(any(),
@@ -1234,6 +1253,37 @@
         assertEquals("_TEST._sub._999._tcp", constructServiceType(serviceType4));
     }
 
+    @Test
+    @EnableCompatChanges(ENABLE_PLATFORM_MDNS_BACKEND)
+    public void testEnablePlatformMdnsBackend() {
+        final NsdManager client = connectClient(mService);
+        final NsdServiceInfo regInfo = new NsdServiceInfo("a".repeat(70), SERVICE_TYPE);
+        final Network network = new Network(999);
+        regInfo.setHostAddresses(List.of(parseNumericAddress("192.0.2.123")));
+        regInfo.setPort(12345);
+        regInfo.setAttribute("testattr", "testvalue");
+        regInfo.setNetwork(network);
+
+        // Verify the registration uses MdnsAdvertiser
+        final RegistrationListener regListener = mock(RegistrationListener.class);
+        client.registerService(regInfo, NsdManager.PROTOCOL_DNS_SD, Runnable::run, regListener);
+        waitForIdle();
+        verify(mSocketProvider).startMonitoringSockets();
+        verify(mAdvertiser).addService(anyInt(), any());
+
+        // Verify the discovery uses MdnsDiscoveryManager
+        final DiscoveryListener discListener = mock(DiscoveryListener.class);
+        client.discoverServices(SERVICE_TYPE, PROTOCOL, network, r -> r.run(), discListener);
+        waitForIdle();
+        verify(mDiscoveryManager).registerListener(anyString(), any(), any());
+
+        // Verify the discovery uses MdnsDiscoveryManager
+        final ResolveListener resolveListener = mock(ResolveListener.class);
+        client.resolveService(regInfo, r -> r.run(), resolveListener);
+        waitForIdle();
+        verify(mDiscoveryManager, times(2)).registerListener(anyString(), any(), any());
+    }
+
     private void waitForIdle() {
         HandlerUtils.waitForIdle(mHandler, TIMEOUT_MS);
     }
@@ -1241,7 +1291,8 @@
     NsdService makeService() {
         final NsdService service = new NsdService(mContext, mHandler, CLEANUP_DELAY_MS, mDeps) {
             @Override
-            public INsdServiceConnector connect(INsdManagerCallback baseCb) {
+            public INsdServiceConnector connect(INsdManagerCallback baseCb,
+                    boolean runNewMdnsBackend) {
                 // Wrap the callback in a transparent mock, to mock asBinder returning a
                 // LinkToDeathRecorder. This will allow recording the binder death recipient
                 // registered on the callback. Use a transparent mock and not a spy as the actual
@@ -1250,7 +1301,7 @@
                         AdditionalAnswers.delegatesTo(baseCb));
                 doReturn(new LinkToDeathRecorder()).when(cb).asBinder();
                 mCreatedCallbacks.add(cb);
-                return super.connect(cb);
+                return super.connect(cb, runNewMdnsBackend);
             }
         };
         return service;
diff --git a/tests/unit/java/com/android/server/connectivity/VpnTest.java b/tests/unit/java/com/android/server/connectivity/VpnTest.java
index 2d87728..79987e6 100644
--- a/tests/unit/java/com/android/server/connectivity/VpnTest.java
+++ b/tests/unit/java/com/android/server/connectivity/VpnTest.java
@@ -25,6 +25,8 @@
 import static android.net.ConnectivityManager.NetworkCallback;
 import static android.net.INetd.IF_STATE_DOWN;
 import static android.net.INetd.IF_STATE_UP;
+import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
+import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
 import static android.net.RouteInfo.RTN_UNREACHABLE;
 import static android.net.VpnManager.TYPE_VPN_PLATFORM;
 import static android.net.cts.util.IkeSessionTestUtils.CHILD_PARAMS;
@@ -33,13 +35,24 @@
 import static android.net.cts.util.IkeSessionTestUtils.getTestIkeSessionParams;
 import static android.net.ipsec.ike.IkeSessionConfiguration.EXTENSION_TYPE_MOBIKE;
 import static android.net.ipsec.ike.IkeSessionParams.ESP_ENCAP_TYPE_AUTO;
+import static android.net.ipsec.ike.IkeSessionParams.ESP_ENCAP_TYPE_NONE;
+import static android.net.ipsec.ike.IkeSessionParams.ESP_ENCAP_TYPE_UDP;
 import static android.net.ipsec.ike.IkeSessionParams.ESP_IP_VERSION_AUTO;
+import static android.net.ipsec.ike.IkeSessionParams.ESP_IP_VERSION_IPV4;
+import static android.net.ipsec.ike.IkeSessionParams.ESP_IP_VERSION_IPV6;
 import static android.os.Build.VERSION_CODES.S_V2;
 import static android.os.UserHandle.PER_USER_RANGE;
+import static android.telephony.CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL;
+import static android.telephony.CarrierConfigManager.KEY_MIN_UDP_PORT_4500_NAT_TIMEOUT_SEC_INT;
+import static android.telephony.CarrierConfigManager.KEY_PREFERRED_IKE_PROTOCOL_INT;
 
 import static com.android.net.module.util.NetworkStackConstants.IPV6_MIN_MTU;
 import static com.android.server.connectivity.Vpn.AUTOMATIC_KEEPALIVE_DELAY_SECONDS;
 import static com.android.server.connectivity.Vpn.DEFAULT_UDP_PORT_4500_NAT_TIMEOUT_SEC_INT;
+import static com.android.server.connectivity.Vpn.PREFERRED_IKE_PROTOCOL_AUTO;
+import static com.android.server.connectivity.Vpn.PREFERRED_IKE_PROTOCOL_IPV4_UDP;
+import static com.android.server.connectivity.Vpn.PREFERRED_IKE_PROTOCOL_IPV6_ESP;
+import static com.android.server.connectivity.Vpn.PREFERRED_IKE_PROTOCOL_IPV6_UDP;
 import static com.android.testutils.Cleanup.testAndCleanup;
 import static com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
 import static com.android.testutils.MiscAsserts.assertThrows;
@@ -107,6 +120,7 @@
 import android.net.NetworkCapabilities;
 import android.net.NetworkInfo.DetailedState;
 import android.net.RouteInfo;
+import android.net.TelephonyNetworkSpecifier;
 import android.net.UidRangeParcel;
 import android.net.VpnManager;
 import android.net.VpnProfileState;
@@ -126,6 +140,7 @@
 import android.net.ipsec.ike.exceptions.IkeNonProtocolException;
 import android.net.ipsec.ike.exceptions.IkeProtocolException;
 import android.net.ipsec.ike.exceptions.IkeTimeoutException;
+import android.net.wifi.WifiInfo;
 import android.os.Build.VERSION_CODES;
 import android.os.Bundle;
 import android.os.ConditionVariable;
@@ -139,6 +154,10 @@
 import android.os.test.TestLooper;
 import android.provider.Settings;
 import android.security.Credentials;
+import android.telephony.CarrierConfigManager;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
 import android.util.ArrayMap;
 import android.util.ArraySet;
 import android.util.Pair;
@@ -265,6 +284,10 @@
     private static final Range<Integer> PRIMARY_USER_RANGE = uidRangeForUser(PRIMARY_USER.id);
     // Same as IkeSessionParams#IKE_NATT_KEEPALIVE_DELAY_SEC_DEFAULT
     private static final int IKE_NATT_KEEPALIVE_DELAY_SEC_DEFAULT = 10;
+    private static final int TEST_KEEPALIVE_TIMER = 800;
+    private static final int TEST_SUB_ID = 1234;
+    private static final String TEST_MCCMNC = "12345";
+
     @Mock(answer = Answers.RETURNS_DEEP_STUBS) private Context mContext;
     @Mock private UserManager mUserManager;
     @Mock private PackageManager mPackageManager;
@@ -278,6 +301,10 @@
     @Mock private Vpn.VpnNetworkAgentWrapper mMockNetworkAgent;
     @Mock private ConnectivityManager mConnectivityManager;
     @Mock private ConnectivityDiagnosticsManager mCdm;
+    @Mock private TelephonyManager mTelephonyManager;
+    @Mock private TelephonyManager mTmPerSub;
+    @Mock private CarrierConfigManager mConfigManager;
+    @Mock private SubscriptionManager mSubscriptionManager;
     @Mock private IpSecService mIpSecService;
     @Mock private VpnProfileStore mVpnProfileStore;
     @Mock private ScheduledThreadPoolExecutor mExecutor;
@@ -286,7 +313,6 @@
     private final VpnProfile mVpnProfile;
 
     private IpSecManager mIpSecManager;
-
     private TestDeps mTestDeps;
 
     public VpnTest() throws Exception {
@@ -322,6 +348,11 @@
         mockService(IpSecManager.class, Context.IPSEC_SERVICE, mIpSecManager);
         mockService(ConnectivityDiagnosticsManager.class, Context.CONNECTIVITY_DIAGNOSTICS_SERVICE,
                 mCdm);
+        mockService(TelephonyManager.class, Context.TELEPHONY_SERVICE, mTelephonyManager);
+        mockService(CarrierConfigManager.class, Context.CARRIER_CONFIG_SERVICE, mConfigManager);
+        mockService(SubscriptionManager.class, Context.TELEPHONY_SUBSCRIPTION_SERVICE,
+                mSubscriptionManager);
+        doReturn(mTmPerSub).when(mTelephonyManager).createForSubscriptionId(anyInt());
         when(mContext.getString(R.string.config_customVpnAlwaysOnDisconnectedDialogComponent))
                 .thenReturn(Resources.getSystem().getString(
                         R.string.config_customVpnAlwaysOnDisconnectedDialogComponent));
@@ -1924,43 +1955,54 @@
     }
 
     @Test
-    public void testMigrateIkeSessionFromIkeTunnConnParams_AutoTimerNoTimer()
-            throws Exception {
+    public void testMigrateIkeSession_FromIkeTunnConnParams_AutoTimerNoTimer() throws Exception {
         doTestMigrateIkeSession_FromIkeTunnConnParams(
                 false /* isAutomaticIpVersionSelectionEnabled */,
                 true /* isAutomaticNattKeepaliveTimerEnabled */,
-                TEST_KEEPALIVE_TIMEOUT_UNSET);
+                TEST_KEEPALIVE_TIMEOUT_UNSET /* keepaliveInProfile */,
+                ESP_IP_VERSION_AUTO /* ipVersionInProfile */,
+                ESP_ENCAP_TYPE_AUTO /* encapTypeInProfile */);
     }
 
     @Test
-    public void testMigrateIkeSessionFromIkeTunnConnParams_AutoTimerTimerSet()
-            throws Exception {
+    public void testMigrateIkeSession_FromIkeTunnConnParams_AutoTimerTimerSet() throws Exception {
         doTestMigrateIkeSession_FromIkeTunnConnParams(
                 false /* isAutomaticIpVersionSelectionEnabled */,
                 true /* isAutomaticNattKeepaliveTimerEnabled */,
-                800 /* keepaliveTimeout */);
+                TEST_KEEPALIVE_TIMER /* keepaliveInProfile */,
+                ESP_IP_VERSION_AUTO /* ipVersionInProfile */,
+                ESP_ENCAP_TYPE_AUTO /* encapTypeInProfile */);
     }
 
     @Test
-    public void testMigrateIkeSessionFromIkeTunnConnParams_AutoIp()
-            throws Exception {
+    public void testMigrateIkeSession_FromIkeTunnConnParams_AutoIp() throws Exception {
         doTestMigrateIkeSession_FromIkeTunnConnParams(
                 true /* isAutomaticIpVersionSelectionEnabled */,
                 false /* isAutomaticNattKeepaliveTimerEnabled */,
-                TEST_KEEPALIVE_TIMEOUT_UNSET /* keepaliveTimeout */);
+                TEST_KEEPALIVE_TIMEOUT_UNSET /* keepaliveInProfile */,
+                ESP_IP_VERSION_AUTO /* ipVersionInProfile */,
+                ESP_ENCAP_TYPE_AUTO /* encapTypeInProfile */);
     }
 
     @Test
-    public void testMigrateIkeSession_FromNotIkeTunnConnParams_AutoTimer()
-            throws Exception {
+    public void testMigrateIkeSession_FromIkeTunnConnParams_AssignedIpProtocol() throws Exception {
+        doTestMigrateIkeSession_FromIkeTunnConnParams(
+                false /* isAutomaticIpVersionSelectionEnabled */,
+                false /* isAutomaticNattKeepaliveTimerEnabled */,
+                TEST_KEEPALIVE_TIMEOUT_UNSET /* keepaliveInProfile */,
+                ESP_IP_VERSION_IPV4 /* ipVersionInProfile */,
+                ESP_ENCAP_TYPE_UDP /* encapTypeInProfile */);
+    }
+
+    @Test
+    public void testMigrateIkeSession_FromNotIkeTunnConnParams_AutoTimer() throws Exception {
         doTestMigrateIkeSession_FromNotIkeTunnConnParams(
                 false /* isAutomaticIpVersionSelectionEnabled */,
                 true /* isAutomaticNattKeepaliveTimerEnabled */);
     }
 
     @Test
-    public void testMigrateIkeSession_FromNotIkeTunnConnParams_AutoIp()
-            throws Exception {
+    public void testMigrateIkeSession_FromNotIkeTunnConnParams_AutoIp() throws Exception {
         doTestMigrateIkeSession_FromNotIkeTunnConnParams(
                 true /* isAutomaticIpVersionSelectionEnabled */,
                 false /* isAutomaticNattKeepaliveTimerEnabled */);
@@ -1980,16 +2022,27 @@
         final int expectedKeepalive = isAutomaticNattKeepaliveTimerEnabled
                 ? AUTOMATIC_KEEPALIVE_DELAY_SECONDS
                 : DEFAULT_UDP_PORT_4500_NAT_TIMEOUT_SEC_INT;
-        doTestMigrateIkeSession(ikeProfile.toVpnProfile(), expectedKeepalive,
-                isAutomaticIpVersionSelectionEnabled);
+        doTestMigrateIkeSession(ikeProfile.toVpnProfile(),
+                expectedKeepalive,
+                ESP_IP_VERSION_AUTO /* expectedIpVersion */,
+                ESP_ENCAP_TYPE_AUTO /* expectedEncapType */);
     }
 
     private void doTestMigrateIkeSession_FromIkeTunnConnParams(
             boolean isAutomaticIpVersionSelectionEnabled,
             boolean isAutomaticNattKeepaliveTimerEnabled,
-            int keepaliveInProfile) throws Exception {
-        final IkeSessionParams ikeSessionParams = getTestIkeSessionParams(true /* testIpv6 */,
+            int keepaliveInProfile,
+            int ipVersionInProfile,
+            int encapTypeInProfile) throws Exception {
+        // TODO: Update helper function in IkeSessionTestUtils to support building IkeSessionParams
+        // with IP version and encap type when mainline-prod branch support these two APIs.
+        final IkeSessionParams params = getTestIkeSessionParams(true /* testIpv6 */,
                 new IkeFqdnIdentification(TEST_IDENTITY), keepaliveInProfile);
+        final IkeSessionParams ikeSessionParams = new IkeSessionParams.Builder(params)
+                .setIpVersion(ipVersionInProfile)
+                .setEncapType(encapTypeInProfile)
+                .build();
+
         final IkeTunnelConnectionParams tunnelParams =
                 new IkeTunnelConnectionParams(ikeSessionParams, CHILD_PARAMS);
         final Ikev2VpnProfile ikeProfile = new Ikev2VpnProfile.Builder(tunnelParams)
@@ -2001,24 +2054,28 @@
         final int expectedKeepalive = isAutomaticNattKeepaliveTimerEnabled
                 ? AUTOMATIC_KEEPALIVE_DELAY_SECONDS
                 : ikeSessionParams.getNattKeepAliveDelaySeconds();
+        final int expectedIpVersion = isAutomaticIpVersionSelectionEnabled
+                ? ESP_IP_VERSION_AUTO
+                : ikeSessionParams.getIpVersion();
+        final int expectedEncapType = isAutomaticIpVersionSelectionEnabled
+                ? ESP_ENCAP_TYPE_AUTO
+                : ikeSessionParams.getEncapType();
         doTestMigrateIkeSession(ikeProfile.toVpnProfile(), expectedKeepalive,
-                isAutomaticIpVersionSelectionEnabled);
+                expectedIpVersion, expectedEncapType);
     }
 
-    private void doTestMigrateIkeSession(VpnProfile profile, int expectedKeepalive,
-            boolean isAutomaticIpVersionSelectionEnabled) throws Exception {
-        final int expectedIpVersion = isAutomaticIpVersionSelectionEnabled
-                ? ESP_IP_VERSION_AUTO : ESP_IP_VERSION_AUTO;
-        final int expectedEncapType = isAutomaticIpVersionSelectionEnabled
-                ? ESP_ENCAP_TYPE_AUTO : ESP_IP_VERSION_AUTO;
-
+    private void doTestMigrateIkeSession(VpnProfile profile,
+            int expectedKeepalive, int expectedIpVersion, int expectedEncapType) throws Exception {
         final PlatformVpnSnapshot vpnSnapShot =
                 verifySetupPlatformVpn(profile,
                         createIkeConfig(createIkeConnectInfo(), true /* isMobikeEnabled */),
                         false /* mtuSupportsIpv6 */);
-        // Mock new network comes up and the cleanup task is cancelled
+        // Simulate a new network coming up
         vpnSnapShot.nwCb.onAvailable(TEST_NETWORK_2);
+        verify(mIkeSessionWrapper, never()).setNetwork(any(), anyInt(), anyInt(), anyInt());
 
+        vpnSnapShot.nwCb.onCapabilitiesChanged(
+                TEST_NETWORK_2, new NetworkCapabilities.Builder().build());
         // Verify MOBIKE is triggered
         verify(mIkeSessionWrapper).setNetwork(TEST_NETWORK_2,
                 expectedIpVersion, expectedEncapType, expectedKeepalive);
@@ -2026,6 +2083,155 @@
         vpnSnapShot.vpn.mVpnRunner.exitVpnRunner();
     }
 
+    private void mockCarrierConfig(int subId, int simStatus, int keepaliveTimer, int ikeProtocol) {
+        final SubscriptionInfo subscriptionInfo = mock(SubscriptionInfo.class);
+        doReturn(subId).when(subscriptionInfo).getSubscriptionId();
+        doReturn(List.of(subscriptionInfo)).when(mSubscriptionManager)
+                .getActiveSubscriptionInfoList();
+
+        doReturn(simStatus).when(mTmPerSub).getSimApplicationState();
+        doReturn(TEST_MCCMNC).when(mTmPerSub).getSimOperator(subId);
+
+        final PersistableBundle persistableBundle = new PersistableBundle();
+        persistableBundle.putInt(KEY_MIN_UDP_PORT_4500_NAT_TIMEOUT_SEC_INT, keepaliveTimer);
+        persistableBundle.putInt(KEY_PREFERRED_IKE_PROTOCOL_INT, ikeProtocol);
+        // For CarrierConfigManager.isConfigForIdentifiedCarrier check
+        persistableBundle.putBoolean(KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
+        doReturn(persistableBundle).when(mConfigManager).getConfigForSubId(subId);
+    }
+
+    private CarrierConfigManager.CarrierConfigChangeListener getCarrierConfigListener() {
+        final ArgumentCaptor<CarrierConfigManager.CarrierConfigChangeListener> listenerCaptor =
+                ArgumentCaptor.forClass(CarrierConfigManager.CarrierConfigChangeListener.class);
+
+        verify(mConfigManager).registerCarrierConfigChangeListener(any(), listenerCaptor.capture());
+
+        return listenerCaptor.getValue();
+    }
+
+    @Test
+    public void testNattKeepaliveTimerFromCarrierConfig_noSubId() throws Exception {
+        doTestReadCarrierConfig(new NetworkCapabilities(),
+                TelephonyManager.SIM_STATE_LOADED,
+                PREFERRED_IKE_PROTOCOL_IPV4_UDP,
+                AUTOMATIC_KEEPALIVE_DELAY_SECONDS /* expectedKeepaliveTimer */,
+                ESP_IP_VERSION_AUTO /* expectedIpVersion */,
+                ESP_ENCAP_TYPE_AUTO /* expectedEncapType */);
+    }
+
+    @Test
+    public void testNattKeepaliveTimerFromCarrierConfig_simAbsent() throws Exception {
+        doTestReadCarrierConfig(new NetworkCapabilities.Builder().build(),
+                TelephonyManager.SIM_STATE_ABSENT,
+                PREFERRED_IKE_PROTOCOL_IPV4_UDP,
+                AUTOMATIC_KEEPALIVE_DELAY_SECONDS /* expectedKeepaliveTimer */,
+                ESP_IP_VERSION_AUTO /* expectedIpVersion */,
+                ESP_ENCAP_TYPE_AUTO /* expectedEncapType */);
+    }
+
+    @Test
+    public void testNattKeepaliveTimerFromCarrierConfig() throws Exception {
+        doTestReadCarrierConfig(createTestCellNc(),
+                TelephonyManager.SIM_STATE_LOADED,
+                PREFERRED_IKE_PROTOCOL_AUTO,
+                TEST_KEEPALIVE_TIMER /* expectedKeepaliveTimer */,
+                ESP_IP_VERSION_AUTO /* expectedIpVersion */,
+                ESP_ENCAP_TYPE_AUTO /* expectedEncapType */);
+    }
+
+    @Test
+    public void testNattKeepaliveTimerFromCarrierConfig_NotCell() throws Exception {
+        final NetworkCapabilities nc = new NetworkCapabilities.Builder()
+                .addTransportType(TRANSPORT_WIFI)
+                .setTransportInfo(new WifiInfo.Builder().build())
+                .build();
+        doTestReadCarrierConfig(nc,
+                TelephonyManager.SIM_STATE_LOADED,
+                PREFERRED_IKE_PROTOCOL_IPV4_UDP,
+                AUTOMATIC_KEEPALIVE_DELAY_SECONDS /* expectedKeepaliveTimer */,
+                ESP_IP_VERSION_AUTO /* expectedIpVersion */,
+                ESP_ENCAP_TYPE_AUTO /* expectedEncapType */);
+    }
+
+    @Test
+    public void testPreferredIpProtocolFromCarrierConfig_v4UDP() throws Exception {
+        doTestReadCarrierConfig(createTestCellNc(),
+                TelephonyManager.SIM_STATE_LOADED,
+                PREFERRED_IKE_PROTOCOL_IPV4_UDP,
+                TEST_KEEPALIVE_TIMER /* expectedKeepaliveTimer */,
+                ESP_IP_VERSION_IPV4 /* expectedIpVersion */,
+                ESP_ENCAP_TYPE_UDP /* expectedEncapType */);
+    }
+
+    @Test
+    public void testPreferredIpProtocolFromCarrierConfig_v6ESP() throws Exception {
+        doTestReadCarrierConfig(createTestCellNc(),
+                TelephonyManager.SIM_STATE_LOADED,
+                PREFERRED_IKE_PROTOCOL_IPV6_ESP,
+                TEST_KEEPALIVE_TIMER /* expectedKeepaliveTimer */,
+                ESP_IP_VERSION_IPV6 /* expectedIpVersion */,
+                ESP_ENCAP_TYPE_NONE /* expectedEncapType */);
+    }
+
+    @Test
+    public void testPreferredIpProtocolFromCarrierConfig_v6UDP() throws Exception {
+        doTestReadCarrierConfig(createTestCellNc(),
+                TelephonyManager.SIM_STATE_LOADED,
+                PREFERRED_IKE_PROTOCOL_IPV6_UDP,
+                TEST_KEEPALIVE_TIMER /* expectedKeepaliveTimer */,
+                ESP_IP_VERSION_IPV6 /* expectedIpVersion */,
+                ESP_ENCAP_TYPE_UDP /* expectedEncapType */);
+    }
+
+    private NetworkCapabilities createTestCellNc() {
+        return new NetworkCapabilities.Builder()
+                .addTransportType(TRANSPORT_CELLULAR)
+                .setNetworkSpecifier(new TelephonyNetworkSpecifier.Builder()
+                        .setSubscriptionId(TEST_SUB_ID)
+                        .build())
+                .build();
+    }
+
+    private void doTestReadCarrierConfig(NetworkCapabilities nc, int simState, int preferredIpProto,
+            int expectedKeepaliveTimer, int expectedIpVersion, int expectedEncapType)
+            throws Exception {
+        final Ikev2VpnProfile ikeProfile =
+                new Ikev2VpnProfile.Builder(TEST_VPN_SERVER, TEST_VPN_IDENTITY)
+                        .setAuthPsk(TEST_VPN_PSK)
+                        .setBypassable(true /* isBypassable */)
+                        .setAutomaticNattKeepaliveTimerEnabled(true)
+                        .setAutomaticIpVersionSelectionEnabled(true)
+                        .build();
+
+        final PlatformVpnSnapshot vpnSnapShot =
+                verifySetupPlatformVpn(ikeProfile.toVpnProfile(),
+                        createIkeConfig(createIkeConnectInfo(), true /* isMobikeEnabled */),
+                        false /* mtuSupportsIpv6 */);
+
+        final CarrierConfigManager.CarrierConfigChangeListener listener =
+                getCarrierConfigListener();
+
+        // Simulate a new network coming up
+        vpnSnapShot.nwCb.onAvailable(TEST_NETWORK_2);
+        // Migration will not be started until receiving network capabilities change.
+        verify(mIkeSessionWrapper, never()).setNetwork(any(), anyInt(), anyInt(), anyInt());
+
+        reset(mIkeSessionWrapper);
+        mockCarrierConfig(TEST_SUB_ID, simState, TEST_KEEPALIVE_TIMER, preferredIpProto);
+        vpnSnapShot.nwCb.onCapabilitiesChanged(TEST_NETWORK_2, nc);
+        verify(mIkeSessionWrapper).setNetwork(TEST_NETWORK_2,
+                expectedIpVersion, expectedEncapType, expectedKeepaliveTimer);
+
+        reset(mExecutor);
+        reset(mIkeSessionWrapper);
+
+        // Trigger carrier config change
+        listener.onCarrierConfigChanged(1 /* logicalSlotIndex */, TEST_SUB_ID,
+                -1 /* carrierId */, -1 /* specificCarrierId */);
+        verify(mIkeSessionWrapper).setNetwork(TEST_NETWORK_2,
+                expectedIpVersion, expectedEncapType, expectedKeepaliveTimer);
+    }
+
     @Test
     public void testStartPlatformVpn_mtuDoesNotSupportIpv6() throws Exception {
         final PlatformVpnSnapshot vpnSnapShot =
@@ -2051,7 +2257,10 @@
         // Mock new network comes up and the cleanup task is cancelled
         vpnSnapShot.nwCb.onAvailable(TEST_NETWORK_2);
         verify(mScheduledFuture).cancel(anyBoolean());
+        verify(mIkeSessionWrapper, never()).setNetwork(any(), anyInt(), anyInt(), anyInt());
 
+        vpnSnapShot.nwCb.onCapabilitiesChanged(TEST_NETWORK_2,
+                new NetworkCapabilities.Builder().build());
         // Verify MOBIKE is triggered
         verify(mIkeSessionWrapper).setNetwork(eq(TEST_NETWORK_2),
                 eq(ESP_IP_VERSION_AUTO) /* ipVersion */,
@@ -2146,7 +2355,11 @@
         // Mock network switch
         vpnSnapShot.nwCb.onLost(TEST_NETWORK);
         vpnSnapShot.nwCb.onAvailable(TEST_NETWORK_2);
+        // The old IKE Session will not be killed until receiving network capabilities change.
+        verify(mIkeSessionWrapper, never()).kill();
 
+        vpnSnapShot.nwCb.onCapabilitiesChanged(
+                TEST_NETWORK_2, new NetworkCapabilities.Builder().build());
         // Verify the old IKE Session is killed
         verify(mIkeSessionWrapper).kill();
 
diff --git a/tests/unit/java/com/android/server/connectivity/mdns/MdnsAdvertiserTest.kt b/tests/unit/java/com/android/server/connectivity/mdns/MdnsAdvertiserTest.kt
index 375c150..a917361 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsAdvertiserTest.kt
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsAdvertiserTest.kt
@@ -97,6 +97,7 @@
     @After
     fun tearDown() {
         thread.quitSafely()
+        thread.join()
     }
 
     @Test
diff --git a/tests/unit/java/com/android/server/connectivity/mdns/MdnsAnnouncerTest.kt b/tests/unit/java/com/android/server/connectivity/mdns/MdnsAnnouncerTest.kt
index 6c3f729..7c6cb3e 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsAnnouncerTest.kt
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsAnnouncerTest.kt
@@ -63,6 +63,7 @@
     @After
     fun tearDown() {
         thread.quitSafely()
+        thread.join()
     }
 
     private class TestAnnouncementInfo(
diff --git a/tests/unit/java/com/android/server/connectivity/mdns/MdnsInterfaceAdvertiserTest.kt b/tests/unit/java/com/android/server/connectivity/mdns/MdnsInterfaceAdvertiserTest.kt
index 2d8d8f3..0ca0835 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsInterfaceAdvertiserTest.kt
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsInterfaceAdvertiserTest.kt
@@ -136,6 +136,7 @@
     @After
     fun tearDown() {
         thread.quitSafely()
+        thread.join()
     }
 
     @Test
diff --git a/tests/unit/java/com/android/server/connectivity/mdns/MdnsProberTest.kt b/tests/unit/java/com/android/server/connectivity/mdns/MdnsProberTest.kt
index a2dbbc6..2b5423b 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsProberTest.kt
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsProberTest.kt
@@ -68,6 +68,7 @@
     @After
     fun tearDown() {
         thread.quitSafely()
+        thread.join()
     }
 
     private class TestProbeInfo(probeRecords: List<MdnsRecord>, private val delayMs: Long = 1L) :
diff --git a/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordRepositoryTest.kt b/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordRepositoryTest.kt
index 5665091..44e0d08 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordRepositoryTest.kt
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsRecordRepositoryTest.kt
@@ -79,6 +79,7 @@
     @After
     fun tearDown() {
         thread.quitSafely()
+        thread.join()
     }
 
     @Test
diff --git a/tests/unit/java/com/android/server/connectivity/mdns/MdnsResponseDecoderTests.java b/tests/unit/java/com/android/server/connectivity/mdns/MdnsResponseDecoderTests.java
index a80c078..b0a1f18 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsResponseDecoderTests.java
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsResponseDecoderTests.java
@@ -156,16 +156,20 @@
             + "010001000000780004C0A8018A0000000000000000000000000000"
             + "000000");
 
-    // MDNS record for name "testhost1" with an IPv4 address of 10.1.2.3
+    // MDNS record for name "testhost1" with an IPv4 address of 10.1.2.3. Also set cache flush bit
+    // for the records changed.
     private static final byte[] DATAIN_IPV4_1 = HexDump.hexStringToByteArray(
             "0974657374686f73743100000180010000007800040a010203");
-    // MDNS record for name "testhost1" with an IPv4 address of 10.1.2.4
+    // MDNS record for name "testhost1" with an IPv4 address of 10.1.2.4. Also set cache flush bit
+    // for the records changed.
     private static final byte[] DATAIN_IPV4_2 = HexDump.hexStringToByteArray(
             "0974657374686f73743100000180010000007800040a010204");
-    // MDNS record w/name "testhost1" & IPv6 address of aabb:ccdd:1122:3344:a0b0:c0d0:1020:3040
+    // MDNS record w/name "testhost1" & IPv6 address of aabb:ccdd:1122:3344:a0b0:c0d0:1020:3040.
+    // Also set cache flush bit for the records changed.
     private static final byte[] DATAIN_IPV6_1 = HexDump.hexStringToByteArray(
             "0974657374686f73743100001c8001000000780010aabbccdd11223344a0b0c0d010203040");
-    // MDNS record w/name "testhost1" & IPv6 address of aabb:ccdd:1122:3344:a0b0:c0d0:1020:3030
+    // MDNS record w/name "testhost1" & IPv6 address of aabb:ccdd:1122:3344:a0b0:c0d0:1020:3030.
+    // Also set cache flush bit for the records changed.
     private static final byte[] DATAIN_IPV6_2 = HexDump.hexStringToByteArray(
             "0974657374686f73743100001c8001000000780010aabbccdd11223344a0b0c0d010203030");
     // MDNS record w/name "test" & PTR to foo.bar.quxx
diff --git a/tests/unit/java/com/android/server/connectivity/mdns/MdnsServiceTypeClientTests.java b/tests/unit/java/com/android/server/connectivity/mdns/MdnsServiceTypeClientTests.java
index 3e2ea35..5d58f5d 100644
--- a/tests/unit/java/com/android/server/connectivity/mdns/MdnsServiceTypeClientTests.java
+++ b/tests/unit/java/com/android/server/connectivity/mdns/MdnsServiceTypeClientTests.java
@@ -449,8 +449,8 @@
         verifyServiceInfo(serviceInfoCaptor.getAllValues().get(0),
                 "service-instance-1",
                 SERVICE_TYPE_LABELS,
-                /* ipv4Address= */ List.of(),
-                /* ipv6Address= */ List.of(),
+                /* ipv4Addresses= */ List.of(),
+                /* ipv6Addresses= */ List.of(),
                 /* port= */ 0,
                 /* subTypes= */ List.of(),
                 Collections.emptyMap(),
diff --git a/tests/unit/java/com/android/server/ethernet/EthernetTrackerTest.java b/tests/unit/java/com/android/server/ethernet/EthernetTrackerTest.java
index 5e7f0ff..e6aba22 100644
--- a/tests/unit/java/com/android/server/ethernet/EthernetTrackerTest.java
+++ b/tests/unit/java/com/android/server/ethernet/EthernetTrackerTest.java
@@ -86,8 +86,9 @@
     }
 
     @After
-    public void cleanUp() {
+    public void cleanUp() throws InterruptedException {
         mHandlerThread.quitSafely();
+        mHandlerThread.join();
     }
 
     private void initMockResources() {
diff --git a/tests/unit/java/com/android/server/net/IpConfigStoreTest.java b/tests/unit/java/com/android/server/net/IpConfigStoreTest.java
index 4adc999..dcf0f75 100644
--- a/tests/unit/java/com/android/server/net/IpConfigStoreTest.java
+++ b/tests/unit/java/com/android/server/net/IpConfigStoreTest.java
@@ -36,7 +36,6 @@
 
 import com.android.testutils.DevSdkIgnoreRule;
 import com.android.testutils.DevSdkIgnoreRunner;
-import com.android.testutils.HandlerUtils;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -58,7 +57,7 @@
 @RunWith(DevSdkIgnoreRunner.class)
 @DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.S_V2)
 public class IpConfigStoreTest {
-    private static final int TIMEOUT_MS = 2_000;
+    private static final int TIMEOUT_MS = 5_000;
     private static final int KEY_CONFIG = 17;
     private static final String IFACE_1 = "eth0";
     private static final String IFACE_2 = "eth1";
@@ -139,6 +138,8 @@
                     }
                     @Override
                     public void quitHandlerThread(HandlerThread handlerThread) {
+                        // Don't join in here, quitHandlerThread runs on the
+                        // handler thread itself.
                         testHandlerThread.quitSafely();
                     }
         };
@@ -155,7 +156,7 @@
         final DelayedDiskWrite writer = new DelayedDiskWrite(dependencies);
         final IpConfigStore store = new IpConfigStore(writer);
         store.writeIpConfigurations(configFile.getPath(), expectedNetworks);
-        HandlerUtils.waitForIdle(testHandlerThread, TIMEOUT_MS);
+        testHandlerThread.join();
 
         // Read IP config from the file path.
         final ArrayMap<String, IpConfiguration> actualNetworks =
diff --git a/tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java b/tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java
index 8046263..04163fd 100644
--- a/tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java
+++ b/tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java
@@ -539,6 +539,7 @@
         mService = null;
 
         mHandlerThread.quitSafely();
+        mHandlerThread.join();
     }
 
     private void initWifiStats(NetworkStateSnapshot snapshot) throws Exception {
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index d22a576..f0d8156 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -14,9 +14,11 @@
 //
 // This file is automatically generated by gen_android_bp. Do not edit.
 
+soong_namespace {}
+
 build = ["Android.extras.bp"]
 
-// GN: PACKAGE
+// The actual license can be found in Android.extras.bp
 package {
     default_applicable_licenses: [
         "external_cronet_license",
@@ -36,6 +38,7 @@
         "components/cronet/android/api/src/android/net/http/ExperimentalBidirectionalStream.java",
         "components/cronet/android/api/src/android/net/http/ExperimentalHttpEngine.java",
         "components/cronet/android/api/src/android/net/http/ExperimentalUrlRequest.java",
+        "components/cronet/android/api/src/android/net/http/HeaderBlock.java",
         "components/cronet/android/api/src/android/net/http/HttpEngine.java",
         "components/cronet/android/api/src/android/net/http/HttpException.java",
         "components/cronet/android/api/src/android/net/http/IHttpEngineBuilder.java",
@@ -292,6 +295,7 @@
 cc_library_static {
     name: "cronet_aml_base_allocator_partition_allocator_partition_alloc",
     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",
@@ -345,9 +349,6 @@
         "base/allocator/partition_allocator/tagging.cc",
         "base/allocator/partition_allocator/thread_cache.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_android_ndk_cpu_features",
-    ],
     generated_headers: [
         "cronet_aml_base_allocator_partition_allocator_chromecast_buildflags",
         "cronet_aml_base_allocator_partition_allocator_chromeos_buildflags",
@@ -559,15 +560,13 @@
     target: {
         android_arm: {
             srcs: [
+                ":cronet_aml_third_party_android_ndk_cpu_features__testing",
                 "base/allocator/partition_allocator/partition_alloc_base/files/file_path.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/time/time_android.cc",
                 "base/allocator/partition_allocator/starscan/stack/asm/arm/push_registers_asm.cc",
             ],
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -580,15 +579,13 @@
         },
         android_arm64: {
             srcs: [
+                ":cronet_aml_third_party_android_ndk_cpu_features__testing",
                 "base/allocator/partition_allocator/partition_alloc_base/files/file_path.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/time/time_android.cc",
                 "base/allocator/partition_allocator/starscan/stack/asm/arm64/push_registers_asm.cc",
             ],
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -604,15 +601,13 @@
         },
         android_x86: {
             srcs: [
+                ":cronet_aml_third_party_android_ndk_cpu_features__testing",
                 "base/allocator/partition_allocator/partition_alloc_base/files/file_path.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/time/time_android.cc",
                 "base/allocator/partition_allocator/starscan/stack/asm/x86/push_registers_asm.cc",
             ],
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -625,15 +620,13 @@
         },
         android_x86_64: {
             srcs: [
+                ":cronet_aml_third_party_android_ndk_cpu_features__testing",
                 "base/allocator/partition_allocator/partition_alloc_base/files/file_path.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/time/time_android.cc",
                 "base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc",
             ],
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -943,6 +936,56 @@
 cc_library_static {
     name: "cronet_aml_base_base",
     srcs: [
+        ":cronet_aml_base_nodebug_assertion",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base",
+        ":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_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_container_hashtablez_sampler",
+        ":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_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_numeric_int128",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions",
+        ":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_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_seed_material",
+        ":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_internal",
+        ":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_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_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",
@@ -1378,66 +1421,16 @@
         "base/vlog.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
     ],
     static_libs: [
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -1616,6 +1609,54 @@
 cc_library_static {
     name: "cronet_aml_base_base__testing",
     srcs: [
+        ":cronet_aml_base_nodebug_assertion__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
         "base/allocator/allocator_check.cc",
         "base/allocator/allocator_extension.cc",
         "base/allocator/dispatcher/dispatcher.cc",
@@ -1983,58 +2024,9 @@
     static_libs: [
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -2146,6 +2138,8 @@
         },
         android_arm: {
             srcs: [
+                ":cronet_aml_third_party_android_ndk_cpu_features__testing",
+                ":cronet_aml_third_party_ashmem_ashmem__testing",
                 "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",
@@ -2222,10 +2216,6 @@
                 "base/time/time_android.cc",
                 "base/trace_event/cfi_backtrace_android.cc",
             ],
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-                "cronet_aml_third_party_ashmem_ashmem__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2242,6 +2232,13 @@
                 "cronet_aml_base_logging_buildflags__testing",
                 "cronet_aml_build_chromeos_buildflags__testing",
             ],
+            export_generated_headers: [
+                "cronet_aml_base_android_runtime_jni_headers__testing",
+                "cronet_aml_base_base_jni_headers__testing",
+                "cronet_aml_base_debugging_buildflags__testing",
+                "cronet_aml_base_logging_buildflags__testing",
+                "cronet_aml_build_chromeos_buildflags__testing",
+            ],
             ldflags: [
                 "-Wl,-wrap,asprintf",
                 "-Wl,-wrap,calloc",
@@ -2262,6 +2259,8 @@
         },
         android_arm64: {
             srcs: [
+                ":cronet_aml_third_party_android_ndk_cpu_features__testing",
+                ":cronet_aml_third_party_ashmem_ashmem__testing",
                 "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",
@@ -2334,10 +2333,6 @@
                 "base/threading/platform_thread_android.cc",
                 "base/time/time_android.cc",
             ],
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-                "cronet_aml_third_party_ashmem_ashmem__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2356,6 +2351,13 @@
                 "cronet_aml_base_logging_buildflags__testing",
                 "cronet_aml_build_chromeos_buildflags__testing",
             ],
+            export_generated_headers: [
+                "cronet_aml_base_android_runtime_jni_headers__testing",
+                "cronet_aml_base_base_jni_headers__testing",
+                "cronet_aml_base_debugging_buildflags__testing",
+                "cronet_aml_base_logging_buildflags__testing",
+                "cronet_aml_build_chromeos_buildflags__testing",
+            ],
             ldflags: [
                 "-Wl,-wrap,asprintf",
                 "-Wl,-wrap,calloc",
@@ -2376,6 +2378,8 @@
         },
         android_x86: {
             srcs: [
+                ":cronet_aml_third_party_android_ndk_cpu_features__testing",
+                ":cronet_aml_third_party_ashmem_ashmem__testing",
                 "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",
@@ -2448,10 +2452,6 @@
                 "base/threading/platform_thread_android.cc",
                 "base/time/time_android.cc",
             ],
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-                "cronet_aml_third_party_ashmem_ashmem__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2468,6 +2468,13 @@
                 "cronet_aml_base_logging_buildflags__testing",
                 "cronet_aml_build_chromeos_buildflags__testing",
             ],
+            export_generated_headers: [
+                "cronet_aml_base_android_runtime_jni_headers__testing",
+                "cronet_aml_base_base_jni_headers__testing",
+                "cronet_aml_base_debugging_buildflags__testing",
+                "cronet_aml_base_logging_buildflags__testing",
+                "cronet_aml_build_chromeos_buildflags__testing",
+            ],
             ldflags: [
                 "-Wl,-wrap,asprintf",
                 "-Wl,-wrap,calloc",
@@ -2488,6 +2495,8 @@
         },
         android_x86_64: {
             srcs: [
+                ":cronet_aml_third_party_android_ndk_cpu_features__testing",
+                ":cronet_aml_third_party_ashmem_ashmem__testing",
                 "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",
@@ -2560,10 +2569,6 @@
                 "base/threading/platform_thread_android.cc",
                 "base/time/time_android.cc",
             ],
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-                "cronet_aml_third_party_ashmem_ashmem__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2581,6 +2586,13 @@
                 "cronet_aml_base_logging_buildflags__testing",
                 "cronet_aml_build_chromeos_buildflags__testing",
             ],
+            export_generated_headers: [
+                "cronet_aml_base_android_runtime_jni_headers__testing",
+                "cronet_aml_base_base_jni_headers__testing",
+                "cronet_aml_base_debugging_buildflags__testing",
+                "cronet_aml_base_logging_buildflags__testing",
+                "cronet_aml_build_chromeos_buildflags__testing",
+            ],
             ldflags: [
                 "-Wl,-wrap,asprintf",
                 "-Wl,-wrap,calloc",
@@ -3396,7 +3408,7 @@
 cc_genrule {
     name: "cronet_aml_base_build_date",
     cmd: "$(location build/write_build_date_header.py) $(out) " +
-         "1674644139",
+         "1678293768",
     out: [
         "base/generated_build_date.h",
     ],
@@ -3412,7 +3424,7 @@
 cc_genrule {
     name: "cronet_aml_base_build_date__testing",
     cmd: "$(location build/write_build_date_header.py) $(out) " +
-         "1674644139",
+         "1678293768",
     host_supported: true,
     out: [
         "base/generated_build_date.h",
@@ -3735,60 +3747,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_ced_ced__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
@@ -4094,7 +4055,7 @@
 }
 
 // GN: //base:nodebug_assertion
-cc_library_static {
+cc_object {
     name: "cronet_aml_base_nodebug_assertion",
     srcs: [
         "base/nodebug_assertion.cc",
@@ -4139,11 +4100,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -4172,7 +4128,7 @@
 }
 
 // GN: //base:nodebug_assertion__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_base_nodebug_assertion__testing",
     srcs: [
         "base/nodebug_assertion.cc",
@@ -4213,11 +4169,6 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -4701,60 +4652,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -4858,6 +4758,55 @@
 cc_library_static {
     name: "cronet_aml_base_test_test_support__testing",
     srcs: [
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
+        ":cronet_aml_third_party_googletest_gmock__testing",
+        ":cronet_aml_third_party_googletest_gtest__testing",
         "base/task/sequence_manager/test/fake_task.cc",
         "base/task/sequence_manager/test/mock_time_domain.cc",
         "base/task/sequence_manager/test/mock_time_message_pump.cc",
@@ -4935,65 +4884,12 @@
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
         "cronet_aml_base_i18n__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_test_test_config__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_ced_ced__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -5931,7 +5827,7 @@
 }
 
 // GN: //buildtools/third_party/libc++:libc++
-cc_library_static {
+cc_object {
     name: "cronet_aml_buildtools_third_party_libc___libc__",
     srcs: [
         "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
@@ -5977,9 +5873,6 @@
         "buildtools/third_party/libc++/trunk/src/vector.cpp",
         "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
     ],
-    static_libs: [
-        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -6015,11 +5908,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
     ],
     cpp_std: "c++20",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     cppflags: [
         "-fexceptions",
     ],
@@ -6083,7 +5971,7 @@
 }
 
 // GN: //buildtools/third_party/libc++:libc++__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_buildtools_third_party_libc___libc____testing",
     srcs: [
         "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
@@ -6129,9 +6017,6 @@
         "buildtools/third_party/libc++/trunk/src/vector.cpp",
         "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
     ],
-    static_libs: [
-        "cronet_aml_buildtools_third_party_libc__abi_libc__abi__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -6167,11 +6052,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
     ],
     cpp_std: "c++20",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     cppflags: [
         "-fexceptions",
     ],
@@ -6235,7 +6115,7 @@
 }
 
 // GN: //buildtools/third_party/libc++abi:libc++abi
-cc_library_static {
+cc_object {
     name: "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
     srcs: [
         "buildtools/third_party/libc++abi/trunk/src/abort_message.cpp",
@@ -6289,11 +6169,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
     ],
     cpp_std: "c++20",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     cppflags: [
         "-fexceptions",
     ],
@@ -6372,7 +6247,7 @@
 }
 
 // GN: //buildtools/third_party/libc++abi:libc++abi__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_buildtools_third_party_libc__abi_libc__abi__testing",
     srcs: [
         "buildtools/third_party/libc++abi/trunk/src/abort_message.cpp",
@@ -6426,11 +6301,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
     ],
     cpp_std: "c++20",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     cppflags: [
         "-fexceptions",
     ],
@@ -6558,9 +6428,17 @@
 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_components_cronet_android_cronet_static",
+        ":cronet_aml_components_cronet_cronet_common",
+        ":cronet_aml_components_cronet_metrics_util",
+        ":cronet_aml_components_metrics_library_support",
         "components/cronet/android/cronet_jni.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libz",
@@ -6569,79 +6447,14 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_buildtools_third_party_libc___libc__",
-        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-        "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_metrics_library_support",
         "cronet_aml_components_prefs_prefs",
         "cronet_aml_crypto_crypto",
-        "cronet_aml_net_dns_dns",
-        "cronet_aml_net_dns_public_public",
-        "cronet_aml_net_http_transport_security_state_generated_files",
         "cronet_aml_net_net",
-        "cronet_aml_net_net_deps",
-        "cronet_aml_net_net_public_deps",
         "cronet_aml_net_preload_decoder",
         "cronet_aml_net_third_party_quiche_quiche",
-        "cronet_aml_net_traffic_annotation_traffic_annotation",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_brotli_common",
         "cronet_aml_third_party_brotli_dec",
         "cronet_aml_third_party_icu_icui18n",
@@ -6651,6 +6464,30 @@
         "cronet_aml_third_party_protobuf_protobuf_lite",
         "cronet_aml_url_url",
     ],
+    generated_headers: [
+        "cronet_aml_base_debugging_buildflags",
+        "cronet_aml_base_logging_buildflags",
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_components_cronet_android_buildflags",
+        "cronet_aml_components_cronet_android_cronet_jni_headers",
+        "cronet_aml_components_cronet_android_cronet_jni_registration",
+        "cronet_aml_components_cronet_cronet_buildflags",
+        "cronet_aml_components_cronet_cronet_version_header_action",
+        "cronet_aml_third_party_metrics_proto_metrics_proto_gen_headers",
+        "cronet_aml_url_buildflags",
+    ],
+    export_generated_headers: [
+        "cronet_aml_base_debugging_buildflags",
+        "cronet_aml_base_logging_buildflags",
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_components_cronet_android_buildflags",
+        "cronet_aml_components_cronet_android_cronet_jni_headers",
+        "cronet_aml_components_cronet_android_cronet_jni_registration",
+        "cronet_aml_components_cronet_cronet_buildflags",
+        "cronet_aml_components_cronet_cronet_version_header_action",
+        "cronet_aml_third_party_metrics_proto_metrics_proto_gen_headers",
+        "cronet_aml_url_buildflags",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -7033,6 +6870,7 @@
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java",
+        "components/cronet/android/java/src/org/chromium/net/impl/HeaderBlockImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NetworkExceptionImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NoOpLogger.java",
@@ -7286,6 +7124,7 @@
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java",
+        "components/cronet/android/java/src/org/chromium/net/impl/HeaderBlockImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NetworkExceptionImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NoOpLogger.java",
@@ -7535,6 +7374,7 @@
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java",
+        "components/cronet/android/java/src/org/chromium/net/impl/HeaderBlockImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NetworkExceptionImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NoOpLogger.java",
@@ -7782,6 +7622,7 @@
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java",
+        "components/cronet/android/java/src/org/chromium/net/impl/HeaderBlockImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NetworkExceptionImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NoOpLogger.java",
@@ -7861,7 +7702,7 @@
 }
 
 // GN: //components/cronet/android:cronet_static
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_cronet_android_cronet_static",
     srcs: [
         "components/cronet/android/cronet_bidirectional_stream_adapter.cc",
@@ -7873,6 +7714,8 @@
         "components/cronet/android/url_request_error.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libz",
@@ -7881,76 +7724,14 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_components_cronet_cronet_common",
-        "cronet_aml_components_cronet_cronet_version_header",
-        "cronet_aml_components_cronet_metrics_util",
-        "cronet_aml_components_metrics_library_support",
         "cronet_aml_components_prefs_prefs",
         "cronet_aml_crypto_crypto",
-        "cronet_aml_net_dns_dns",
-        "cronet_aml_net_dns_public_public",
-        "cronet_aml_net_http_transport_security_state_generated_files",
         "cronet_aml_net_net",
-        "cronet_aml_net_net_deps",
-        "cronet_aml_net_net_public_deps",
         "cronet_aml_net_preload_decoder",
         "cronet_aml_net_third_party_quiche_quiche",
-        "cronet_aml_net_traffic_annotation_traffic_annotation",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_brotli_common",
         "cronet_aml_third_party_brotli_dec",
         "cronet_aml_third_party_icu_icui18n",
@@ -7967,15 +7748,9 @@
         "cronet_aml_components_cronet_android_buildflags",
         "cronet_aml_components_cronet_android_cronet_jni_headers",
         "cronet_aml_components_cronet_android_cronet_jni_registration",
-        "cronet_aml_url_buildflags",
-    ],
-    export_generated_headers: [
-        "cronet_aml_base_debugging_buildflags",
-        "cronet_aml_base_logging_buildflags",
-        "cronet_aml_build_chromeos_buildflags",
-        "cronet_aml_components_cronet_android_buildflags",
-        "cronet_aml_components_cronet_android_cronet_jni_headers",
-        "cronet_aml_components_cronet_android_cronet_jni_registration",
+        "cronet_aml_components_cronet_cronet_buildflags",
+        "cronet_aml_components_cronet_cronet_version_header_action",
+        "cronet_aml_third_party_metrics_proto_metrics_proto_gen_headers",
         "cronet_aml_url_buildflags",
     ],
     defaults: [
@@ -8024,27 +7799,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -8073,7 +7827,7 @@
 }
 
 // GN: //components/cronet/android:cronet_static__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_cronet_android_cronet_static__testing",
     srcs: [
         "components/cronet/android/cronet_bidirectional_stream_adapter.cc",
@@ -8093,76 +7847,15 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_components_cronet_cronet_common__testing",
-        "cronet_aml_components_cronet_cronet_version_header__testing",
-        "cronet_aml_components_cronet_metrics_util__testing",
-        "cronet_aml_components_metrics_library_support__testing",
         "cronet_aml_components_prefs_prefs__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -8179,15 +7872,9 @@
         "cronet_aml_components_cronet_android_buildflags__testing",
         "cronet_aml_components_cronet_android_cronet_jni_headers__testing",
         "cronet_aml_components_cronet_android_cronet_jni_registration__testing",
-        "cronet_aml_url_buildflags__testing",
-    ],
-    export_generated_headers: [
-        "cronet_aml_base_debugging_buildflags__testing",
-        "cronet_aml_base_logging_buildflags__testing",
-        "cronet_aml_build_chromeos_buildflags__testing",
-        "cronet_aml_components_cronet_android_buildflags__testing",
-        "cronet_aml_components_cronet_android_cronet_jni_headers__testing",
-        "cronet_aml_components_cronet_android_cronet_jni_registration__testing",
+        "cronet_aml_components_cronet_cronet_buildflags__testing",
+        "cronet_aml_components_cronet_cronet_version_header_action__testing",
+        "cronet_aml_third_party_metrics_proto_metrics_proto__testing_gen_headers",
         "cronet_aml_url_buildflags__testing",
     ],
     defaults: [
@@ -8236,27 +7923,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -8288,6 +7954,15 @@
 cc_library_shared {
     name: "cronet_aml_components_cronet_android_cronet_unittests_android__library__testing",
     srcs: [
+        ":cronet_aml_buildtools_third_party_libc___libc____testing",
+        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi__testing",
+        ":cronet_aml_components_cronet_android_cronet_static__testing",
+        ":cronet_aml_components_cronet_cronet_common__testing",
+        ":cronet_aml_components_cronet_cronet_common_unittests__testing",
+        ":cronet_aml_components_cronet_metrics_util__testing",
+        ":cronet_aml_components_metrics_library_support__testing",
+        ":cronet_aml_testing_android_native_test_native_test_native_code__testing",
+        ":cronet_aml_testing_android_native_test_native_test_support__testing",
         "components/cronet/run_all_unittests.cc",
     ],
     shared_libs: [
@@ -8300,98 +7975,25 @@
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
         "cronet_aml_base_i18n__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_test_test_config__testing",
         "cronet_aml_base_test_test_support__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_buildtools_third_party_libc___libc____testing",
-        "cronet_aml_buildtools_third_party_libc__abi_libc__abi__testing",
-        "cronet_aml_components_cronet_android_cronet_static__testing",
-        "cronet_aml_components_cronet_cronet_common__testing",
-        "cronet_aml_components_cronet_cronet_common_unittests__testing",
-        "cronet_aml_components_cronet_cronet_version_header__testing",
-        "cronet_aml_components_cronet_metrics_util__testing",
-        "cronet_aml_components_metrics_library_support__testing",
         "cronet_aml_components_prefs_prefs__testing",
         "cronet_aml_components_prefs_test_support__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_dns_test_support__testing",
         "cronet_aml_net_gtest_util__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
-        "cronet_aml_net_quic_test_flags_utils__testing",
-        "cronet_aml_net_simple_quic_tools__testing",
         "cronet_aml_net_test_support__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
         "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
-        "cronet_aml_net_tools_tld_cleanup_tld_cleanup__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_testing_android_native_test_native_test_native_code__testing",
-        "cronet_aml_testing_android_native_test_native_test_support__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_ced_ced__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -8402,6 +8004,32 @@
         "cronet_aml_third_party_protobuf_protobuf_lite__testing",
         "cronet_aml_url_url__testing",
     ],
+    generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_components_cronet_android_buildflags__testing",
+        "cronet_aml_components_cronet_android_cronet_jni_headers__testing",
+        "cronet_aml_components_cronet_android_cronet_jni_registration__testing",
+        "cronet_aml_components_cronet_cronet_buildflags__testing",
+        "cronet_aml_components_cronet_cronet_version_header_action__testing",
+        "cronet_aml_testing_android_native_test_native_test_jni_headers__testing",
+        "cronet_aml_third_party_metrics_proto_metrics_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
+    ],
+    export_generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_components_cronet_android_buildflags__testing",
+        "cronet_aml_components_cronet_android_cronet_jni_headers__testing",
+        "cronet_aml_components_cronet_android_cronet_jni_registration__testing",
+        "cronet_aml_components_cronet_cronet_buildflags__testing",
+        "cronet_aml_components_cronet_cronet_version_header_action__testing",
+        "cronet_aml_testing_android_native_test_native_test_jni_headers__testing",
+        "cronet_aml_third_party_metrics_proto_metrics_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -8812,7 +8440,7 @@
 }
 
 // GN: //components/cronet:cronet_common
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_cronet_cronet_common",
     srcs: [
         "components/cronet/cronet_context.cc",
@@ -8824,6 +8452,8 @@
         "components/cronet/url_request_context_config.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libz",
@@ -8832,74 +8462,14 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_components_cronet_cronet_version_header",
-        "cronet_aml_components_metrics_library_support",
         "cronet_aml_components_prefs_prefs",
         "cronet_aml_crypto_crypto",
-        "cronet_aml_net_dns_dns",
-        "cronet_aml_net_dns_public_public",
-        "cronet_aml_net_http_transport_security_state_generated_files",
         "cronet_aml_net_net",
-        "cronet_aml_net_net_deps",
-        "cronet_aml_net_net_public_deps",
         "cronet_aml_net_preload_decoder",
         "cronet_aml_net_third_party_quiche_quiche",
-        "cronet_aml_net_traffic_annotation_traffic_annotation",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_brotli_common",
         "cronet_aml_third_party_brotli_dec",
         "cronet_aml_third_party_icu_icui18n",
@@ -8911,9 +8481,8 @@
     ],
     generated_headers: [
         "cronet_aml_components_cronet_cronet_buildflags",
-    ],
-    export_generated_headers: [
-        "cronet_aml_components_cronet_cronet_buildflags",
+        "cronet_aml_components_cronet_cronet_version_header_action",
+        "cronet_aml_third_party_metrics_proto_metrics_proto_gen_headers",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -8961,27 +8530,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -9010,7 +8558,7 @@
 }
 
 // GN: //components/cronet:cronet_common__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_cronet_cronet_common__testing",
     srcs: [
         "components/cronet/cronet_context.cc",
@@ -9030,74 +8578,15 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_components_cronet_cronet_version_header__testing",
-        "cronet_aml_components_metrics_library_support__testing",
         "cronet_aml_components_prefs_prefs__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -9109,9 +8598,8 @@
     ],
     generated_headers: [
         "cronet_aml_components_cronet_cronet_buildflags__testing",
-    ],
-    export_generated_headers: [
-        "cronet_aml_components_cronet_cronet_buildflags__testing",
+        "cronet_aml_components_cronet_cronet_version_header_action__testing",
+        "cronet_aml_third_party_metrics_proto_metrics_proto__testing_gen_headers",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -9159,27 +8647,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -9208,7 +8675,7 @@
 }
 
 // GN: //components/cronet:cronet_common_unittests__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_cronet_cronet_common_unittests__testing",
     srcs: [
         "components/cronet/host_cache_persistence_manager_unittest.cc",
@@ -9226,91 +8693,25 @@
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
         "cronet_aml_base_i18n__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_test_test_config__testing",
         "cronet_aml_base_test_test_support__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_components_cronet_cronet_common__testing",
-        "cronet_aml_components_cronet_cronet_version_header__testing",
-        "cronet_aml_components_metrics_library_support__testing",
         "cronet_aml_components_prefs_prefs__testing",
         "cronet_aml_components_prefs_test_support__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_dns_test_support__testing",
         "cronet_aml_net_gtest_util__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
-        "cronet_aml_net_quic_test_flags_utils__testing",
-        "cronet_aml_net_simple_quic_tools__testing",
         "cronet_aml_net_test_support__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
         "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
-        "cronet_aml_net_tools_tld_cleanup_tld_cleanup__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_ced_ced__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -9321,6 +8722,11 @@
         "cronet_aml_third_party_protobuf_protobuf_lite__testing",
         "cronet_aml_url_url__testing",
     ],
+    generated_headers: [
+        "cronet_aml_components_cronet_cronet_buildflags__testing",
+        "cronet_aml_components_cronet_cronet_version_header_action__testing",
+        "cronet_aml_third_party_metrics_proto_metrics_proto__testing_gen_headers",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -9387,181 +8793,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
-    target: {
-        android_arm: {
-            cflags: [
-                "-fstack-protector",
-            ],
-        },
-        android_arm64: {
-            cflags: [
-                "-fstack-protector",
-                "-mno-outline",
-                "-mno-outline-atomics",
-            ],
-        },
-        android_x86: {
-            cflags: [
-                "-msse3",
-            ],
-        },
-        android_x86_64: {
-            cflags: [
-                "-fstack-protector",
-                "-msse3",
-            ],
-        },
-    },
-}
-
-// GN: //components/cronet:cronet_version_header
-cc_library_static {
-    name: "cronet_aml_components_cronet_cronet_version_header",
-    generated_headers: [
-        "cronet_aml_components_cronet_cronet_version_header_action",
-    ],
-    export_generated_headers: [
-        "cronet_aml_components_cronet_cronet_version_header_action",
-    ],
-    defaults: [
-        "cronet_aml_defaults",
-    ],
-    cflags: [
-        "-DANDROID",
-        "-DANDROID_NDK_VERSION_ROLL=r23_1",
-        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
-        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
-        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
-        "-DHAVE_SYS_UIO_H",
-        "-DNDEBUG",
-        "-DNO_UNWIND_TABLES",
-        "-DNVALGRIND",
-        "-DOFFICIAL_BUILD",
-        "-D_FORTIFY_SOURCE=2",
-        "-D_GNU_SOURCE",
-        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D__STDC_CONSTANT_MACROS",
-        "-D__STDC_FORMAT_MACROS",
-        "-Oz",
-        "-fdata-sections",
-        "-ffunction-sections",
-        "-fno-asynchronous-unwind-tables",
-        "-fno-unwind-tables",
-        "-fvisibility-inlines-hidden",
-        "-fvisibility=hidden",
-        "-g1",
-    ],
-    local_include_dirs: [
-        "./",
-        "buildtools/third_party/libc++/",
-        "buildtools/third_party/libc++/trunk/include",
-        "buildtools/third_party/libc++abi/trunk/include",
-    ],
-    cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
-    target: {
-        android_arm: {
-            cflags: [
-                "-fstack-protector",
-            ],
-        },
-        android_arm64: {
-            cflags: [
-                "-fstack-protector",
-                "-mno-outline",
-                "-mno-outline-atomics",
-            ],
-        },
-        android_x86: {
-            cflags: [
-                "-msse3",
-            ],
-        },
-        android_x86_64: {
-            cflags: [
-                "-fstack-protector",
-                "-msse3",
-            ],
-        },
-    },
-}
-
-// GN: //components/cronet:cronet_version_header__testing
-cc_library_static {
-    name: "cronet_aml_components_cronet_cronet_version_header__testing",
-    generated_headers: [
-        "cronet_aml_components_cronet_cronet_version_header_action__testing",
-    ],
-    export_generated_headers: [
-        "cronet_aml_components_cronet_cronet_version_header_action__testing",
-    ],
-    defaults: [
-        "cronet_aml_defaults",
-    ],
-    cflags: [
-        "-DANDROID",
-        "-DANDROID_NDK_VERSION_ROLL=r23_1",
-        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
-        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
-        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
-        "-DHAVE_SYS_UIO_H",
-        "-DNDEBUG",
-        "-DNO_UNWIND_TABLES",
-        "-DNVALGRIND",
-        "-DOFFICIAL_BUILD",
-        "-D_FORTIFY_SOURCE=2",
-        "-D_GNU_SOURCE",
-        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D__STDC_CONSTANT_MACROS",
-        "-D__STDC_FORMAT_MACROS",
-        "-Oz",
-        "-fdata-sections",
-        "-ffunction-sections",
-        "-fno-asynchronous-unwind-tables",
-        "-fno-unwind-tables",
-        "-fvisibility-inlines-hidden",
-        "-fvisibility=hidden",
-        "-g1",
-    ],
-    local_include_dirs: [
-        "./",
-        "buildtools/third_party/libc++/",
-        "buildtools/third_party/libc++/trunk/include",
-        "buildtools/third_party/libc++abi/trunk/include",
-    ],
-    cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -9642,12 +8873,14 @@
 }
 
 // GN: //components/cronet:metrics_util
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_cronet_metrics_util",
     srcs: [
         "components/cronet/metrics_util.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
     ],
@@ -9655,60 +8888,8 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -9752,27 +8933,6 @@
         "third_party/boringssl/src/include/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -9801,7 +8961,7 @@
 }
 
 // GN: //components/cronet:metrics_util__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_cronet_metrics_util__testing",
     srcs: [
         "components/cronet/metrics_util.cc",
@@ -9814,60 +8974,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -9911,27 +9020,6 @@
         "third_party/boringssl/src/include/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -9960,7 +9048,7 @@
 }
 
 // GN: //components/metrics:library_support
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_metrics_library_support",
     srcs: [
         ":cronet_aml_third_party_metrics_proto_metrics_proto_gen",
@@ -9968,6 +9056,8 @@
         "components/metrics/library_support/histogram_manager.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libprotobuf-cpp-lite",
@@ -9976,60 +9066,8 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -10039,9 +9077,6 @@
     generated_headers: [
         "cronet_aml_third_party_metrics_proto_metrics_proto_gen_headers",
     ],
-    export_generated_headers: [
-        "cronet_aml_third_party_metrics_proto_metrics_proto_gen_headers",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -10085,27 +9120,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -10134,7 +9148,7 @@
 }
 
 // GN: //components/metrics:library_support__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_components_metrics_library_support__testing",
     srcs: [
         ":cronet_aml_third_party_metrics_proto_metrics_proto__testing_gen",
@@ -10150,60 +9164,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -10213,9 +9176,6 @@
     generated_headers: [
         "cronet_aml_third_party_metrics_proto_metrics_proto__testing_gen_headers",
     ],
-    export_generated_headers: [
-        "cronet_aml_third_party_metrics_proto_metrics_proto__testing_gen_headers",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -10259,27 +9219,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -10400,6 +9339,8 @@
         "components/prefs/writeable_pref_store.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
     ],
@@ -10407,60 +9348,8 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -10599,60 +9488,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -10761,6 +9599,55 @@
 cc_library_static {
     name: "cronet_aml_components_prefs_test_support__testing",
     srcs: [
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
+        ":cronet_aml_third_party_googletest_gmock__testing",
+        ":cronet_aml_third_party_googletest_gtest__testing",
         "components/prefs/mock_pref_change_callback.cc",
         "components/prefs/pref_store_observer_mock.cc",
         "components/prefs/pref_test_utils.cc",
@@ -10777,67 +9664,14 @@
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
         "cronet_aml_base_i18n__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_test_test_config__testing",
         "cronet_aml_base_test_test_support__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_components_prefs_prefs__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_ced_ced__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -10846,6 +9680,12 @@
         "cronet_aml_third_party_libxml_xml_reader__testing",
         "cronet_aml_third_party_modp_b64_modp_b64__testing",
     ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
+    export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -11023,6 +9863,8 @@
         "crypto/unexportable_key_metrics.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
     ],
@@ -11030,60 +9872,8 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -11210,58 +10000,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -11322,10 +10063,6 @@
             ],
         },
         android_arm: {
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-                "cronet_aml_third_party_ashmem_ashmem__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -11352,10 +10089,6 @@
             ],
         },
         android_arm64: {
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-                "cronet_aml_third_party_ashmem_ashmem__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -11384,10 +10117,6 @@
             ],
         },
         android_x86: {
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-                "cronet_aml_third_party_ashmem_ashmem__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -11414,10 +10143,6 @@
             ],
         },
         android_x86_64: {
-            static_libs: [
-                "cronet_aml_third_party_android_ndk_cpu_features__testing",
-                "cronet_aml_third_party_ashmem_ashmem__testing",
-            ],
             cflags: [
                 "-DANDROID",
                 "-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -11462,10 +10187,120 @@
     },
 }
 
+// GN: //crypto:test_support__testing
+cc_library_static {
+    name: "cronet_aml_crypto_test_support__testing",
+    srcs: [
+        "crypto/scoped_mock_unexportable_key_provider.cc",
+    ],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+    ],
+    static_libs: [
+        "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
+        "cronet_aml_base_base__testing",
+        "cronet_aml_base_base_static__testing",
+        "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
+        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
+        "cronet_aml_crypto_crypto__testing",
+        "cronet_aml_third_party_boringssl_boringssl__testing",
+        "cronet_aml_third_party_icu_icui18n__testing",
+        "cronet_aml_third_party_icu_icuuc_private__testing",
+        "cronet_aml_third_party_libevent_libevent__testing",
+        "cronet_aml_third_party_modp_b64_modp_b64__testing",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
+        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
+        "-DHAVE_SYS_UIO_H",
+        "-DNDEBUG",
+        "-DNO_UNWIND_TABLES",
+        "-DNVALGRIND",
+        "-DOFFICIAL_BUILD",
+        "-D_FORTIFY_SOURCE=2",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D__STDC_CONSTANT_MACROS",
+        "-D__STDC_FORMAT_MACROS",
+        "-Oz",
+        "-fdata-sections",
+        "-ffunction-sections",
+        "-fno-asynchronous-unwind-tables",
+        "-fno-unwind-tables",
+        "-fvisibility-inlines-hidden",
+        "-fvisibility=hidden",
+        "-g1",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "third_party/abseil-cpp/",
+        "third_party/boringssl/src/include/",
+    ],
+    cpp_std: "c++17",
+    ldflags: [
+        "-Wl,--as-needed",
+        "-Wl,--gc-sections",
+        "-Wl,--icf=all",
+        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
+        "-Wl,-wrap,asprintf",
+        "-Wl,-wrap,calloc",
+        "-Wl,-wrap,free",
+        "-Wl,-wrap,getcwd",
+        "-Wl,-wrap,malloc",
+        "-Wl,-wrap,malloc_usable_size",
+        "-Wl,-wrap,memalign",
+        "-Wl,-wrap,posix_memalign",
+        "-Wl,-wrap,pvalloc",
+        "-Wl,-wrap,realloc",
+        "-Wl,-wrap,realpath",
+        "-Wl,-wrap,strdup",
+        "-Wl,-wrap,strndup",
+        "-Wl,-wrap,valloc",
+        "-Wl,-wrap,vasprintf",
+    ],
+    target: {
+        android_arm: {
+            cflags: [
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+    },
+}
+
 // GN: //gn:default_deps
 cc_defaults {
     name: "cronet_aml_defaults",
     cflags: [
+        "-DBORINGSSL_SHARED_LIBRARY",
         "-DGOOGLE_PROTOBUF_NO_RTTI",
         "-Wno-ambiguous-reversed-operator",
         "-Wno-c++11-narrowing",
@@ -11486,6 +10321,7 @@
         "com.android.tethering",
     ],
     min_sdk_version: "29",
+    c_std: "gnu11",
     target: {
         android: {
             shared_libs: [
@@ -11700,6 +10536,7 @@
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java",
+        "components/cronet/android/java/src/org/chromium/net/impl/HeaderBlockImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NetworkExceptionImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NoOpLogger.java",
@@ -11977,6 +10814,7 @@
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java",
         "components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java",
+        "components/cronet/android/java/src/org/chromium/net/impl/HeaderBlockImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NetworkExceptionImpl.java",
         "components/cronet/android/java/src/org/chromium/net/impl/NoOpLogger.java",
@@ -12151,33 +10989,92 @@
     ],
 }
 
+// GN: //net/base/registry_controlled_domains:lookup_strings_test_sets__testing
+cc_genrule {
+    name: "cronet_aml_net_base_registry_controlled_domains_lookup_strings_test_sets__testing",
+    cmd: "$(location net/tools/dafsa/make_dafsa.py) $(location net/base/registry_controlled_domains/effective_tld_names.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names-inc.cc) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1-inc.cc) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2-inc.cc) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3-inc.cc) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4-inc.cc) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5-inc.cc) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6-inc.cc)",
+    out: [
+        "net/base/registry_controlled_domains/effective_tld_names-inc.cc",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest1-inc.cc",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest2-inc.cc",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest3-inc.cc",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest4-inc.cc",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest5-inc.cc",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest6-inc.cc",
+    ],
+    tool_files: [
+        "net/base/registry_controlled_domains/effective_tld_names.gperf",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest2.gperf",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest3.gperf",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest4.gperf",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest5.gperf",
+        "net/base/registry_controlled_domains/effective_tld_names_unittest6.gperf",
+        "net/tools/dafsa/make_dafsa.py",
+    ],
+    apex_available: [
+        "com.android.tethering",
+    ],
+}
+
 // GN: //net/base/registry_controlled_domains:registry_controlled_domains
 cc_genrule {
     name: "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
     cmd: "$(location net/tools/dafsa/make_dafsa.py) --reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6-reversed-inc.cc)",
@@ -12211,27 +11108,33 @@
     cmd: "$(location net/tools/dafsa/make_dafsa.py) --reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "&& " +
+         "python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6-reversed-inc.cc)",
@@ -12383,8 +11286,54 @@
     ],
 }
 
+// GN: //net:cronet_buildflags
+cc_genrule {
+    name: "cronet_aml_net_cronet_buildflags",
+    cmd: "echo '--flags CRONET_BUILD=\"true\"' | " +
+         "$(location build/write_buildflag_header.py) --output " +
+         "$(out) " +
+         "--rulename " +
+         "//net:cronet_buildflags " +
+         "--gen-dir " +
+         ". " +
+         "--definitions " +
+         "/dev/stdin",
+    out: [
+        "net/base/cronet_buildflags.h",
+    ],
+    tool_files: [
+        "build/write_buildflag_header.py",
+    ],
+    apex_available: [
+        "com.android.tethering",
+    ],
+}
+
+// GN: //net:cronet_buildflags__testing
+cc_genrule {
+    name: "cronet_aml_net_cronet_buildflags__testing",
+    cmd: "echo '--flags CRONET_BUILD=\"true\"' | " +
+         "$(location build/write_buildflag_header.py) --output " +
+         "$(out) " +
+         "--rulename " +
+         "//net:cronet_buildflags " +
+         "--gen-dir " +
+         ". " +
+         "--definitions " +
+         "/dev/stdin",
+    out: [
+        "net/base/cronet_buildflags.h",
+    ],
+    tool_files: [
+        "build/write_buildflag_header.py",
+    ],
+    apex_available: [
+        "com.android.tethering",
+    ],
+}
+
 // GN: //net/dns:dns
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_dns_dns",
     srcs: [
         "net/dns/address_info.cc",
@@ -12426,6 +11375,8 @@
         "net/dns/test_dns_config_service.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libz",
@@ -12434,68 +11385,12 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "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_dns_public_public",
-        "cronet_aml_net_net_deps",
-        "cronet_aml_net_net_public_deps",
         "cronet_aml_net_preload_decoder",
         "cronet_aml_net_third_party_quiche_quiche",
-        "cronet_aml_net_traffic_annotation_traffic_annotation",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_brotli_common",
         "cronet_aml_third_party_brotli_dec",
         "cronet_aml_third_party_icu_icui18n",
@@ -12505,6 +11400,18 @@
         "cronet_aml_third_party_protobuf_protobuf_lite",
         "cronet_aml_url_url",
     ],
+    generated_headers: [
+        "cronet_aml_base_debugging_buildflags",
+        "cronet_aml_base_logging_buildflags",
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
+        "cronet_aml_net_buildflags",
+        "cronet_aml_net_isolation_info_proto_gen_headers",
+        "cronet_aml_net_net_jni_headers",
+        "cronet_aml_net_net_nqe_proto_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen_headers",
+        "cronet_aml_url_buildflags",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -12554,27 +11461,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -12603,7 +11489,7 @@
 }
 
 // GN: //net/dns:dns__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_dns_dns__testing",
     srcs: [
         "net/dns/address_info.cc",
@@ -12653,68 +11539,13 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -12724,6 +11555,18 @@
         "cronet_aml_third_party_protobuf_protobuf_lite__testing",
         "cronet_aml_url_url__testing",
     ],
+    generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains__testing",
+        "cronet_aml_net_buildflags__testing",
+        "cronet_aml_net_isolation_info_proto__testing_gen_headers",
+        "cronet_aml_net_net_jni_headers__testing",
+        "cronet_aml_net_net_nqe_proto__testing_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -12773,27 +11616,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -12822,7 +11644,7 @@
 }
 
 // GN: //net/dns/public:public
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_dns_public_public",
     srcs: [
         "net/dns/public/dns_config_overrides.cc",
@@ -12835,6 +11657,8 @@
         "net/dns/public/util.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libz",
@@ -12843,67 +11667,12 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "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_deps",
-        "cronet_aml_net_net_public_deps",
         "cronet_aml_net_preload_decoder",
         "cronet_aml_net_third_party_quiche_quiche",
-        "cronet_aml_net_traffic_annotation_traffic_annotation",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_brotli_common",
         "cronet_aml_third_party_brotli_dec",
         "cronet_aml_third_party_icu_icui18n",
@@ -12913,6 +11682,18 @@
         "cronet_aml_third_party_protobuf_protobuf_lite",
         "cronet_aml_url_url",
     ],
+    generated_headers: [
+        "cronet_aml_base_debugging_buildflags",
+        "cronet_aml_base_logging_buildflags",
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
+        "cronet_aml_net_buildflags",
+        "cronet_aml_net_isolation_info_proto_gen_headers",
+        "cronet_aml_net_net_jni_headers",
+        "cronet_aml_net_net_nqe_proto_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen_headers",
+        "cronet_aml_url_buildflags",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -12962,27 +11743,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -13011,7 +11771,7 @@
 }
 
 // GN: //net/dns/public:public__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_dns_public_public__testing",
     srcs: [
         "net/dns/public/dns_config_overrides.cc",
@@ -13032,67 +11792,13 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -13102,6 +11808,18 @@
         "cronet_aml_third_party_protobuf_protobuf_lite__testing",
         "cronet_aml_url_url__testing",
     ],
+    generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains__testing",
+        "cronet_aml_net_buildflags__testing",
+        "cronet_aml_net_isolation_info_proto__testing_gen_headers",
+        "cronet_aml_net_net_jni_headers__testing",
+        "cronet_aml_net_net_nqe_proto__testing_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -13151,27 +11869,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -13199,13 +11896,13 @@
     },
 }
 
-// GN: //net/dns:test_support__testing
-cc_library_static {
-    name: "cronet_aml_net_dns_test_support__testing",
+// GN: //net/dns/public:tests__testing
+cc_object {
+    name: "cronet_aml_net_dns_public_tests__testing",
     srcs: [
-        "net/dns/dns_test_util.cc",
-        "net/dns/host_resolver_results_test_util.cc",
-        "net/dns/mock_host_resolver.cc",
+        "net/dns/public/dns_over_https_config_unittest.cc",
+        "net/dns/public/dns_over_https_server_config_unittest.cc",
+        "net/dns/public/doh_provider_entry_unittest.cc",
     ],
     shared_libs: [
         "libandroid",
@@ -13216,76 +11913,17 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -13293,6 +11931,9 @@
         "cronet_aml_third_party_protobuf_protobuf_lite__testing",
         "cronet_aml_url_url__testing",
     ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -13348,27 +11989,291 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
+    target: {
+        android_arm: {
+            cflags: [
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+    },
+}
+
+// GN: //net/dns:test_support__testing
+cc_object {
+    name: "cronet_aml_net_dns_test_support__testing",
+    srcs: [
+        "net/dns/dns_test_util.cc",
+        "net/dns/host_resolver_results_test_util.cc",
+        "net/dns/mock_host_resolver.cc",
     ],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+        "libz",
+    ],
+    static_libs: [
+        "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
+        "cronet_aml_base_base__testing",
+        "cronet_aml_base_base_static__testing",
+        "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
+        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
+        "cronet_aml_crypto_crypto__testing",
+        "cronet_aml_net_net__testing",
+        "cronet_aml_net_preload_decoder__testing",
+        "cronet_aml_net_third_party_quiche_quiche__testing",
+        "cronet_aml_net_uri_template__testing",
+        "cronet_aml_testing_gtest_gtest__testing",
+        "cronet_aml_third_party_boringssl_boringssl__testing",
+        "cronet_aml_third_party_brotli_common__testing",
+        "cronet_aml_third_party_brotli_dec__testing",
+        "cronet_aml_third_party_icu_icui18n__testing",
+        "cronet_aml_third_party_icu_icuuc_private__testing",
+        "cronet_aml_third_party_libevent_libevent__testing",
+        "cronet_aml_third_party_modp_b64_modp_b64__testing",
+        "cronet_aml_third_party_protobuf_protobuf_lite__testing",
+        "cronet_aml_url_url__testing",
+    ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
+        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
+        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
+        "-DGOOGLE_PROTOBUF_NO_RTTI",
+        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+        "-DGTEST_API_=",
+        "-DGTEST_HAS_ABSL=1",
+        "-DGTEST_HAS_POSIX_RE=0",
+        "-DGTEST_HAS_TR1_TUPLE=0",
+        "-DGTEST_LANG_CXX11=1",
+        "-DHAVE_PTHREAD",
+        "-DHAVE_SYS_UIO_H",
+        "-DNDEBUG",
+        "-DNO_UNWIND_TABLES",
+        "-DNVALGRIND",
+        "-DOFFICIAL_BUILD",
+        "-DUNIT_TEST",
+        "-D_FORTIFY_SOURCE=2",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D__STDC_CONSTANT_MACROS",
+        "-D__STDC_FORMAT_MACROS",
+        "-Oz",
+        "-fdata-sections",
+        "-ffunction-sections",
+        "-fno-asynchronous-unwind-tables",
+        "-fno-unwind-tables",
+        "-fvisibility-inlines-hidden",
+        "-fvisibility=hidden",
+        "-g1",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "net/third_party/quiche/overrides/",
+        "net/third_party/quiche/src/",
+        "net/third_party/quiche/src/quiche/common/platform/default/",
+        "third_party/abseil-cpp/",
+        "third_party/boringssl/src/include/",
+        "third_party/googletest/custom/",
+        "third_party/googletest/src/googlemock/include/",
+        "third_party/googletest/src/googletest/include/",
+        "third_party/protobuf/src/",
+    ],
+    cpp_std: "c++17",
+    target: {
+        android_arm: {
+            cflags: [
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+    },
+}
+
+// GN: //net/dns:tests__testing
+cc_object {
+    name: "cronet_aml_net_dns_tests__testing",
+    srcs: [
+        "net/dns/address_info_unittest.cc",
+        "net/dns/address_sorter_posix_unittest.cc",
+        "net/dns/address_sorter_unittest.cc",
+        "net/dns/context_host_resolver_unittest.cc",
+        "net/dns/dns_alias_utility_unittest.cc",
+        "net/dns/dns_client_unittest.cc",
+        "net/dns/dns_config_service_android_unittest.cc",
+        "net/dns/dns_config_service_unittest.cc",
+        "net/dns/dns_hosts_unittest.cc",
+        "net/dns/dns_query_unittest.cc",
+        "net/dns/dns_response_result_extractor_unittest.cc",
+        "net/dns/dns_response_unittest.cc",
+        "net/dns/dns_transaction_unittest.cc",
+        "net/dns/dns_udp_tracker_unittest.cc",
+        "net/dns/dns_util_unittest.cc",
+        "net/dns/host_cache_unittest.cc",
+        "net/dns/host_resolver_manager_unittest.cc",
+        "net/dns/https_record_rdata_unittest.cc",
+        "net/dns/httpssvc_metrics_unittest.cc",
+        "net/dns/mapped_host_resolver_unittest.cc",
+        "net/dns/nsswitch_reader_unittest.cc",
+        "net/dns/opt_record_rdata_unittest.cc",
+        "net/dns/record_parsed_unittest.cc",
+        "net/dns/record_rdata_unittest.cc",
+        "net/dns/resolve_context_unittest.cc",
+        "net/dns/serial_worker_unittest.cc",
+        "net/dns/system_dns_config_change_notifier_unittest.cc",
+    ],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+        "libz",
+    ],
+    static_libs: [
+        "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
+        "cronet_aml_base_base__testing",
+        "cronet_aml_base_base_static__testing",
+        "cronet_aml_base_i18n__testing",
+        "cronet_aml_base_test_test_config__testing",
+        "cronet_aml_base_test_test_support__testing",
+        "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
+        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
+        "cronet_aml_crypto_crypto__testing",
+        "cronet_aml_net_gtest_util__testing",
+        "cronet_aml_net_net__testing",
+        "cronet_aml_net_preload_decoder__testing",
+        "cronet_aml_net_test_support__testing",
+        "cronet_aml_net_third_party_quiche_quiche__testing",
+        "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
+        "cronet_aml_net_uri_template__testing",
+        "cronet_aml_testing_gtest_gtest__testing",
+        "cronet_aml_third_party_boringssl_boringssl__testing",
+        "cronet_aml_third_party_brotli_common__testing",
+        "cronet_aml_third_party_brotli_dec__testing",
+        "cronet_aml_third_party_ced_ced__testing",
+        "cronet_aml_third_party_icu_icui18n__testing",
+        "cronet_aml_third_party_icu_icuuc_private__testing",
+        "cronet_aml_third_party_libevent_libevent__testing",
+        "cronet_aml_third_party_libxml_libxml__testing",
+        "cronet_aml_third_party_libxml_libxml_utils__testing",
+        "cronet_aml_third_party_libxml_xml_reader__testing",
+        "cronet_aml_third_party_modp_b64_modp_b64__testing",
+        "cronet_aml_third_party_protobuf_protobuf_lite__testing",
+        "cronet_aml_url_url__testing",
+    ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
+        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
+        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
+        "-DGOOGLE_PROTOBUF_NO_RTTI",
+        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+        "-DGTEST_API_=",
+        "-DGTEST_HAS_ABSL=1",
+        "-DGTEST_HAS_POSIX_RE=0",
+        "-DGTEST_HAS_TR1_TUPLE=0",
+        "-DGTEST_LANG_CXX11=1",
+        "-DHAVE_PTHREAD",
+        "-DHAVE_SYS_UIO_H",
+        "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
+        "-DNDEBUG",
+        "-DNO_UNWIND_TABLES",
+        "-DNVALGRIND",
+        "-DOFFICIAL_BUILD",
+        "-DUNIT_TEST",
+        "-DUSE_CHROMIUM_ICU=1",
+        "-DUSE_REMOTE_TEST_SERVER",
+        "-DU_ENABLE_DYLOAD=0",
+        "-DU_ENABLE_RESOURCE_TRACING=0",
+        "-DU_ENABLE_TRACING=1",
+        "-DU_STATIC_IMPLEMENTATION",
+        "-DU_USING_ICU_NAMESPACE=0",
+        "-D_FORTIFY_SOURCE=2",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D__STDC_CONSTANT_MACROS",
+        "-D__STDC_FORMAT_MACROS",
+        "-Oz",
+        "-fdata-sections",
+        "-ffunction-sections",
+        "-fno-asynchronous-unwind-tables",
+        "-fno-unwind-tables",
+        "-fvisibility-inlines-hidden",
+        "-fvisibility=hidden",
+        "-g1",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "net/third_party/quiche/overrides/",
+        "net/third_party/quiche/src/",
+        "net/third_party/quiche/src/quiche/common/platform/default/",
+        "third_party/abseil-cpp/",
+        "third_party/boringssl/src/include/",
+        "third_party/ced/src/",
+        "third_party/googletest/custom/",
+        "third_party/googletest/src/googlemock/include/",
+        "third_party/googletest/src/googletest/include/",
+        "third_party/icu/source/common/",
+        "third_party/icu/source/i18n/",
+        "third_party/protobuf/src/",
+    ],
+    cpp_std: "c++17",
     target: {
         android_arm: {
             cflags: [
@@ -13419,6 +12324,55 @@
 cc_library_static {
     name: "cronet_aml_net_gtest_util__testing",
     srcs: [
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
+        ":cronet_aml_third_party_googletest_gmock__testing",
+        ":cronet_aml_third_party_googletest_gtest__testing",
         "net/test/scoped_disable_exit_on_dfatal.cc",
     ],
     shared_libs: [
@@ -13431,79 +12385,20 @@
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
         "cronet_aml_base_i18n__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_test_test_config__testing",
         "cronet_aml_base_test_test_support__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_ced_ced__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -13514,6 +12409,12 @@
         "cronet_aml_third_party_protobuf_protobuf_lite__testing",
         "cronet_aml_url_url__testing",
     ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
+    export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -13628,12 +12529,14 @@
 }
 
 // GN: //net/http:transport_security_state_generated_files
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_http_transport_security_state_generated_files",
     srcs: [
         "net/http/transport_security_state.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libz",
@@ -13642,69 +12545,12 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "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_dns_dns",
-        "cronet_aml_net_dns_public_public",
-        "cronet_aml_net_net_deps",
-        "cronet_aml_net_net_public_deps",
         "cronet_aml_net_preload_decoder",
         "cronet_aml_net_third_party_quiche_quiche",
-        "cronet_aml_net_traffic_annotation_traffic_annotation",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_brotli_common",
         "cronet_aml_third_party_brotli_dec",
         "cronet_aml_third_party_icu_icui18n",
@@ -13715,10 +12561,17 @@
         "cronet_aml_url_url",
     ],
     generated_headers: [
+        "cronet_aml_base_debugging_buildflags",
+        "cronet_aml_base_logging_buildflags",
         "cronet_aml_build_branding_buildflags",
-    ],
-    export_generated_headers: [
-        "cronet_aml_build_branding_buildflags",
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
+        "cronet_aml_net_buildflags",
+        "cronet_aml_net_isolation_info_proto_gen_headers",
+        "cronet_aml_net_net_jni_headers",
+        "cronet_aml_net_net_nqe_proto_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen_headers",
+        "cronet_aml_url_buildflags",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -13769,27 +12622,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -13818,7 +12650,7 @@
 }
 
 // GN: //net/http:transport_security_state_generated_files__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_http_transport_security_state_generated_files__testing",
     srcs: [
         "net/http/transport_security_state.cc",
@@ -13832,69 +12664,13 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -13905,10 +12681,17 @@
         "cronet_aml_url_url__testing",
     ],
     generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
         "cronet_aml_build_branding_buildflags__testing",
-    ],
-    export_generated_headers: [
-        "cronet_aml_build_branding_buildflags__testing",
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains__testing",
+        "cronet_aml_net_buildflags__testing",
+        "cronet_aml_net_isolation_info_proto__testing_gen_headers",
+        "cronet_aml_net_net_jni_headers__testing",
+        "cronet_aml_net_net_nqe_proto__testing_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -13959,27 +12742,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -14007,6 +12769,47 @@
     },
 }
 
+// GN: //net/http:transport_security_state_unittest_data__testing
+cc_genrule {
+    name: "cronet_aml_net_http_transport_security_state_unittest_data__testing",
+    tools: [
+        "cronet_aml_net_tools_transport_security_state_generator_transport_security_state_generator__testing",
+    ],
+    cmd: "$(location cronet_aml_net_tools_transport_security_state_generator_transport_security_state_generator__testing) " +
+         "$(location net/http/transport_security_state_static_unittest1.json) " +
+         "$(location net/http/transport_security_state_static_unittest.pins) " +
+         "$(location net/http/transport_security_state_static_unittest.template) " +
+         "$(location net/http/transport_security_state_static_unittest1.h) " +
+         "&& " +
+         "$(location cronet_aml_net_tools_transport_security_state_generator_transport_security_state_generator__testing) " +
+         "$(location net/http/transport_security_state_static_unittest2.json) " +
+         "$(location net/http/transport_security_state_static_unittest.pins) " +
+         "$(location net/http/transport_security_state_static_unittest.template) " +
+         "$(location net/http/transport_security_state_static_unittest2.h) " +
+         "&& " +
+         "$(location cronet_aml_net_tools_transport_security_state_generator_transport_security_state_generator__testing) " +
+         "$(location net/http/transport_security_state_static_unittest3.json) " +
+         "$(location net/http/transport_security_state_static_unittest.pins) " +
+         "$(location net/http/transport_security_state_static_unittest.template) " +
+         "$(location net/http/transport_security_state_static_unittest3.h)",
+    out: [
+        "net/http/transport_security_state_static_unittest1.h",
+        "net/http/transport_security_state_static_unittest2.h",
+        "net/http/transport_security_state_static_unittest3.h",
+    ],
+    tool_files: [
+        "build/gn_run_binary.py",
+        "net/http/transport_security_state_static_unittest.pins",
+        "net/http/transport_security_state_static_unittest.template",
+        "net/http/transport_security_state_static_unittest1.json",
+        "net/http/transport_security_state_static_unittest2.json",
+        "net/http/transport_security_state_static_unittest3.json",
+    ],
+    apex_available: [
+        "com.android.tethering",
+    ],
+}
+
 // GN: //net/http:transport_security_state_unittest_data_default__testing
 cc_genrule {
     name: "cronet_aml_net_http_transport_security_state_unittest_data_default__testing",
@@ -14032,52 +12835,6 @@
     ],
 }
 
-// GN: //net:ios_cronet_buildflags
-cc_genrule {
-    name: "cronet_aml_net_ios_cronet_buildflags",
-    cmd: "echo '--flags CRONET_BUILD=\"true\"' | " +
-         "$(location build/write_buildflag_header.py) --output " +
-         "$(out) " +
-         "--rulename " +
-         "//net:ios_cronet_buildflags " +
-         "--gen-dir " +
-         ". " +
-         "--definitions " +
-         "/dev/stdin",
-    out: [
-        "net/socket/ios_cronet_buildflags.h",
-    ],
-    tool_files: [
-        "build/write_buildflag_header.py",
-    ],
-    apex_available: [
-        "com.android.tethering",
-    ],
-}
-
-// GN: //net:ios_cronet_buildflags__testing
-cc_genrule {
-    name: "cronet_aml_net_ios_cronet_buildflags__testing",
-    cmd: "echo '--flags CRONET_BUILD=\"true\"' | " +
-         "$(location build/write_buildflag_header.py) --output " +
-         "$(out) " +
-         "--rulename " +
-         "//net:ios_cronet_buildflags " +
-         "--gen-dir " +
-         ". " +
-         "--definitions " +
-         "/dev/stdin",
-    out: [
-        "net/socket/ios_cronet_buildflags.h",
-    ],
-    tool_files: [
-        "build/write_buildflag_header.py",
-    ],
-    apex_available: [
-        "com.android.tethering",
-    ],
-}
-
 // GN: //net:isolation_info_proto__testing
 cc_genrule {
     name: "cronet_aml_net_isolation_info_proto__testing_gen",
@@ -14164,6 +12921,12 @@
 cc_library_static {
     name: "cronet_aml_net_net",
     srcs: [
+        ":cronet_aml_net_dns_dns",
+        ":cronet_aml_net_dns_public_public",
+        ":cronet_aml_net_http_transport_security_state_generated_files",
+        ":cronet_aml_net_net_deps",
+        ":cronet_aml_net_net_public_deps",
+        ":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",
@@ -14648,6 +13411,8 @@
         "net/url_request/websocket_handshake_userdata_key.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libz",
@@ -14656,70 +13421,12 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "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_dns_dns",
-        "cronet_aml_net_dns_public_public",
-        "cronet_aml_net_http_transport_security_state_generated_files",
-        "cronet_aml_net_net_deps",
-        "cronet_aml_net_net_public_deps",
         "cronet_aml_net_preload_decoder",
         "cronet_aml_net_third_party_quiche_quiche",
-        "cronet_aml_net_traffic_annotation_traffic_annotation",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_brotli_common",
         "cronet_aml_third_party_brotli_dec",
         "cronet_aml_third_party_icu_icui18n",
@@ -14730,12 +13437,32 @@
         "cronet_aml_url_url",
     ],
     generated_headers: [
+        "cronet_aml_base_debugging_buildflags",
+        "cronet_aml_base_logging_buildflags",
+        "cronet_aml_build_branding_buildflags",
         "cronet_aml_build_chromeos_buildflags",
-        "cronet_aml_net_ios_cronet_buildflags",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
+        "cronet_aml_net_buildflags",
+        "cronet_aml_net_cronet_buildflags",
+        "cronet_aml_net_isolation_info_proto_gen_headers",
+        "cronet_aml_net_net_jni_headers",
+        "cronet_aml_net_net_nqe_proto_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen_headers",
+        "cronet_aml_url_buildflags",
     ],
     export_generated_headers: [
+        "cronet_aml_base_debugging_buildflags",
+        "cronet_aml_base_logging_buildflags",
+        "cronet_aml_build_branding_buildflags",
         "cronet_aml_build_chromeos_buildflags",
-        "cronet_aml_net_ios_cronet_buildflags",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
+        "cronet_aml_net_buildflags",
+        "cronet_aml_net_cronet_buildflags",
+        "cronet_aml_net_isolation_info_proto_gen_headers",
+        "cronet_aml_net_net_jni_headers",
+        "cronet_aml_net_net_nqe_proto_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen_headers",
+        "cronet_aml_url_buildflags",
     ],
     export_static_lib_headers: [
         "cronet_aml_crypto_crypto",
@@ -14854,6 +13581,12 @@
 cc_library_static {
     name: "cronet_aml_net_net__testing",
     srcs: [
+        ":cronet_aml_net_dns_dns__testing",
+        ":cronet_aml_net_dns_public_public__testing",
+        ":cronet_aml_net_http_transport_security_state_generated_files__testing",
+        ":cronet_aml_net_net_deps__testing",
+        ":cronet_aml_net_net_public_deps__testing",
+        ":cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "net/android/android_http_util.cc",
         "net/android/cert_verify_result_android.cc",
         "net/android/gurl_utils.cc",
@@ -15346,70 +14079,13 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -15420,12 +14096,32 @@
         "cronet_aml_url_url__testing",
     ],
     generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_branding_buildflags__testing",
         "cronet_aml_build_chromeos_buildflags__testing",
-        "cronet_aml_net_ios_cronet_buildflags__testing",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains__testing",
+        "cronet_aml_net_buildflags__testing",
+        "cronet_aml_net_cronet_buildflags__testing",
+        "cronet_aml_net_isolation_info_proto__testing_gen_headers",
+        "cronet_aml_net_net_jni_headers__testing",
+        "cronet_aml_net_net_nqe_proto__testing_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
     ],
     export_generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_branding_buildflags__testing",
         "cronet_aml_build_chromeos_buildflags__testing",
-        "cronet_aml_net_ios_cronet_buildflags__testing",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains__testing",
+        "cronet_aml_net_buildflags__testing",
+        "cronet_aml_net_cronet_buildflags__testing",
+        "cronet_aml_net_isolation_info_proto__testing_gen_headers",
+        "cronet_aml_net_net_jni_headers__testing",
+        "cronet_aml_net_net_nqe_proto__testing_gen_headers",
+        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -15537,12 +14233,14 @@
 }
 
 // GN: //net:net_deps
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_net_deps",
     srcs: [
         ":cronet_aml_net_isolation_info_proto_gen",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libprotobuf-cpp-lite",
@@ -15552,61 +14250,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "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_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_brotli_common",
         "cronet_aml_third_party_brotli_dec",
         "cronet_aml_third_party_icu_icui18n",
@@ -15624,15 +14270,6 @@
         "cronet_aml_net_net_jni_headers",
         "cronet_aml_url_buildflags",
     ],
-    export_generated_headers: [
-        "cronet_aml_base_debugging_buildflags",
-        "cronet_aml_base_logging_buildflags",
-        "cronet_aml_build_chromeos_buildflags",
-        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
-        "cronet_aml_net_isolation_info_proto_gen_headers",
-        "cronet_aml_net_net_jni_headers",
-        "cronet_aml_url_buildflags",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -15679,27 +14316,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -15728,7 +14344,7 @@
 }
 
 // GN: //net:net_deps__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_net_deps__testing",
     srcs: [
         ":cronet_aml_net_isolation_info_proto__testing_gen",
@@ -15743,61 +14359,10 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_net_preload_decoder__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -15815,15 +14380,6 @@
         "cronet_aml_net_net_jni_headers__testing",
         "cronet_aml_url_buildflags__testing",
     ],
-    export_generated_headers: [
-        "cronet_aml_base_debugging_buildflags__testing",
-        "cronet_aml_base_logging_buildflags__testing",
-        "cronet_aml_build_chromeos_buildflags__testing",
-        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains__testing",
-        "cronet_aml_net_isolation_info_proto__testing_gen_headers",
-        "cronet_aml_net_net_jni_headers__testing",
-        "cronet_aml_url_buildflags__testing",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -15870,27 +14426,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -16211,13 +14746,15 @@
 }
 
 // GN: //net:net_public_deps
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_net_public_deps",
     srcs: [
         ":cronet_aml_net_net_nqe_proto_gen",
         ":cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libprotobuf-cpp-lite",
@@ -16227,64 +14764,11 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "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_traffic_annotation_traffic_annotation",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -16293,11 +14777,7 @@
         "cronet_aml_url_url",
     ],
     generated_headers: [
-        "cronet_aml_net_buildflags",
-        "cronet_aml_net_net_nqe_proto_gen_headers",
-        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen_headers",
-    ],
-    export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
         "cronet_aml_net_buildflags",
         "cronet_aml_net_net_nqe_proto_gen_headers",
         "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen_headers",
@@ -16348,27 +14828,6 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -16397,7 +14856,7 @@
 }
 
 // GN: //net:net_public_deps__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_net_public_deps__testing",
     srcs: [
         ":cronet_aml_net_net_nqe_proto__testing_gen",
@@ -16413,64 +14872,12 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -16479,11 +14886,7 @@
         "cronet_aml_url_url__testing",
     ],
     generated_headers: [
-        "cronet_aml_net_buildflags__testing",
-        "cronet_aml_net_net_nqe_proto__testing_gen_headers",
-        "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto__testing_gen_headers",
-    ],
-    export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
         "cronet_aml_net_buildflags__testing",
         "cronet_aml_net_net_nqe_proto__testing_gen_headers",
         "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto__testing_gen_headers",
@@ -16534,6 +14937,627 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
+    target: {
+        android_arm: {
+            cflags: [
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+    },
+}
+
+// GN: //net:net_test_jni_headers__testing
+cc_genrule {
+    name: "cronet_aml_net_net_test_jni_headers__testing",
+    srcs: [
+        "net/android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java",
+        "net/android/javatests/src/org/chromium/net/AndroidProxyConfigServiceTestUtil.java",
+        "net/test/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java",
+        "net/test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java",
+        "net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java",
+    ],
+    cmd: "$(location base/android/jni_generator/jni_generator.py) --ptr_type " +
+         "long " +
+         "--output_dir " +
+         "$(genDir)/net/net_test_jni_headers " +
+         "--includes " +
+         "base/android/jni_generator/jni_generator_helper.h " +
+         "--use_proxy_hash " +
+         "--output_name " +
+         "AndroidKeyStoreTestUtil_jni.h " +
+         "--output_name " +
+         "AndroidProxyConfigServiceTestUtil_jni.h " +
+         "--output_name " +
+         "AndroidNetworkLibraryTestUtil_jni.h " +
+         "--output_name " +
+         "DummySpnegoAuthenticator_jni.h " +
+         "--output_name " +
+         "EmbeddedTestServerImpl_jni.h " +
+         "--input_file " +
+         "$(location net/android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java) " +
+         "--input_file " +
+         "$(location net/android/javatests/src/org/chromium/net/AndroidProxyConfigServiceTestUtil.java) " +
+         "--input_file " +
+         "$(location net/test/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java) " +
+         "--input_file " +
+         "$(location net/test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java) " +
+         "--input_file " +
+         "$(location net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java)",
+    out: [
+        "net/net_test_jni_headers/AndroidKeyStoreTestUtil_jni.h",
+        "net/net_test_jni_headers/AndroidNetworkLibraryTestUtil_jni.h",
+        "net/net_test_jni_headers/AndroidProxyConfigServiceTestUtil_jni.h",
+        "net/net_test_jni_headers/DummySpnegoAuthenticator_jni.h",
+        "net/net_test_jni_headers/EmbeddedTestServerImpl_jni.h",
+    ],
+    tool_files: [
+        "base/android/jni_generator/android_jar.classes",
+        "base/android/jni_generator/jni_generator.py",
+        "build/android/gyp/util/__init__.py",
+        "build/android/gyp/util/build_utils.py",
+        "build/gn_helpers.py",
+    ],
+    apex_available: [
+        "com.android.tethering",
+    ],
+}
+
+// GN: //net:net_unittests__library__testing
+cc_library_shared {
+    name: "cronet_aml_net_net_unittests__library__testing",
+    srcs: [
+        ":cronet_aml_buildtools_third_party_libc___libc____testing",
+        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi__testing",
+        ":cronet_aml_net_dns_public_tests__testing",
+        ":cronet_aml_net_dns_tests__testing",
+        ":cronet_aml_net_quic_test_flags_utils__testing",
+        ":cronet_aml_net_quic_test_tools__testing",
+        ":cronet_aml_net_simple_quic_tools__testing",
+        ":cronet_aml_net_spdy_test_tools__testing",
+        ":cronet_aml_net_third_party_quiche_quiche_tests__testing",
+        ":cronet_aml_net_tools_huffman_trie_huffman_trie_generator_sources__testing",
+        ":cronet_aml_testing_android_native_test_native_test_native_code__testing",
+        ":cronet_aml_testing_android_native_test_native_test_support__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
+        ":cronet_aml_third_party_googletest_gmock__testing",
+        ":cronet_aml_third_party_googletest_gtest__testing",
+        "net/android/dummy_spnego_authenticator.cc",
+        "net/android/http_auth_negotiate_android_unittest.cc",
+        "net/android/network_change_notifier_android_unittest.cc",
+        "net/android/network_library_unittest.cc",
+        "net/android/traffic_stats_unittest.cc",
+        "net/base/address_family_unittest.cc",
+        "net/base/address_list_unittest.cc",
+        "net/base/address_tracker_linux_unittest.cc",
+        "net/base/backoff_entry_serializer_unittest.cc",
+        "net/base/backoff_entry_unittest.cc",
+        "net/base/chunked_upload_data_stream_unittest.cc",
+        "net/base/data_url_unittest.cc",
+        "net/base/datagram_buffer_unittest.cc",
+        "net/base/elements_upload_data_stream_unittest.cc",
+        "net/base/expiring_cache_unittest.cc",
+        "net/base/file_stream_unittest.cc",
+        "net/base/host_mapping_rules_unittest.cc",
+        "net/base/host_port_pair_unittest.cc",
+        "net/base/interval_test.cc",
+        "net/base/ip_address_unittest.cc",
+        "net/base/ip_endpoint_unittest.cc",
+        "net/base/isolation_info_unittest.cc",
+        "net/base/lookup_string_in_fixed_set_unittest.cc",
+        "net/base/mime_sniffer_unittest.cc",
+        "net/base/mime_util_unittest.cc",
+        "net/base/net_errors_unittest.cc",
+        "net/base/net_string_util_unittest.cc",
+        "net/base/network_activity_monitor_unittest.cc",
+        "net/base/network_anonymization_key_unittest.cc",
+        "net/base/network_change_notifier_posix_unittest.cc",
+        "net/base/network_change_notifier_unittest.cc",
+        "net/base/network_delegate_unittest.cc",
+        "net/base/network_interfaces_getifaddrs_unittest.cc",
+        "net/base/network_interfaces_linux_unittest.cc",
+        "net/base/network_interfaces_unittest.cc",
+        "net/base/network_isolation_key_unittest.cc",
+        "net/base/parse_number_unittest.cc",
+        "net/base/port_util_unittest.cc",
+        "net/base/prioritized_dispatcher_unittest.cc",
+        "net/base/prioritized_task_runner_unittest.cc",
+        "net/base/priority_queue_unittest.cc",
+        "net/base/proxy_server_unittest.cc",
+        "net/base/proxy_string_util_unittest.cc",
+        "net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc",
+        "net/base/scheme_host_port_matcher_rule_unittest.cc",
+        "net/base/scheme_host_port_matcher_unittest.cc",
+        "net/base/schemeful_site_unittest.cc",
+        "net/base/sockaddr_util_posix_unittest.cc",
+        "net/base/test_completion_callback_unittest.cc",
+        "net/base/test_proxy_delegate.cc",
+        "net/base/upload_bytes_element_reader_unittest.cc",
+        "net/base/upload_file_element_reader_unittest.cc",
+        "net/cert/caching_cert_verifier_unittest.cc",
+        "net/cert/cert_and_ct_verifier_unittest.cc",
+        "net/cert/cert_verifier_unittest.cc",
+        "net/cert/cert_verify_proc_android_unittest.cc",
+        "net/cert/cert_verify_proc_builtin_unittest.cc",
+        "net/cert/cert_verify_proc_unittest.cc",
+        "net/cert/coalescing_cert_verifier_unittest.cc",
+        "net/cert/crl_set_unittest.cc",
+        "net/cert/ct_log_response_parser_unittest.cc",
+        "net/cert/ct_log_verifier_unittest.cc",
+        "net/cert/ct_objects_extractor_unittest.cc",
+        "net/cert/ct_serialization_unittest.cc",
+        "net/cert/ev_root_ca_metadata_unittest.cc",
+        "net/cert/internal/cert_issuer_source_aia_unittest.cc",
+        "net/cert/internal/cert_issuer_source_sync_unittest.cc",
+        "net/cert/internal/crl_unittest.cc",
+        "net/cert/internal/general_names_unittest.cc",
+        "net/cert/internal/revocation_checker_unittest.cc",
+        "net/cert/internal/revocation_util_unittest.cc",
+        "net/cert/internal/system_trust_store_unittest.cc",
+        "net/cert/known_roots_unittest.cc",
+        "net/cert/merkle_audit_proof_unittest.cc",
+        "net/cert/merkle_tree_leaf_unittest.cc",
+        "net/cert/multi_log_ct_verifier_unittest.cc",
+        "net/cert/multi_threaded_cert_verifier_unittest.cc",
+        "net/cert/pem_unittest.cc",
+        "net/cert/pki/cert_issuer_source_static_unittest.cc",
+        "net/cert/pki/certificate_policies_unittest.cc",
+        "net/cert/pki/extended_key_usage_unittest.cc",
+        "net/cert/pki/name_constraints_unittest.cc",
+        "net/cert/pki/nist_pkits_unittest.cc",
+        "net/cert/pki/ocsp_unittest.cc",
+        "net/cert/pki/parse_certificate_unittest.cc",
+        "net/cert/pki/parse_name_unittest.cc",
+        "net/cert/pki/parsed_certificate_unittest.cc",
+        "net/cert/pki/path_builder_pkits_unittest.cc",
+        "net/cert/pki/path_builder_unittest.cc",
+        "net/cert/pki/path_builder_verify_certificate_chain_unittest.cc",
+        "net/cert/pki/signature_algorithm_unittest.cc",
+        "net/cert/pki/simple_path_builder_delegate_unittest.cc",
+        "net/cert/pki/string_util_unittest.cc",
+        "net/cert/pki/test_helpers.cc",
+        "net/cert/pki/trust_store_collection_unittest.cc",
+        "net/cert/pki/verify_certificate_chain_pkits_unittest.cc",
+        "net/cert/pki/verify_certificate_chain_unittest.cc",
+        "net/cert/pki/verify_name_match_unittest.cc",
+        "net/cert/pki/verify_signed_data_unittest.cc",
+        "net/cert/signed_certificate_timestamp_unittest.cc",
+        "net/cert/symantec_certs_unittest.cc",
+        "net/cert/test_root_certs_unittest.cc",
+        "net/cert/x509_cert_types_unittest.cc",
+        "net/cert/x509_util_unittest.cc",
+        "net/cert_net/cert_net_fetcher_url_request_unittest.cc",
+        "net/cookies/canonical_cookie_unittest.cc",
+        "net/cookies/cookie_constants_unittest.cc",
+        "net/cookies/cookie_deletion_info_unittest.cc",
+        "net/cookies/cookie_inclusion_status_unittest.cc",
+        "net/cookies/cookie_monster_unittest.cc",
+        "net/cookies/cookie_options_unittest.cc",
+        "net/cookies/cookie_partition_key_collection_unittest.cc",
+        "net/cookies/cookie_partition_key_unittest.cc",
+        "net/cookies/cookie_util_unittest.cc",
+        "net/cookies/parsed_cookie_unittest.cc",
+        "net/cookies/site_for_cookies_unittest.cc",
+        "net/cookies/static_cookie_policy_unittest.cc",
+        "net/der/encode_values_unittest.cc",
+        "net/der/input_unittest.cc",
+        "net/der/parse_values_unittest.cc",
+        "net/der/parser_unittest.cc",
+        "net/disk_cache/backend_cleanup_tracker_unittest.cc",
+        "net/disk_cache/backend_unittest.cc",
+        "net/disk_cache/blockfile/addr_unittest.cc",
+        "net/disk_cache/blockfile/bitmap_unittest.cc",
+        "net/disk_cache/blockfile/block_files_unittest.cc",
+        "net/disk_cache/blockfile/mapped_file_unittest.cc",
+        "net/disk_cache/blockfile/stats_unittest.cc",
+        "net/disk_cache/blockfile/storage_block_unittest.cc",
+        "net/disk_cache/cache_util_unittest.cc",
+        "net/disk_cache/entry_unittest.cc",
+        "net/disk_cache/simple/simple_file_enumerator_unittest.cc",
+        "net/disk_cache/simple/simple_file_tracker_unittest.cc",
+        "net/disk_cache/simple/simple_index_file_unittest.cc",
+        "net/disk_cache/simple/simple_index_unittest.cc",
+        "net/disk_cache/simple/simple_test_util.cc",
+        "net/disk_cache/simple/simple_util_unittest.cc",
+        "net/disk_cache/simple/simple_version_upgrade_unittest.cc",
+        "net/filter/brotli_source_stream_unittest.cc",
+        "net/filter/filter_source_stream_unittest.cc",
+        "net/filter/gzip_source_stream_unittest.cc",
+        "net/first_party_sets/addition_overlaps_union_find_unittest.cc",
+        "net/first_party_sets/first_party_sets_cache_filter_unittest.cc",
+        "net/first_party_sets/first_party_sets_context_config_unittest.cc",
+        "net/first_party_sets/global_first_party_sets_unittest.cc",
+        "net/http/alternative_service_unittest.cc",
+        "net/http/bidirectional_stream_unittest.cc",
+        "net/http/broken_alternative_services_unittest.cc",
+        "net/http/http_auth_cache_unittest.cc",
+        "net/http/http_auth_challenge_tokenizer_unittest.cc",
+        "net/http/http_auth_controller_unittest.cc",
+        "net/http/http_auth_filter_unittest.cc",
+        "net/http/http_auth_handler_basic_unittest.cc",
+        "net/http/http_auth_handler_digest_unittest.cc",
+        "net/http/http_auth_handler_factory_unittest.cc",
+        "net/http/http_auth_handler_mock.cc",
+        "net/http/http_auth_handler_negotiate_unittest.cc",
+        "net/http/http_auth_handler_ntlm_portable_unittest.cc",
+        "net/http/http_auth_handler_unittest.cc",
+        "net/http/http_auth_multi_round_parse_unittest.cc",
+        "net/http/http_auth_preferences_unittest.cc",
+        "net/http/http_auth_unittest.cc",
+        "net/http/http_basic_state_unittest.cc",
+        "net/http/http_byte_range_unittest.cc",
+        "net/http/http_cache_lookup_manager_unittest.cc",
+        "net/http/http_cache_unittest.cc",
+        "net/http/http_cache_writers_unittest.cc",
+        "net/http/http_chunked_decoder_unittest.cc",
+        "net/http/http_content_disposition_unittest.cc",
+        "net/http/http_log_util_unittest.cc",
+        "net/http/http_network_layer_unittest.cc",
+        "net/http/http_network_transaction_unittest.cc",
+        "net/http/http_proxy_client_socket_unittest.cc",
+        "net/http/http_proxy_connect_job_unittest.cc",
+        "net/http/http_request_headers_unittest.cc",
+        "net/http/http_request_info_unittest.cc",
+        "net/http/http_response_body_drainer_unittest.cc",
+        "net/http/http_response_headers_unittest.cc",
+        "net/http/http_response_info_unittest.cc",
+        "net/http/http_security_headers_unittest.cc",
+        "net/http/http_server_properties_manager_unittest.cc",
+        "net/http/http_server_properties_unittest.cc",
+        "net/http/http_status_code_unittest.cc",
+        "net/http/http_stream_factory_job_controller_unittest.cc",
+        "net/http/http_stream_factory_unittest.cc",
+        "net/http/http_stream_parser_unittest.cc",
+        "net/http/http_stream_request_unittest.cc",
+        "net/http/http_util_unittest.cc",
+        "net/http/http_vary_data_unittest.cc",
+        "net/http/mock_allow_http_auth_preferences.cc",
+        "net/http/test_upload_data_stream_not_allow_http1.cc",
+        "net/http/transport_security_persister_unittest.cc",
+        "net/http/transport_security_state_unittest.cc",
+        "net/http/url_security_manager_unittest.cc",
+        "net/http/webfonts_histogram_unittest.cc",
+        "net/log/file_net_log_observer_unittest.cc",
+        "net/log/net_log_capture_mode_unittest.cc",
+        "net/log/net_log_unittest.cc",
+        "net/log/net_log_util_unittest.cc",
+        "net/log/net_log_values_unittest.cc",
+        "net/network_error_logging/mock_persistent_nel_store_unittest.cc",
+        "net/network_error_logging/network_error_logging_service_unittest.cc",
+        "net/nqe/effective_connection_type_unittest.cc",
+        "net/nqe/event_creator_unittest.cc",
+        "net/nqe/network_id_unittest.cc",
+        "net/nqe/network_qualities_prefs_manager_unittest.cc",
+        "net/nqe/network_quality_estimator_params_unittest.cc",
+        "net/nqe/network_quality_estimator_unittest.cc",
+        "net/nqe/network_quality_estimator_util_unittest.cc",
+        "net/nqe/network_quality_store_unittest.cc",
+        "net/nqe/observation_buffer_unittest.cc",
+        "net/nqe/socket_watcher_unittest.cc",
+        "net/nqe/throughput_analyzer_unittest.cc",
+        "net/ntlm/ntlm_buffer_reader_unittest.cc",
+        "net/ntlm/ntlm_buffer_writer_unittest.cc",
+        "net/ntlm/ntlm_client_unittest.cc",
+        "net/ntlm/ntlm_unittest.cc",
+        "net/proxy_resolution/configured_proxy_resolution_service_unittest.cc",
+        "net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc",
+        "net/proxy_resolution/network_delegate_error_observer_unittest.cc",
+        "net/proxy_resolution/pac_file_decider_unittest.cc",
+        "net/proxy_resolution/pac_file_fetcher_impl_unittest.cc",
+        "net/proxy_resolution/proxy_bypass_rules_unittest.cc",
+        "net/proxy_resolution/proxy_config_service_android_unittest.cc",
+        "net/proxy_resolution/proxy_config_unittest.cc",
+        "net/proxy_resolution/proxy_info_unittest.cc",
+        "net/proxy_resolution/proxy_list_unittest.cc",
+        "net/quic/bidirectional_stream_quic_impl_unittest.cc",
+        "net/quic/crypto/proof_test_chromium.cc",
+        "net/quic/crypto/proof_verifier_chromium_test.cc",
+        "net/quic/dedicated_web_transport_http3_client_test.cc",
+        "net/quic/mock_quic_data.cc",
+        "net/quic/network_connection_unittest.cc",
+        "net/quic/platform/impl/quic_chromium_clock_test.cc",
+        "net/quic/properties_based_quic_server_info_test.cc",
+        "net/quic/quic_address_mismatch_test.cc",
+        "net/quic/quic_chromium_alarm_factory_test.cc",
+        "net/quic/quic_chromium_client_session_peer.cc",
+        "net/quic/quic_chromium_client_session_test.cc",
+        "net/quic/quic_chromium_client_stream_test.cc",
+        "net/quic/quic_chromium_connection_helper_test.cc",
+        "net/quic/quic_clock_skew_detector_test.cc",
+        "net/quic/quic_end_to_end_unittest.cc",
+        "net/quic/quic_http_stream_test.cc",
+        "net/quic/quic_http_utils_test.cc",
+        "net/quic/quic_network_transaction_unittest.cc",
+        "net/quic/quic_proxy_client_socket_unittest.cc",
+        "net/quic/quic_stream_factory_peer.cc",
+        "net/quic/quic_stream_factory_test.cc",
+        "net/quic/quic_test_packet_maker.cc",
+        "net/quic/set_quic_flag_test.cc",
+        "net/quic/test_quic_crypto_client_config_handle.cc",
+        "net/reporting/mock_persistent_reporting_store_unittest.cc",
+        "net/reporting/reporting_browsing_data_remover_unittest.cc",
+        "net/reporting/reporting_cache_unittest.cc",
+        "net/reporting/reporting_delivery_agent_unittest.cc",
+        "net/reporting/reporting_endpoint_manager_unittest.cc",
+        "net/reporting/reporting_garbage_collector_unittest.cc",
+        "net/reporting/reporting_header_parser_unittest.cc",
+        "net/reporting/reporting_network_change_observer_unittest.cc",
+        "net/reporting/reporting_service_unittest.cc",
+        "net/reporting/reporting_uploader_unittest.cc",
+        "net/socket/client_socket_pool_base_unittest.cc",
+        "net/socket/client_socket_pool_unittest.cc",
+        "net/socket/connect_job_factory_unittest.cc",
+        "net/socket/connect_job_test_util.cc",
+        "net/socket/connect_job_unittest.cc",
+        "net/socket/mock_client_socket_pool_manager.cc",
+        "net/socket/sequenced_socket_data_unittest.cc",
+        "net/socket/socket_bio_adapter_unittest.cc",
+        "net/socket/socket_tag_unittest.cc",
+        "net/socket/socks5_client_socket_unittest.cc",
+        "net/socket/socks_client_socket_unittest.cc",
+        "net/socket/socks_connect_job_unittest.cc",
+        "net/socket/ssl_client_socket_unittest.cc",
+        "net/socket/ssl_connect_job_unittest.cc",
+        "net/socket/ssl_server_socket_unittest.cc",
+        "net/socket/tcp_client_socket_unittest.cc",
+        "net/socket/tcp_server_socket_unittest.cc",
+        "net/socket/tcp_socket_unittest.cc",
+        "net/socket/transport_client_socket_pool_test_util.cc",
+        "net/socket/transport_client_socket_pool_unittest.cc",
+        "net/socket/transport_client_socket_unittest.cc",
+        "net/socket/transport_connect_job_unittest.cc",
+        "net/socket/udp_socket_unittest.cc",
+        "net/socket/unix_domain_client_socket_posix_unittest.cc",
+        "net/socket/unix_domain_server_socket_posix_unittest.cc",
+        "net/socket/websocket_endpoint_lock_manager_unittest.cc",
+        "net/socket/websocket_transport_client_socket_pool_unittest.cc",
+        "net/spdy/alps_decoder_test.cc",
+        "net/spdy/bidirectional_stream_spdy_impl_unittest.cc",
+        "net/spdy/buffered_spdy_framer_unittest.cc",
+        "net/spdy/fuzzing/hpack_fuzz_util_test.cc",
+        "net/spdy/header_coalescer_test.cc",
+        "net/spdy/http2_priority_dependencies_unittest.cc",
+        "net/spdy/http2_push_promise_index_test.cc",
+        "net/spdy/spdy_buffer_unittest.cc",
+        "net/spdy/spdy_http_stream_unittest.cc",
+        "net/spdy/spdy_http_utils_unittest.cc",
+        "net/spdy/spdy_log_util_unittest.cc",
+        "net/spdy/spdy_network_transaction_unittest.cc",
+        "net/spdy/spdy_proxy_client_socket_unittest.cc",
+        "net/spdy/spdy_read_queue_unittest.cc",
+        "net/spdy/spdy_session_pool_unittest.cc",
+        "net/spdy/spdy_session_test_util.cc",
+        "net/spdy/spdy_session_unittest.cc",
+        "net/spdy/spdy_stream_test_util.cc",
+        "net/spdy/spdy_stream_unittest.cc",
+        "net/spdy/spdy_write_queue_unittest.cc",
+        "net/ssl/client_cert_identity_unittest.cc",
+        "net/ssl/ssl_cipher_suite_names_unittest.cc",
+        "net/ssl/ssl_client_auth_cache_unittest.cc",
+        "net/ssl/ssl_client_session_cache_unittest.cc",
+        "net/ssl/ssl_config_service_unittest.cc",
+        "net/ssl/ssl_config_unittest.cc",
+        "net/ssl/ssl_connection_status_flags_unittest.cc",
+        "net/ssl/ssl_platform_key_android_unittest.cc",
+        "net/ssl/ssl_platform_key_util_unittest.cc",
+        "net/test/embedded_test_server/embedded_test_server_unittest.cc",
+        "net/test/embedded_test_server/http_request_unittest.cc",
+        "net/test/embedded_test_server/http_response_unittest.cc",
+        "net/test/run_all_unittests.cc",
+        "net/third_party/uri_template/uri_template_test.cc",
+        "net/tools/content_decoder_tool/content_decoder_tool.cc",
+        "net/tools/content_decoder_tool/content_decoder_tool_unittest.cc",
+        "net/tools/quic/quic_simple_client_test.cc",
+        "net/tools/tld_cleanup/tld_cleanup_util_unittest.cc",
+        "net/url_request/http_with_dns_over_https_unittest.cc",
+        "net/url_request/redirect_info_unittest.cc",
+        "net/url_request/redirect_util_unittest.cc",
+        "net/url_request/report_sender_unittest.cc",
+        "net/url_request/url_request_context_builder_unittest.cc",
+        "net/url_request/url_request_filter_unittest.cc",
+        "net/url_request/url_request_http_job_unittest.cc",
+        "net/url_request/url_request_job_factory_unittest.cc",
+        "net/url_request/url_request_quic_unittest.cc",
+        "net/url_request/url_request_throttler_simulation_unittest.cc",
+        "net/url_request/url_request_throttler_test_support.cc",
+        "net/url_request/url_request_throttler_unittest.cc",
+        "net/url_request/url_request_unittest.cc",
+        "net/url_request/view_cache_helper_unittest.cc",
+    ],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+        "libz",
+    ],
+    static_libs: [
+        "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
+        "cronet_aml_base_base__testing",
+        "cronet_aml_base_base_static__testing",
+        "cronet_aml_base_i18n__testing",
+        "cronet_aml_base_test_test_config__testing",
+        "cronet_aml_base_test_test_support__testing",
+        "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
+        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
+        "cronet_aml_crypto_crypto__testing",
+        "cronet_aml_crypto_test_support__testing",
+        "cronet_aml_net_gtest_util__testing",
+        "cronet_aml_net_net__testing",
+        "cronet_aml_net_preload_decoder__testing",
+        "cronet_aml_net_test_support__testing",
+        "cronet_aml_net_third_party_quiche_quiche__testing",
+        "cronet_aml_net_third_party_quiche_quiche_test_support__testing",
+        "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
+        "cronet_aml_net_uri_template__testing",
+        "cronet_aml_testing_gtest_gtest__testing",
+        "cronet_aml_third_party_boringssl_boringssl__testing",
+        "cronet_aml_third_party_brotli_common__testing",
+        "cronet_aml_third_party_brotli_dec__testing",
+        "cronet_aml_third_party_ced_ced__testing",
+        "cronet_aml_third_party_icu_icui18n__testing",
+        "cronet_aml_third_party_icu_icuuc_private__testing",
+        "cronet_aml_third_party_libevent_libevent__testing",
+        "cronet_aml_third_party_libxml_libxml__testing",
+        "cronet_aml_third_party_libxml_libxml_utils__testing",
+        "cronet_aml_third_party_libxml_xml_reader__testing",
+        "cronet_aml_third_party_modp_b64_modp_b64__testing",
+        "cronet_aml_third_party_protobuf_protobuf_lite__testing",
+        "cronet_aml_url_url__testing",
+    ],
+    generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_net_base_registry_controlled_domains_lookup_strings_test_sets__testing",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains__testing",
+        "cronet_aml_net_http_transport_security_state_unittest_data__testing",
+        "cronet_aml_net_http_transport_security_state_unittest_data_default__testing",
+        "cronet_aml_net_net_test_jni_headers__testing",
+        "cronet_aml_testing_android_native_test_native_test_jni_headers__testing",
+        "cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
+    ],
+    export_generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_net_base_registry_controlled_domains_lookup_strings_test_sets__testing",
+        "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains__testing",
+        "cronet_aml_net_http_transport_security_state_unittest_data__testing",
+        "cronet_aml_net_http_transport_security_state_unittest_data_default__testing",
+        "cronet_aml_net_net_test_jni_headers__testing",
+        "cronet_aml_testing_android_native_test_native_test_jni_headers__testing",
+        "cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen_headers",
+        "cronet_aml_url_buildflags__testing",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
+        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
+        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
+        "-DGOOGLE_PROTOBUF_NO_RTTI",
+        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+        "-DGTEST_API_=",
+        "-DGTEST_HAS_ABSL=1",
+        "-DGTEST_HAS_POSIX_RE=0",
+        "-DGTEST_HAS_TR1_TUPLE=0",
+        "-DGTEST_LANG_CXX11=1",
+        "-DHAVE_PTHREAD",
+        "-DHAVE_SYS_UIO_H",
+        "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
+        "-DNDEBUG",
+        "-DNO_UNWIND_TABLES",
+        "-DNVALGRIND",
+        "-DOFFICIAL_BUILD",
+        "-DUNIT_TEST",
+        "-DUSE_CHROMIUM_ICU=1",
+        "-DUSE_REMOTE_TEST_SERVER",
+        "-DU_ENABLE_DYLOAD=0",
+        "-DU_ENABLE_RESOURCE_TRACING=0",
+        "-DU_ENABLE_TRACING=1",
+        "-DU_STATIC_IMPLEMENTATION",
+        "-DU_USING_ICU_NAMESPACE=0",
+        "-D_FORTIFY_SOURCE=2",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D__STDC_CONSTANT_MACROS",
+        "-D__STDC_FORMAT_MACROS",
+        "-Oz",
+        "-fdata-sections",
+        "-ffunction-sections",
+        "-fno-asynchronous-unwind-tables",
+        "-fno-unwind-tables",
+        "-fvisibility-inlines-hidden",
+        "-fvisibility=hidden",
+        "-g1",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "net/third_party/quiche/overrides/",
+        "net/third_party/quiche/src/",
+        "net/third_party/quiche/src/quiche/common/platform/default/",
+        "third_party/abseil-cpp/",
+        "third_party/boringssl/src/include/",
+        "third_party/ced/src/",
+        "third_party/googletest/custom/",
+        "third_party/googletest/src/googlemock/include/",
+        "third_party/googletest/src/googletest/include/",
+        "third_party/icu/source/common/",
+        "third_party/icu/source/i18n/",
+        "third_party/protobuf/src/",
+    ],
+    cpp_std: "c++17",
     ldflags: [
         "-Wl,--as-needed",
         "-Wl,--gc-sections",
@@ -16555,6 +15579,7 @@
         "-Wl,-wrap,valloc",
         "-Wl,-wrap,vasprintf",
     ],
+    stem: "libnet_unittests__library",
     target: {
         android_arm: {
             cflags: [
@@ -16589,6 +15614,8 @@
         "net/extras/preload_data/decoder.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
     ],
@@ -16596,60 +15623,8 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -16755,60 +15730,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -16901,7 +15825,7 @@
 }
 
 // GN: //net:quic_test_flags_utils__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_quic_test_flags_utils__testing",
     srcs: [
         "net/quic/platform/impl/quic_test_flags_utils.cc",
@@ -16915,71 +15839,14 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -17035,27 +15902,156 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
+    target: {
+        android_arm: {
+            cflags: [
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+    },
+}
+
+// GN: //net:quic_test_tools__testing
+cc_object {
+    name: "cronet_aml_net_quic_test_tools__testing",
+    srcs: [
+        ":cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen",
+        "net/quic/crypto_test_utils_chromium.cc",
+        "net/quic/mock_crypto_client_stream.cc",
+        "net/quic/mock_crypto_client_stream_factory.cc",
+        "net/quic/mock_decrypter.cc",
+        "net/quic/mock_encrypter.cc",
+        "net/quic/mock_quic_context.cc",
+        "net/quic/test_task_runner.cc",
     ],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+        "libprotobuf-cpp-lite",
+        "libz",
+    ],
+    static_libs: [
+        "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
+        "cronet_aml_base_base__testing",
+        "cronet_aml_base_base_static__testing",
+        "cronet_aml_base_i18n__testing",
+        "cronet_aml_base_test_test_config__testing",
+        "cronet_aml_base_test_test_support__testing",
+        "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
+        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
+        "cronet_aml_crypto_crypto__testing",
+        "cronet_aml_crypto_test_support__testing",
+        "cronet_aml_net_gtest_util__testing",
+        "cronet_aml_net_net__testing",
+        "cronet_aml_net_preload_decoder__testing",
+        "cronet_aml_net_test_support__testing",
+        "cronet_aml_net_third_party_quiche_quiche__testing",
+        "cronet_aml_net_third_party_quiche_quiche_test_support__testing",
+        "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
+        "cronet_aml_net_uri_template__testing",
+        "cronet_aml_testing_gtest_gtest__testing",
+        "cronet_aml_third_party_boringssl_boringssl__testing",
+        "cronet_aml_third_party_brotli_common__testing",
+        "cronet_aml_third_party_brotli_dec__testing",
+        "cronet_aml_third_party_ced_ced__testing",
+        "cronet_aml_third_party_icu_icui18n__testing",
+        "cronet_aml_third_party_icu_icuuc_private__testing",
+        "cronet_aml_third_party_libevent_libevent__testing",
+        "cronet_aml_third_party_libxml_libxml__testing",
+        "cronet_aml_third_party_libxml_libxml_utils__testing",
+        "cronet_aml_third_party_libxml_xml_reader__testing",
+        "cronet_aml_third_party_modp_b64_modp_b64__testing",
+        "cronet_aml_third_party_protobuf_protobuf_lite__testing",
+        "cronet_aml_url_url__testing",
+    ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen_headers",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
+        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
+        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
+        "-DGOOGLE_PROTOBUF_NO_RTTI",
+        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+        "-DGTEST_API_=",
+        "-DGTEST_HAS_ABSL=1",
+        "-DGTEST_HAS_POSIX_RE=0",
+        "-DGTEST_HAS_TR1_TUPLE=0",
+        "-DGTEST_LANG_CXX11=1",
+        "-DHAVE_PTHREAD",
+        "-DHAVE_SYS_UIO_H",
+        "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
+        "-DNDEBUG",
+        "-DNO_UNWIND_TABLES",
+        "-DNVALGRIND",
+        "-DOFFICIAL_BUILD",
+        "-DUNIT_TEST",
+        "-DUSE_CHROMIUM_ICU=1",
+        "-DUSE_REMOTE_TEST_SERVER",
+        "-DU_ENABLE_DYLOAD=0",
+        "-DU_ENABLE_RESOURCE_TRACING=0",
+        "-DU_ENABLE_TRACING=1",
+        "-DU_STATIC_IMPLEMENTATION",
+        "-DU_USING_ICU_NAMESPACE=0",
+        "-D_FORTIFY_SOURCE=2",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D__STDC_CONSTANT_MACROS",
+        "-D__STDC_FORMAT_MACROS",
+        "-Oz",
+        "-fdata-sections",
+        "-ffunction-sections",
+        "-fno-asynchronous-unwind-tables",
+        "-fno-unwind-tables",
+        "-fvisibility-inlines-hidden",
+        "-fvisibility=hidden",
+        "-g1",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "net/third_party/quiche/overrides/",
+        "net/third_party/quiche/src/",
+        "net/third_party/quiche/src/quiche/common/platform/default/",
+        "third_party/abseil-cpp/",
+        "third_party/boringssl/src/include/",
+        "third_party/ced/src/",
+        "third_party/googletest/custom/",
+        "third_party/googletest/src/googlemock/include/",
+        "third_party/googletest/src/googletest/include/",
+        "third_party/icu/source/common/",
+        "third_party/icu/source/i18n/",
+        "third_party/protobuf/src/",
+    ],
+    cpp_std: "c++17",
     target: {
         android_arm: {
             cflags: [
@@ -17084,7 +16080,7 @@
 }
 
 // GN: //net:simple_quic_tools__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_simple_quic_tools__testing",
     srcs: [
         "net/tools/quic/quic_client_message_loop_network_helper.cc",
@@ -17104,72 +16100,15 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
         "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -17225,27 +16164,124 @@
         "third_party/protobuf/src/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
+    target: {
+        android_arm: {
+            cflags: [
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+    },
+}
+
+// GN: //net:spdy_test_tools__testing
+cc_object {
+    name: "cronet_aml_net_spdy_test_tools__testing",
+    srcs: [
+        "net/spdy/fuzzing/hpack_fuzz_util.cc",
     ],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+        "libz",
+    ],
+    static_libs: [
+        "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
+        "cronet_aml_base_base__testing",
+        "cronet_aml_base_base_static__testing",
+        "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
+        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
+        "cronet_aml_crypto_crypto__testing",
+        "cronet_aml_net_net__testing",
+        "cronet_aml_net_preload_decoder__testing",
+        "cronet_aml_net_third_party_quiche_quiche__testing",
+        "cronet_aml_net_uri_template__testing",
+        "cronet_aml_testing_gtest_gtest__testing",
+        "cronet_aml_third_party_boringssl_boringssl__testing",
+        "cronet_aml_third_party_brotli_common__testing",
+        "cronet_aml_third_party_brotli_dec__testing",
+        "cronet_aml_third_party_icu_icui18n__testing",
+        "cronet_aml_third_party_icu_icuuc_private__testing",
+        "cronet_aml_third_party_libevent_libevent__testing",
+        "cronet_aml_third_party_modp_b64_modp_b64__testing",
+        "cronet_aml_third_party_protobuf_protobuf_lite__testing",
+        "cronet_aml_url_url__testing",
+    ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
+        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
+        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
+        "-DGOOGLE_PROTOBUF_NO_RTTI",
+        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+        "-DGTEST_API_=",
+        "-DGTEST_HAS_ABSL=1",
+        "-DGTEST_HAS_POSIX_RE=0",
+        "-DGTEST_HAS_TR1_TUPLE=0",
+        "-DGTEST_LANG_CXX11=1",
+        "-DHAVE_PTHREAD",
+        "-DHAVE_SYS_UIO_H",
+        "-DNDEBUG",
+        "-DNO_UNWIND_TABLES",
+        "-DNVALGRIND",
+        "-DOFFICIAL_BUILD",
+        "-DUNIT_TEST",
+        "-D_FORTIFY_SOURCE=2",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D__STDC_CONSTANT_MACROS",
+        "-D__STDC_FORMAT_MACROS",
+        "-Oz",
+        "-fdata-sections",
+        "-ffunction-sections",
+        "-fno-asynchronous-unwind-tables",
+        "-fno-unwind-tables",
+        "-fvisibility-inlines-hidden",
+        "-fvisibility=hidden",
+        "-g1",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "net/third_party/quiche/overrides/",
+        "net/third_party/quiche/src/",
+        "net/third_party/quiche/src/quiche/common/platform/default/",
+        "third_party/abseil-cpp/",
+        "third_party/boringssl/src/include/",
+        "third_party/googletest/custom/",
+        "third_party/googletest/src/googlemock/include/",
+        "third_party/googletest/src/googletest/include/",
+        "third_party/protobuf/src/",
+    ],
+    cpp_std: "c++17",
     target: {
         android_arm: {
             cflags: [
@@ -17277,6 +16313,60 @@
 cc_library_static {
     name: "cronet_aml_net_test_support__testing",
     srcs: [
+        ":cronet_aml_net_dns_test_support__testing",
+        ":cronet_aml_net_quic_test_flags_utils__testing",
+        ":cronet_aml_net_simple_quic_tools__testing",
+        ":cronet_aml_net_tools_tld_cleanup_tld_cleanup__testing",
+        ":cronet_aml_net_traffic_annotation_traffic_annotation__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
+        ":cronet_aml_third_party_googletest_gmock__testing",
+        ":cronet_aml_third_party_googletest_gtest__testing",
         "net/base/connection_endpoint_metadata_test_util.cc",
         "net/base/load_timing_info_test_util.cc",
         "net/base/mock_file_stream.cc",
@@ -17363,85 +16453,22 @@
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
         "cronet_aml_base_i18n__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_test_test_config__testing",
         "cronet_aml_base_test_test_support__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_dns_test_support__testing",
         "cronet_aml_net_gtest_util__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
-        "cronet_aml_net_quic_test_flags_utils__testing",
-        "cronet_aml_net_simple_quic_tools__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
         "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
-        "cronet_aml_net_tools_tld_cleanup_tld_cleanup__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_ced_ced__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -17453,9 +16480,13 @@
         "cronet_aml_url_url__testing",
     ],
     generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_net_cronet_buildflags__testing",
         "cronet_aml_net_http_transport_security_state_unittest_data_default__testing",
     ],
     export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_net_cronet_buildflags__testing",
         "cronet_aml_net_http_transport_security_state_unittest_data_default__testing",
     ],
     defaults: [
@@ -17703,6 +16734,7 @@
     ],
     export_include_dirs: [
         ".",
+        "net/third_party/quiche/src",
         "net/third_party/quiche/src/quiche/quic/test_tools",
         "protos",
     ],
@@ -17744,6 +16776,7 @@
     ],
     export_include_dirs: [
         ".",
+        "net/third_party/quiche/src",
         "net/third_party/quiche/src/quiche/quic/test_tools",
         "protos",
     ],
@@ -17757,6 +16790,53 @@
     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_base_base",
+        ":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_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_container_hashtablez_sampler",
+        ":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_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_numeric_int128",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions",
+        ":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_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_seed_material",
+        ":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_internal",
+        ":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_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",
         "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",
@@ -18039,6 +17119,8 @@
         "net/third_party/quiche/src/quiche/spdy/core/spdy_simple_arena.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
         "libprotobuf-cpp-lite",
@@ -18048,61 +17130,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
         "cronet_aml_net_uri_template",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -18111,9 +17141,11 @@
         "cronet_aml_url_url",
     ],
     generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
         "cronet_aml_net_third_party_quiche_net_quic_proto_gen_headers",
     ],
     export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
         "cronet_aml_net_third_party_quiche_net_quic_proto_gen_headers",
     ],
     defaults: [
@@ -18216,6 +17248,53 @@
     name: "cronet_aml_net_third_party_quiche_quiche__testing",
     srcs: [
         ":cronet_aml_net_third_party_quiche_net_quic_proto__testing_gen",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
         "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",
@@ -18507,61 +17586,10 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -18570,9 +17598,11 @@
         "cronet_aml_url_url__testing",
     ],
     generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
         "cronet_aml_net_third_party_quiche_net_quic_proto__testing_gen_headers",
     ],
     export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
         "cronet_aml_net_third_party_quiche_net_quic_proto__testing_gen_headers",
     ],
     defaults: [
@@ -18670,6 +17700,681 @@
     },
 }
 
+// GN: //net/third_party/quiche:quiche_test_support__testing
+cc_library_static {
+    name: "cronet_aml_net_third_party_quiche_quiche_test_support__testing",
+    srcs: [
+        ":cronet_aml_net_quic_test_flags_utils__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
+        ":cronet_aml_third_party_googletest_gmock__testing",
+        ":cronet_aml_third_party_googletest_gtest__testing",
+        ":cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen",
+        "net/third_party/quiche/overrides/quiche_platform_impl/quiche_test_helpers_impl.cc",
+        "net/third_party/quiche/overrides/quiche_platform_impl/quiche_test_impl.cc",
+        "net/third_party/quiche/overrides/quiche_platform_impl/quiche_test_output_impl.cc",
+        "net/third_party/quiche/src/quiche/common/platform/api/quiche_test_loopback.cc",
+        "net/third_party/quiche/src/quiche/common/platform/default/quiche_platform_impl/quiche_test_loopback_impl.cc",
+        "net/third_party/quiche/src/quiche/common/test_tools/quiche_test_utils.cc",
+        "net/third_party/quiche/src/quiche/http2/adapter/test_frame_sequence.cc",
+        "net/third_party/quiche/src/quiche/http2/adapter/test_utils.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/frame_decoder_state_test_util.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/frame_parts.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/frame_parts_collector.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/frame_parts_collector_listener.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/hpack_block_builder.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/hpack_block_collector.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/hpack_entry_collector.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/hpack_example.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/hpack_string_collector.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/http2_constants_test_util.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/http2_frame_builder.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/http2_frame_decoder_listener_test_util.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/http2_random.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/http2_structure_decoder_test_util.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/http2_structures_test_util.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/payload_decoder_base_test_util.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/random_decoder_test_base.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/random_util.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_trace_visitor.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/bad_packet_writer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/crypto_test_utils.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/failing_proof_source.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/fake_proof_source.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/first_flight.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/limited_mtu_test_writer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/mock_clock.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/mock_quic_client_promised_info.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/mock_quic_dispatcher.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/mock_quic_session_visitor.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/mock_quic_spdy_client_stream.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/mock_quic_time_wait_list_manager.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/mock_random.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/packet_dropping_test_writer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/packet_reordering_writer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/qpack/qpack_decoder_test_utils.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/qpack/qpack_encoder_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/qpack/qpack_offline_decoder.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/qpack/qpack_test_utils.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_buffered_packet_store_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_client_promised_info_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_coalesced_packet_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_config_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_connection_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_crypto_server_config_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_dispatcher_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_flow_controller_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_framer_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_packet_creator_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_path_validator_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_sent_packet_manager_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_session_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_spdy_session_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_spdy_stream_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_stream_id_manager_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_stream_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_stream_send_buffer_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_stream_sequencer_buffer_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_stream_sequencer_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_sustained_bandwidth_recorder_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_test_backend.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_test_utils.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_time_wait_list_manager_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_unacked_packet_map_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/rtt_stats_peer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_utils.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simple_data_producer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simple_quic_framer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simple_session_cache.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simple_session_notifier.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/actor.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/alarm_factory.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/link.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/packet_filter.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/port.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/queue.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/quic_endpoint.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/quic_endpoint_base.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/simulator.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/switch.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/traffic_policer.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/test_certificates.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/test_ticket_crypter.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/web_transport_resets_backend.cc",
+        "net/third_party/quiche/src/quiche/spdy/test_tools/mock_spdy_framer_visitor.cc",
+        "net/third_party/quiche/src/quiche/spdy/test_tools/spdy_test_utils.cc",
+    ],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+        "libprotobuf-cpp-lite",
+        "libz",
+    ],
+    static_libs: [
+        "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
+        "cronet_aml_base_base__testing",
+        "cronet_aml_base_base_static__testing",
+        "cronet_aml_base_i18n__testing",
+        "cronet_aml_base_test_test_config__testing",
+        "cronet_aml_base_test_test_support__testing",
+        "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
+        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
+        "cronet_aml_crypto_crypto__testing",
+        "cronet_aml_crypto_test_support__testing",
+        "cronet_aml_net_gtest_util__testing",
+        "cronet_aml_net_net__testing",
+        "cronet_aml_net_preload_decoder__testing",
+        "cronet_aml_net_test_support__testing",
+        "cronet_aml_net_third_party_quiche_quiche__testing",
+        "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
+        "cronet_aml_net_uri_template__testing",
+        "cronet_aml_testing_gtest_gtest__testing",
+        "cronet_aml_third_party_boringssl_boringssl__testing",
+        "cronet_aml_third_party_brotli_common__testing",
+        "cronet_aml_third_party_brotli_dec__testing",
+        "cronet_aml_third_party_ced_ced__testing",
+        "cronet_aml_third_party_icu_icui18n__testing",
+        "cronet_aml_third_party_icu_icuuc_private__testing",
+        "cronet_aml_third_party_libevent_libevent__testing",
+        "cronet_aml_third_party_libxml_libxml__testing",
+        "cronet_aml_third_party_libxml_libxml_utils__testing",
+        "cronet_aml_third_party_libxml_xml_reader__testing",
+        "cronet_aml_third_party_modp_b64_modp_b64__testing",
+        "cronet_aml_third_party_protobuf_protobuf_lite__testing",
+        "cronet_aml_url_url__testing",
+    ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen_headers",
+    ],
+    export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen_headers",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
+        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
+        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
+        "-DGOOGLE_PROTOBUF_NO_RTTI",
+        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+        "-DGTEST_API_=",
+        "-DGTEST_HAS_ABSL=1",
+        "-DGTEST_HAS_POSIX_RE=0",
+        "-DGTEST_HAS_TR1_TUPLE=0",
+        "-DGTEST_LANG_CXX11=1",
+        "-DHAVE_PTHREAD",
+        "-DHAVE_SYS_UIO_H",
+        "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
+        "-DNDEBUG",
+        "-DNO_UNWIND_TABLES",
+        "-DNVALGRIND",
+        "-DOFFICIAL_BUILD",
+        "-DUNIT_TEST",
+        "-DUSE_CHROMIUM_ICU=1",
+        "-DUSE_REMOTE_TEST_SERVER",
+        "-DU_ENABLE_DYLOAD=0",
+        "-DU_ENABLE_RESOURCE_TRACING=0",
+        "-DU_ENABLE_TRACING=1",
+        "-DU_STATIC_IMPLEMENTATION",
+        "-DU_USING_ICU_NAMESPACE=0",
+        "-D_FORTIFY_SOURCE=2",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D__STDC_CONSTANT_MACROS",
+        "-D__STDC_FORMAT_MACROS",
+        "-Oz",
+        "-fdata-sections",
+        "-ffunction-sections",
+        "-fno-asynchronous-unwind-tables",
+        "-fno-unwind-tables",
+        "-fvisibility-inlines-hidden",
+        "-fvisibility=hidden",
+        "-g1",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "net/third_party/quiche/overrides/",
+        "net/third_party/quiche/src/",
+        "net/third_party/quiche/src/quiche/common/platform/default/",
+        "third_party/abseil-cpp/",
+        "third_party/boringssl/src/include/",
+        "third_party/ced/src/",
+        "third_party/googletest/custom/",
+        "third_party/googletest/src/googlemock/include/",
+        "third_party/googletest/src/googletest/include/",
+        "third_party/icu/source/common/",
+        "third_party/icu/source/i18n/",
+        "third_party/protobuf/src/",
+    ],
+    cpp_std: "c++17",
+    ldflags: [
+        "-Wl,--as-needed",
+        "-Wl,--gc-sections",
+        "-Wl,--icf=all",
+        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
+        "-Wl,-wrap,asprintf",
+        "-Wl,-wrap,calloc",
+        "-Wl,-wrap,free",
+        "-Wl,-wrap,getcwd",
+        "-Wl,-wrap,malloc",
+        "-Wl,-wrap,malloc_usable_size",
+        "-Wl,-wrap,memalign",
+        "-Wl,-wrap,posix_memalign",
+        "-Wl,-wrap,pvalloc",
+        "-Wl,-wrap,realloc",
+        "-Wl,-wrap,realpath",
+        "-Wl,-wrap,strdup",
+        "-Wl,-wrap,strndup",
+        "-Wl,-wrap,valloc",
+        "-Wl,-wrap,vasprintf",
+    ],
+    target: {
+        android_arm: {
+            cflags: [
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+    },
+}
+
+// GN: //net/third_party/quiche:quiche_tests__testing
+cc_object {
+    name: "cronet_aml_net_third_party_quiche_quiche_tests__testing",
+    srcs: [
+        "net/third_party/quiche/src/quiche/common/platform/api/quiche_file_utils_test.cc",
+        "net/third_party/quiche/src/quiche/common/platform/api/quiche_hostname_utils_test.cc",
+        "net/third_party/quiche/src/quiche/common/platform/api/quiche_mem_slice_test.cc",
+        "net/third_party/quiche/src/quiche/common/platform/api/quiche_reference_counted_test.cc",
+        "net/third_party/quiche/src/quiche/common/platform/api/quiche_stack_trace_test.cc",
+        "net/third_party/quiche/src/quiche/common/platform/api/quiche_time_utils_test.cc",
+        "net/third_party/quiche/src/quiche/common/platform/api/quiche_url_utils_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_buffer_allocator_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_circular_deque_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_data_reader_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_data_writer_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_endian_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_ip_address_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_linked_hash_map_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_mem_slice_storage_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_random_test.cc",
+        "net/third_party/quiche/src/quiche/common/quiche_text_utils_test.cc",
+        "net/third_party/quiche/src/quiche/common/simple_buffer_allocator_test.cc",
+        "net/third_party/quiche/src/quiche/common/structured_headers_generated_test.cc",
+        "net/third_party/quiche/src/quiche/common/structured_headers_test.cc",
+        "net/third_party/quiche/src/quiche/http2/adapter/event_forwarder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/adapter/header_validator_test.cc",
+        "net/third_party/quiche/src/quiche/http2/adapter/noop_header_validator_test.cc",
+        "net/third_party/quiche/src/quiche/http2/adapter/oghttp2_adapter_test.cc",
+        "net/third_party/quiche/src/quiche/http2/adapter/oghttp2_session_test.cc",
+        "net/third_party/quiche/src/quiche/http2/adapter/window_manager_test.cc",
+        "net/third_party/quiche/src/quiche/http2/core/priority_write_scheduler_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/decode_buffer_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/decode_http2_structures_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/http2_frame_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/http2_structure_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/data_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/headers_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/ping_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/priority_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/priority_update_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/settings_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_block_collector_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_block_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_decoder_state_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_decoder_tables_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_entry_collector_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_entry_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_entry_type_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_string_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/http2_hpack_constants_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/huffman/hpack_huffman_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/huffman/hpack_huffman_encoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/huffman/hpack_huffman_transcoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/varint/hpack_varint_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/varint/hpack_varint_encoder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/hpack/varint/hpack_varint_round_trip_test.cc",
+        "net/third_party/quiche/src/quiche/http2/http2_constants_test.cc",
+        "net/third_party/quiche/src/quiche/http2/http2_structures_test.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/hpack_block_builder_test.cc",
+        "net/third_party/quiche/src/quiche/http2/test_tools/http2_random_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/bandwidth_sampler_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/bbr2_simulator_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/bbr_sender_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/cubic_bytes_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/general_loss_algorithm_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/hybrid_slow_start_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/pacing_sender_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/prr_sender_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/rtt_stats_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/send_algorithm_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/uber_loss_algorithm_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/congestion_control/windowed_filter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/aes_128_gcm_decrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/aes_128_gcm_encrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/aes_256_gcm_decrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/aes_256_gcm_encrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/cert_compressor_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/certificate_util_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/certificate_view_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/chacha20_poly1305_decrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/chacha20_poly1305_encrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/channel_id_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/client_proof_source_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/crypto_framer_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/crypto_handshake_message_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/crypto_secret_boxer_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/crypto_server_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/crypto_utils_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/curve25519_key_exchange_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/null_decrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/null_encrypter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/p256_key_exchange_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/proof_source_x509_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/quic_client_session_cache_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/quic_compressed_certs_cache_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/quic_crypto_client_config_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/quic_crypto_server_config_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/quic_hkdf_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/transport_parameters_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/crypto/web_transport_fingerprint_proof_verifier_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/frames/quic_frames_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/capsule_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/http_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/http_encoder_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/http_frames_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_client_promised_info_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_client_push_promise_index_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_header_list_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_headers_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_receive_control_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_send_control_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_server_session_base_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_spdy_session_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_spdy_stream_body_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/quic_spdy_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/spdy_server_push_utils_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/spdy_utils_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/http/web_transport_http3_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/legacy_quic_stream_id_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/packet_number_indexed_queue_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_blocking_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_decoder_stream_receiver_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_decoder_stream_sender_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_encoder_stream_receiver_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_encoder_stream_sender_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_encoder_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_header_table_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_index_conversions_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_instruction_decoder_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_instruction_encoder_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_receive_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_required_insert_count_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_round_trip_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_send_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_static_table_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/qpack/value_splitting_header_list_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_alarm_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_arena_scoped_ptr_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_bandwidth_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_buffered_packet_store_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_chaos_protector_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_coalesced_packet_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_config_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_connection_context_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_connection_id_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_connection_id_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_connection_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_control_frame_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_crypto_client_handshaker_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_crypto_client_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_crypto_server_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_crypto_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_data_writer_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_datagram_queue_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_dispatcher_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_error_codes_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_flow_controller_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_framer_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_idle_network_detector_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_interval_deque_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_interval_set_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_interval_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_legacy_version_encapsulator_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_lru_cache_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_network_blackhole_detector_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_packet_creator_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_packet_number_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_packets_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_path_validator_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_received_packet_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_sent_packet_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_server_id_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_session_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_socket_address_coder_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_stream_id_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_stream_send_buffer_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_stream_sequencer_buffer_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_stream_sequencer_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_stream_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_sustained_bandwidth_recorder_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_tag_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_time_accumulator_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_time_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_time_wait_list_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_trace_visitor_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_unacked_packet_map_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_utils_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_version_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_versions_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/quic_write_blocked_list_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/tls_chlo_extractor_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/tls_client_handshaker_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/uber_quic_stream_id_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/core/uber_received_packet_manager_test.cc",
+        "net/third_party/quiche/src/quiche/quic/platform/api/quic_socket_address_test.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/crypto_test_utils_test.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/quic_test_utils_test.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simple_session_notifier_test.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/quic_endpoint_test.cc",
+        "net/third_party/quiche/src/quiche/quic/test_tools/simulator/simulator_test.cc",
+        "net/third_party/quiche/src/quiche/quic/tools/quic_memory_cache_backend_test.cc",
+        "net/third_party/quiche/src/quiche/quic/tools/quic_tcp_like_trace_converter_test.cc",
+        "net/third_party/quiche/src/quiche/quic/tools/simple_ticket_crypter_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/array_output_buffer_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/hpack/hpack_decoder_adapter_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/hpack/hpack_encoder_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/hpack/hpack_entry_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/hpack/hpack_header_table_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/hpack/hpack_output_stream_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/hpack/hpack_round_trip_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/hpack/hpack_static_table_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/http2_header_block_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/http2_header_storage_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/spdy_alt_svc_wire_format_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/spdy_frame_builder_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/spdy_framer_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/spdy_intrusive_list_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/spdy_pinnable_buffer_piece_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/spdy_prefixed_buffer_reader_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/spdy_protocol_test.cc",
+        "net/third_party/quiche/src/quiche/spdy/core/spdy_simple_arena_test.cc",
+    ],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+        "libz",
+    ],
+    static_libs: [
+        "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
+        "cronet_aml_base_base__testing",
+        "cronet_aml_base_base_static__testing",
+        "cronet_aml_base_i18n__testing",
+        "cronet_aml_base_test_test_config__testing",
+        "cronet_aml_base_test_test_support__testing",
+        "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
+        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
+        "cronet_aml_crypto_crypto__testing",
+        "cronet_aml_crypto_test_support__testing",
+        "cronet_aml_net_gtest_util__testing",
+        "cronet_aml_net_net__testing",
+        "cronet_aml_net_preload_decoder__testing",
+        "cronet_aml_net_test_support__testing",
+        "cronet_aml_net_third_party_quiche_quiche__testing",
+        "cronet_aml_net_third_party_quiche_quiche_test_support__testing",
+        "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
+        "cronet_aml_net_uri_template__testing",
+        "cronet_aml_testing_gtest_gtest__testing",
+        "cronet_aml_third_party_boringssl_boringssl__testing",
+        "cronet_aml_third_party_brotli_common__testing",
+        "cronet_aml_third_party_brotli_dec__testing",
+        "cronet_aml_third_party_ced_ced__testing",
+        "cronet_aml_third_party_icu_icui18n__testing",
+        "cronet_aml_third_party_icu_icuuc_private__testing",
+        "cronet_aml_third_party_libevent_libevent__testing",
+        "cronet_aml_third_party_libxml_libxml__testing",
+        "cronet_aml_third_party_libxml_libxml_utils__testing",
+        "cronet_aml_third_party_libxml_xml_reader__testing",
+        "cronet_aml_third_party_modp_b64_modp_b64__testing",
+        "cronet_aml_third_party_protobuf_protobuf_lite__testing",
+        "cronet_aml_url_url__testing",
+    ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen_headers",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
+        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
+        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
+        "-DGOOGLE_PROTOBUF_NO_RTTI",
+        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+        "-DGTEST_API_=",
+        "-DGTEST_HAS_ABSL=1",
+        "-DGTEST_HAS_POSIX_RE=0",
+        "-DGTEST_HAS_TR1_TUPLE=0",
+        "-DGTEST_LANG_CXX11=1",
+        "-DHAVE_PTHREAD",
+        "-DHAVE_SYS_UIO_H",
+        "-DNDEBUG",
+        "-DNO_UNWIND_TABLES",
+        "-DNVALGRIND",
+        "-DOFFICIAL_BUILD",
+        "-DUNIT_TEST",
+        "-D_FORTIFY_SOURCE=2",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D__STDC_CONSTANT_MACROS",
+        "-D__STDC_FORMAT_MACROS",
+        "-Oz",
+        "-fdata-sections",
+        "-ffunction-sections",
+        "-fno-asynchronous-unwind-tables",
+        "-fno-unwind-tables",
+        "-fvisibility-inlines-hidden",
+        "-fvisibility=hidden",
+        "-g1",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "net/third_party/quiche/overrides/",
+        "net/third_party/quiche/src/",
+        "net/third_party/quiche/src/quiche/common/platform/default/",
+        "third_party/abseil-cpp/",
+        "third_party/boringssl/src/include/",
+        "third_party/googletest/custom/",
+        "third_party/googletest/src/googlemock/include/",
+        "third_party/googletest/src/googletest/include/",
+        "third_party/protobuf/src/",
+    ],
+    cpp_std: "c++17",
+    target: {
+        android_arm: {
+            cflags: [
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+    },
+}
+
 // GN: //net/third_party/quiche:quiche_tool_support__testing
 cc_library_static {
     name: "cronet_aml_net_third_party_quiche_quiche_tool_support__testing",
@@ -18708,71 +18413,14 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_dns_dns__testing",
-        "cronet_aml_net_dns_public_public__testing",
-        "cronet_aml_net_http_transport_security_state_generated_files__testing",
         "cronet_aml_net_net__testing",
-        "cronet_aml_net_net_deps__testing",
-        "cronet_aml_net_net_public_deps__testing",
         "cronet_aml_net_preload_decoder__testing",
         "cronet_aml_net_third_party_quiche_quiche__testing",
-        "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
         "cronet_aml_net_uri_template__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_brotli_common__testing",
         "cronet_aml_third_party_brotli_dec__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
@@ -18877,7 +18525,7 @@
 }
 
 // GN: //net/tools/huffman_trie:huffman_trie_generator_sources__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_tools_huffman_trie_huffman_trie_generator_sources__testing",
     srcs: [
         "net/tools/huffman_trie/bit_writer.cc",
@@ -18890,99 +18538,39 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
         "cronet_aml_third_party_modp_b64_modp_b64__testing",
     ],
     host_supported: true,
-    device_supported: false,
     defaults: [
         "cronet_aml_defaults",
     ],
     cflags: [
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
         "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
-        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
         "-DNDEBUG",
         "-DNO_UNWIND_TABLES",
         "-DNVALGRIND",
         "-DOFFICIAL_BUILD",
-        "-DUSE_AURA=1",
-        "-DUSE_OZONE=1",
-        "-DUSE_UDEV",
-        "-D_FILE_OFFSET_BITS=64",
         "-D_FORTIFY_SOURCE=2",
         "-D_GNU_SOURCE",
-        "-D_LARGEFILE64_SOURCE",
-        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D__STDC_CONSTANT_MACROS",
         "-D__STDC_FORMAT_MACROS",
-        "-O2",
         "-fdata-sections",
         "-ffunction-sections",
         "-fno-asynchronous-unwind-tables",
         "-fno-unwind-tables",
-        "-fstack-protector",
         "-fvisibility-inlines-hidden",
         "-fvisibility=hidden",
         "-g1",
-        "-msse3",
     ],
     local_include_dirs: [
         "./",
@@ -18992,16 +18580,72 @@
         "third_party/abseil-cpp/",
         "third_party/boringssl/src/include/",
     ],
-    cpp_std: "c++20",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
+    target: {
+        android: {
+            shared_libs: [
+                "libandroid",
+                "liblog",
+            ],
+        },
+        android_arm: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+                "-Oz",
+                "-fstack-protector",
+            ],
+        },
+        android_arm64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+                "-Oz",
+                "-fstack-protector",
+                "-mno-outline",
+                "-mno-outline-atomics",
+            ],
+        },
+        android_x86: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+                "-Oz",
+                "-msse3",
+            ],
+        },
+        android_x86_64: {
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
+                "-Oz",
+                "-fstack-protector",
+                "-msse3",
+            ],
+        },
+        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",
+                "-O2",
+                "-fstack-protector",
+                "-msse3",
+            ],
+            compile_multilib: "64",
+        },
+    },
 }
 
 // GN: //net/tools/tld_cleanup:tld_cleanup__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_tools_tld_cleanup_tld_cleanup__testing",
     srcs: [
         "net/tools/tld_cleanup/tld_cleanup_util.cc",
@@ -19014,60 +18658,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -19112,27 +18705,6 @@
         "third_party/boringssl/src/include/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -19164,69 +18736,20 @@
 cc_binary {
     name: "cronet_aml_net_tools_transport_security_state_generator_transport_security_state_generator__testing",
     srcs: [
+        ":cronet_aml_buildtools_third_party_libc___libc____testing",
+        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi__testing",
+        ":cronet_aml_net_tools_huffman_trie_huffman_trie_generator_sources__testing",
+        ":cronet_aml_net_tools_transport_security_state_generator_transport_security_state_generator_sources__testing",
         "net/tools/transport_security_state_generator/transport_security_state_generator.cc",
     ],
     static_libs: [
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_buildtools_third_party_libc___libc____testing",
-        "cronet_aml_buildtools_third_party_libc__abi_libc__abi__testing",
         "cronet_aml_crypto_crypto__testing",
-        "cronet_aml_net_tools_huffman_trie_huffman_trie_generator_sources__testing",
-        "cronet_aml_net_tools_transport_security_state_generator_transport_security_state_generator_sources__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -19286,7 +18809,7 @@
 }
 
 // GN: //net/tools/transport_security_state_generator:transport_security_state_generator_sources__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_tools_transport_security_state_generator_transport_security_state_generator_sources__testing",
     srcs: [
         "net/tools/transport_security_state_generator/cert_util.cc",
@@ -19301,59 +18824,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_net_tools_huffman_trie_huffman_trie_generator_sources__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -19405,20 +18878,17 @@
         "third_party/boringssl/src/include/",
     ],
     cpp_std: "c++20",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
 }
 
 // GN: //net/traffic_annotation:traffic_annotation
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_traffic_annotation_traffic_annotation",
     srcs: [
         "net/traffic_annotation/network_traffic_annotation_android.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
     ],
@@ -19426,60 +18896,8 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -19488,9 +18906,6 @@
     generated_headers: [
         "cronet_aml_build_chromeos_buildflags",
     ],
-    export_generated_headers: [
-        "cronet_aml_build_chromeos_buildflags",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -19529,27 +18944,6 @@
         "third_party/boringssl/src/include/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -19578,7 +18972,7 @@
 }
 
 // GN: //net/traffic_annotation:traffic_annotation__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_net_traffic_annotation_traffic_annotation__testing",
     srcs: [
         "net/traffic_annotation/network_traffic_annotation_android.cc",
@@ -19591,60 +18985,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -19653,9 +18996,6 @@
     generated_headers: [
         "cronet_aml_build_chromeos_buildflags__testing",
     ],
-    export_generated_headers: [
-        "cronet_aml_build_chromeos_buildflags__testing",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -19694,27 +19034,6 @@
         "third_party/boringssl/src/include/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -19749,6 +19068,8 @@
         "net/third_party/uri_template/uri_template.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
     ],
@@ -19756,60 +19077,8 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -19916,60 +19185,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -20101,7 +19319,7 @@
 }
 
 // GN: //testing/android/native_test:native_test_native_code__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_testing_android_native_test_native_test_native_code__testing",
     srcs: [
         "testing/android/native_test/native_test_jni_onload.cc",
@@ -20116,67 +19334,13 @@
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
         "cronet_aml_base_i18n__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_test_test_config__testing",
         "cronet_aml_base_test_test_support__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_testing_android_native_test_native_test_support__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_ced_ced__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -20185,6 +19349,12 @@
         "cronet_aml_third_party_libxml_xml_reader__testing",
         "cronet_aml_third_party_modp_b64_modp_b64__testing",
     ],
+    generated_headers: [
+        "cronet_aml_base_debugging_buildflags__testing",
+        "cronet_aml_base_logging_buildflags__testing",
+        "cronet_aml_build_chromeos_buildflags__testing",
+        "cronet_aml_testing_android_native_test_native_test_jni_headers__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -20223,27 +19393,6 @@
         "third_party/boringssl/src/include/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -20272,7 +19421,7 @@
 }
 
 // GN: //testing/android/native_test:native_test_support__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_testing_android_native_test_native_test_support__testing",
     srcs: [
         "testing/android/native_test/main_runner.cc",
@@ -20289,66 +19438,13 @@
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
         "cronet_aml_base_i18n__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_test_test_config__testing",
         "cronet_aml_base_test_test_support__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
         "cronet_aml_testing_gtest_gtest__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_ced_ced__testing",
-        "cronet_aml_third_party_googletest_gmock__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -20363,12 +19459,6 @@
         "cronet_aml_build_chromeos_buildflags__testing",
         "cronet_aml_testing_android_native_test_native_test_jni_headers__testing",
     ],
-    export_generated_headers: [
-        "cronet_aml_base_debugging_buildflags__testing",
-        "cronet_aml_base_logging_buildflags__testing",
-        "cronet_aml_build_chromeos_buildflags__testing",
-        "cronet_aml_testing_android_native_test_native_test_jni_headers__testing",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -20426,27 +19516,6 @@
         "third_party/icu/source/i18n/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -20478,6 +19547,54 @@
 cc_library_static {
     name: "cronet_aml_testing_gtest_gtest__testing",
     srcs: [
+        ":cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
+        ":cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
+        ":cronet_aml_third_party_googletest_gtest__testing",
         "testing/gtest/empty.cc",
         "testing/multiprocess_func_list.cc",
     ],
@@ -20489,66 +19606,20 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
         "cronet_aml_third_party_modp_b64_modp_b64__testing",
     ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
+    export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -20643,7 +19714,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:base
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_base",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/cycleclock.cc",
@@ -20652,11 +19723,6 @@
         "third_party/abseil-cpp/absl/base/internal/thread_identity.cc",
         "third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -20692,11 +19758,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -20725,7 +19786,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:base__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/cycleclock.cc",
@@ -20734,11 +19795,6 @@
         "third_party/abseil-cpp/absl/base/internal/thread_identity.cc",
         "third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -20770,11 +19826,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -20834,7 +19885,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:log_severity
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
     srcs: [
         "third_party/abseil-cpp/absl/base/log_severity.cc",
@@ -20874,11 +19925,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -20907,7 +19953,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:log_severity__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
     srcs: [
         "third_party/abseil-cpp/absl/base/log_severity.cc",
@@ -20943,11 +19989,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21007,17 +20048,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:malloc_internal
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -21053,11 +20088,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21086,17 +20116,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:malloc_internal__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -21128,11 +20152,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21192,14 +20211,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:raw_logging_internal
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/raw_logging.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -21235,11 +20251,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21268,14 +20279,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:raw_logging_internal__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/raw_logging.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -21307,11 +20315,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21371,7 +20374,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:spinlock_wait
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc",
@@ -21411,11 +20414,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21444,7 +20442,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:spinlock_wait__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc",
@@ -21480,11 +20478,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21544,7 +20537,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:strerror
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_strerror",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/strerror.cc",
@@ -21584,11 +20577,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21617,7 +20605,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:strerror__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/strerror.cc",
@@ -21653,11 +20641,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21717,15 +20700,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:throw_delegate
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/throw_delegate.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -21761,11 +20740,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21794,15 +20768,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/base:throw_delegate__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
     srcs: [
         "third_party/abseil-cpp/absl/base/internal/throw_delegate.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -21834,11 +20804,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21898,33 +20863,12 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/container:hashtablez_sampler
-cc_library_static {
+cc_object {
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "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_stacktrace",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_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_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",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -21960,11 +20904,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -21993,33 +20932,12 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/container:hashtablez_sampler__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
     srcs: [
         "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc",
         "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -22051,11 +20969,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22115,34 +21028,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/container:raw_hash_set
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set",
     srcs: [
         "third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler",
-        "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_stacktrace",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_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_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",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -22178,11 +21068,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22211,34 +21096,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/container:raw_hash_set__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
     srcs: [
         "third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -22270,11 +21132,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22334,17 +21191,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:debugging_internal
-cc_library_static {
+cc_object {
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -22380,11 +21233,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22413,17 +21261,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:debugging_internal__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -22455,11 +21299,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22519,17 +21358,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:demangle_internal
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/internal/demangle.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -22565,11 +21398,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22598,17 +21426,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:demangle_internal__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/internal/demangle.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -22640,11 +21462,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22704,26 +21521,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:examine_stack
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "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_stacktrace",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -22759,11 +21561,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22792,26 +21589,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:examine_stack__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -22843,11 +21625,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22907,27 +21684,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:failure_signal_handler
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "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_stacktrace",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -22963,11 +21724,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -22996,27 +21752,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:failure_signal_handler__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -23048,11 +21788,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23112,16 +21847,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:stacktrace
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/stacktrace.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -23157,11 +21887,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23190,16 +21915,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:stacktrace__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/stacktrace.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -23231,11 +21951,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23295,24 +22010,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:symbolize
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/symbolize.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -23348,11 +22050,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23381,24 +22078,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/debugging:symbolize__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
     srcs: [
         "third_party/abseil-cpp/absl/debugging/symbolize.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -23430,11 +22114,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23494,17 +22173,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:city
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_city",
     srcs: [
         "third_party/abseil-cpp/absl/hash/internal/city.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -23540,11 +22213,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23573,17 +22241,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:city__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
     srcs: [
         "third_party/abseil-cpp/absl/hash/internal/city.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -23615,11 +22277,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23679,25 +22336,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:hash
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_hash",
     srcs: [
         "third_party/abseil-cpp/absl/hash/internal/hash.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -23733,11 +22376,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23766,25 +22404,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:hash__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
     srcs: [
         "third_party/abseil-cpp/absl/hash/internal/hash.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -23816,11 +22440,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23880,18 +22499,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:low_level_hash
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash",
     srcs: [
         "third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_numeric_int128",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -23927,11 +22539,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -23960,18 +22567,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/hash:low_level_hash__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
     srcs: [
         "third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -24003,11 +22603,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24067,7 +22662,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/numeric:int128
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
     srcs: [
         "third_party/abseil-cpp/absl/numeric/int128.cc",
@@ -24107,11 +22702,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24140,7 +22730,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/numeric:int128__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
     srcs: [
         "third_party/abseil-cpp/absl/numeric/int128.cc",
@@ -24176,11 +22766,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24240,7 +22825,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/profiling:exponential_biased
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
     srcs: [
         "third_party/abseil-cpp/absl/profiling/internal/exponential_biased.cc",
@@ -24280,11 +22865,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24313,7 +22893,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/profiling:exponential_biased__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
     srcs: [
         "third_party/abseil-cpp/absl/profiling/internal/exponential_biased.cc",
@@ -24349,11 +22929,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24413,22 +22988,12 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random:distributions
-cc_library_static {
+cc_object {
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -24464,11 +23029,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24497,22 +23057,12 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random:distributions__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/discrete_distribution.cc",
         "third_party/abseil-cpp/absl/random/gaussian_distribution.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -24544,11 +23094,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24608,7 +23153,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:platform
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc",
@@ -24616,9 +23161,6 @@
     generated_headers: [
         "cronet_aml_build_chromeos_buildflags",
     ],
-    export_generated_headers: [
-        "cronet_aml_build_chromeos_buildflags",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -24654,11 +23196,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24687,7 +23224,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:platform__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc",
@@ -24696,9 +23233,6 @@
     generated_headers: [
         "cronet_aml_build_chromeos_buildflags__testing",
     ],
-    export_generated_headers: [
-        "cronet_aml_build_chromeos_buildflags__testing",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -24729,11 +23263,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24793,28 +23322,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:pool_urbg
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/pool_urbg.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen",
-        "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_seed_material",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -24851,11 +23365,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -24884,30 +23393,15 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:pool_urbg__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/pool_urbg.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-    ],
     host_supported: true,
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -24938,11 +23432,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25002,21 +23491,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
-        "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",
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -25053,11 +23534,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25086,23 +23562,15 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-    ],
     host_supported: true,
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -25133,11 +23601,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25197,15 +23660,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_hwaes
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen_detect.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl",
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -25242,11 +23703,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25275,17 +23731,15 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_hwaes__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen_detect.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-    ],
     host_supported: true,
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -25316,11 +23770,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25380,14 +23829,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_hwaes_impl
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -25424,11 +23872,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25457,16 +23900,15 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_hwaes_impl__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-    ],
     host_supported: true,
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -25497,11 +23939,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25561,18 +23998,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_slow
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen_slow.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform",
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -25609,11 +24041,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25642,20 +24069,15 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:randen_slow__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/randen_slow.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-    ],
     host_supported: true,
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -25686,11 +24108,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25750,22 +24167,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:seed_material
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/seed_material.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -25801,11 +24207,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25834,22 +24235,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random/internal:seed_material__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/internal/seed_material.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -25881,11 +24271,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -25945,7 +24330,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random:seed_gen_exception
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception",
     srcs: [
         "third_party/abseil-cpp/absl/random/seed_gen_exception.cc",
@@ -25985,11 +24370,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26018,7 +24398,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random:seed_gen_exception__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/seed_gen_exception.cc",
@@ -26054,11 +24434,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26118,29 +24493,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random:seed_sequences
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences",
     srcs: [
         "third_party/abseil-cpp/absl/random/seed_sequences.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "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_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_seed_material",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
     ],
     defaults: [
         "cronet_aml_defaults",
@@ -26177,11 +24536,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26210,31 +24564,15 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/random:seed_sequences__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
     srcs: [
         "third_party/abseil-cpp/absl/random/seed_sequences.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-    ],
     host_supported: true,
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -26265,11 +24603,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26329,41 +24662,12 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/status:status
-cc_library_static {
+cc_object {
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_debugging_debugging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal",
-        "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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "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_internal",
-        "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_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",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -26399,11 +24703,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26432,41 +24731,12 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/status:status__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
     srcs: [
         "third_party/abseil-cpp/absl/status/status.cc",
         "third_party/abseil-cpp/absl/status/status_payload_printer.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -26498,11 +24768,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26562,42 +24827,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/status:statusor
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_status_statusor",
     srcs: [
         "third_party/abseil-cpp/absl/status/statusor.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_debugging_debugging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal",
-        "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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status",
-        "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_internal",
-        "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_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",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -26633,11 +24867,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26666,42 +24895,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/status:statusor__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
     srcs: [
         "third_party/abseil-cpp/absl/status/statusor.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -26733,11 +24931,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26797,40 +24990,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cord
-cc_library_static {
+cc_object {
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "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_stacktrace",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "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_internal",
-        "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_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",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -26866,11 +25032,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -26899,40 +25060,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cord__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -26964,11 +25098,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27028,7 +25157,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cord_internal
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/cord_internal.cc",
@@ -27039,16 +25168,6 @@
         "third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc",
         "third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -27084,11 +25203,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27117,7 +25231,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cord_internal__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/cord_internal.cc",
@@ -27128,16 +25242,6 @@
         "third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc",
         "third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -27169,11 +25273,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27233,16 +25332,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_functions
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -27278,11 +25372,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27311,16 +25400,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_functions__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -27352,11 +25436,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27416,31 +25495,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_handle
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "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_stacktrace",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_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_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",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -27476,11 +25535,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27509,31 +25563,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_handle__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -27565,11 +25599,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27629,35 +25658,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_info
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/cordz_info.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "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_stacktrace",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "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_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_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",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -27693,11 +25698,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27726,35 +25726,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:cordz_info__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/cordz_info.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -27786,11 +25762,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27850,19 +25821,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:internal
-cc_library_static {
+cc_object {
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -27898,11 +25863,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -27931,19 +25891,13 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:internal__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
     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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -27975,11 +25929,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28039,7 +25988,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:str_format_internal
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc",
@@ -28049,17 +25998,6 @@
         "third_party/abseil-cpp/absl/strings/internal/str_format/output.cc",
         "third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -28095,11 +26033,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28128,7 +26061,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:str_format_internal__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
     srcs: [
         "third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc",
@@ -28138,17 +26071,6 @@
         "third_party/abseil-cpp/absl/strings/internal/str_format/output.cc",
         "third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -28180,11 +26102,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28244,7 +26161,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:strings
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
     srcs: [
         "third_party/abseil-cpp/absl/strings/ascii.cc",
@@ -28261,15 +26178,6 @@
         "third_party/abseil-cpp/absl/strings/string_view.cc",
         "third_party/abseil-cpp/absl/strings/substitute.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -28305,11 +26213,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28338,7 +26241,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/strings:strings__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
     srcs: [
         "third_party/abseil-cpp/absl/strings/ascii.cc",
@@ -28355,15 +26258,6 @@
         "third_party/abseil-cpp/absl/strings/string_view.cc",
         "third_party/abseil-cpp/absl/strings/substitute.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -28395,11 +26289,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28459,18 +26348,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/synchronization:graphcycles_internal
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal",
     srcs: [
         "third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -28506,11 +26388,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28539,18 +26416,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/synchronization:graphcycles_internal__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
     srcs: [
         "third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -28582,11 +26452,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28646,7 +26511,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/synchronization:synchronization
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization",
     srcs: [
         "third_party/abseil-cpp/absl/synchronization/barrier.cc",
@@ -28657,25 +26522,6 @@
         "third_party/abseil-cpp/absl/synchronization/mutex.cc",
         "third_party/abseil-cpp/absl/synchronization/notification.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_raw_logging_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate",
-        "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_stacktrace",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_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_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",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -28711,11 +26557,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28744,7 +26585,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/synchronization:synchronization__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
     srcs: [
         "third_party/abseil-cpp/absl/synchronization/barrier.cc",
@@ -28755,25 +26596,6 @@
         "third_party/abseil-cpp/absl/synchronization/mutex.cc",
         "third_party/abseil-cpp/absl/synchronization/notification.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -28805,11 +26627,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28869,7 +26686,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/time/internal/cctz:civil_time
-cc_library_static {
+cc_object {
     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",
@@ -28909,11 +26726,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -28942,7 +26754,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/time/internal/cctz:civil_time__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
     srcs: [
         "third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc",
@@ -28978,11 +26790,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29042,7 +26849,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/time/internal/cctz:time_zone
-cc_library_static {
+cc_object {
     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",
@@ -29055,9 +26862,6 @@
         "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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -29093,11 +26897,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29126,7 +26925,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/time/internal/cctz:time_zone__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
     srcs: [
         "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc",
@@ -29139,9 +26938,6 @@
         "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",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -29173,11 +26969,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29237,7 +27028,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/time:time
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_time_time",
     srcs: [
         "third_party/abseil-cpp/absl/time/civil_time.cc",
@@ -29246,18 +27037,6 @@
         "third_party/abseil-cpp/absl/time/format.cc",
         "third_party/abseil-cpp/absl/time/time.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "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_throw_delegate",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -29293,11 +27072,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29326,7 +27100,7 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/time:time__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
     srcs: [
         "third_party/abseil-cpp/absl/time/civil_time.cc",
@@ -29335,18 +27109,6 @@
         "third_party/abseil-cpp/absl/time/format.cc",
         "third_party/abseil-cpp/absl/time/time.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -29378,11 +27140,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29442,15 +27199,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/types:bad_optional_access
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access",
     srcs: [
         "third_party/abseil-cpp/absl/types/bad_optional_access.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -29486,11 +27239,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29519,15 +27267,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/types:bad_optional_access__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
     srcs: [
         "third_party/abseil-cpp/absl/types/bad_optional_access.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -29559,11 +27303,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29623,15 +27362,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/types:bad_variant_access
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access",
     srcs: [
         "third_party/abseil-cpp/absl/types/bad_variant_access.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal",
-    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -29667,11 +27402,6 @@
         "third_party/abseil-cpp/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29700,15 +27430,11 @@
 }
 
 // GN: //third_party/abseil-cpp/absl/types:bad_variant_access__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
     srcs: [
         "third_party/abseil-cpp/absl/types/bad_variant_access.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -29740,11 +27466,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29804,7 +27525,7 @@
 }
 
 // GN: //third_party/android_ndk:cpu_features
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_android_ndk_cpu_features",
     srcs: [
         "third_party/android_ndk/sources/android/cpufeatures/cpu-features.c",
@@ -29843,11 +27564,6 @@
         "third_party/android_ndk/sources/android/cpufeatures/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29876,7 +27592,7 @@
 }
 
 // GN: //third_party/android_ndk:cpu_features__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_android_ndk_cpu_features__testing",
     srcs: [
         "third_party/android_ndk/sources/android/cpufeatures/cpu-features.c",
@@ -29915,11 +27631,6 @@
         "third_party/android_ndk/sources/android/cpufeatures/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -29948,7 +27659,7 @@
 }
 
 // GN: //third_party/ashmem:ashmem
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_ashmem_ashmem",
     srcs: [
         "third_party/ashmem/ashmem-dev.c",
@@ -29989,11 +27700,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -30022,7 +27728,7 @@
 }
 
 // GN: //third_party/ashmem:ashmem__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_ashmem_ashmem__testing",
     srcs: [
         "third_party/ashmem/ashmem-dev.c",
@@ -30063,355 +27769,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
-    target: {
-        android_arm: {
-            cflags: [
-                "-fstack-protector",
-            ],
-        },
-        android_arm64: {
-            cflags: [
-                "-fstack-protector",
-                "-mno-outline",
-                "-mno-outline-atomics",
-            ],
-        },
-        android_x86: {
-            cflags: [
-                "-msse3",
-            ],
-        },
-        android_x86_64: {
-            cflags: [
-                "-fstack-protector",
-                "-msse3",
-            ],
-        },
-    },
-}
-
-// 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",
-    ],
-    static_libs: [
-        "cronet_aml_third_party_boringssl_boringssl_asm",
-    ],
-    defaults: [
-        "cronet_aml_defaults",
-    ],
-    cflags: [
-        "-DANDROID",
-        "-DANDROID_NDK_VERSION_ROLL=r23_1",
-        "-DBORINGSSL_ALLOW_CXX_RUNTIME",
-        "-DBORINGSSL_IMPLEMENTATION",
-        "-DBORINGSSL_NO_STATIC_INITIALIZER",
-        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
-        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
-        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
-        "-DHAVE_SYS_UIO_H",
-        "-DNDEBUG",
-        "-DNO_UNWIND_TABLES",
-        "-DNVALGRIND",
-        "-DOFFICIAL_BUILD",
-        "-DOPENSSL_SMALL",
-        "-D_GNU_SOURCE",
-        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-Oz",
-        "-fdata-sections",
-        "-ffunction-sections",
-        "-fno-asynchronous-unwind-tables",
-        "-fno-unwind-tables",
-        "-fvisibility-inlines-hidden",
-        "-fvisibility=hidden",
-        "-g1",
-    ],
-    local_include_dirs: [
-        "./",
-        "buildtools/third_party/libc++/",
-        "buildtools/third_party/libc++/trunk/include",
-        "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/boringssl/src/include/",
-    ],
-    cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -30443,6 +27800,7 @@
 cc_library_static {
     name: "cronet_aml_third_party_boringssl_boringssl__testing",
     srcs: [
+        ":cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "third_party/boringssl/err_data.c",
         "third_party/boringssl/src/crypto/asn1/a_bitstr.c",
         "third_party/boringssl/src/crypto/asn1/a_bool.c",
@@ -30710,9 +28068,6 @@
         "third_party/boringssl/src/ssl/tls_method.cc",
         "third_party/boringssl/src/ssl/tls_record.cc",
     ],
-    static_libs: [
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
-    ],
     host_supported: true,
     defaults: [
         "cronet_aml_defaults",
@@ -30810,147 +28165,8 @@
     },
 }
 
-// GN: //third_party/boringssl:boringssl_asm
-cc_library_static {
-    name: "cronet_aml_third_party_boringssl_boringssl_asm",
-    defaults: [
-        "cronet_aml_defaults",
-    ],
-    cflags: [
-        "-DANDROID",
-        "-DANDROID_NDK_VERSION_ROLL=r23_1",
-        "-DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\"",
-        "-DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851",
-        "-DDYNAMIC_ANNOTATIONS_ENABLED=0",
-        "-DHAVE_SYS_UIO_H",
-        "-DNDEBUG",
-        "-DNO_UNWIND_TABLES",
-        "-DNVALGRIND",
-        "-DOFFICIAL_BUILD",
-        "-D_FORTIFY_SOURCE=2",
-        "-D_GNU_SOURCE",
-        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D__STDC_CONSTANT_MACROS",
-        "-D__STDC_FORMAT_MACROS",
-        "-Oz",
-        "-fdata-sections",
-        "-ffunction-sections",
-        "-fno-asynchronous-unwind-tables",
-        "-fno-unwind-tables",
-        "-fvisibility-inlines-hidden",
-        "-fvisibility=hidden",
-        "-g1",
-    ],
-    local_include_dirs: [
-        "./",
-        "buildtools/third_party/libc++/",
-        "buildtools/third_party/libc++/trunk/include",
-        "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/boringssl/src/include/",
-    ],
-    cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
-    target: {
-        android_arm: {
-            srcs: [
-                "third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/aesv8-armx32.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/armv4-mont.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/bsaes-armv7.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/ghash-armv4.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/ghashv8-armx32.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/sha1-armv4-large.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/sha256-armv4.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/sha512-armv4.S",
-                "third_party/boringssl/linux-arm/crypto/fipsmodule/vpaes-armv7.S",
-                "third_party/boringssl/linux-arm/crypto/test/trampoline-armv4.S",
-                "third_party/boringssl/src/crypto/curve25519/asm/x25519-asm-arm.S",
-                "third_party/boringssl/src/crypto/poly1305/poly1305_arm_asm.S",
-            ],
-            cflags: [
-                "-fstack-protector",
-            ],
-        },
-        android_arm64: {
-            srcs: [
-                "third_party/boringssl/linux-aarch64/crypto/chacha/chacha-armv8.S",
-                "third_party/boringssl/linux-aarch64/crypto/cipher_extra/chacha20_poly1305_armv8.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/aesv8-armx64.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/armv8-mont.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/ghash-neon-armv8.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/ghashv8-armx64.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/p256-armv8-asm.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/p256_beeu-armv8-asm.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/sha1-armv8.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/sha256-armv8.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/sha512-armv8.S",
-                "third_party/boringssl/linux-aarch64/crypto/fipsmodule/vpaes-armv8.S",
-                "third_party/boringssl/linux-aarch64/crypto/test/trampoline-armv8.S",
-            ],
-            cflags: [
-                "-fstack-protector",
-                "-mno-outline",
-                "-mno-outline-atomics",
-            ],
-        },
-        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",
-            ],
-            cflags: [
-                "-msse3",
-            ],
-        },
-        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",
-            ],
-            cflags: [
-                "-fstack-protector",
-                "-msse3",
-            ],
-        },
-    },
-}
-
 // GN: //third_party/boringssl:boringssl_asm__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_boringssl_boringssl_asm__testing",
     host_supported: true,
     defaults: [
@@ -30985,11 +28201,6 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/boringssl/src/include/",
     ],
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-    ],
     target: {
         android_arm: {
             srcs: [
@@ -31531,7 +28742,7 @@
 }
 
 // GN: //third_party/googletest:gmock__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_googletest_gmock__testing",
     srcs: [
         "third_party/googletest/src/googlemock/src/gmock-cardinalities.cc",
@@ -31548,66 +28759,17 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
-        "cronet_aml_third_party_googletest_gtest__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
         "cronet_aml_third_party_modp_b64_modp_b64__testing",
     ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -31653,27 +28815,6 @@
         "third_party/googletest/src/googletest/include/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -31702,7 +28843,7 @@
 }
 
 // GN: //third_party/googletest:gtest__testing
-cc_library_static {
+cc_object {
     name: "cronet_aml_third_party_googletest_gtest__testing",
     srcs: [
         "third_party/googletest/custom/gtest/internal/custom/chrome_custom_temp_dir.cc",
@@ -31725,65 +28866,17 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
         "cronet_aml_third_party_modp_b64_modp_b64__testing",
     ],
+    generated_headers: [
+        "cronet_aml_build_chromeos_buildflags__testing",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -31827,27 +28920,6 @@
         "third_party/googletest/src/googletest/include/",
     ],
     cpp_std: "c++17",
-    ldflags: [
-        "-Wl,--as-needed",
-        "-Wl,--gc-sections",
-        "-Wl,--icf=all",
-        "-Wl,--script,external/cronet/base/android/library_loader/anchor_functions.lds",
-        "-Wl,-wrap,asprintf",
-        "-Wl,-wrap,calloc",
-        "-Wl,-wrap,free",
-        "-Wl,-wrap,getcwd",
-        "-Wl,-wrap,malloc",
-        "-Wl,-wrap,malloc_usable_size",
-        "-Wl,-wrap,memalign",
-        "-Wl,-wrap,posix_memalign",
-        "-Wl,-wrap,pvalloc",
-        "-Wl,-wrap,realloc",
-        "-Wl,-wrap,realpath",
-        "-Wl,-wrap,strdup",
-        "-Wl,-wrap,strndup",
-        "-Wl,-wrap,valloc",
-        "-Wl,-wrap,vasprintf",
-    ],
     target: {
         android_arm: {
             cflags: [
@@ -34500,14 +31572,14 @@
 cc_binary {
     name: "cronet_aml_third_party_protobuf_protoc",
     srcs: [
+        ":cronet_aml_buildtools_third_party_libc___libc__",
+        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi",
         "third_party/protobuf/src/google/protobuf/compiler/main.cc",
     ],
     shared_libs: [
         "libz",
     ],
     static_libs: [
-        "cronet_aml_buildtools_third_party_libc___libc__",
-        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
         "cronet_aml_third_party_protobuf_protobuf_full",
         "cronet_aml_third_party_protobuf_protoc_lib",
     ],
@@ -34713,6 +31785,48 @@
     ],
 }
 
+// GN: //third_party/quic_trace:quic_trace_proto__testing
+cc_genrule {
+    name: "cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen",
+    srcs: [
+        "third_party/quic_trace/src/quic_trace/quic_trace.proto",
+    ],
+    tools: [
+        "cronet_aml_third_party_protobuf_protoc",
+    ],
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc) --proto_path=external/cronet/third_party/quic_trace/src/quic_trace --cpp_out=lite=true:$(genDir)/external/cronet/third_party/quic_trace/src/quic_trace/ $(in)",
+    out: [
+        "external/cronet/third_party/quic_trace/src/quic_trace/quic_trace.pb.cc",
+    ],
+    apex_available: [
+        "com.android.tethering",
+    ],
+}
+
+// GN: //third_party/quic_trace:quic_trace_proto__testing
+cc_genrule {
+    name: "cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen_headers",
+    srcs: [
+        "third_party/quic_trace/src/quic_trace/quic_trace.proto",
+    ],
+    tools: [
+        "cronet_aml_third_party_protobuf_protoc",
+    ],
+    cmd: "$(location cronet_aml_third_party_protobuf_protoc) --proto_path=external/cronet/third_party/quic_trace/src/quic_trace --cpp_out=lite=true:$(genDir)/external/cronet/third_party/quic_trace/src/quic_trace/ $(in)",
+    out: [
+        "external/cronet/third_party/quic_trace/src/quic_trace/quic_trace.pb.h",
+    ],
+    export_include_dirs: [
+        ".",
+        "protos",
+        "third_party/quic_trace/src",
+        "third_party/quic_trace/src/quic_trace",
+    ],
+    apex_available: [
+        "com.android.tethering",
+    ],
+}
+
 // GN: //url:buildflags
 cc_genrule {
     name: "cronet_aml_url_buildflags",
@@ -34787,6 +31901,8 @@
         "url/url_util.cc",
     ],
     shared_libs: [
+        "//external/cronet/third_party/boringssl:libcrypto",
+        "//external/cronet/third_party/boringssl:libssl",
         "libandroid",
         "liblog",
     ],
@@ -34794,60 +31910,8 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc",
         "cronet_aml_base_base",
         "cronet_aml_base_base_static",
-        "cronet_aml_base_nodebug_assertion",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base",
-        "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_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_container_hashtablez_sampler",
-        "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_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_numeric_int128",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions",
-        "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_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_seed_material",
-        "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_internal",
-        "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_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_android_ndk_cpu_features",
-        "cronet_aml_third_party_ashmem_ashmem",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_boringssl_boringssl_asm",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
         "cronet_aml_third_party_libevent_libevent",
@@ -34989,60 +32053,9 @@
         "cronet_aml_base_allocator_partition_allocator_partition_alloc__testing",
         "cronet_aml_base_base__testing",
         "cronet_aml_base_base_static__testing",
-        "cronet_aml_base_nodebug_assertion__testing",
         "cronet_aml_base_third_party_double_conversion_double_conversion__testing",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_base__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_log_severity__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_malloc_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_raw_logging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_spinlock_wait__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_strerror__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_base_throw_delegate__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_hashtablez_sampler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_container_raw_hash_set__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_debugging_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_demangle_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_examine_stack__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_failure_signal_handler__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_stacktrace__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_debugging_symbolize__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_city__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_hash_low_level_hash__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_numeric_int128__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_profiling_exponential_biased__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_distributions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_platform__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_pool_urbg__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_hwaes_impl__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_randen_slow__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_internal_seed_material__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_gen_exception__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_random_seed_sequences__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_status__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_status_statusor__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cord_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_functions__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_handle__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_cordz_info__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_str_format_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_strings_strings__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_graphcycles_internal__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_synchronization_synchronization__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_civil_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_internal_cctz_time_zone__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_time_time__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_optional_access__testing",
-        "cronet_aml_third_party_abseil_cpp_absl_types_bad_variant_access__testing",
-        "cronet_aml_third_party_android_ndk_cpu_features__testing",
-        "cronet_aml_third_party_ashmem_ashmem__testing",
         "cronet_aml_third_party_boringssl_boringssl__testing",
-        "cronet_aml_third_party_boringssl_boringssl_asm__testing",
         "cronet_aml_third_party_icu_icui18n__testing",
         "cronet_aml_third_party_icu_icuuc_private__testing",
         "cronet_aml_third_party_libevent_libevent__testing",
@@ -35227,51 +32240,3 @@
     ],
 }
 
-// GN: LICENSE
-license {
-    name: "external_cronet_license",
-    license_kinds: [
-        "SPDX-license-identifier-AFL-2.0",
-        "SPDX-license-identifier-Apache-2.0",
-        "SPDX-license-identifier-BSD",
-        "SPDX-license-identifier-BSL-1.0",
-        "SPDX-license-identifier-ICU",
-        "SPDX-license-identifier-ISC",
-        "SPDX-license-identifier-MIT",
-        "SPDX-license-identifier-MPL",
-        "SPDX-license-identifier-MPL-1.1",
-        "SPDX-license-identifier-MPL-2.0",
-        "SPDX-license-identifier-NCSA",
-        "SPDX-license-identifier-OpenSSL",
-        "SPDX-license-identifier-Unicode-DFS",
-        "legacy_unencumbered",
-    ],
-    license_text: [
-        "LICENSE",
-        "base/third_party/double_conversion/LICENSE",
-        "base/third_party/dynamic_annotations/LICENSE",
-        "base/third_party/icu/LICENSE",
-        "base/third_party/nspr/LICENSE",
-        "base/third_party/superfasthash/LICENSE",
-        "base/third_party/symbolize/LICENSE",
-        "base/third_party/valgrind/LICENSE",
-        "base/third_party/xdg_user_dirs/LICENSE",
-        "net/third_party/quiche/src/LICENSE",
-        "net/third_party/uri_template/LICENSE",
-        "third_party/abseil-cpp/LICENSE",
-        "third_party/ashmem/LICENSE",
-        "third_party/boringssl/src/LICENSE",
-        "third_party/boringssl/src/third_party/fiat/LICENSE",
-        "third_party/boringssl/src/third_party/googletest/LICENSE",
-        "third_party/boringssl/src/third_party/wycheproof_testvectors/LICENSE",
-        "third_party/brotli/LICENSE",
-        "third_party/icu/LICENSE",
-        "third_party/icu/scripts/LICENSE",
-        "third_party/libevent/LICENSE",
-        "third_party/metrics_proto/LICENSE",
-        "third_party/modp_b64/LICENSE",
-        "third_party/protobuf/LICENSE",
-        "third_party/protobuf/third_party/utf8_range/LICENSE",
-    ],
-}
-
diff --git a/tools/gn2bp/desc_arm.json b/tools/gn2bp/desc_arm.json
index 87b86e3..8087bc9 100644
--- a/tools/gn2bp/desc_arm.json
+++ b/tools/gn2bp/desc_arm.json
Binary files differ
diff --git a/tools/gn2bp/desc_arm64.json b/tools/gn2bp/desc_arm64.json
index 7b8bfe3..99e2332 100644
--- a/tools/gn2bp/desc_arm64.json
+++ b/tools/gn2bp/desc_arm64.json
Binary files differ
diff --git a/tools/gn2bp/desc_x64.json b/tools/gn2bp/desc_x64.json
index df8635a..bba6b56 100644
--- a/tools/gn2bp/desc_x64.json
+++ b/tools/gn2bp/desc_x64.json
Binary files differ
diff --git a/tools/gn2bp/desc_x86.json b/tools/gn2bp/desc_x86.json
index 707b9c7..a5d4891 100644
--- a/tools/gn2bp/desc_x86.json
+++ b/tools/gn2bp/desc_x86.json
Binary files differ
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index d714a90..d6f4c83 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -39,6 +39,8 @@
 
 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
+CRONET_LICENSE_NAME = "external_cronet_license"
+
 # Default targets to translate to the blueprint file.
 DEFAULT_TARGETS = [
     '//components/cronet/android:cronet',
@@ -47,6 +49,7 @@
 
 DEFAULT_TESTS = [
   '//components/cronet/android:cronet_unittests_android__library',
+  '//net:net_unittests__library',
 ]
 
 EXTRAS_ANDROID_BP_FILE = "Android.extras.bp"
@@ -164,6 +167,21 @@
 
 # Additional arguments to apply to Android.bp rules.
 additional_args = {
+    'cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen_headers': [
+      ('export_include_dirs', {
+        "net/third_party/quiche/src",
+      })
+    ],
+    'cronet_aml_net_third_party_quiche_net_quic_test_tools_proto__testing_gen_headers': [
+        ('export_include_dirs', {
+        "net/third_party/quiche/src",
+        })
+     ],
+    'cronet_aml_third_party_quic_trace_quic_trace_proto__testing_gen_headers': [
+        ('export_include_dirs', {
+          "third_party/quic_trace/src",
+        })
+    ],
     'cronet_aml_net_net': [
         ('export_static_lib_headers', {
             'cronet_aml_net_third_party_quiche_quiche',
@@ -188,6 +206,9 @@
     ],
 }
 
+def always_disable(module, arch):
+  return None
+
 def enable_brotli(module, arch):
   # Requires crrev/c/4111690
   if arch is None:
@@ -213,25 +234,43 @@
   else:
     module.arch[arch].shared_libs.add('libz')
 
+def enable_boringssl(module, arch):
+  # Do not add boringssl targets to cc_genrules. This happens, because protobuf targets are
+  # originally static_libraries, but later get converted to a cc_genrule.
+  if module.is_genrule(): return
+  if arch is None:
+    shared_libs = module.shared_libs
+  else:
+    shared_libs = module.arch[arch].shared_libs
+  shared_libs.add('//external/cronet/third_party/boringssl:libcrypto')
+  shared_libs.add('//external/cronet/third_party/boringssl:libssl')
+
 # Android equivalents for third-party libraries that the upstream project
 # depends on.
 builtin_deps = {
     '//buildtools/third_party/libunwind:libunwind':
-        lambda m, a: None, # disable libunwind
+        always_disable,
     '//buildtools/third_party/libunwind:libunwind__testing':
-        lambda m, a: None, # disable libunwind
+        always_disable,
     '//net/data/ssl/chrome_root_store:gen_root_store_inc':
-        lambda m, a: None,
+        always_disable,
     '//net/data/ssl/chrome_root_store:gen_root_store_inc__testing':
-        lambda m, a: None,
+        always_disable,
     '//net/tools/root_store_tool:root_store_tool':
-        lambda m, a: None,
+        always_disable,
     '//net/tools/root_store_tool:root_store_tool__testing':
-        lambda m, a: None,
+        always_disable,
     '//third_party/zlib:zlib':
         enable_zlib,
     '//third_party/zlib:zlib__testing':
         enable_zlib,
+    '//third_party/boringssl:boringssl':
+        enable_boringssl,
+    '//third_party/boringssl:boringssl_asm':
+        # Due to FIPS requirements, downstream BoringSSL has a different "shape" than upstream's.
+        # We're guaranteed that if X depends on :boringssl it will also depend on :boringssl_asm.
+        # Hence, always drop :boringssl_asm and handle the translation entirely in :boringssl.
+        always_disable,
 }
 
 experimental_android_deps = {
@@ -436,8 +475,7 @@
     self.processor_class = None
     self.sdk_version = None
     self.javacflags = set()
-    self.license_kinds = set()
-    self.license_text = set()
+    self.c_std = None
     self.default_applicable_licenses = set()
 
   def to_string(self, output):
@@ -495,8 +533,7 @@
     self._output_field(output, 'processor_class')
     self._output_field(output, 'sdk_version')
     self._output_field(output, 'javacflags')
-    self._output_field(output, 'license_kinds')
-    self._output_field(output, 'license_text')
+    self._output_field(output, 'c_std')
     self._output_field(output, 'default_applicable_licenses')
     if self.rtti:
       self._output_field(output, 'rtti')
@@ -549,13 +586,7 @@
     return self.type == "cc_genrule"
 
   def has_input_files(self):
-    if len(self.srcs) > 0:
-      return True
-    if any([len(target.srcs) > 0 for target in self.target.values()]):
-      return True
-    # Allow cc_static_library with export_generated_headers as those are crucial for
-    # the depending modules
-    return len(self.export_generated_headers) > 0
+    return len(self.srcs) > 0 or any([len(target.srcs) > 0 for target in self.target.values()])
 
   def merge_attribute(self, key, source_module, allowed_archs, source_key = None):
     """
@@ -597,8 +628,8 @@
 
   def to_string(self, output):
     for m in sorted(self.modules.values(), key=lambda m: m.name):
-      if m.type != "cc_library_static" or m.has_input_files():
-        # Don't print cc_library_static with empty srcs. These attributes are already
+      if m.type != "cc_object" or m.has_input_files():
+        # Don't print cc_object with empty srcs. These attributes are already
         # propagated up the tree. Printing them messes the presubmits because
         # every module is compiled while those targets are not reachable in
         # a normal compilation path.
@@ -1026,10 +1057,19 @@
       return "$(location %s)" % arg.replace("gen/", "")
     return arg
 
+  def _replace_binary(self, arg):
+    if arg in self.binary_to_target:
+      return '$(location %s)' % self.binary
+    return arg
+
+  def _remove_python_args(self):
+    self.target.args = [arg for arg in self.target.args if "python3" not in arg]
+
   def _sanitize_args(self):
     self._update_all_args(self._sanitize_filepath_with_location_tag)
     self._update_all_args(self._replace_gen_with_location_tag)
-    self._set_arg_at(0, '$(location %s)' % self.binary)
+    self._update_all_args(self._replace_binary)
+    self._remove_python_args()
     super()._sanitize_args()
 
   def get_tools(self):
@@ -1223,7 +1263,8 @@
     # don't add script arg for the first source -- create_action_module
     # already does this.
     if i != 0:
-      new_args.append('&& python3 $(location %s)' %
+      new_args.append('&&')
+      new_args.append('python3 $(location %s)' %
                    gn_utils.label_to_path(target.script))
     for arg in target.args:
       if '{{source}}' in arg:
@@ -1237,6 +1278,10 @@
         for out in target.outputs:
           if out.endswith(file_name):
             new_args.append('$(location %s)' % out)
+
+        for file in target.sources:
+          if file.endswith(file_name):
+            new_args.append('$(location %s)' % gn_utils.label_to_path(file))
       else:
         new_args.append(arg)
 
@@ -1351,9 +1396,10 @@
 
 def set_module_flags(module, module_type, cflags, defines, ldflags, libs):
   module.cflags.update(_get_cflags(cflags, defines))
-  module.ldflags.update({flag for flag in ldflags
-                         if flag in ldflag_allowlist or flag.startswith("-Wl,-wrap,")})
-  _set_linker_script(module, libs)
+  if module_type != 'cc_object':
+    module.ldflags.update({flag for flag in ldflags
+            if flag in ldflag_allowlist or flag.startswith("-Wl,-wrap,")})
+    _set_linker_script(module, libs)
   # TODO: implement proper cflag parsing.
   for flag in cflags:
     if '-std=' in flag:
@@ -1402,10 +1448,12 @@
       # 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 in ['static_library', 'source_set']:
+  elif target.type == 'static_library':
     module = Module('cc_library_static', bp_module_name, gn_target_name)
   elif target.type == 'shared_library':
     module = Module('cc_library_shared', bp_module_name, gn_target_name)
+  elif target.type == 'source_set':
+    module = Module('cc_object', 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.
@@ -1528,21 +1576,27 @@
     if not module.is_compiled() or module.is_genrule():
       continue
 
-    # Drop compiled modules that doesn't provide any benefit. This is mostly
-    # applicable to source_sets when converted to cc_static_library, sometimes
-    # the source set only has header files which are dropped so the module becomes empty.
-    if dep_module.is_compiled() and not dep_module.has_input_files():
-      continue
-
     if dep_module.type == 'cc_library_shared':
       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 == 'cc_object':
+      module.merge_attribute('generated_headers', dep_module, target.arch.keys())
+      if module.type != 'cc_object':
+        if dep_module.has_input_files():
+          # Only add it as part of srcs if the dep_module has input files otherwise
+          # this would throw an error.
+          module.srcs.add(":" + dep_module.name)
+        module.merge_attribute('export_generated_headers', dep_module,
+                         target.arch.keys(), 'generated_headers')
     elif dep_module.type == 'cc_genrule':
       module.merge_attribute('generated_headers', dep_module, [], 'genrule_headers')
       module.merge_attribute('srcs', dep_module, [], 'genrule_srcs')
       module.merge_attribute('shared_libs', dep_module, [], 'genrule_shared_libs')
       module.merge_attribute('header_libs', dep_module, [], 'genrule_header_libs')
+      if module.type not in ["cc_object"]:
+        module.merge_attribute('export_generated_headers', dep_module, [],
+                         'genrule_headers')
     elif dep_module.type == 'cc_binary':
       continue  # Ignore executables deps (used by cmdline integration tests).
     else:
@@ -1560,13 +1614,20 @@
       # 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':
-        if dep_module.has_input_files():
-          module.target[arch_name].static_libs.add(dep_module.name)
+        module.target[arch_name].static_libs.add(dep_module.name)
       elif dep_module.type == 'cc_genrule':
         module.target[arch_name].generated_headers.update(dep_module.genrule_headers)
         module.target[arch_name].srcs.update(dep_module.genrule_srcs)
         module.target[arch_name].shared_libs.update(dep_module.genrule_shared_libs)
         module.target[arch_name].header_libs.update(dep_module.genrule_header_libs)
+        if module.type not in ["cc_object"]:
+          module.target[arch_name].export_generated_headers.update(
+            dep_module.genrule_headers)
+      elif dep_module.type == 'cc_object':
+        if dep_module.has_input_files():
+          # Only add it as part of srcs if the dep_module has input files otherwise
+          # this would throw an error.
+          module.target[arch_name].srcs.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))
@@ -1694,6 +1755,7 @@
   defaults = Module('cc_defaults', defaults_module, '//gn:default_deps')
   defaults.cflags = [
       '-DGOOGLE_PROTOBUF_NO_RTTI',
+      '-DBORINGSSL_SHARED_LIBRARY',
       '-Wno-error=return-type',
       '-Wno-non-virtual-dtor',
       '-Wno-macro-redefined',
@@ -1707,6 +1769,7 @@
       '-fPIC',
       '-Wno-c++11-narrowing',
   ]
+  defaults.c_std = 'gnu11'
   # Chromium builds do not add a dependency for headers found inside the
   # sysroot, so they are added globally via defaults.
   defaults.target['android'].header_libs = [
@@ -1764,54 +1827,10 @@
 
   return blueprint
 
-def create_license_module(blueprint):
-  module = Module("license", "external_cronet_license", "LICENSE")
-  module.license_kinds.update({
-      'SPDX-license-identifier-MPL',
-      'SPDX-license-identifier-MPL-1.1',
-      'SPDX-license-identifier-ISC',
-      'SPDX-license-identifier-AFL-2.0',
-      'SPDX-license-identifier-MPL-2.0',
-      'SPDX-license-identifier-BSD',
-      'SPDX-license-identifier-Apache-2.0',
-      'SPDX-license-identifier-BSL-1.0',
-      'SPDX-license-identifier-Unicode-DFS',
-      'SPDX-license-identifier-NCSA',
-      'SPDX-license-identifier-OpenSSL',
-      'SPDX-license-identifier-MIT',
-      "SPDX-license-identifier-ICU",
-      'legacy_unencumbered',
-  })
-  module.license_text.update({
-      "LICENSE",
-      "net/third_party/uri_template/LICENSE",
-      "net/third_party/quiche/src/LICENSE",
-      "base/third_party/symbolize/LICENSE",
-      "base/third_party/superfasthash/LICENSE",
-      "base/third_party/xdg_user_dirs/LICENSE",
-      "base/third_party/double_conversion/LICENSE",
-      "base/third_party/nspr/LICENSE",
-      "base/third_party/dynamic_annotations/LICENSE",
-      "base/third_party/icu/LICENSE",
-      "base/third_party/valgrind/LICENSE",
-      "third_party/brotli/LICENSE",
-      "third_party/protobuf/LICENSE",
-      "third_party/protobuf/third_party/utf8_range/LICENSE",
-      "third_party/metrics_proto/LICENSE",
-      "third_party/boringssl/src/LICENSE",
-      "third_party/boringssl/src/third_party/googletest/LICENSE",
-      "third_party/boringssl/src/third_party/wycheproof_testvectors/LICENSE",
-      "third_party/boringssl/src/third_party/fiat/LICENSE",
-      "third_party/libevent/LICENSE",
-      "third_party/ashmem/LICENSE",
-      "third_party/icu/LICENSE",
-      "third_party/icu/scripts/LICENSE",
-      "third_party/abseil-cpp/LICENSE",
-      "third_party/modp_b64/LICENSE",
-  })
+def create_default_license_module(blueprint):
   default_license = Module("package", "", "PACKAGE")
-  default_license.default_applicable_licenses.add(module.name)
-  blueprint.add_module(module)
+  default_license.comment = "The actual license can be found in Android.extras.bp"
+  default_license.default_applicable_licenses.add(CRONET_LICENSE_NAME)
   blueprint.add_module(default_license)
 
 def main():
@@ -1866,7 +1885,7 @@
   # Add any proto groups to the blueprint.
   for l_name, t_names in proto_groups.items():
     create_proto_group_modules(blueprint, gn, l_name, t_names)
-  create_license_module(blueprint)
+  create_default_license_module(blueprint)
   output = [
       """// Copyright (C) 2022 The Android Open Source Project
 //
@@ -1884,6 +1903,8 @@
 //
 // This file is automatically generated by %s. Do not edit.
 
+soong_namespace {}
+
 build = ["Android.extras.bp"]
 """ % (tool_name)
   ]
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 4066673..09a7b80 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -429,6 +429,14 @@
         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.arch[arch].source_set_deps.add(dep.name)
+        target.arch[arch].source_set_deps.update(dep.arch[arch].source_set_deps)
+        # flatten source_set deps
+        if target.is_linker_unit_type():
+          # This ensure that all transitive source set dependencies are
+          # propagated upward to the linker units.
+          target.arch[arch].deps.update(target.arch[arch].source_set_deps)
       elif dep.type == 'group':
         target.update(dep, arch)  # Bubble up groups's cflags/ldflags etc.
       elif dep.type in ['action', 'action_foreach', 'copy']:
@@ -442,11 +450,12 @@
         # java_library.
         pass
 
-      if dep.type in ['static_library', 'source_set']:
-        # Bubble up static_libs and source_set. Necessary, since soong does not propagate
+      # Source set bubble up transitive source sets but can't be combined with this
+      # if they are combined then source sets will bubble up static libraries
+      # while we only want to have source sets bubble up only source sets.
+      if dep.type == 'static_library':
+        # Bubble up static_libs. Necessary, since soong does not propagate
         # static_libs up the build tree.
-        # Source sets are later translated to static_libraries, so it makes sense
-        # to reuse transitive_static_libs_deps.
         target.arch[arch].transitive_static_libs_deps.add(dep.name)
 
       if arch in dep.arch: