Adding EXEC version of calling ABB.
This is corresponding to exec: command of adb and allows for simplifed calls
to binder without shell protocol.
Bug: 111621042
Test: manual
Change-Id: Id6935cd53e351388ecf6d2d15f3a204cb871536a
diff --git a/adb/daemon/abb.cpp b/adb/daemon/abb.cpp
index d949dd1..4ffa6bb 100644
--- a/adb/daemon/abb.cpp
+++ b/adb/daemon/abb.cpp
@@ -85,7 +85,19 @@
break;
}
- unique_fd result = StartCommandInProcess(std::move(data), &execCmd);
+ std::string_view name = data;
+ auto protocol = SubprocessProtocol::kShell;
+ if (name.starts_with("abb:")) {
+ name.remove_prefix(strlen("abb:"));
+ protocol = SubprocessProtocol::kShell;
+ } else if (name.starts_with("abb_exec:")) {
+ name.remove_prefix(strlen("abb_exec:"));
+ protocol = SubprocessProtocol::kNone;
+ } else {
+ LOG(FATAL) << "Unknown command prefix for abb: " << data;
+ }
+
+ unique_fd result = StartCommandInProcess(std::string(name), &execCmd, protocol);
if (android::base::SendFileDescriptors(fd, "", 1, result.get()) != 1) {
PLOG(ERROR) << "Failed to send an inprocess fd for command: " << data;
break;