Merge "TetheringConfiguration: force to select upstream automatically on U+"
diff --git a/tests/cts/net/src/android/net/cts/TestUtils.java b/tests/cts/net/src/android/net/cts/TestUtils.java
index 001aa01..6180845 100644
--- a/tests/cts/net/src/android/net/cts/TestUtils.java
+++ b/tests/cts/net/src/android/net/cts/TestUtils.java
@@ -16,8 +16,6 @@
package android.net.cts;
-import static com.android.testutils.DevSdkIgnoreRuleKt.SC_V2;
-
import android.os.Build;
import com.android.modules.utils.build.SdkLevel;
@@ -37,11 +35,18 @@
}
/**
- * Whether to test T+ APIs. This requires a) that the test be running on an S+ device, and
+ * Whether to test T+ APIs. This requires a) that the test be running on an T+ device, and
* b) that the code be compiled against shims new enough to access these APIs.
*/
public static boolean shouldTestTApis() {
- // TODO: replace SC_V2 with Build.VERSION_CODES.S_V2 when it's available in mainline branch.
- return SdkLevel.isAtLeastT() && ConstantsShim.VERSION > SC_V2;
+ return SdkLevel.isAtLeastT() && ConstantsShim.VERSION > Build.VERSION_CODES.S_V2;
+ }
+
+ /**
+ * Whether to test U+ APIs. This requires a) that the test be running on an U+ device, and
+ * b) that the code be compiled against shims new enough to access these APIs.
+ */
+ public static boolean shouldTestUApis() {
+ return SdkLevel.isAtLeastU() && ConstantsShim.VERSION > Build.VERSION_CODES.TIRAMISU;
}
}
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 62afa61..376b8f1 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -1727,12 +1727,14 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
],
cpp_std: "c++20",
@@ -1772,12 +1774,14 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
],
cpp_std: "c++20",
@@ -1812,12 +1816,14 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
],
cpp_std: "c++20",
@@ -4376,6 +4382,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -4385,6 +4392,7 @@
"buildtools/third_party/libc++abi/trunk/include",
"third_party/abseil-cpp/",
"third_party/boringssl/src/include/",
+ "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
],
cpp_std: "c++20",
@@ -6779,6 +6787,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -6786,6 +6795,7 @@
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
"third_party/zlib/",
+ "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
],
cpp_std: "c++20",
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 4bd2479..2644e43 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -1048,6 +1048,11 @@
cflags = {flag for flag in target.cflags if re.match(cflag_allowlist, flag)}
# Consider proper allowlist or denylist if needed
cflags |= set("-D%s" % define.replace("\"", "\\\"") for define in target.defines)
+ # -DANDROID is added by default but target.defines contain -DANDROID if it's required.
+ # So adding -UANDROID to cancel default -DANDROID if it's not specified.
+ # This is needed for some targets(e.g. symbolize)
+ if "ANDROID" not in target.defines:
+ cflags.add("-UANDROID")
return cflags
@@ -1153,7 +1158,10 @@
# include. So adding sysroot include at the end.
for flag in target.cflags:
if '--sysroot' in flag:
- module.local_include_dirs.append(flag[len('--sysroot=../../'):] + "/usr/include")
+ sysroot = flag[len('--sysroot=../../'):]
+ if sysroot == "build/linux/debian_bullseye_amd64-sysroot":
+ module.local_include_dirs.append(sysroot + "/usr/include/x86_64-linux-gnu")
+ module.local_include_dirs.append(sysroot + "/usr/include")
module_is_compiled = module.type not in ('genrule', 'filegroup')
if module_is_compiled: