Merge "gn2bp: Add `use_nss_certs = false` to gen_desc_json"
diff --git a/Cronet/tests/common/Android.bp b/Cronet/tests/common/Android.bp
new file mode 100644
index 0000000..1ed0881
--- /dev/null
+++ b/Cronet/tests/common/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+//
+
+// Tests in this folder are included both in unit tests and CTS.
+// They must be fast and stable, and exercise public or test APIs.
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+// TODO: Consider merging with ConnectivityCoverageTests which is a collection of all
+// Connectivity tests being used for coverage. This will depend on how far we decide to
+// go with merging NetHttp and Tethering targets.
+android_test {
+ name: "NetHttpCoverageTests",
+ defaults: ["CronetTestJavaDefaults"],
+ sdk_version: "test_current",
+ test_suites: ["general-tests", "mts-tethering"],
+ static_libs: [
+ "modules-utils-native-coverage-listener",
+ "CtsNetHttpTestsLib",
+ "NetHttpTestsLibPreJarJar",
+ ],
+ jarjar_rules: ":framework-tethering-jarjar-rules",
+ compile_multilib: "both",
+}
diff --git a/Cronet/tests/common/AndroidManifest.xml b/Cronet/tests/common/AndroidManifest.xml
new file mode 100644
index 0000000..efe880c
--- /dev/null
+++ b/Cronet/tests/common/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="com.android.net.http.tests.coverage">
+ <!-- NetHttpCoverageTests combines CtsNetHttpTestCases and NetHttpTests targets,
+ so permissions and others are declared in their respective manifests -->
+ <application tools:replace="android:label"
+ android:label="NetHttp coverage tests">
+ <uses-library android:name="android.test.runner" />
+ </application>
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.net.http.tests.coverage"
+ android:label="NetHttp coverage tests">
+ </instrumentation>
+</manifest>
diff --git a/Cronet/tests/common/AndroidTest.xml b/Cronet/tests/common/AndroidTest.xml
new file mode 100644
index 0000000..ca298dd
--- /dev/null
+++ b/Cronet/tests/common/AndroidTest.xml
@@ -0,0 +1,33 @@
+<!--
+ ~ 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.
+ -->
+<configuration description="Runs coverage tests for NetHttp">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="test-file-name" value="NetHttpCoverageTests.apk" />
+ <option name="install-arg" value="-t" />
+ </target_preparer>
+ <option name="test-tag" value="NetHttpCoverageTests" />
+ <!-- Tethering/Connectivity is a SDK 30+ module -->
+ <object type="module_controller"
+ class="com.android.tradefed.testtype.suite.module.Sdk30ModuleController" />
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="com.android.net.http.tests.coverage" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
+ <option name="hidden-api-checks" value="false"/>
+ <option
+ name="device-listeners"
+ value="com.android.modules.utils.testing.NativeCoverageHackInstrumentationListener" />
+ </test>
+</configuration>
diff --git a/Cronet/tests/cts/Android.bp b/Cronet/tests/cts/Android.bp
index 2c28b8d..9a5ed89 100644
--- a/Cronet/tests/cts/Android.bp
+++ b/Cronet/tests/cts/Android.bp
@@ -41,13 +41,8 @@
defaults: [cronet_test_java_defaults],
}
-android_test {
- name: "CtsNetHttpTestCases",
- compile_multilib: "both", // Include both the 32 and 64 bit versions
- defaults: [
- "CronetTestJavaDefaults",
- "cts_defaults",
- ],
+android_library {
+ name: "CtsNetHttpTestsLib",
sdk_version: "test_current",
srcs: [
"src/**/*.java",
@@ -69,7 +64,17 @@
"framework-tethering",
"org.apache.http.legacy",
],
+}
+android_test {
+ name: "CtsNetHttpTestCases",
+ defaults: [
+ "cts_defaults",
+ "CronetTestJavaDefaults",
+ ],
+ sdk_version: "test_current",
+ compile_multilib: "both", // Include both the 32 and 64 bit versions
+ static_libs: ["CtsNetHttpTestsLib"],
// Tag this as a cts test artifact
test_suites: [
"cts",
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 6a8467c..6d27b43 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/HttpEngineTest.java
+++ b/Cronet/tests/cts/src/android/net/http/cts/HttpEngineTest.java
@@ -17,6 +17,7 @@
package android.net.http.cts;
import static android.net.http.cts.util.TestUtilsKt.assertOKStatusCode;
+import static android.net.http.cts.util.TestUtilsKt.assumeOKStatusCode;
import static android.net.http.cts.util.TestUtilsKt.skipIfNoInternetConnection;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -100,13 +101,14 @@
// 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, mCallback.getExecutor());
builder.build().start();
mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
UrlResponseInfo info = mCallback.mResponseInfo;
- assertOKStatusCode(info);
+ assumeOKStatusCode(info);
quicWasUsed = isQuic(info.getNegotiatedProtocol());
if (quicWasUsed) {
break;
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 54c1ee3..5256bae 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/UrlRequestTest.java
+++ b/Cronet/tests/cts/src/android/net/http/cts/UrlRequestTest.java
@@ -21,6 +21,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import android.content.Context;
@@ -30,6 +31,7 @@
import android.net.http.UrlResponseInfo;
import android.net.http.cts.util.HttpCtsTestServer;
import android.net.http.cts.util.TestStatusListener;
+import android.net.http.cts.util.TestUploadDataProvider;
import android.net.http.cts.util.TestUrlRequestCallback;
import android.net.http.cts.util.TestUrlRequestCallback.ResponseStep;
@@ -67,14 +69,14 @@
}
}
- private UrlRequest buildUrlRequest(String url) {
- return mHttpEngine.newUrlRequestBuilder(url, mCallback, mCallback.getExecutor()).build();
+ private UrlRequest.Builder createUrlRequestBuilder(String url) {
+ return mHttpEngine.newUrlRequestBuilder(url, mCallback, mCallback.getExecutor());
}
@Test
public void testUrlRequestGet_CompletesSuccessfully() throws Exception {
String url = mTestServer.getSuccessUrl();
- UrlRequest request = buildUrlRequest(url);
+ UrlRequest request = createUrlRequestBuilder(url).build();
request.start();
mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
@@ -85,7 +87,7 @@
@Test
public void testUrlRequestStatus_InvalidBeforeRequestStarts() throws Exception {
- UrlRequest request = buildUrlRequest(mTestServer.getSuccessUrl());
+ UrlRequest request = createUrlRequestBuilder(mTestServer.getSuccessUrl()).build();
// Calling before request is started should give Status.INVALID,
// since the native adapter is not created.
TestStatusListener statusListener = new TestStatusListener();
@@ -95,7 +97,7 @@
@Test
public void testUrlRequestCancel_CancelCalled() throws Exception {
- UrlRequest request = buildUrlRequest(mTestServer.getSuccessUrl());
+ UrlRequest request = createUrlRequestBuilder(mTestServer.getSuccessUrl()).build();
mCallback.setAutoAdvance(false);
request.start();
@@ -105,4 +107,28 @@
request.cancel();
mCallback.expectCallback(ResponseStep.ON_CANCELED);
}
+
+ @Test
+ public void testUrlRequestPost_EchoRequestBody() throws Exception {
+ String testData = "test";
+ UrlRequest.Builder builder = createUrlRequestBuilder(mTestServer.getEchoBodyUrl());
+
+ TestUploadDataProvider dataProvider = new TestUploadDataProvider(
+ TestUploadDataProvider.SuccessCallbackMode.SYNC, mCallback.getExecutor());
+ dataProvider.addRead(testData.getBytes());
+ builder.setUploadDataProvider(dataProvider, mCallback.getExecutor());
+ builder.addHeader("Content-Type", "text/html");
+ builder.build().start();
+ mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
+
+ assertOKStatusCode(mCallback.mResponseInfo);
+ assertEquals(testData, mCallback.mResponseAsString);
+ dataProvider.assertClosed();
+ }
+
+ @Test
+ public void testUrlRequestFail_FailedCalled() throws Exception {
+ createUrlRequestBuilder("http://0.0.0.0:0/").build().start();
+ mCallback.expectCallback(ResponseStep.ON_FAILED);
+ }
}
diff --git a/Cronet/tests/cts/src/android/net/http/cts/util/TestUtils.kt b/Cronet/tests/cts/src/android/net/http/cts/util/TestUtils.kt
index d30c059..23ec2c8 100644
--- a/Cronet/tests/cts/src/android/net/http/cts/util/TestUtils.kt
+++ b/Cronet/tests/cts/src/android/net/http/cts/util/TestUtils.kt
@@ -19,8 +19,10 @@
import android.content.Context
import android.net.ConnectivityManager
import android.net.http.UrlResponseInfo
+import org.hamcrest.Matchers.equalTo
import org.junit.Assert.assertEquals
import org.junit.Assume.assumeNotNull
+import org.junit.Assume.assumeThat
fun skipIfNoInternetConnection(context: Context) {
val connectivityManager = context.getSystemService(ConnectivityManager::class.java)
@@ -29,5 +31,9 @@
}
fun assertOKStatusCode(info: UrlResponseInfo) {
- assertEquals("Status code must be 200 OK", 200, info.getHttpStatusCode())
+ assertEquals("Status code must be 200 OK", 200, info.httpStatusCode)
+}
+
+fun assumeOKStatusCode(info: UrlResponseInfo) {
+ assumeThat("Status code must be 200 OK", info.getHttpStatusCode(), equalTo(200))
}
diff --git a/Cronet/tests/mts/Android.bp b/Cronet/tests/mts/Android.bp
new file mode 100644
index 0000000..cfafc5b
--- /dev/null
+++ b/Cronet/tests/mts/Android.bp
@@ -0,0 +1,49 @@
+// 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 {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_library {
+ name: "NetHttpTestsLibPreJarJar",
+ srcs: [":cronet_aml_javatests_sources"],
+ static_libs: [
+ "androidx.test.ext.junit",
+ "androidx.test.rules",
+ "junit",
+ ],
+ libs: [
+ "android.test.base",
+ "framework-tethering-pre-jarjar",
+ ]
+}
+
+android_test {
+ name: "NetHttpTests",
+ defaults: [
+ "CronetTestJavaDefaults",
+ "mts-target-sdk-version-current",
+ ],
+ compile_multilib: "both",
+ sdk_version: "test_current",
+ static_libs: ["NetHttpTestsLibPreJarJar"],
+ jarjar_rules: ":framework-tethering-jarjar-rules",
+ test_suites: [
+ "general-tests",
+ "mts-tethering",
+ ],
+}
+
diff --git a/Cronet/tests/mts/AndroidManifest.xml b/Cronet/tests/mts/AndroidManifest.xml
new file mode 100644
index 0000000..62c2060
--- /dev/null
+++ b/Cronet/tests/mts/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.net.http.mts">
+
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.INTERNET"/>
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.net.http.mts"
+ android:label="MTS tests of android.net.http">
+ </instrumentation>
+
+</manifest>
\ No newline at end of file
diff --git a/Cronet/tests/mts/AndroidTest.xml b/Cronet/tests/mts/AndroidTest.xml
new file mode 100644
index 0000000..8cb549e
--- /dev/null
+++ b/Cronet/tests/mts/AndroidTest.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<configuration description="Runs NetHttp Mainline Tests.">
+ <!-- Only run tests if the device under test is SDK version 30 or above. -->
+ <object type="module_controller"
+ class="com.android.tradefed.testtype.suite.module.Sdk30ModuleController" />
+
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="test-file-name" value="NetHttpTests.apk" />
+ </target_preparer>
+
+ <option name="test-tag" value="NetHttpTests" />
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="android.net.http.mts" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
+ <option name="hidden-api-checks" value="false"/>
+ </test>
+
+ <!-- Only run NetHttpTests in MTS if the Tethering Mainline module is installed. -->
+ <object type="module_controller"
+ class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <option name="mainline-module-package-name" value="com.google.android.tethering" />
+ </object>
+</configuration>
\ No newline at end of file
diff --git a/TEST_MAPPING b/TEST_MAPPING
index a1e81c8..34646e2 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -102,6 +102,11 @@
},
{
"name": "FrameworksNetDeflakeTest"
+ },
+ // Run in postsubmit to confirm test passes continously since this is a new test setup
+ // TODO: move tests to presubmit
+ {
+ "name": "NetHttpTests"
}
],
"mainline-presubmit": [
diff --git a/Tethering/apex/Android.bp b/Tethering/apex/Android.bp
index b26911c..67206cd 100644
--- a/Tethering/apex/Android.bp
+++ b/Tethering/apex/Android.bp
@@ -144,7 +144,6 @@
compat_configs: [
"connectivity-platform-compat-config",
- "connectivity-t-platform-compat-config",
],
}
diff --git a/framework-t/Android.bp b/framework-t/Android.bp
index d40fad9..7ef20c5 100644
--- a/framework-t/Android.bp
+++ b/framework-t/Android.bp
@@ -164,6 +164,7 @@
],
}
+// This rule is not used anymore(b/268440216).
platform_compat_config {
name: "connectivity-t-platform-compat-config",
src: ":framework-connectivity-t",
diff --git a/framework-t/src/android/net/NetworkTemplate.java b/framework-t/src/android/net/NetworkTemplate.java
index f633a8f..748b1ba 100644
--- a/framework-t/src/android/net/NetworkTemplate.java
+++ b/framework-t/src/android/net/NetworkTemplate.java
@@ -383,8 +383,9 @@
@Override
public int hashCode() {
- return Objects.hash(mMatchRule, Arrays.hashCode(mMatchWifiNetworkKeys),
- mMetered, mRoaming, mDefaultNetwork, mRatType, mOemManaged);
+ return Objects.hash(mMatchRule, Arrays.hashCode(mMatchSubscriberIds),
+ Arrays.hashCode(mMatchWifiNetworkKeys), mMetered, mRoaming, mDefaultNetwork,
+ mRatType, mOemManaged);
}
@Override
@@ -397,6 +398,7 @@
&& mDefaultNetwork == other.mDefaultNetwork
&& mRatType == other.mRatType
&& mOemManaged == other.mOemManaged
+ && Arrays.equals(mMatchSubscriberIds, other.mMatchSubscriberIds)
&& Arrays.equals(mMatchWifiNetworkKeys, other.mMatchWifiNetworkKeys);
}
return false;
diff --git a/framework-t/src/android/net/nsd/NsdManager.java b/framework-t/src/android/net/nsd/NsdManager.java
index e38ae8e..b4f8897 100644
--- a/framework-t/src/android/net/nsd/NsdManager.java
+++ b/framework-t/src/android/net/nsd/NsdManager.java
@@ -16,6 +16,8 @@
package android.net.nsd;
+import static android.net.connectivity.ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -24,8 +26,6 @@
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemService;
import android.app.compat.CompatChanges;
-import android.compat.annotation.ChangeId;
-import android.compat.annotation.EnabledSince;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.ConnectivityManager.NetworkCallback;
@@ -137,28 +137,6 @@
private static final boolean DBG = false;
/**
- * When enabled, apps targeting < Android 12 are considered legacy for
- * the NSD native daemon.
- * The platform will only keep the daemon running as long as there are
- * any legacy apps connected.
- *
- * After Android 12, direct communication with the native daemon might not work since the native
- * daemon won't always stay alive. Using the NSD APIs from NsdManager as the replacement is
- * recommended.
- * Another alternative could be bundling your own mdns solutions instead of
- * depending on the system mdns native daemon.
- *
- * This compatibility change applies to Android 13 and later only. To toggle behavior on
- * Android 12 and Android 12L, use RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS.
- *
- * @hide
- */
- @ChangeId
- @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.S)
- // This was a platform change ID with value 191844585L before T
- public static final long RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER = 235355681L;
-
- /**
* Broadcast intent action to indicate whether network service discovery is
* enabled or disabled. An extra {@link #EXTRA_NSD_STATE} provides the state
* information as int.
diff --git a/framework/src/android/net/LinkProperties.java b/framework/src/android/net/LinkProperties.java
index b7ee846..e0926e9 100644
--- a/framework/src/android/net/LinkProperties.java
+++ b/framework/src/android/net/LinkProperties.java
@@ -16,19 +16,18 @@
package android.net;
+import static android.net.connectivity.ConnectivityCompatChanges.EXCLUDED_ROUTES;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.compat.CompatChanges;
-import android.compat.annotation.ChangeId;
-import android.compat.annotation.EnabledAfter;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.modules.utils.build.SdkLevel;
import com.android.net.module.util.CollectionUtils;
import com.android.net.module.util.LinkPropertiesUtils;
@@ -58,17 +57,6 @@
*
*/
public final class LinkProperties implements Parcelable {
- /**
- * The {@link #getRoutes()} now can contain excluded as well as included routes. Use
- * {@link RouteInfo#getType()} to determine route type.
- *
- * @hide
- */
- @ChangeId
- @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S_V2)
- @VisibleForTesting
- public static final long EXCLUDED_ROUTES = 186082280;
-
// The interface described by the network link.
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
private String mIfaceName;
diff --git a/framework/src/android/net/connectivity/ConnectivityCompatChanges.java b/framework/src/android/net/connectivity/ConnectivityCompatChanges.java
new file mode 100644
index 0000000..a166675
--- /dev/null
+++ b/framework/src/android/net/connectivity/ConnectivityCompatChanges.java
@@ -0,0 +1,67 @@
+/*
+ * 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 android.net.connectivity;
+
+import android.compat.annotation.ChangeId;
+import android.compat.annotation.EnabledAfter;
+import android.compat.annotation.EnabledSince;
+import android.os.Build;
+
+/**
+ * The class contains all CompatChanges for the Connectivity module.
+ *
+ * <p>This is the centralized place for the CompatChanges used in the Connectivity module.
+ * Putting all the CompatChanges in single place makes it possible to manage them under a single
+ * platform_compat_config.
+ * @hide
+ */
+public final class ConnectivityCompatChanges {
+
+ /**
+ * The {@link android.net.LinkProperties#getRoutes()} now can contain excluded as well as
+ * included routes. Use {@link android.net.RouteInfo#getType()} to determine route type.
+ *
+ * @hide
+ */
+ @ChangeId
+ @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S_V2)
+ public static final long EXCLUDED_ROUTES = 186082280;
+
+ /**
+ * When enabled, apps targeting < Android 12 are considered legacy for
+ * the NSD native daemon.
+ * The platform will only keep the daemon running as long as there are
+ * any legacy apps connected.
+ *
+ * After Android 12, direct communication with the native daemon might not work since the native
+ * daemon won't always stay alive. Using the NSD APIs from NsdManager as the replacement is
+ * recommended.
+ * Another alternative could be bundling your own mdns solutions instead of
+ * depending on the system mdns native daemon.
+ *
+ * This compatibility change applies to Android 13 and later only. To toggle behavior on
+ * Android 12 and Android 12L, use RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS.
+ *
+ * @hide
+ */
+ @ChangeId
+ @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.S)
+ // This was a platform change ID with value 191844585L before T
+ public static final long RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER = 235355681L;
+
+ private ConnectivityCompatChanges() {
+ }
+}
diff --git a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
index 122c2d4..4fbc5f4 100644
--- a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
+++ b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
@@ -247,10 +247,6 @@
return parseBpfNetworkStatsDevInternal(lines, ifaceStatsMap, ifaceIndexNameMap);
}
-uint64_t combineUidTag(const uid_t uid, const uint32_t tag) {
- return (uint64_t)uid << 32 | tag;
-}
-
void groupNetworkStats(std::vector<stats_line>* lines) {
if (lines->size() <= 1) return;
std::sort(lines->begin(), lines->end());
diff --git a/service-t/src/com/android/server/IpSecService.java b/service-t/src/com/android/server/IpSecService.java
index 9e71eb3..a884840 100644
--- a/service-t/src/com/android/server/IpSecService.java
+++ b/service-t/src/com/android/server/IpSecService.java
@@ -17,6 +17,7 @@
package com.android.server;
import static android.Manifest.permission.DUMP;
+import static android.Manifest.permission.NETWORK_SETTINGS;
import static android.net.IpSecManager.FEATURE_IPSEC_TUNNEL_MIGRATION;
import static android.net.IpSecManager.INVALID_RESOURCE_ID;
import static android.system.OsConstants.AF_INET;
@@ -65,6 +66,7 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.Preconditions;
+import com.android.modules.utils.build.SdkLevel;
import com.android.net.module.util.BinderUtils;
import com.android.net.module.util.NetdUtils;
import com.android.net.module.util.PermissionUtils;
@@ -102,6 +104,7 @@
private static final int NETD_FETCH_TIMEOUT_MS = 5000; // ms
private static final InetAddress INADDR_ANY;
+ private static final InetAddress IN6ADDR_ANY;
@VisibleForTesting static final int MAX_PORT_BIND_ATTEMPTS = 10;
@@ -110,6 +113,8 @@
static {
try {
INADDR_ANY = InetAddress.getByAddress(new byte[] {0, 0, 0, 0});
+ IN6ADDR_ANY = InetAddress.getByAddress(
+ new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
@@ -1013,11 +1018,13 @@
private final class EncapSocketRecord extends OwnedResourceRecord {
private FileDescriptor mSocket;
private final int mPort;
+ private final int mFamily; // TODO: what about IPV6_ADDRFORM?
- EncapSocketRecord(int resourceId, FileDescriptor socket, int port) {
+ EncapSocketRecord(int resourceId, FileDescriptor socket, int port, int family) {
super(resourceId);
mSocket = socket;
mPort = port;
+ mFamily = family;
}
/** always guarded by IpSecService#this */
@@ -1038,6 +1045,10 @@
return mSocket;
}
+ public int getFamily() {
+ return mFamily;
+ }
+
@Override
protected ResourceTracker getResourceTracker() {
return getUserRecord().mSocketQuotaTracker;
@@ -1210,15 +1221,16 @@
* and re-binding, during which the system could *technically* hand that port out to someone
* else.
*/
- private int bindToRandomPort(FileDescriptor sockFd) throws IOException {
+ private int bindToRandomPort(FileDescriptor sockFd, int family, InetAddress localAddr)
+ throws IOException {
for (int i = MAX_PORT_BIND_ATTEMPTS; i > 0; i--) {
try {
- FileDescriptor probeSocket = Os.socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- Os.bind(probeSocket, INADDR_ANY, 0);
+ FileDescriptor probeSocket = Os.socket(family, SOCK_DGRAM, IPPROTO_UDP);
+ Os.bind(probeSocket, localAddr, 0);
int port = ((InetSocketAddress) Os.getsockname(probeSocket)).getPort();
Os.close(probeSocket);
Log.v(TAG, "Binding to port " + port);
- Os.bind(sockFd, INADDR_ANY, port);
+ Os.bind(sockFd, localAddr, port);
return port;
} catch (ErrnoException e) {
// Someone miraculously claimed the port just after we closed probeSocket.
@@ -1260,6 +1272,19 @@
@Override
public synchronized IpSecUdpEncapResponse openUdpEncapsulationSocket(int port, IBinder binder)
throws RemoteException {
+ // Experimental support for IPv6 UDP encap.
+ final int family;
+ final InetAddress localAddr;
+ if (SdkLevel.isAtLeastU() && port >= 65536) {
+ PermissionUtils.enforceNetworkStackPermissionOr(mContext, NETWORK_SETTINGS);
+ port -= 65536;
+ family = AF_INET6;
+ localAddr = IN6ADDR_ANY;
+ } else {
+ family = AF_INET;
+ localAddr = INADDR_ANY;
+ }
+
if (port != 0 && (port < FREE_PORT_MIN || port > PORT_MAX)) {
throw new IllegalArgumentException(
"Specified port number must be a valid non-reserved UDP port");
@@ -1278,7 +1303,7 @@
FileDescriptor sockFd = null;
try {
- sockFd = Os.socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ sockFd = Os.socket(family, SOCK_DGRAM, IPPROTO_UDP);
pFd = ParcelFileDescriptor.dup(sockFd);
} finally {
IoUtils.closeQuietly(sockFd);
@@ -1295,15 +1320,16 @@
mNetd.ipSecSetEncapSocketOwner(pFd, callingUid);
if (port != 0) {
Log.v(TAG, "Binding to port " + port);
- Os.bind(pFd.getFileDescriptor(), INADDR_ANY, port);
+ Os.bind(pFd.getFileDescriptor(), localAddr, port);
} else {
- port = bindToRandomPort(pFd.getFileDescriptor());
+ port = bindToRandomPort(pFd.getFileDescriptor(), family, localAddr);
}
userRecord.mEncapSocketRecords.put(
resourceId,
new RefcountedResource<EncapSocketRecord>(
- new EncapSocketRecord(resourceId, pFd.getFileDescriptor(), port),
+ new EncapSocketRecord(resourceId, pFd.getFileDescriptor(), port,
+ family),
binder));
return new IpSecUdpEncapResponse(IpSecManager.Status.OK, resourceId, port,
pFd.getFileDescriptor());
@@ -1580,6 +1606,7 @@
*/
private void checkIpSecConfig(IpSecConfig config) {
UserRecord userRecord = mUserResourceTracker.getUserRecord(Binder.getCallingUid());
+ EncapSocketRecord encapSocketRecord = null;
switch (config.getEncapType()) {
case IpSecTransform.ENCAP_NONE:
@@ -1587,7 +1614,7 @@
case IpSecTransform.ENCAP_ESPINUDP:
case IpSecTransform.ENCAP_ESPINUDP_NON_IKE:
// Retrieve encap socket record; will throw IllegalArgumentException if not found
- userRecord.mEncapSocketRecords.getResourceOrThrow(
+ encapSocketRecord = userRecord.mEncapSocketRecords.getResourceOrThrow(
config.getEncapSocketResourceId());
int port = config.getEncapRemotePort();
@@ -1641,10 +1668,9 @@
+ ") have different address families.");
}
- // Throw an error if UDP Encapsulation is not used in IPv4.
- if (config.getEncapType() != IpSecTransform.ENCAP_NONE && sourceFamily != AF_INET) {
+ if (encapSocketRecord != null && encapSocketRecord.getFamily() != destinationFamily) {
throw new IllegalArgumentException(
- "UDP Encapsulation is not supported for this address family");
+ "UDP encapsulation socket and destination address families must match");
}
switch (config.getMode()) {
diff --git a/service/ServiceConnectivityResources/res/values-mcc310-mnc590/config.xml b/service/ServiceConnectivityResources/res/values-mcc310-mnc590/config.xml
new file mode 120000
index 0000000..2b8e406
--- /dev/null
+++ b/service/ServiceConnectivityResources/res/values-mcc310-mnc590/config.xml
@@ -0,0 +1 @@
+../values-mcc310-mnc004/config.xml
\ No newline at end of file
diff --git a/service/ServiceConnectivityResources/res/values-mcc310-mnc599/config.xml b/service/ServiceConnectivityResources/res/values-mcc310-mnc599/config.xml
new file mode 120000
index 0000000..2b8e406
--- /dev/null
+++ b/service/ServiceConnectivityResources/res/values-mcc310-mnc599/config.xml
@@ -0,0 +1 @@
+../values-mcc310-mnc004/config.xml
\ No newline at end of file
diff --git a/service/ServiceConnectivityResources/res/values-mcc311-mnc270/config.xml b/service/ServiceConnectivityResources/res/values-mcc311-mnc270/config.xml
new file mode 120000
index 0000000..2b8e406
--- /dev/null
+++ b/service/ServiceConnectivityResources/res/values-mcc311-mnc270/config.xml
@@ -0,0 +1 @@
+../values-mcc310-mnc004/config.xml
\ No newline at end of file
diff --git a/service/ServiceConnectivityResources/res/values-mcc311-mnc280/config.xml b/service/ServiceConnectivityResources/res/values-mcc311-mnc280/config.xml
new file mode 120000
index 0000000..2b8e406
--- /dev/null
+++ b/service/ServiceConnectivityResources/res/values-mcc311-mnc280/config.xml
@@ -0,0 +1 @@
+../values-mcc310-mnc004/config.xml
\ No newline at end of file
diff --git a/service/ServiceConnectivityResources/res/values-mcc311-mnc480/config.xml b/service/ServiceConnectivityResources/res/values-mcc311-mnc480/config.xml
deleted file mode 100644
index 7e7025f..0000000
--- a/service/ServiceConnectivityResources/res/values-mcc311-mnc480/config.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2021 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.
- -->
-
-<!-- Configuration values for ConnectivityService
- DO NOT EDIT THIS FILE for specific device configuration; instead, use a Runtime Resources
- Overlay package following the overlayable.xml configuration in the same directory:
- https://source.android.com/devices/architecture/rros -->
-<resources>
- <!-- Whether the device should automatically switch away from Wi-Fi networks that lose
- Internet access. Actual device behaviour is controlled by
- Settings.Global.NETWORK_AVOID_BAD_WIFI. This is the default value of that setting. -->
- <integer translatable="false" name="config_networkAvoidBadWifi">0</integer>
-</resources>
\ No newline at end of file
diff --git a/service/ServiceConnectivityResources/res/values-mcc311-mnc480/config.xml b/service/ServiceConnectivityResources/res/values-mcc311-mnc480/config.xml
new file mode 120000
index 0000000..2b8e406
--- /dev/null
+++ b/service/ServiceConnectivityResources/res/values-mcc311-mnc480/config.xml
@@ -0,0 +1 @@
+../values-mcc310-mnc004/config.xml
\ No newline at end of file
diff --git a/tests/common/java/android/net/LinkPropertiesTest.java b/tests/common/java/android/net/LinkPropertiesTest.java
index 5ee375f..09f5d6e 100644
--- a/tests/common/java/android/net/LinkPropertiesTest.java
+++ b/tests/common/java/android/net/LinkPropertiesTest.java
@@ -32,6 +32,7 @@
import android.compat.testing.PlatformCompatChangeRule;
import android.net.LinkProperties.ProvisioningChange;
+import android.net.connectivity.ConnectivityCompatChanges;
import android.os.Build;
import android.system.OsConstants;
import android.util.ArraySet;
@@ -1261,7 +1262,7 @@
@Test @IgnoreUpTo(Build.VERSION_CODES.R)
@CtsNetTestCasesMaxTargetSdk31(reason = "Compat change cannot be overridden when targeting T+")
- @EnableCompatChanges({LinkProperties.EXCLUDED_ROUTES})
+ @EnableCompatChanges({ConnectivityCompatChanges.EXCLUDED_ROUTES})
public void testHasExcludeRoute() {
LinkProperties lp = new LinkProperties();
lp.setInterfaceName("tun0");
@@ -1274,7 +1275,7 @@
@Test @IgnoreUpTo(Build.VERSION_CODES.R)
@CtsNetTestCasesMaxTargetSdk31(reason = "Compat change cannot be overridden when targeting T+")
- @EnableCompatChanges({LinkProperties.EXCLUDED_ROUTES})
+ @EnableCompatChanges({ConnectivityCompatChanges.EXCLUDED_ROUTES})
public void testRouteAddWithSameKey() throws Exception {
LinkProperties lp = new LinkProperties();
lp.setInterfaceName("wlan0");
@@ -1348,14 +1349,14 @@
@Test @IgnoreUpTo(Build.VERSION_CODES.R)
@CtsNetTestCasesMaxTargetSdk31(reason = "Compat change cannot be overridden when targeting T+")
- @EnableCompatChanges({LinkProperties.EXCLUDED_ROUTES})
+ @EnableCompatChanges({ConnectivityCompatChanges.EXCLUDED_ROUTES})
public void testExcludedRoutesEnabledByCompatChange() {
assertExcludeRoutesVisible();
}
@Test @IgnoreUpTo(Build.VERSION_CODES.R)
@CtsNetTestCasesMaxTargetSdk31(reason = "Compat change cannot be overridden when targeting T+")
- @DisableCompatChanges({LinkProperties.EXCLUDED_ROUTES})
+ @DisableCompatChanges({ConnectivityCompatChanges.EXCLUDED_ROUTES})
public void testExcludedRoutesDisabledByCompatChange() {
checkExcludeRoutesNotVisibleAfterS();
}
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 a62ef8a..f1ab62d 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
@@ -41,6 +41,7 @@
import static com.android.networkstack.apishim.ConstantsShim.RECEIVER_EXPORTED;
import static com.android.testutils.Cleanup.testAndCleanup;
import static com.android.testutils.DevSdkIgnoreRuleKt.SC_V2;
+import static com.android.testutils.RecorderCallback.CallbackEntry.BLOCKED_STATUS_INT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -1643,7 +1644,8 @@
// setRequireVpnForUids setup a lockdown rule asynchronously. So it needs to wait for
// BlockedStatusCallback to be fired before checking the blocking status of incoming
// packets.
- remoteUidCallback.expectBlockedStatusCallback(network, BLOCKED_REASON_LOCKDOWN_VPN);
+ remoteUidCallback.expect(BLOCKED_STATUS_INT, network,
+ cb -> cb.getReason() == BLOCKED_REASON_LOCKDOWN_VPN);
if (SdkLevel.isAtLeastT()) {
// On T and above, lockdown rule drop packets not coming from lo regardless of the
@@ -1818,9 +1820,6 @@
super.expectAvailableCallbacks(network, false /* suspended */, true /* validated */,
BLOCKED_REASON_NONE, NETWORK_CALLBACK_TIMEOUT_MS);
}
- public void expectBlockedStatusCallback(Network network, int blockedStatus) {
- super.expectBlockedStatusCallback(blockedStatus, network, NETWORK_CALLBACK_TIMEOUT_MS);
- }
public void onBlockedStatusChanged(Network network, int blockedReasons) {
getHistory().add(new CallbackEntry.BlockedStatusInt(network, blockedReasons));
}
diff --git a/tests/cts/net/native/dns/Android.bp b/tests/cts/net/native/dns/Android.bp
index 434e529..49b9337 100644
--- a/tests/cts/net/native/dns/Android.bp
+++ b/tests/cts/net/native/dns/Android.bp
@@ -24,6 +24,10 @@
"liblog",
"libutils",
],
+ static_libs: [
+ "libbase",
+ "libnetdutils",
+ ],
// To be compatible with Q devices, the min_sdk_version must be 29.
min_sdk_version: "29",
}
diff --git a/tests/cts/net/native/dns/NativeDnsAsyncTest.cpp b/tests/cts/net/native/dns/NativeDnsAsyncTest.cpp
index e501475..68bd227 100644
--- a/tests/cts/net/native/dns/NativeDnsAsyncTest.cpp
+++ b/tests/cts/net/native/dns/NativeDnsAsyncTest.cpp
@@ -28,6 +28,7 @@
#include <android/multinetwork.h>
#include <gtest/gtest.h>
+#include <netdutils/NetNativeTestBase.h>
namespace {
constexpr int MAXPACKET = 8 * 1024;
@@ -101,7 +102,9 @@
} // namespace
-TEST (NativeDnsAsyncTest, Async_Query) {
+class NativeDnsAsyncTest : public NetNativeTestBase {};
+
+TEST_F(NativeDnsAsyncTest, Async_Query) {
// V4
int fd1 = android_res_nquery(
NETWORK_UNSPECIFIED, "www.google.com", ns_c_in, ns_t_a, 0);
@@ -123,7 +126,7 @@
expectAnswersValid(fd1, AF_INET6, ns_r_noerror);
}
-TEST (NativeDnsAsyncTest, Async_Send) {
+TEST_F(NativeDnsAsyncTest, Async_Send) {
// V4
uint8_t buf1[MAXPACKET] = {};
int len1 = res_mkquery(ns_o_query, "www.googleapis.com",
@@ -162,7 +165,7 @@
expectAnswersValid(fd1, AF_INET6, ns_r_noerror);
}
-TEST (NativeDnsAsyncTest, Async_NXDOMAIN) {
+TEST_F(NativeDnsAsyncTest, Async_NXDOMAIN) {
uint8_t buf[MAXPACKET] = {};
int len = res_mkquery(ns_o_query, "test1-nx.metric.gstatic.com",
ns_c_in, ns_t_a, nullptr, 0, nullptr, buf, sizeof(buf));
@@ -191,7 +194,7 @@
expectAnswersValid(fd1, AF_INET6, ns_r_nxdomain);
}
-TEST (NativeDnsAsyncTest, Async_Cancel) {
+TEST_F(NativeDnsAsyncTest, Async_Cancel) {
int fd = android_res_nquery(
NETWORK_UNSPECIFIED, "www.google.com", ns_c_in, ns_t_a, 0);
errno = 0;
@@ -202,7 +205,7 @@
// otherwise it will hit fdsan double-close fd.
}
-TEST (NativeDnsAsyncTest, Async_Query_MALFORMED) {
+TEST_F(NativeDnsAsyncTest, Async_Query_MALFORMED) {
// Empty string to create BLOB and query, we will get empty result and rcode = 0
// on DNSTLS.
int fd = android_res_nquery(
@@ -221,7 +224,7 @@
EXPECT_EQ(-EMSGSIZE, fd);
}
-TEST (NativeDnsAsyncTest, Async_Send_MALFORMED) {
+TEST_F(NativeDnsAsyncTest, Async_Send_MALFORMED) {
uint8_t buf[10] = {};
// empty BLOB
int fd = android_res_nsend(NETWORK_UNSPECIFIED, buf, 10, 0);
diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
index ccba983..68b20e2 100644
--- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -2385,7 +2385,7 @@
}
public void eventuallyExpectBlockedStatusCallback(Network network, int blockedStatus) {
super.eventuallyExpect(CallbackEntry.BLOCKED_STATUS_INT, NETWORK_CALLBACK_TIMEOUT_MS,
- (it) -> it.getNetwork().equals(network) && it.getBlocked() == blockedStatus);
+ (it) -> it.getNetwork().equals(network) && it.getReason() == blockedStatus);
}
public void onBlockedStatusChanged(Network network, int blockedReasons) {
getHistory().add(new CallbackEntry.BlockedStatusInt(network, blockedReasons));
diff --git a/tests/cts/net/src/android/net/cts/IpSecManagerTest.java b/tests/cts/net/src/android/net/cts/IpSecManagerTest.java
index 8234ec1..4fa0080 100644
--- a/tests/cts/net/src/android/net/cts/IpSecManagerTest.java
+++ b/tests/cts/net/src/android/net/cts/IpSecManagerTest.java
@@ -16,6 +16,7 @@
package android.net.cts;
+import static android.Manifest.permission.NETWORK_SETTINGS;
import static android.net.IpSecAlgorithm.AUTH_AES_CMAC;
import static android.net.IpSecAlgorithm.AUTH_AES_XCBC;
import static android.net.IpSecAlgorithm.AUTH_CRYPT_AES_GCM;
@@ -52,7 +53,9 @@
import static com.android.compatibility.common.util.PropertyUtil.getFirstApiLevel;
import static com.android.compatibility.common.util.PropertyUtil.getVendorApiLevel;
+import static com.android.testutils.DeviceInfoUtils.isKernelVersionAtLeast;
import static com.android.testutils.MiscAsserts.assertThrows;
+import static com.android.testutils.TestPermissionUtil.runAsShell;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
@@ -62,6 +65,8 @@
import android.net.IpSecAlgorithm;
import android.net.IpSecManager;
+import android.net.IpSecManager.SecurityParameterIndex;
+import android.net.IpSecManager.UdpEncapsulationSocket;
import android.net.IpSecTransform;
import android.net.TrafficStats;
import android.os.Build;
@@ -73,6 +78,7 @@
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
+import com.android.modules.utils.build.SdkLevel;
import com.android.testutils.DevSdkIgnoreRule;
import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
@@ -120,7 +126,7 @@
@Test
public void testAllocSpi() throws Exception {
for (InetAddress addr : GOOGLE_DNS_LIST) {
- IpSecManager.SecurityParameterIndex randomSpi = null, droidSpi = null;
+ SecurityParameterIndex randomSpi, droidSpi;
randomSpi = mISM.allocateSecurityParameterIndex(addr);
assertTrue(
"Failed to receive a valid SPI",
@@ -258,6 +264,24 @@
accepted.close();
}
+ private IpSecTransform buildTransportModeTransform(
+ SecurityParameterIndex spi, InetAddress localAddr,
+ UdpEncapsulationSocket encapSocket)
+ throws Exception {
+ final IpSecTransform.Builder builder =
+ new IpSecTransform.Builder(InstrumentationRegistry.getContext())
+ .setEncryption(new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY))
+ .setAuthentication(
+ new IpSecAlgorithm(
+ IpSecAlgorithm.AUTH_HMAC_SHA256,
+ AUTH_KEY,
+ AUTH_KEY.length * 8));
+ if (encapSocket != null) {
+ builder.setIpv4Encapsulation(encapSocket, encapSocket.getPort());
+ }
+ return builder.buildTransportModeTransform(localAddr, spi);
+ }
+
/*
* Alloc outbound SPI
* Alloc inbound SPI
@@ -268,21 +292,8 @@
* release transform
* send data (expect exception)
*/
- @Test
- public void testCreateTransform() throws Exception {
- InetAddress localAddr = InetAddress.getByName(IPV4_LOOPBACK);
- IpSecManager.SecurityParameterIndex spi =
- mISM.allocateSecurityParameterIndex(localAddr);
-
- IpSecTransform transform =
- new IpSecTransform.Builder(InstrumentationRegistry.getContext())
- .setEncryption(new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY))
- .setAuthentication(
- new IpSecAlgorithm(
- IpSecAlgorithm.AUTH_HMAC_SHA256,
- AUTH_KEY,
- AUTH_KEY.length * 8))
- .buildTransportModeTransform(localAddr, spi);
+ private void doTestCreateTransform(String loopbackAddrString, boolean encap) throws Exception {
+ InetAddress localAddr = InetAddress.getByName(loopbackAddrString);
final boolean [][] applyInApplyOut = {
{false, false}, {false, true}, {true, false}, {true,true}};
@@ -291,50 +302,93 @@
byte[] in = new byte[data.length];
DatagramPacket inPacket = new DatagramPacket(in, in.length);
- DatagramSocket localSocket;
int localPort;
for(boolean[] io : applyInApplyOut) {
boolean applyIn = io[0];
boolean applyOut = io[1];
- // Bind localSocket to a random available port.
- localSocket = new DatagramSocket(0);
- localPort = localSocket.getLocalPort();
- localSocket.setSoTimeout(200);
- outPacket.setPort(localPort);
- if (applyIn) {
- mISM.applyTransportModeTransform(
- localSocket, IpSecManager.DIRECTION_IN, transform);
- }
- if (applyOut) {
- mISM.applyTransportModeTransform(
- localSocket, IpSecManager.DIRECTION_OUT, transform);
- }
- if (applyIn == applyOut) {
- localSocket.send(outPacket);
- localSocket.receive(inPacket);
- assertTrue("Encapsulated data did not match.",
- Arrays.equals(outPacket.getData(), inPacket.getData()));
- mISM.removeTransportModeTransforms(localSocket);
- localSocket.close();
- } else {
- try {
+ try (
+ SecurityParameterIndex spi = mISM.allocateSecurityParameterIndex(localAddr);
+ UdpEncapsulationSocket encapSocket = encap
+ ? getPrivilegedUdpEncapSocket(/*ipv6=*/ localAddr instanceof Inet6Address)
+ : null;
+ IpSecTransform transform = buildTransportModeTransform(spi, localAddr,
+ encapSocket);
+ // Bind localSocket to a random available port.
+ DatagramSocket localSocket = new DatagramSocket(0);
+ ) {
+ localPort = localSocket.getLocalPort();
+ localSocket.setSoTimeout(200);
+ outPacket.setPort(localPort);
+ if (applyIn) {
+ mISM.applyTransportModeTransform(
+ localSocket, IpSecManager.DIRECTION_IN, transform);
+ }
+ if (applyOut) {
+ mISM.applyTransportModeTransform(
+ localSocket, IpSecManager.DIRECTION_OUT, transform);
+ }
+ if (applyIn == applyOut) {
localSocket.send(outPacket);
localSocket.receive(inPacket);
- } catch (IOException e) {
- continue;
- } finally {
+ assertTrue("Encrypted data did not match.",
+ Arrays.equals(outPacket.getData(), inPacket.getData()));
mISM.removeTransportModeTransforms(localSocket);
- localSocket.close();
+ } else {
+ try {
+ localSocket.send(outPacket);
+ localSocket.receive(inPacket);
+ } catch (IOException e) {
+ continue;
+ } finally {
+ mISM.removeTransportModeTransforms(localSocket);
+ }
+ // FIXME: This check is disabled because sockets currently receive data
+ // if there is a valid SA for decryption, even when the input policy is
+ // not applied to a socket.
+ // fail("Data IO should fail on asymmetrical transforms! + Input="
+ // + applyIn + " Output=" + applyOut);
}
- // FIXME: This check is disabled because sockets currently receive data
- // if there is a valid SA for decryption, even when the input policy is
- // not applied to a socket.
- // fail("Data IO should fail on asymmetrical transforms! + Input="
- // + applyIn + " Output=" + applyOut);
}
}
- transform.close();
+ }
+
+ private UdpEncapsulationSocket getPrivilegedUdpEncapSocket(boolean ipv6) throws Exception {
+ return runAsShell(NETWORK_SETTINGS, () -> {
+ if (ipv6) {
+ return mISM.openUdpEncapsulationSocket(65536);
+ } else {
+ // Can't pass 0 to IpSecManager#openUdpEncapsulationSocket(int).
+ return mISM.openUdpEncapsulationSocket();
+ }
+ });
+ }
+
+ private void assumeExperimentalIpv6UdpEncapSupported() throws Exception {
+ assumeTrue("Not supported before U", SdkLevel.isAtLeastU());
+ assumeTrue("Not supported by kernel", isKernelVersionAtLeast("5.15.31")
+ || (isKernelVersionAtLeast("5.10.108") && !isKernelVersionAtLeast("5.15.0")));
+ }
+
+ @Test
+ public void testCreateTransformIpv4() throws Exception {
+ doTestCreateTransform(IPV4_LOOPBACK, false);
+ }
+
+ @Test
+ public void testCreateTransformIpv6() throws Exception {
+ doTestCreateTransform(IPV6_LOOPBACK, false);
+ }
+
+ @Test
+ public void testCreateTransformIpv4Encap() throws Exception {
+ doTestCreateTransform(IPV4_LOOPBACK, true);
+ }
+
+ @Test
+ public void testCreateTransformIpv6Encap() throws Exception {
+ assumeExperimentalIpv6UdpEncapSupported();
+ doTestCreateTransform(IPV6_LOOPBACK, true);
}
/** Snapshot of TrafficStats as of initStatsChecker call for later comparisons */
@@ -503,8 +557,8 @@
StatsChecker.initStatsChecker();
InetAddress local = InetAddress.getByName(localAddress);
- try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket();
- IpSecManager.SecurityParameterIndex spi =
+ try (UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket();
+ SecurityParameterIndex spi =
mISM.allocateSecurityParameterIndex(local)) {
IpSecTransform.Builder transformBuilder =
@@ -656,7 +710,7 @@
public void testIkeOverUdpEncapSocket() throws Exception {
// IPv6 not supported for UDP-encap-ESP
InetAddress local = InetAddress.getByName(IPV4_LOOPBACK);
- try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
+ try (UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
NativeUdpSocket wrappedEncapSocket =
new NativeUdpSocket(encapSocket.getFileDescriptor());
checkIkePacket(wrappedEncapSocket, local);
@@ -665,7 +719,7 @@
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
- try (IpSecManager.SecurityParameterIndex spi =
+ try (SecurityParameterIndex spi =
mISM.allocateSecurityParameterIndex(local);
IpSecTransform transform =
new IpSecTransform.Builder(InstrumentationRegistry.getContext())
@@ -1498,7 +1552,7 @@
@Test
public void testOpenUdpEncapSocketSpecificPort() throws Exception {
- IpSecManager.UdpEncapsulationSocket encapSocket = null;
+ UdpEncapsulationSocket encapSocket = null;
int port = -1;
for (int i = 0; i < MAX_PORT_BIND_ATTEMPTS; i++) {
try {
@@ -1527,7 +1581,7 @@
@Test
public void testOpenUdpEncapSocketRandomPort() throws Exception {
- try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
+ try (UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
assertTrue("Returned invalid port", encapSocket.getPort() != 0);
}
}
diff --git a/tests/cts/net/src/android/net/cts/NsdManagerTest.kt b/tests/cts/net/src/android/net/cts/NsdManagerTest.kt
index 9b27df5..093c7f8 100644
--- a/tests/cts/net/src/android/net/cts/NsdManagerTest.kt
+++ b/tests/cts/net/src/android/net/cts/NsdManagerTest.kt
@@ -30,6 +30,7 @@
import android.net.TestNetworkInterface
import android.net.TestNetworkManager
import android.net.TestNetworkSpecifier
+import android.net.connectivity.ConnectivityCompatChanges
import android.net.cts.NsdManagerTest.NsdDiscoveryRecord.DiscoveryEvent.DiscoveryStarted
import android.net.cts.NsdManagerTest.NsdDiscoveryRecord.DiscoveryEvent.DiscoveryStopped
import android.net.cts.NsdManagerTest.NsdDiscoveryRecord.DiscoveryEvent.ServiceFound
@@ -40,8 +41,8 @@
import android.net.cts.NsdManagerTest.NsdRegistrationRecord.RegistrationEvent.ServiceRegistered
import android.net.cts.NsdManagerTest.NsdRegistrationRecord.RegistrationEvent.ServiceUnregistered
import android.net.cts.NsdManagerTest.NsdRegistrationRecord.RegistrationEvent.UnregistrationFailed
-import android.net.cts.NsdManagerTest.NsdResolveRecord.ResolveEvent.ResolveFailed
import android.net.cts.NsdManagerTest.NsdResolveRecord.ResolveEvent.ResolutionStopped
+import android.net.cts.NsdManagerTest.NsdResolveRecord.ResolveEvent.ResolveFailed
import android.net.cts.NsdManagerTest.NsdResolveRecord.ResolveEvent.ServiceResolved
import android.net.cts.NsdManagerTest.NsdResolveRecord.ResolveEvent.StopResolutionFailed
import android.net.cts.NsdManagerTest.NsdServiceInfoCallbackRecord.ServiceInfoCallbackEvent.RegisterCallbackFailed
@@ -783,7 +784,7 @@
// when the compat change is disabled.
// Note that before T the compat constant had a different int value.
assertFalse(CompatChanges.isChangeEnabled(
- NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER))
+ ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER))
}
@Test
diff --git a/tests/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt b/tests/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt
index 26b058d..cf3f375 100644
--- a/tests/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt
+++ b/tests/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt
@@ -37,7 +37,6 @@
import android.net.TestNetworkStackClient
import android.net.Uri
import android.net.metrics.IpConnectivityLog
-import com.android.server.connectivity.MultinetworkPolicyTracker
import android.os.ConditionVariable
import android.os.IBinder
import android.os.SystemConfigManager
@@ -52,6 +51,7 @@
import com.android.server.NetworkAgentWrapper
import com.android.server.TestNetIdManager
import com.android.server.connectivity.MockableSystemProperties
+import com.android.server.connectivity.MultinetworkPolicyTracker
import com.android.server.connectivity.ProxyTracker
import com.android.testutils.TestableNetworkCallback
import org.junit.After
@@ -73,7 +73,6 @@
import org.mockito.MockitoAnnotations
import org.mockito.Spy
import kotlin.test.assertEquals
-import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import kotlin.test.fail
@@ -297,7 +296,9 @@
assertEquals(Uri.parse("https://login.capport.android.com"), capportData.userPortalUrl)
assertEquals(Uri.parse("https://venueinfo.capport.android.com"), capportData.venueInfoUrl)
- val nc = testCb.expectCapabilitiesWith(NET_CAPABILITY_CAPTIVE_PORTAL, na, TEST_TIMEOUT_MS)
- assertFalse(nc.hasCapability(NET_CAPABILITY_VALIDATED))
+ testCb.expectCaps(na, TEST_TIMEOUT_MS) {
+ it.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL) &&
+ !it.hasCapability(NET_CAPABILITY_VALIDATED)
+ }
}
-}
\ No newline at end of file
+}
diff --git a/tests/unit/java/android/net/NetworkTemplateTest.kt b/tests/unit/java/android/net/NetworkTemplateTest.kt
index 78854fb..edbcea9 100644
--- a/tests/unit/java/android/net/NetworkTemplateTest.kt
+++ b/tests/unit/java/android/net/NetworkTemplateTest.kt
@@ -443,6 +443,35 @@
}
@Test
+ fun testEquals() {
+ val templateImsi1 = NetworkTemplate.Builder(MATCH_MOBILE).setMeteredness(METERED_YES)
+ .setSubscriberIds(setOf(TEST_IMSI1)).setRatType(TelephonyManager.NETWORK_TYPE_UMTS)
+ .build()
+ val dupTemplateImsi1 = NetworkTemplate(MATCH_MOBILE, arrayOf(TEST_IMSI1),
+ emptyArray<String>(), METERED_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL,
+ TelephonyManager.NETWORK_TYPE_UMTS, OEM_MANAGED_ALL)
+ val templateImsi2 = NetworkTemplate.Builder(MATCH_MOBILE).setMeteredness(METERED_YES)
+ .setSubscriberIds(setOf(TEST_IMSI2)).setRatType(TelephonyManager.NETWORK_TYPE_UMTS)
+ .build()
+
+ assertEquals(templateImsi1, dupTemplateImsi1)
+ assertEquals(dupTemplateImsi1, templateImsi1)
+ assertNotEquals(templateImsi1, templateImsi2)
+
+ val templateWifiKey1 = NetworkTemplate.Builder(MATCH_WIFI)
+ .setWifiNetworkKeys(setOf(TEST_WIFI_KEY1)).build()
+ val dupTemplateWifiKey1 = NetworkTemplate(MATCH_WIFI, emptyArray<String>(),
+ arrayOf(TEST_WIFI_KEY1), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL,
+ NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
+ val templateWifiKey2 = NetworkTemplate.Builder(MATCH_WIFI)
+ .setWifiNetworkKeys(setOf(TEST_WIFI_KEY2)).build()
+
+ assertEquals(templateWifiKey1, dupTemplateWifiKey1)
+ assertEquals(dupTemplateWifiKey1, templateWifiKey1)
+ assertNotEquals(templateWifiKey1, templateWifiKey2)
+ }
+
+ @Test
fun testParcelUnparcel() {
val templateMobile = NetworkTemplate(MATCH_MOBILE, arrayOf(TEST_IMSI1),
emptyArray<String>(), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL,
diff --git a/tests/unit/java/android/net/nsd/NsdManagerTest.java b/tests/unit/java/android/net/nsd/NsdManagerTest.java
index 8a4932b..da65b62 100644
--- a/tests/unit/java/android/net/nsd/NsdManagerTest.java
+++ b/tests/unit/java/android/net/nsd/NsdManagerTest.java
@@ -32,6 +32,7 @@
import android.compat.testing.PlatformCompatChangeRule;
import android.content.Context;
+import android.net.connectivity.ConnectivityCompatChanges;
import android.os.Build;
import androidx.test.filters.SmallTest;
@@ -81,70 +82,70 @@
}
@Test
- @EnableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testResolveServiceS() throws Exception {
verify(mServiceConn, never()).startDaemon();
doTestResolveService();
}
@Test
- @DisableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @DisableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testResolveServicePreS() throws Exception {
verify(mServiceConn).startDaemon();
doTestResolveService();
}
@Test
- @EnableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testDiscoverServiceS() throws Exception {
verify(mServiceConn, never()).startDaemon();
doTestDiscoverService();
}
@Test
- @DisableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @DisableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testDiscoverServicePreS() throws Exception {
verify(mServiceConn).startDaemon();
doTestDiscoverService();
}
@Test
- @EnableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testParallelResolveServiceS() throws Exception {
verify(mServiceConn, never()).startDaemon();
doTestParallelResolveService();
}
@Test
- @DisableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @DisableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testParallelResolveServicePreS() throws Exception {
verify(mServiceConn).startDaemon();
doTestParallelResolveService();
}
@Test
- @EnableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testInvalidCallsS() throws Exception {
verify(mServiceConn, never()).startDaemon();
doTestInvalidCalls();
}
@Test
- @DisableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @DisableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testInvalidCallsPreS() throws Exception {
verify(mServiceConn).startDaemon();
doTestInvalidCalls();
}
@Test
- @EnableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testRegisterServiceS() throws Exception {
verify(mServiceConn, never()).startDaemon();
doTestRegisterService();
}
@Test
- @DisableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @DisableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testRegisterServicePreS() throws Exception {
verify(mServiceConn).startDaemon();
doTestRegisterService();
diff --git a/tests/unit/java/com/android/server/ConnectivityServiceTest.java b/tests/unit/java/com/android/server/ConnectivityServiceTest.java
index bd6920a..a1186a3 100755
--- a/tests/unit/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/unit/java/com/android/server/ConnectivityServiceTest.java
@@ -172,6 +172,7 @@
import static com.android.testutils.MiscAsserts.assertThrows;
import static com.android.testutils.RecorderCallback.CallbackEntry.AVAILABLE;
import static com.android.testutils.RecorderCallback.CallbackEntry.BLOCKED_STATUS;
+import static com.android.testutils.RecorderCallback.CallbackEntry.BLOCKED_STATUS_INT;
import static com.android.testutils.RecorderCallback.CallbackEntry.LINK_PROPERTIES_CHANGED;
import static com.android.testutils.RecorderCallback.CallbackEntry.LOSING;
import static com.android.testutils.RecorderCallback.CallbackEntry.LOST;
@@ -2765,7 +2766,7 @@
if (expectLingering) {
generalCb.expectLosing(net1);
}
- generalCb.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, net2);
+ generalCb.expectCaps(net2, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
defaultCb.expectAvailableDoubleValidatedCallbacks(net2);
// Make sure cell 1 is unwanted immediately if the radio can't time share, but only
@@ -3181,7 +3182,8 @@
mWiFiAgent.connect(true);
genericNetworkCallback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
genericNetworkCallback.expectLosing(mCellAgent);
- genericNetworkCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ genericNetworkCallback.expectCaps(mWiFiAgent,
+ c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
wifiNetworkCallback.expectAvailableThenValidatedCallbacks(mWiFiAgent);
cellNetworkCallback.expectLosing(mCellAgent);
assertEquals(mWiFiAgent.getNetwork(), mCm.getActiveNetwork());
@@ -3330,7 +3332,7 @@
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
// TODO: Investigate sending validated before losing.
callback.expectLosing(mCellAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
defaultCallback.expectAvailableDoubleValidatedCallbacks(mWiFiAgent);
assertEquals(mWiFiAgent.getNetwork(), mCm.getActiveNetwork());
assertEquals(defaultCallback.getLastAvailableNetwork(), mCm.getActiveNetwork());
@@ -3339,7 +3341,7 @@
callback.expectAvailableCallbacksUnvalidated(mEthernetAgent);
// TODO: Investigate sending validated before losing.
callback.expectLosing(mWiFiAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mEthernetAgent);
+ callback.expectCaps(mEthernetAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
defaultCallback.expectAvailableDoubleValidatedCallbacks(mEthernetAgent);
assertEquals(mEthernetAgent.getNetwork(), mCm.getActiveNetwork());
assertEquals(defaultCallback.getLastAvailableNetwork(), mCm.getActiveNetwork());
@@ -3374,7 +3376,7 @@
// if the network is still up.
mWiFiAgent.removeCapability(NET_CAPABILITY_NOT_METERED);
// We expect a notification about the capabilities change, and nothing else.
- defaultCallback.expectCapabilitiesWithout(NET_CAPABILITY_NOT_METERED, mWiFiAgent);
+ defaultCallback.expectCaps(mWiFiAgent, c -> !c.hasCapability(NET_CAPABILITY_NOT_METERED));
defaultCallback.assertNoCallback();
callback.expect(LOST, mWiFiAgent);
assertEquals(defaultCallback.getLastAvailableNetwork(), mCm.getActiveNetwork());
@@ -3433,7 +3435,7 @@
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
// TODO: Investigate sending validated before losing.
callback.expectLosing(mCellAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
defaultCallback.expectAvailableThenValidatedCallbacks(mWiFiAgent);
assertEquals(mWiFiAgent.getNetwork(), mCm.getActiveNetwork());
assertEquals(defaultCallback.getLastAvailableNetwork(), mCm.getActiveNetwork());
@@ -3460,7 +3462,7 @@
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
// TODO: Investigate sending validated before losing.
callback.expectLosing(mCellAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
assertEquals(defaultCallback.getLastAvailableNetwork(), mCm.getActiveNetwork());
NetworkRequest cellRequest = new NetworkRequest.Builder()
@@ -3510,7 +3512,7 @@
mEthernetAgent.connect(true);
callback.expectAvailableCallbacksUnvalidated(mEthernetAgent);
callback.expectLosing(mWiFiAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mEthernetAgent);
+ callback.expectCaps(mEthernetAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
trackDefaultCallback.expectAvailableDoubleValidatedCallbacks(mEthernetAgent);
defaultCallback.expectAvailableDoubleValidatedCallbacks(mEthernetAgent);
assertEquals(defaultCallback.getLastAvailableNetwork(), mCm.getActiveNetwork());
@@ -3570,7 +3572,7 @@
defaultCallback.expectAvailableDoubleValidatedCallbacks(mWiFiAgent);
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
callback.expectLosing(mCellAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
// File a request for cellular, then release it.
NetworkRequest cellRequest = new NetworkRequest.Builder()
@@ -3583,7 +3585,8 @@
// Let linger run its course.
callback.assertNoCallback();
final int lingerTimeoutMs = TEST_LINGER_DELAY_MS + TEST_LINGER_DELAY_MS / 4;
- callback.expectCapabilitiesWithout(NET_CAPABILITY_FOREGROUND, mCellAgent, lingerTimeoutMs);
+ callback.expectCaps(mCellAgent, lingerTimeoutMs,
+ c -> !c.hasCapability(NET_CAPABILITY_FOREGROUND));
// Clean up.
mCm.unregisterNetworkCallback(defaultCallback);
@@ -3805,7 +3808,7 @@
mWiFiAgent.connect(true);
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
callback.expectLosing(mCellAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
assertEquals(mWiFiAgent.getNetwork(), mCm.getActiveNetwork());
expectUnvalidationCheckWillNotNotify(mWiFiAgent);
@@ -3813,7 +3816,7 @@
mEthernetAgent.connect(true);
callback.expectAvailableCallbacksUnvalidated(mEthernetAgent);
callback.expectLosing(mWiFiAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mEthernetAgent);
+ callback.expectCaps(mEthernetAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
assertEquals(mEthernetAgent.getNetwork(), mCm.getActiveNetwork());
callback.assertNoCallback();
@@ -4261,7 +4264,7 @@
mWiFiAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
mWiFiAgent.connectWithPartialConnectivity();
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_PARTIAL_CONNECTIVITY, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY));
// Mobile data should be the default network.
assertEquals(mCellAgent.getNetwork(), mCm.getActiveNetwork());
@@ -4289,8 +4292,8 @@
// validated.
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), true);
callback.expectLosing(mCellAgent);
- NetworkCapabilities nc = callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED,
- mWiFiAgent);
+ NetworkCapabilities nc =
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
assertTrue(nc.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY));
assertEquals(mWiFiAgent.getNetwork(), mCm.getActiveNetwork());
@@ -4304,7 +4307,7 @@
mWiFiAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
mWiFiAgent.connectWithPartialConnectivity();
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_PARTIAL_CONNECTIVITY, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY));
// Mobile data should be the default network.
assertEquals(mCellAgent.getNetwork(), mCm.getActiveNetwork());
@@ -4336,7 +4339,7 @@
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
verify(mWiFiAgent.mNetworkMonitor, times(1)).setAcceptPartialConnectivity();
callback.expectLosing(mCellAgent);
- nc = callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ nc = callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
assertFalse(nc.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY));
// Wifi should be the default network.
@@ -4357,7 +4360,7 @@
verify(mWiFiAgent.mNetworkMonitor, times(1)).setAcceptPartialConnectivity();
callback.expectLosing(mCellAgent);
assertEquals(mWiFiAgent.getNetwork(), mCm.getActiveNetwork());
- callback.expectCapabilitiesWith(NET_CAPABILITY_PARTIAL_CONNECTIVITY, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY));
expectUnvalidationCheckWillNotNotify(mWiFiAgent);
mWiFiAgent.setNetworkValid(false /* privateDnsProbeSent */);
@@ -4365,7 +4368,7 @@
// Need a trigger point to let NetworkMonitor tell ConnectivityService that the network is
// validated.
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), true);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
mWiFiAgent.disconnect();
callback.expect(LOST, mWiFiAgent);
@@ -4381,8 +4384,8 @@
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
verify(mWiFiAgent.mNetworkMonitor, times(1)).setAcceptPartialConnectivity();
callback.expectLosing(mCellAgent);
- callback.expectCapabilitiesWith(
- NET_CAPABILITY_PARTIAL_CONNECTIVITY | NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY)
+ && c.hasCapability(NET_CAPABILITY_VALIDATED));
expectUnvalidationCheckWillNotNotify(mWiFiAgent);
mWiFiAgent.disconnect();
callback.expect(LOST, mWiFiAgent);
@@ -4413,7 +4416,7 @@
// This is necessary because of b/245893397, the same bug that happens where we use
// expectAvailableDoubleValidatedCallbacks.
// TODO : fix b/245893397 and remove this.
- wifiCallback.expectCapabilitiesWith(NET_CAPABILITY_CAPTIVE_PORTAL, mWiFiAgent);
+ wifiCallback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL));
// Check that startCaptivePortalApp sends the expected command to NetworkMonitor.
mCm.startCaptivePortalApp(mWiFiAgent.getNetwork());
@@ -4434,9 +4437,10 @@
false /* always */);
waitForIdle();
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), true);
- wifiCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ wifiCallback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
validatedCallback.expectAvailableCallbacksValidated(mWiFiAgent);
- validatedCallback.expectCapabilitiesWith(NET_CAPABILITY_PARTIAL_CONNECTIVITY, mWiFiAgent);
+ validatedCallback.expectCaps(mWiFiAgent,
+ c -> c.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY));
mCm.unregisterNetworkCallback(wifiCallback);
mCm.unregisterNetworkCallback(validatedCallback);
@@ -5232,7 +5236,8 @@
// Suspend the network.
mCellAgent.suspend();
- cellNetworkCallback.expectCapabilitiesWithout(NET_CAPABILITY_NOT_SUSPENDED, mCellAgent);
+ cellNetworkCallback.expectCaps(mCellAgent,
+ c -> !c.hasCapability(NET_CAPABILITY_NOT_SUSPENDED));
cellNetworkCallback.expect(SUSPENDED, mCellAgent);
cellNetworkCallback.assertNoCallback();
assertEquals(NetworkInfo.State.SUSPENDED, mCm.getActiveNetworkInfo().getState());
@@ -5247,7 +5252,8 @@
mCm.unregisterNetworkCallback(dfltNetworkCallback);
mCellAgent.resume();
- cellNetworkCallback.expectCapabilitiesWith(NET_CAPABILITY_NOT_SUSPENDED, mCellAgent);
+ cellNetworkCallback.expectCaps(mCellAgent,
+ c -> c.hasCapability(NET_CAPABILITY_NOT_SUSPENDED));
cellNetworkCallback.expect(RESUMED, mCellAgent);
cellNetworkCallback.assertNoCallback();
assertEquals(NetworkInfo.State.CONNECTED, mCm.getActiveNetworkInfo().getState());
@@ -5474,10 +5480,10 @@
// When wifi connects, cell lingers.
callback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
callback.expectLosing(mCellAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ callback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
fgCallback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
fgCallback.expectLosing(mCellAgent);
- fgCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ fgCallback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
assertTrue(isForegroundNetwork(mCellAgent));
assertTrue(isForegroundNetwork(mWiFiAgent));
@@ -5486,7 +5492,7 @@
int timeoutMs = TEST_LINGER_DELAY_MS + TEST_LINGER_DELAY_MS / 4;
fgCallback.expect(LOST, mCellAgent, timeoutMs);
// Expect a network capabilities update sans FOREGROUND.
- callback.expectCapabilitiesWithout(NET_CAPABILITY_FOREGROUND, mCellAgent);
+ callback.expectCaps(mCellAgent, c -> !c.hasCapability(NET_CAPABILITY_FOREGROUND));
assertFalse(isForegroundNetwork(mCellAgent));
assertTrue(isForegroundNetwork(mWiFiAgent));
@@ -5499,8 +5505,8 @@
fgCallback.expectAvailableCallbacksValidated(mCellAgent);
// Expect a network capabilities update with FOREGROUND, because the most recent
// request causes its state to change.
- cellCallback.expectCapabilitiesWith(NET_CAPABILITY_FOREGROUND, mCellAgent);
- callback.expectCapabilitiesWith(NET_CAPABILITY_FOREGROUND, mCellAgent);
+ cellCallback.expectCaps(mCellAgent, c -> c.hasCapability(NET_CAPABILITY_FOREGROUND));
+ callback.expectCaps(mCellAgent, c -> c.hasCapability(NET_CAPABILITY_FOREGROUND));
assertTrue(isForegroundNetwork(mCellAgent));
assertTrue(isForegroundNetwork(mWiFiAgent));
@@ -5509,7 +5515,7 @@
mCm.unregisterNetworkCallback(cellCallback);
fgCallback.expect(LOST, mCellAgent);
// Expect a network capabilities update sans FOREGROUND.
- callback.expectCapabilitiesWithout(NET_CAPABILITY_FOREGROUND, mCellAgent);
+ callback.expectCaps(mCellAgent, c -> !c.hasCapability(NET_CAPABILITY_FOREGROUND));
assertFalse(isForegroundNetwork(mCellAgent));
assertTrue(isForegroundNetwork(mWiFiAgent));
@@ -5661,7 +5667,8 @@
// Need a trigger point to let NetworkMonitor tell ConnectivityService that network is
// validated – see testPartialConnectivity.
mCm.reportNetworkConnectivity(mCellAgent.getNetwork(), true);
- cellNetworkCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mCellAgent);
+ cellNetworkCallback.expectCaps(mCellAgent,
+ c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
testFactory.expectRequestRemove();
testFactory.assertRequestCountEquals(0);
// Accordingly, the factory shouldn't be started.
@@ -5862,14 +5869,15 @@
mWiFiAgent.setNetworkValid(true /* privateDnsProbeSent */);
// Have CS reconsider the network (see testPartialConnectivity)
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), true);
- wifiNetworkCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ wifiNetworkCallback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
cellCallback.expectOnNetworkUnneeded(defaultCaps);
wifiCallback.assertNoCallback();
// Wifi is no longer validated. Cell is needed again.
mWiFiAgent.setNetworkInvalid(true /* invalidBecauseOfPrivateDns */);
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), false);
- wifiNetworkCallback.expectCapabilitiesWithout(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ wifiNetworkCallback.expectCaps(mWiFiAgent,
+ c -> !c.hasCapability(NET_CAPABILITY_VALIDATED));
cellCallback.expectOnNetworkNeeded(defaultCaps);
wifiCallback.assertNoCallback();
@@ -5891,7 +5899,8 @@
wifiCallback.assertNoCallback();
mWiFiAgent.setNetworkValid(true /* privateDnsProbeSent */);
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), true);
- wifiNetworkCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ wifiNetworkCallback.expectCaps(mWiFiAgent,
+ c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
cellCallback.expectOnNetworkUnneeded(defaultCaps);
wifiCallback.assertNoCallback();
@@ -5899,7 +5908,8 @@
// not needed.
mWiFiAgent.setNetworkInvalid(true /* invalidBecauseOfPrivateDns */);
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), false);
- wifiNetworkCallback.expectCapabilitiesWithout(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ wifiNetworkCallback.expectCaps(mWiFiAgent,
+ c -> !c.hasCapability(NET_CAPABILITY_VALIDATED));
cellCallback.assertNoCallback();
wifiCallback.assertNoCallback();
}
@@ -5994,7 +6004,7 @@
// Fail validation on wifi.
mWiFiAgent.setNetworkInvalid(false /* invalidBecauseOfPrivateDns */);
mCm.reportNetworkConnectivity(wifiNetwork, false);
- defaultCallback.expectCapabilitiesWithout(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ defaultCallback.expectCaps(mWiFiAgent, c -> !c.hasCapability(NET_CAPABILITY_VALIDATED));
validatedWifiCallback.expect(LOST, mWiFiAgent);
expectNotification(mWiFiAgent, NotificationType.LOST_INTERNET);
@@ -6045,7 +6055,7 @@
// Fail validation on wifi and expect the dialog to appear.
mWiFiAgent.setNetworkInvalid(false /* invalidBecauseOfPrivateDns */);
mCm.reportNetworkConnectivity(wifiNetwork, false);
- defaultCallback.expectCapabilitiesWithout(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ defaultCallback.expectCaps(mWiFiAgent, c -> !c.hasCapability(NET_CAPABILITY_VALIDATED));
validatedWifiCallback.expect(LOST, mWiFiAgent);
expectNotification(mWiFiAgent, NotificationType.LOST_INTERNET);
@@ -7262,7 +7272,7 @@
CallbackEntry.LinkPropertiesChanged cbi =
networkCallback.expect(LINK_PROPERTIES_CHANGED, networkAgent);
networkCallback.expect(BLOCKED_STATUS, networkAgent);
- networkCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, networkAgent);
+ networkCallback.expectCaps(networkAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
networkCallback.assertNoCallback();
checkDirectlyConnectedRoutes(cbi.getLp(), asList(myIpv4Address),
asList(myIpv4DefaultRoute));
@@ -8548,7 +8558,7 @@
mMockVpn.getAgent().mNetworkMonitor.forceReevaluation(Process.myUid());
// Expect to see the validated capability, but no other changes, because the VPN is already
// the default network for the app.
- callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mMockVpn);
+ callback.expectCaps(mMockVpn, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
callback.assertNoCallback();
mMockVpn.disconnect();
@@ -9156,11 +9166,6 @@
public void expectAvailableThenValidatedCallbacks(HasNetwork n, int blockedStatus) {
super.expectAvailableThenValidatedCallbacks(n.getNetwork(), blockedStatus, TIMEOUT_MS);
}
- public void expectBlockedStatusCallback(HasNetwork n, int blockedStatus) {
- // This doesn't work:
- // super.expectBlockedStatusCallback(blockedStatus, n.getNetwork());
- super.expectBlockedStatusCallback(blockedStatus, n.getNetwork(), TIMEOUT_MS);
- }
public void onBlockedStatusChanged(Network network, int blockedReasons) {
getHistory().add(new CallbackEntry.BlockedStatusInt(network, blockedReasons));
}
@@ -9188,8 +9193,9 @@
assertExtraInfoFromCmPresent(mCellAgent);
setBlockedReasonChanged(BLOCKED_REASON_BATTERY_SAVER);
- cellNetworkCallback.expectBlockedStatusCallback(true, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent, BLOCKED_REASON_BATTERY_SAVER);
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> cb.getBlocked());
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_REASON_BATTERY_SAVER);
assertNull(mCm.getActiveNetwork());
assertActiveNetworkInfo(TYPE_MOBILE, DetailedState.BLOCKED);
assertNetworkInfo(TYPE_MOBILE, DetailedState.BLOCKED);
@@ -9198,21 +9204,23 @@
// If blocked state does not change but blocked reason does, the boolean callback is called.
// TODO: investigate de-duplicating.
setBlockedReasonChanged(BLOCKED_METERED_REASON_USER_RESTRICTED);
- cellNetworkCallback.expectBlockedStatusCallback(true, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent,
- BLOCKED_METERED_REASON_USER_RESTRICTED);
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> cb.getBlocked());
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_METERED_REASON_USER_RESTRICTED);
setBlockedReasonChanged(BLOCKED_REASON_NONE);
- cellNetworkCallback.expectBlockedStatusCallback(false, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent, BLOCKED_REASON_NONE);
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> !cb.getBlocked());
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_REASON_NONE);
assertEquals(mCellAgent.getNetwork(), mCm.getActiveNetwork());
assertActiveNetworkInfo(TYPE_MOBILE, DetailedState.CONNECTED);
assertNetworkInfo(TYPE_MOBILE, DetailedState.CONNECTED);
assertExtraInfoFromCmPresent(mCellAgent);
setBlockedReasonChanged(BLOCKED_METERED_REASON_DATA_SAVER);
- cellNetworkCallback.expectBlockedStatusCallback(true, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent, BLOCKED_METERED_REASON_DATA_SAVER);
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> cb.getBlocked());
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_METERED_REASON_DATA_SAVER);
assertNull(mCm.getActiveNetwork());
assertActiveNetworkInfo(TYPE_MOBILE, DetailedState.BLOCKED);
assertNetworkInfo(TYPE_MOBILE, DetailedState.BLOCKED);
@@ -9220,28 +9228,34 @@
// Restrict the network based on UID rule and NOT_METERED capability change.
mCellAgent.addCapability(NET_CAPABILITY_NOT_METERED);
- cellNetworkCallback.expectCapabilitiesWith(NET_CAPABILITY_NOT_METERED, mCellAgent);
- cellNetworkCallback.expectBlockedStatusCallback(false, mCellAgent);
- detailedCallback.expectCapabilitiesWith(NET_CAPABILITY_NOT_METERED, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent, BLOCKED_REASON_NONE);
+ cellNetworkCallback.expectCaps(mCellAgent,
+ c -> c.hasCapability(NET_CAPABILITY_NOT_METERED));
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> !cb.getBlocked());
+ detailedCallback.expectCaps(mCellAgent, c -> c.hasCapability(NET_CAPABILITY_NOT_METERED));
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_REASON_NONE);
assertEquals(mCellAgent.getNetwork(), mCm.getActiveNetwork());
assertActiveNetworkInfo(TYPE_MOBILE, DetailedState.CONNECTED);
assertNetworkInfo(TYPE_MOBILE, DetailedState.CONNECTED);
assertExtraInfoFromCmPresent(mCellAgent);
mCellAgent.removeCapability(NET_CAPABILITY_NOT_METERED);
- cellNetworkCallback.expectCapabilitiesWithout(NET_CAPABILITY_NOT_METERED, mCellAgent);
- cellNetworkCallback.expectBlockedStatusCallback(true, mCellAgent);
- detailedCallback.expectCapabilitiesWithout(NET_CAPABILITY_NOT_METERED, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent, BLOCKED_METERED_REASON_DATA_SAVER);
+ cellNetworkCallback.expectCaps(mCellAgent,
+ c -> !c.hasCapability(NET_CAPABILITY_NOT_METERED));
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> cb.getBlocked());
+ detailedCallback.expectCaps(mCellAgent,
+ c -> !c.hasCapability(NET_CAPABILITY_NOT_METERED));
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_METERED_REASON_DATA_SAVER);
assertNull(mCm.getActiveNetwork());
assertActiveNetworkInfo(TYPE_MOBILE, DetailedState.BLOCKED);
assertNetworkInfo(TYPE_MOBILE, DetailedState.BLOCKED);
assertExtraInfoFromCmBlocked(mCellAgent);
setBlockedReasonChanged(BLOCKED_REASON_NONE);
- cellNetworkCallback.expectBlockedStatusCallback(false, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent, BLOCKED_REASON_NONE);
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> !cb.getBlocked());
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_REASON_NONE);
assertEquals(mCellAgent.getNetwork(), mCm.getActiveNetwork());
assertActiveNetworkInfo(TYPE_MOBILE, DetailedState.CONNECTED);
assertNetworkInfo(TYPE_MOBILE, DetailedState.CONNECTED);
@@ -9253,8 +9267,9 @@
// Restrict background data. Networking is not blocked because the network is unmetered.
setBlockedReasonChanged(BLOCKED_METERED_REASON_DATA_SAVER);
- cellNetworkCallback.expectBlockedStatusCallback(true, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent, BLOCKED_METERED_REASON_DATA_SAVER);
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> cb.getBlocked());
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_METERED_REASON_DATA_SAVER);
assertNull(mCm.getActiveNetwork());
assertActiveNetworkInfo(TYPE_MOBILE, DetailedState.BLOCKED);
assertNetworkInfo(TYPE_MOBILE, DetailedState.BLOCKED);
@@ -9263,8 +9278,9 @@
cellNetworkCallback.assertNoCallback();
setBlockedReasonChanged(BLOCKED_REASON_NONE);
- cellNetworkCallback.expectBlockedStatusCallback(false, mCellAgent);
- detailedCallback.expectBlockedStatusCallback(mCellAgent, BLOCKED_REASON_NONE);
+ cellNetworkCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> !cb.getBlocked());
+ detailedCallback.expect(BLOCKED_STATUS_INT, mCellAgent,
+ cb -> cb.getReason() == BLOCKED_REASON_NONE);
assertActiveNetworkInfo(TYPE_MOBILE, DetailedState.CONNECTED);
assertNetworkInfo(TYPE_MOBILE, DetailedState.CONNECTED);
assertExtraInfoFromCmPresent(mCellAgent);
@@ -9295,7 +9311,7 @@
mCellAgent = new TestNetworkAgentWrapper(TRANSPORT_CELLULAR);
mCellAgent.connect(true);
defaultCallback.expectAvailableCallbacksUnvalidatedAndBlocked(mCellAgent);
- defaultCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mCellAgent);
+ defaultCallback.expectCaps(mCellAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
// Allow to use the network after switching to NOT_METERED network.
mWiFiAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
@@ -9310,8 +9326,8 @@
// Network becomes NOT_METERED.
mCellAgent.addCapability(NET_CAPABILITY_NOT_METERED);
- defaultCallback.expectCapabilitiesWith(NET_CAPABILITY_NOT_METERED, mCellAgent);
- defaultCallback.expectBlockedStatusCallback(false, mCellAgent);
+ defaultCallback.expectCaps(mCellAgent, c -> c.hasCapability(NET_CAPABILITY_NOT_METERED));
+ defaultCallback.expect(BLOCKED_STATUS, mCellAgent, cb -> !cb.getBlocked());
// Verify there's no Networkcallbacks invoked after data saver on/off.
setBlockedReasonChanged(BLOCKED_METERED_REASON_DATA_SAVER);
@@ -9452,8 +9468,8 @@
// Disable lockdown, expect to see the network unblocked.
mMockVpn.setAlwaysOnPackage(null, false /* lockdown */, allowList);
- callback.expectBlockedStatusCallback(false, mWiFiAgent);
- defaultCallback.expectBlockedStatusCallback(false, mWiFiAgent);
+ callback.expect(BLOCKED_STATUS, mWiFiAgent, cb -> !cb.getBlocked());
+ defaultCallback.expect(BLOCKED_STATUS, mWiFiAgent, cb -> !cb.getBlocked());
vpnUidCallback.assertNoCallback();
vpnUidDefaultCallback.assertNoCallback();
vpnDefaultCallbackAsUid.assertNoCallback();
@@ -9511,7 +9527,7 @@
mMockVpn.setAlwaysOnPackage(ALWAYS_ON_PACKAGE, true /* lockdown */, allowList);
waitForIdle();
expectNetworkRejectNonSecureVpn(inOrder, true, uidRangeParcels);
- defaultCallback.expectBlockedStatusCallback(true, mWiFiAgent);
+ defaultCallback.expect(BLOCKED_STATUS, mWiFiAgent, cb -> cb.getBlocked());
assertBlockedCallbackInAnyOrder(callback, true, mWiFiAgent, mCellAgent);
vpnUidCallback.assertNoCallback();
vpnUidDefaultCallback.assertNoCallback();
@@ -9524,7 +9540,7 @@
// Disable lockdown. Everything is unblocked.
mMockVpn.setAlwaysOnPackage(null, false /* lockdown */, allowList);
- defaultCallback.expectBlockedStatusCallback(false, mWiFiAgent);
+ defaultCallback.expect(BLOCKED_STATUS, mWiFiAgent, cb -> !cb.getBlocked());
assertBlockedCallbackInAnyOrder(callback, false, mWiFiAgent, mCellAgent);
vpnUidCallback.assertNoCallback();
vpnUidDefaultCallback.assertNoCallback();
@@ -9565,7 +9581,7 @@
// Enable lockdown and connect a VPN. The VPN is not blocked.
mMockVpn.setAlwaysOnPackage(ALWAYS_ON_PACKAGE, true /* lockdown */, allowList);
- defaultCallback.expectBlockedStatusCallback(true, mWiFiAgent);
+ defaultCallback.expect(BLOCKED_STATUS, mWiFiAgent, cb -> cb.getBlocked());
assertBlockedCallbackInAnyOrder(callback, true, mWiFiAgent, mCellAgent);
vpnUidCallback.assertNoCallback();
vpnUidDefaultCallback.assertNoCallback();
@@ -10049,7 +10065,7 @@
// changes back to cellular.
mWiFiAgent.removeCapability(testCap);
callbackWithCap.expectAvailableCallbacksValidated(mCellAgent);
- callbackWithoutCap.expectCapabilitiesWithout(testCap, mWiFiAgent);
+ callbackWithoutCap.expectCaps(mWiFiAgent, c -> !c.hasCapability(testCap));
verify(mMockNetd).networkSetDefault(eq(mCellAgent.getNetwork().netId));
reset(mMockNetd);
@@ -10699,7 +10715,7 @@
mWiFiAgent.connect(true);
networkCallback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
networkCallback.expectLosing(mCellAgent);
- networkCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ networkCallback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
verify(mMockNetd, times(1)).idletimerAddInterface(eq(WIFI_IFNAME), anyInt(),
eq(Integer.toString(TRANSPORT_WIFI)));
verify(mMockNetd, times(1)).idletimerRemoveInterface(eq(MOBILE_IFNAME), anyInt(),
@@ -10723,7 +10739,7 @@
mWiFiAgent.connect(true);
networkCallback.expectAvailableCallbacksUnvalidated(mWiFiAgent);
networkCallback.expectLosing(mCellAgent);
- networkCallback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ networkCallback.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
verify(mMockNetd, times(1)).idletimerAddInterface(eq(WIFI_IFNAME), anyInt(),
eq(Integer.toString(TRANSPORT_WIFI)));
verify(mMockNetd, times(1)).idletimerRemoveInterface(eq(MOBILE_IFNAME), anyInt(),
@@ -12397,7 +12413,7 @@
// sees the network come up and validate later
allNetworksCb.expectAvailableCallbacksUnvalidated(mWiFiAgent);
allNetworksCb.expectLosing(mCellAgent);
- allNetworksCb.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiAgent);
+ allNetworksCb.expectCaps(mWiFiAgent, c -> c.hasCapability(NET_CAPABILITY_VALIDATED));
allNetworksCb.expect(LOST, mCellAgent, TEST_LINGER_DELAY_MS * 2);
// The cell network has disconnected (see LOST above) because it was outscored and
@@ -17114,15 +17130,17 @@
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), false);
// Wi-Fi is now detected to have a portal : cell should become the default network.
mDefaultNetworkCallback.expectAvailableCallbacksValidated(mCellAgent);
- wifiNetworkCallback.expectCapabilitiesWithout(NET_CAPABILITY_VALIDATED, mWiFiAgent);
- wifiNetworkCallback.expectCapabilitiesWith(NET_CAPABILITY_CAPTIVE_PORTAL, mWiFiAgent);
+ wifiNetworkCallback.expectCaps(mWiFiAgent,
+ c -> !c.hasCapability(NET_CAPABILITY_VALIDATED));
+ wifiNetworkCallback.expectCaps(mWiFiAgent,
+ c -> c.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL));
// Wi-Fi becomes valid again. The default network goes back to Wi-Fi.
mWiFiAgent.setNetworkValid(false /* privateDnsProbeSent */);
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), true);
mDefaultNetworkCallback.expectAvailableCallbacksValidated(mWiFiAgent);
- wifiNetworkCallback.expectCapabilitiesWithout(NET_CAPABILITY_CAPTIVE_PORTAL,
- mWiFiAgent);
+ wifiNetworkCallback.expectCaps(mWiFiAgent,
+ c -> !c.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL));
// Wi-Fi roaming from wifiNc2 to wifiNc1, and the network now has partial connectivity.
mWiFiAgent.setNetworkCapabilities(wifiNc1, true);
@@ -17133,15 +17151,15 @@
// Wi-Fi now only offers partial connectivity, so in the absence of accepting partial
// connectivity explicitly for this network, it loses default status to cell.
mDefaultNetworkCallback.expectAvailableCallbacksValidated(mCellAgent);
- wifiNetworkCallback.expectCapabilitiesWith(NET_CAPABILITY_PARTIAL_CONNECTIVITY,
- mWiFiAgent);
+ wifiNetworkCallback.expectCaps(mWiFiAgent,
+ c -> c.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY));
// Wi-Fi becomes valid again. The default network goes back to Wi-Fi.
mWiFiAgent.setNetworkValid(false /* privateDnsProbeSent */);
mCm.reportNetworkConnectivity(mWiFiAgent.getNetwork(), true);
mDefaultNetworkCallback.expectAvailableCallbacksValidated(mWiFiAgent);
- wifiNetworkCallback.expectCapabilitiesWithout(NET_CAPABILITY_PARTIAL_CONNECTIVITY,
- mWiFiAgent);
+ wifiNetworkCallback.expectCaps(mWiFiAgent,
+ c -> !c.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY));
}
mCm.unregisterNetworkCallback(wifiNetworkCallback);
diff --git a/tests/unit/java/com/android/server/IpSecServiceTest.java b/tests/unit/java/com/android/server/IpSecServiceTest.java
index 6955620..4b6857c 100644
--- a/tests/unit/java/com/android/server/IpSecServiceTest.java
+++ b/tests/unit/java/com/android/server/IpSecServiceTest.java
@@ -82,7 +82,7 @@
private static final int MAX_NUM_ENCAP_SOCKETS = 100;
private static final int MAX_NUM_SPIS = 100;
private static final int TEST_UDP_ENCAP_INVALID_PORT = 100;
- private static final int TEST_UDP_ENCAP_PORT_OUT_RANGE = 100000;
+ private static final int TEST_UDP_ENCAP_PORT_OUT_RANGE = 200000;
private static final InetAddress INADDR_ANY;
diff --git a/tests/unit/java/com/android/server/NsdServiceTest.java b/tests/unit/java/com/android/server/NsdServiceTest.java
index 5a3bc64..0680772 100644
--- a/tests/unit/java/com/android/server/NsdServiceTest.java
+++ b/tests/unit/java/com/android/server/NsdServiceTest.java
@@ -53,6 +53,7 @@
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;
@@ -187,7 +188,7 @@
}
@Test
- @DisableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @DisableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testPreSClients() throws Exception {
// Pre S client connected, the daemon should be started.
connectClient(mService);
@@ -214,7 +215,7 @@
}
@Test
- @EnableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testNoDaemonStartedWhenClientsConnect() throws Exception {
// Creating an NsdManager will not cause daemon startup.
connectClient(mService);
@@ -248,7 +249,7 @@
}
@Test
- @EnableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testClientRequestsAreGCedAtDisconnection() throws Exception {
final NsdManager client = connectClient(mService);
final INsdManagerCallback cb1 = getCallback();
@@ -291,7 +292,7 @@
}
@Test
- @EnableCompatChanges(NsdManager.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
+ @EnableCompatChanges(ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER)
public void testCleanupDelayNoRequestActive() throws Exception {
final NsdManager client = connectClient(mService);
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 5517e53..d800b80 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -272,6 +272,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-O3",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -284,18 +290,29 @@
"libgtest_prod_headers",
],
cpp_std: "c++17",
+ ldflags: [
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
+ ],
target: {
android_arm: {
srcs: [
"base/allocator/partition_allocator/starscan/stack/asm/arm/push_registers_asm.cc",
],
+ cflags: [
+ "-fstack-protector",
+ ],
},
android_arm64: {
srcs: [
"base/allocator/partition_allocator/starscan/stack/asm/arm64/push_registers_asm.cc",
],
cflags: [
+ "-fstack-protector",
"-march=armv8-a+memtag",
+ "-mno-outline",
+ "-mno-outline-atomics",
],
},
android_x86: {
@@ -311,6 +328,7 @@
"base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc",
],
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -986,6 +1004,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -1002,6 +1026,11 @@
"libgtest_prod_headers",
],
cpp_std: "c++17",
+ ldflags: [
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
+ ],
target: {
android_arm: {
srcs: [
@@ -1011,11 +1040,19 @@
"base/profiler/chrome_unwinder_android_v2.cc",
"base/trace_event/cfi_backtrace_android.cc",
],
+ cflags: [
+ "-fstack-protector",
+ ],
},
android_arm64: {
srcs: [
"base/android/reached_code_profiler.cc",
],
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
},
android_x86: {
srcs: [
@@ -1030,6 +1067,7 @@
"base/android/reached_code_profiler_stub.cc",
],
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -1374,6 +1412,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -1382,7 +1426,24 @@
"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",
@@ -1390,6 +1451,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -1693,6 +1755,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -1702,6 +1770,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -1709,6 +1789,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -1924,6 +2005,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -1932,7 +2019,24 @@
"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",
@@ -1940,6 +2044,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -1968,6 +2073,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -1976,7 +2087,24 @@
"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",
@@ -1984,6 +2112,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -2230,6 +2359,10 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
],
local_include_dirs: [
"./",
@@ -2249,6 +2382,9 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DHAVE_SYS_UIO_H",
+ "-Oz",
+ "-fstack-protector",
+ "-g1",
],
},
android_arm64: {
@@ -2256,6 +2392,11 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DHAVE_SYS_UIO_H",
+ "-Oz",
+ "-fstack-protector",
+ "-g1",
+ "-mno-outline",
+ "-mno-outline-atomics",
],
},
android_x86: {
@@ -2263,6 +2404,8 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DHAVE_SYS_UIO_H",
+ "-Oz",
+ "-g1",
"-msse3",
],
},
@@ -2271,6 +2414,9 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DHAVE_SYS_UIO_H",
+ "-Oz",
+ "-fstack-protector",
+ "-g1",
"-msse3",
],
},
@@ -2284,6 +2430,9 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-O2",
+ "-fstack-protector",
+ "-g2",
"-msse3",
],
},
@@ -2328,6 +2477,10 @@
"-D_LIBCPP_CONSTINIT=constinit",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
],
local_include_dirs: [
"./",
@@ -2350,6 +2503,9 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DHAVE_SYS_UIO_H",
+ "-Oz",
+ "-fstack-protector",
+ "-g1",
],
},
android_arm64: {
@@ -2360,6 +2516,11 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DHAVE_SYS_UIO_H",
+ "-Oz",
+ "-fstack-protector",
+ "-g1",
+ "-mno-outline",
+ "-mno-outline-atomics",
],
},
android_x86: {
@@ -2370,6 +2531,8 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DHAVE_SYS_UIO_H",
+ "-Oz",
+ "-g1",
"-msse3",
],
},
@@ -2381,6 +2544,9 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DHAVE_SYS_UIO_H",
+ "-Oz",
+ "-fstack-protector",
+ "-g1",
"-msse3",
],
},
@@ -2397,6 +2563,9 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-O2",
+ "-fstack-protector",
+ "-g2",
"-msse3",
],
},
@@ -2512,6 +2681,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -2527,10 +2702,25 @@
],
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",
],
stem: "libcronet.108.0.5359.128",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -2538,6 +2728,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -3178,6 +3369,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -3193,6 +3390,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -3200,6 +3409,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -3544,6 +3754,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -3559,6 +3775,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -3566,6 +3794,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -3639,6 +3868,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -3650,6 +3885,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -3657,6 +3904,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -3715,6 +3963,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -3727,6 +3981,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -3734,6 +4000,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -3848,6 +4115,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -3858,7 +4131,24 @@
"third_party/boringssl/src/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",
@@ -3866,6 +4156,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -3961,6 +4252,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -3971,7 +4268,24 @@
"third_party/boringssl/src/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",
@@ -3979,6 +4293,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -3990,7 +4305,6 @@
name: "cronet_aml_defaults",
cflags: [
"-DGOOGLE_PROTOBUF_NO_RTTI",
- "-O2",
"-Wno-ambiguous-reversed-operator",
"-Wno-error=return-type",
"-Wno-macro-redefined",
@@ -4002,7 +4316,6 @@
"-Wno-unreachable-code-loop-increment",
"-Wno-unused-parameter",
"-fPIC",
- "-fvisibility=hidden",
],
stl: "none",
apex_available: [
@@ -4612,6 +4925,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -4628,6 +4947,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -4635,6 +4966,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -4716,6 +5048,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -4732,6 +5070,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -4739,6 +5089,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -4833,6 +5184,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -4849,6 +5206,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -4856,6 +5225,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -5501,6 +5871,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -5516,16 +5892,29 @@
"third_party/protobuf/src/",
],
cpp_std: "c++17",
+ ldflags: [
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
+ ],
target: {
android_arm: {
srcs: [
"net/disk_cache/blockfile/mapped_file_bypass_mmap_posix.cc",
],
+ cflags: [
+ "-fstack-protector",
+ ],
},
android_arm64: {
srcs: [
"net/disk_cache/blockfile/mapped_file_bypass_mmap_posix.cc",
],
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
},
android_x86: {
srcs: [
@@ -5540,6 +5929,7 @@
"net/disk_cache/blockfile/mapped_file_bypass_mmap_posix.cc",
],
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -5608,6 +5998,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -5621,6 +6017,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -5628,6 +6036,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -5840,6 +6249,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -5855,6 +6270,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -5862,6 +6289,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -5909,6 +6337,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -5919,7 +6353,24 @@
"third_party/boringssl/src/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",
@@ -5927,6 +6378,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6409,6 +6861,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6423,7 +6881,24 @@
"third_party/protobuf/src/",
],
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",
@@ -6431,6 +6906,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6481,6 +6957,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6492,6 +6974,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6499,6 +6993,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6547,6 +7042,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6557,7 +7058,24 @@
"third_party/boringssl/src/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",
@@ -6565,6 +7083,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6598,6 +7117,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6608,6 +7133,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6615,6 +7152,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6644,6 +7182,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6654,6 +7198,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6661,6 +7217,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6690,6 +7247,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6700,6 +7263,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6707,6 +7282,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6736,6 +7312,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6746,6 +7328,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6753,6 +7347,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6782,6 +7377,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6792,6 +7393,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6799,6 +7412,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6828,6 +7442,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6838,6 +7458,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6845,6 +7477,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6874,6 +7507,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6884,6 +7523,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6891,6 +7542,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6921,6 +7573,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6931,6 +7589,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6938,6 +7608,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -6967,6 +7638,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -6977,6 +7654,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -6984,6 +7673,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7015,6 +7705,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7025,6 +7721,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7032,6 +7740,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7061,6 +7770,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7071,6 +7786,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7078,6 +7805,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7107,6 +7835,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7117,6 +7851,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7124,6 +7870,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7153,6 +7900,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7163,6 +7916,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7170,6 +7935,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7199,6 +7965,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7209,6 +7981,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7216,6 +8000,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7245,6 +8030,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7255,6 +8046,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7262,6 +8065,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7291,6 +8095,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7301,6 +8111,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7308,6 +8130,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7337,6 +8160,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7347,6 +8176,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7354,6 +8195,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7383,6 +8225,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7393,6 +8241,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7400,6 +8260,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7429,6 +8290,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7439,6 +8306,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7446,6 +8325,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7475,6 +8355,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7485,6 +8371,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7492,6 +8390,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7522,6 +8421,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7532,6 +8437,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7539,6 +8456,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7571,6 +8489,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7581,6 +8505,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7588,6 +8524,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7620,6 +8557,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7630,6 +8573,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7637,6 +8592,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7669,6 +8625,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7679,6 +8641,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7686,6 +8660,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7718,6 +8693,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7728,6 +8709,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7735,6 +8728,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7767,6 +8761,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7777,6 +8777,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7784,6 +8796,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7816,6 +8829,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7826,6 +8845,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7833,6 +8864,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7862,6 +8894,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7872,6 +8910,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7879,6 +8929,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7908,6 +8959,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7918,6 +8975,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7925,6 +8994,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -7957,6 +9027,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -7967,6 +9043,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -7974,6 +9062,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8004,6 +9093,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8014,6 +9109,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8021,6 +9128,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8050,6 +9158,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8060,6 +9174,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8067,6 +9193,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8098,6 +9225,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8108,6 +9241,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8115,6 +9260,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8150,6 +9296,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8160,6 +9312,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8167,6 +9331,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8196,6 +9361,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8206,6 +9377,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8213,6 +9396,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8242,6 +9426,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8252,6 +9442,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8259,6 +9461,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8288,6 +9491,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8298,6 +9507,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8305,6 +9526,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8336,6 +9558,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8346,6 +9574,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8353,6 +9593,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8387,6 +9628,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8397,6 +9644,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8404,6 +9663,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8445,6 +9705,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8455,6 +9721,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8462,6 +9740,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8491,6 +9770,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8501,6 +9786,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8508,6 +9805,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8543,6 +9841,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8553,6 +9857,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8560,6 +9876,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8589,6 +9906,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8599,6 +9922,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8606,6 +9941,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8643,6 +9979,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8653,6 +9995,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8660,6 +10014,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8693,6 +10048,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8703,6 +10064,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8710,6 +10083,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8739,6 +10113,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8749,6 +10129,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8756,6 +10148,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8785,6 +10178,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8795,6 +10194,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8802,6 +10213,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8830,6 +10242,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8840,6 +10258,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8847,6 +10277,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -8878,6 +10309,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -8887,6 +10324,18 @@
],
cpp_std: "c++17",
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -8894,6 +10343,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -9192,6 +10642,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -9201,7 +10657,24 @@
"third_party/boringssl/src/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",
@@ -9209,6 +10682,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -9237,6 +10711,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -9263,6 +10743,9 @@
"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: [
@@ -9280,6 +10763,11 @@
"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: [
@@ -9325,6 +10813,7 @@
"third_party/boringssl/src/crypto/hrss/asm/poly_rq_mul.S",
],
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -9361,6 +10850,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -9370,7 +10865,24 @@
"third_party/brotli/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",
@@ -9378,6 +10890,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -9412,6 +10925,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -9421,7 +10940,24 @@
"third_party/brotli/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",
@@ -9429,6 +10965,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -9711,6 +11248,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -9721,8 +11264,25 @@
"third_party/icu/source/i18n/",
],
cpp_std: "c++17",
+ ldflags: [
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
+ ],
rtti: true,
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -9730,6 +11290,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -9969,6 +11530,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -9979,8 +11546,25 @@
"third_party/icu/source/i18n/",
],
cpp_std: "c++17",
+ ldflags: [
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
+ ],
rtti: true,
target: {
+ android_arm: {
+ cflags: [
+ "-fstack-protector",
+ ],
+ },
+ android_arm64: {
+ cflags: [
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics",
+ ],
+ },
android_x86: {
cflags: [
"-msse3",
@@ -9988,6 +11572,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -10030,6 +11615,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -10039,7 +11630,24 @@
"third_party/libevent/android/",
],
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",
@@ -10047,6 +11655,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -10223,6 +11832,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -10231,7 +11846,24 @@
"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",
@@ -10239,6 +11871,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -10365,6 +11998,13 @@
"-D_LARGEFILE_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fstack-protector",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g2",
"-msse3",
],
local_include_dirs: [
@@ -10375,6 +12015,11 @@
"third_party/protobuf/src/",
],
cpp_std: "c++20",
+ ldflags: [
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
+ ],
}
// GN: //third_party/protobuf:protobuf_lite
@@ -10437,6 +12082,12 @@
"-D_GNU_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -10446,7 +12097,24 @@
"third_party/protobuf/src/",
],
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",
@@ -10454,6 +12122,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -10502,6 +12171,13 @@
"-D_LARGEFILE_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fstack-protector",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g2",
"-msse3",
],
local_include_dirs: [
@@ -10512,6 +12188,11 @@
"third_party/protobuf/src/",
],
cpp_std: "c++20",
+ ldflags: [
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
+ ],
}
// GN: //third_party/protobuf:protoc_lib
@@ -10637,6 +12318,13 @@
"-D_LARGEFILE_SOURCE",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-O2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fstack-protector",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g2",
"-msse3",
],
local_include_dirs: [
@@ -10647,6 +12335,11 @@
"third_party/protobuf/src/",
],
cpp_std: "c++20",
+ ldflags: [
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
+ ],
}
// GN: //url:buildflags
@@ -10749,6 +12442,12 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-Oz",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-g1",
],
local_include_dirs: [
"./",
@@ -10759,7 +12458,24 @@
"third_party/boringssl/src/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",
@@ -10767,6 +12483,7 @@
},
android_x86_64: {
cflags: [
+ "-fstack-protector",
"-msse3",
],
},
@@ -10821,15 +12538,11 @@
"SPDX-license-identifier-Apache-2.0",
"SPDX-license-identifier-BSD",
"SPDX-license-identifier-BSL-1.0",
- "SPDX-license-identifier-GPL",
- "SPDX-license-identifier-GPL-2.0",
- "SPDX-license-identifier-GPL-3.0",
"SPDX-license-identifier-ICU",
"SPDX-license-identifier-ISC",
- "SPDX-license-identifier-LGPL",
- "SPDX-license-identifier-LGPL-2.1",
"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",
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 9d2d858..9dc5cdb 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -126,6 +126,28 @@
"-msse3",
# needed for zlib:zlib
"-msse4.2",
+ # flags to reduce binary size
+ "-O1",
+ "-O2",
+ "-O3",
+ "-Oz",
+ "-g1",
+ "-g2",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-fvisibility=hidden",
+ "-fvisibility-inlines-hidden",
+ "-fstack-protector",
+ "-mno-outline",
+ "-mno-outline-atomics"
+]
+
+# Linker flags which are passed through to the blueprint.
+ldflag_allowlist = [
+ # flags to reduce binary size
+ "-Wl,--as-needed",
+ "-Wl,--gc-sections",
+ "-Wl,--icf=all",
]
def get_linker_script_ldflag(script_path):
@@ -296,6 +318,7 @@
self.export_system_include_dirs = set()
self.generated_headers = set()
self.export_generated_headers = set()
+ self.ldflags = set()
def to_string(self, output):
nested_out = []
@@ -313,6 +336,7 @@
self._output_field(nested_out, 'export_system_include_dirs')
self._output_field(nested_out, 'generated_headers')
self._output_field(nested_out, 'export_generated_headers')
+ self._output_field(nested_out, 'ldflags')
if nested_out:
output.append(' %s: {' % self.name)
@@ -1242,8 +1266,10 @@
cflags |= set("-D%s" % define.replace("\"", "\\\"") for define in defines)
return cflags
-def set_module_flags(module, cflags, defines):
+def set_module_flags(module, module_type, cflags, defines, ldflags):
module.cflags.update(_get_cflags(cflags, defines))
+ if module_type != 'cc_object':
+ module.ldflags.update({flag for flag in ldflags if flag in ldflag_allowlist})
# TODO: implement proper cflag parsing.
for flag in cflags:
if '-std=' in flag:
@@ -1335,11 +1361,12 @@
module.rtti = target.rtti
if target.type in gn_utils.LINKER_UNIT_TYPES:
- set_module_flags(module, target.cflags, target.defines)
+ set_module_flags(module, module.type, target.cflags, target.defines, target.ldflags)
set_module_include_dirs(module, target.cflags, target.include_dirs)
# TODO: set_module_xxx is confusing, apply similar function to module and target in better way.
for arch_name, arch in target.arch.items():
- set_module_flags(module.target[arch_name], arch.cflags, arch.defines)
+ set_module_flags(module.target[arch_name], module.type,
+ arch.cflags, arch.defines, arch.ldflags)
# -Xclang -target-feature -Xclang +mte are used to enable MTE (Memory Tagging Extensions).
# Flags which does not start with '-' could not be in the cflags so enabling MTE by
# -march and -mcpu Feature Modifiers. MTE is only available on arm64. This is needed for
@@ -1607,10 +1634,8 @@
'-Wno-sign-promo',
'-Wno-unused-parameter',
'-Wno-null-pointer-subtraction', # Needed to libevent
- '-fvisibility=hidden',
'-Wno-ambiguous-reversed-operator', # needed for icui18n
'-Wno-unreachable-code-loop-increment', # needed for icui18n
- '-O2',
'-fPIC',
]
# Chromium builds do not add a dependency for headers found inside the
@@ -1667,24 +1692,20 @@
def create_license_module(blueprint):
module = Module("license", "external_cronet_license", "LICENSE")
module.license_kinds.update({
- 'SPDX-license-identifier-LGPL-2.1',
- 'SPDX-license-identifier-GPL-2.0',
'SPDX-license-identifier-MPL',
+ 'SPDX-license-identifier-MPL-1.1',
'SPDX-license-identifier-ISC',
- 'SPDX-license-identifier-GPL',
'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-LGPL',
- 'SPDX-license-identifier-GPL-3.0',
'SPDX-license-identifier-Unicode-DFS',
'SPDX-license-identifier-NCSA',
'SPDX-license-identifier-OpenSSL',
'SPDX-license-identifier-MIT',
"SPDX-license-identifier-ICU",
- 'legacy_unencumbered', # public domain
+ 'legacy_unencumbered',
})
module.license_text.update({
"LICENSE",
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 3d709e5..6095455 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -119,6 +119,7 @@
self.deps = set()
self.transitive_static_libs_deps = set()
self.source_set_deps = set()
+ self.ldflags = set()
# These are valid only for type == 'action'
self.inputs = set()
@@ -207,7 +208,7 @@
'libs', 'proto_paths'):
self.__dict__[key].update(other.__dict__.get(key, []))
- for key_in_arch in ('cflags', 'defines', 'include_dirs', 'source_set_deps'):
+ for key_in_arch in ('cflags', 'defines', 'include_dirs', 'source_set_deps', 'ldflags'):
self.arch[arch].__dict__[key_in_arch].update(
other.arch[arch].__dict__.get(key_in_arch, []))
@@ -250,7 +251,7 @@
return
for key in ('sources', 'cflags', 'defines', 'include_dirs', 'deps', 'source_set_deps',
- 'inputs', 'outputs', 'args', 'script', 'response_file_contents'):
+ 'inputs', 'outputs', 'args', 'script', 'response_file_contents', 'ldflags'):
self._finalize_attribute(key)
@@ -392,7 +393,7 @@
target.arch[arch].cflags.update(desc.get('cflags', []) + desc.get('cflags_cc', []))
target.libs.update(desc.get('libs', []))
- target.ldflags.update(desc.get('ldflags', []))
+ target.arch[arch].ldflags.update(desc.get('ldflags', []))
target.arch[arch].defines.update(desc.get('defines', []))
target.arch[arch].include_dirs.update(desc.get('include_dirs', []))
target.output_name = desc.get('output_name', None)