Remove undocumented functionality from init.
(cherry-pick of a3cc6026301db08285028c760af2665a66b3cc44.)
Bug: http://b/28151340
Change-Id: I5360502c79d9113a13055bf017b39c099033e947
diff --git a/init/init.cpp b/init/init.cpp
index 9b7d108..78c33d5 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -139,59 +139,19 @@
});
}
-static void msg_start(const std::string& name)
-{
- Service* svc = nullptr;
- std::vector<std::string> vargs;
-
- size_t colon_pos = name.find(':');
- if (colon_pos == std::string::npos) {
- svc = ServiceManager::GetInstance().FindServiceByName(name);
- } else {
- std::string service_name(name.substr(0, colon_pos));
- std::string args(name.substr(colon_pos + 1));
- vargs = android::base::Split(args, " ");
-
- svc = ServiceManager::GetInstance().FindServiceByName(service_name);
- }
-
- if (svc) {
- svc->Start(vargs);
- } else {
- ERROR("no such service '%s'\n", name.c_str());
- }
-}
-
-static void msg_stop(const std::string& name)
-{
+void handle_control_message(const std::string& msg, const std::string& name) {
Service* svc = ServiceManager::GetInstance().FindServiceByName(name);
-
- if (svc) {
- svc->Stop();
- } else {
+ if (svc == nullptr) {
ERROR("no such service '%s'\n", name.c_str());
+ return;
}
-}
-static void msg_restart(const std::string& name)
-{
- Service* svc = ServiceManager::GetInstance().FindServiceByName(name);
-
- if (svc) {
- svc->Restart();
- } else {
- ERROR("no such service '%s'\n", name.c_str());
- }
-}
-
-void handle_control_message(const std::string& msg, const std::string& arg)
-{
if (msg == "start") {
- msg_start(arg);
+ svc->Start();
} else if (msg == "stop") {
- msg_stop(arg);
+ svc->Stop();
} else if (msg == "restart") {
- msg_restart(arg);
+ svc->Restart();
} else {
ERROR("unknown control msg '%s'\n", msg.c_str());
}