Merge "minadbd: daemon_service_to_fd takes std::string_view." am: 72aa58dcf7
am: 29578b1117
Change-Id: I038edb2337aceaaa8586426d14a159c2806d9350
This commit is contained in:
@@ -21,6 +21,8 @@ cc_defaults {
|
|||||||
"-Werror",
|
"-Werror",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
cpp_std: "experimental",
|
||||||
|
|
||||||
include_dirs: [
|
include_dirs: [
|
||||||
"system/core/adb",
|
"system/core/adb",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "adb.h"
|
#include "adb.h"
|
||||||
@@ -49,14 +50,13 @@ static void sideload_host_service(unique_fd sfd, const std::string& args) {
|
|||||||
exit(result == 0 ? 0 : 1);
|
exit(result == 0 ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unique_fd daemon_service_to_fd(const char* name, atransport* /* transport */) {
|
unique_fd daemon_service_to_fd(std::string_view name, atransport* /* transport */) {
|
||||||
if (!strncmp(name, "sideload:", 9)) {
|
if (name.starts_with("sideload:")) {
|
||||||
// this exit status causes recovery to print a special error
|
// This exit status causes recovery to print a special error message saying to use a newer adb
|
||||||
// message saying to use a newer adb (that supports
|
// (that supports sideload-host).
|
||||||
// sideload-host).
|
|
||||||
exit(3);
|
exit(3);
|
||||||
} else if (!strncmp(name, "sideload-host:", 14)) {
|
} else if (name.starts_with("sideload-host:")) {
|
||||||
std::string arg(name + 14);
|
std::string arg(name.substr(strlen("sideload-host:")));
|
||||||
return create_service_thread("sideload-host",
|
return create_service_thread("sideload-host",
|
||||||
std::bind(sideload_host_service, std::placeholders::_1, arg));
|
std::bind(sideload_host_service, std::placeholders::_1, arg));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user