Adds new property for service name -> PID.

Bug: 138114550
Test: used in vts_ibase_test
Change-Id: Id21b81aa09b8597d17ad0a132ddd7749fe1182e9
This commit is contained in:
Daniel Norman 2019-07-19 11:04:01 -07:00
parent d19c5a5076
commit c788771da7
1 changed files with 9 additions and 0 deletions

View File

@ -165,6 +165,15 @@ void Service::NotifyStateChange(const std::string& new_state) const {
property_set(boottime_property, std::to_string(start_ns));
}
}
// init.svc_debug_pid.* properties are only for tests, and should not be used
// on device for security checks.
std::string pid_property = "init.svc_debug_pid." + name_;
if (new_state == "running") {
property_set(pid_property, std::to_string(pid_));
} else if (new_state == "stopped") {
property_set(pid_property, "");
}
}
void Service::KillProcessGroup(int signal) {