system/corennnnn
修订版 | 1f264564af0fc3c359a82fda2c31910a754fed02 (tree) |
---|---|
时间 | 2016-09-20 02:19:46 |
作者 | Steve Kondik <steve@cyng...> |
Commiter | Steve Kondik |
init: Fire a trigger when a class is started/stopped
Change-Id: Ifc72efc7b4cc0718838c711395f5fdc3b043827a
@@ -63,6 +63,8 @@ | ||
63 | 63 | #include "signal_handler.h" |
64 | 64 | #include "util.h" |
65 | 65 | |
66 | +using android::base::StringPrintf; | |
67 | + | |
66 | 68 | #define chmod DO_NOT_USE_CHMOD_USE_FCHMODAT_SYMLINK_NOFOLLOW |
67 | 69 | #define UNMOUNT_CHECK_MS 5000 |
68 | 70 | #define UNMOUNT_CHECK_TIMES 10 |
@@ -225,24 +227,39 @@ static void unmount_and_fsck(const struct mntent *entry) { | ||
225 | 227 | } |
226 | 228 | |
227 | 229 | static int do_class_start(const std::vector<std::string>& args) { |
228 | - /* Starting a class does not start services | |
229 | - * which are explicitly disabled. They must | |
230 | - * be started individually. | |
231 | - */ | |
230 | + /* Starting a class does not start services | |
231 | + * which are explicitly disabled. They must | |
232 | + * be started individually. | |
233 | + */ | |
232 | 234 | ServiceManager::GetInstance(). |
233 | 235 | ForEachServiceInClass(args[1], [] (Service* s) { s->StartIfNotDisabled(); }); |
236 | + | |
237 | + std::string prop_name = StringPrintf("class_start:%s", args[1].c_str()); | |
238 | + if (prop_name.length() < PROP_NAME_MAX) { | |
239 | + ActionManager::GetInstance().QueueEventTrigger(prop_name); | |
240 | + } | |
234 | 241 | return 0; |
235 | 242 | } |
236 | 243 | |
237 | 244 | static int do_class_stop(const std::vector<std::string>& args) { |
238 | 245 | ServiceManager::GetInstance(). |
239 | 246 | ForEachServiceInClass(args[1], [] (Service* s) { s->Stop(); }); |
247 | + | |
248 | + std::string prop_name = StringPrintf("class_stop:%s", args[1].c_str()); | |
249 | + if (prop_name.length() < PROP_NAME_MAX) { | |
250 | + ActionManager::GetInstance().QueueEventTrigger(prop_name); | |
251 | + } | |
240 | 252 | return 0; |
241 | 253 | } |
242 | 254 | |
243 | 255 | static int do_class_reset(const std::vector<std::string>& args) { |
244 | 256 | ServiceManager::GetInstance(). |
245 | 257 | ForEachServiceInClass(args[1], [] (Service* s) { s->Reset(); }); |
258 | + | |
259 | + std::string prop_name = StringPrintf("class_reset:%s", args[1].c_str()); | |
260 | + if (prop_name.length() < PROP_NAME_MAX) { | |
261 | + ActionManager::GetInstance().QueueEventTrigger(prop_name); | |
262 | + } | |
246 | 263 | return 0; |
247 | 264 | } |
248 | 265 |