Merge "Include <print> header" into main
diff --git a/Android.bp b/Android.bp
index 2a0a6a8..834089d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -13,6 +13,7 @@
// limitations under the License.
package {
+ default_team: "trendy_team_native_tools_libraries",
default_applicable_licenses: ["packages_modules_adb_license"],
}
@@ -48,7 +49,7 @@
"-Wno-missing-field-initializers",
"-Wthread-safety",
"-Wvla",
- "-DADB_HOST=1", // overridden by adbd_defaults
+ "-DADB_HOST=1", // overridden by adbd_defaults
"-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
],
cpp_std: "experimental",
@@ -113,7 +114,10 @@
name: "adbd_defaults",
defaults: ["adb_defaults"],
- cflags: ["-UADB_HOST", "-DADB_HOST=0"],
+ cflags: [
+ "-UADB_HOST",
+ "-DADB_HOST=0",
+ ],
}
cc_defaults {
@@ -171,7 +175,7 @@
"libselinux",
],
- soong_config_variables:{
+ soong_config_variables: {
library_linking_strategy: {
prefer_static: {
static_libs: [
@@ -402,7 +406,7 @@
test_options: {
// TODO(b/247985207) remove "no-remote" tag when b/247985207 is fixed.
tags: ["no-remote"],
- }
+ },
}
cc_binary_host {
@@ -430,7 +434,7 @@
generated_headers: [
"bin2c_fastdeployagent",
- "bin2c_fastdeployagentscript"
+ "bin2c_fastdeployagentscript",
],
static_libs: [
@@ -502,7 +506,10 @@
// libadbd_core contains the common sources to build libadbd and libadbd_services.
cc_library_static {
name: "libadbd_core",
- defaults: ["adbd_defaults", "host_adbd_supported"],
+ defaults: [
+ "adbd_defaults",
+ "host_adbd_supported",
+ ],
recovery_available: true,
// libminadbd wants both, as it's used to build native tests.
@@ -551,7 +558,7 @@
"daemon/usb.cpp",
"daemon/usb_ffs.cpp",
"daemon/watchdog.cpp",
- ]
+ ],
},
recovery: {
exclude_shared_libs: [
@@ -559,7 +566,7 @@
"libadb_pairing_connection",
"libapp_processes_protos_lite",
],
- }
+ },
},
min_sdk_version: "30",
@@ -575,7 +582,10 @@
cc_library {
name: "libadbd_services",
- defaults: ["adbd_defaults", "host_adbd_supported"],
+ defaults: [
+ "adbd_defaults",
+ "host_adbd_supported",
+ ],
recovery_available: true,
compile_multilib: "both",
@@ -659,7 +669,10 @@
cc_library {
name: "libadbd",
- defaults: ["adbd_defaults", "host_adbd_supported"],
+ defaults: [
+ "adbd_defaults",
+ "host_adbd_supported",
+ ],
recovery_available: true,
min_sdk_version: "30",
apex_available: ["com.android.adbd"],
@@ -706,10 +719,9 @@
"libadb_pairing_auth",
"libadb_pairing_connection",
],
- }
+ },
},
-
visibility: [
"//bootable/recovery/minadbd",
"//packages/modules/adb",
@@ -718,7 +730,11 @@
cc_binary {
name: "adbd",
- defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
+ defaults: [
+ "adbd_defaults",
+ "host_adbd_supported",
+ "libadbd_binary_dependencies",
+ ],
recovery_available: true,
min_sdk_version: "30",
apex_available: ["com.android.adbd"],
@@ -757,7 +773,7 @@
"libadb_pairing_auth",
"libadb_pairing_connection",
],
- }
+ },
},
}
@@ -833,7 +849,10 @@
cc_test {
name: "adbd_test",
- defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
+ defaults: [
+ "adbd_defaults",
+ "libadbd_binary_dependencies",
+ ],
recovery_available: false,
srcs: libadb_test_srcs + [
@@ -871,7 +890,10 @@
// adbd_test uses the static version of these libraries above, so exclude them here.
exclude_shared_libs: ADBD_TEST_LIBS,
- test_suites: ["general-tests", "mts-adbd"],
+ test_suites: [
+ "general-tests",
+ "mts-adbd",
+ ],
require_root: true,
}
diff --git a/crypto/tests/Android.bp b/crypto/tests/Android.bp
index d45b05d..41e805e 100644
--- a/crypto/tests/Android.bp
+++ b/crypto/tests/Android.bp
@@ -15,6 +15,7 @@
//
package {
+ default_team: "trendy_team_native_tools_libraries",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "packages_modules_adb_license"
@@ -47,5 +48,8 @@
"libadb_sysdeps",
],
- test_suites: ["general-tests", "mts-adbd"],
+ test_suites: [
+ "general-tests",
+ "mts-adbd",
+ ],
}
diff --git a/daemon/main.cpp b/daemon/main.cpp
index 497a5c1..77e535a 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -121,7 +121,19 @@
const bool should_drop_caps = !__android_log_is_debuggable();
if (should_drop_caps) {
- minijail_use_caps(jail.get(), CAP_TO_MASK(CAP_SETUID) | CAP_TO_MASK(CAP_SETGID));
+ // CAP_SETUI and CAP_SETGID are required for change_uid and change_gid calls below.
+ // CAP_SYS_NICE needs to be in the bounding set of adbd for sh spawned from `adb shell`
+ // to also have it in the bounding set. This in turn is required to be able to launch
+ // VMs from shell (e.g. adb shell /apex/com.android.virt/bin/vm run-microdroid).
+ // Full fork+execve chain looks like this:
+ // adbd (CapBnd: CAP_SYS_NICE) -> /system/bin/sh (CapBnd: CAP_SYS_NICE) ->
+ // /apex/com.android.virt/bin/vm (CapBnd: CAP_SYS_NICE) ->
+ // virtmngr (CapBnd: CAP_SYS_NICE) -> crosvm (CapEff: CAP_SYS_NICE).
+ // Note: the adbd will drop it's effective capabilities several lines below, while the
+ // /system/bin/sh process spawned from adbd will run as non-root uid, hence won't be
+ // able to use the CAP_SYS_NICE capability in the first place.
+ minijail_use_caps(jail.get(), CAP_TO_MASK(CAP_SETUID) | CAP_TO_MASK(CAP_SETGID) |
+ CAP_TO_MASK(CAP_SYS_NICE));
}
minijail_change_gid(jail.get(), AID_SHELL);
@@ -140,7 +152,7 @@
PLOG(FATAL) << "cap_clear_flag(INHERITABLE) failed";
}
if (cap_clear_flag(caps.get(), CAP_EFFECTIVE) == -1) {
- PLOG(FATAL) << "cap_clear_flag(PEMITTED) failed";
+ PLOG(FATAL) << "cap_clear_flag(EFFECTIVE) failed";
}
if (cap_clear_flag(caps.get(), CAP_PERMITTED) == -1) {
PLOG(FATAL) << "cap_clear_flag(PEMITTED) failed";
diff --git a/fastdeploy/Android.bp b/fastdeploy/Android.bp
index 84e62c6..309c6d1 100644
--- a/fastdeploy/Android.bp
+++ b/fastdeploy/Android.bp
@@ -14,6 +14,7 @@
// limitations under the License.
//
package {
+ default_team: "trendy_team_framework_android_packages",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "packages_modules_adb_license"
@@ -43,7 +44,7 @@
],
dex_preopt: {
enabled: false,
- }
+ },
}
android_test {
diff --git a/pairing_auth/tests/Android.bp b/pairing_auth/tests/Android.bp
index 9105aa5..ed51594 100644
--- a/pairing_auth/tests/Android.bp
+++ b/pairing_auth/tests/Android.bp
@@ -15,6 +15,7 @@
//
package {
+ default_team: "trendy_team_native_tools_libraries",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "packages_modules_adb_license"
@@ -43,5 +44,8 @@
"libadb_pairing_auth_static",
],
- test_suites: ["general-tests", "mts-adbd"],
+ test_suites: [
+ "general-tests",
+ "mts-adbd",
+ ],
}
diff --git a/pairing_connection/tests/Android.bp b/pairing_connection/tests/Android.bp
index 4199cab..2d8c1e7 100644
--- a/pairing_connection/tests/Android.bp
+++ b/pairing_connection/tests/Android.bp
@@ -15,6 +15,7 @@
//
package {
+ default_team: "trendy_team_android_developer_tools",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "packages_modules_adb_license"
@@ -44,5 +45,8 @@
"libadb_pairing_server",
],
- test_suites: ["general-tests", "mts-adbd"],
+ test_suites: [
+ "general-tests",
+ "mts-adbd",
+ ],
}
diff --git a/tls/tests/Android.bp b/tls/tests/Android.bp
index cbb3a6a..5041d6f 100644
--- a/tls/tests/Android.bp
+++ b/tls/tests/Android.bp
@@ -15,6 +15,7 @@
//
package {
+ default_team: "trendy_team_native_tools_libraries",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "packages_modules_adb_license"
@@ -47,5 +48,8 @@
"libadb_tls_connection_static",
],
- test_suites: ["general-tests", "mts-adbd"],
+ test_suites: [
+ "general-tests",
+ "mts-adbd",
+ ],
}