• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

修订版1f264564af0fc3c359a82fda2c31910a754fed02 (tree)
时间2016-09-20 02:19:46
作者Steve Kondik <steve@cyng...>
CommiterSteve Kondik

Log Message

init: Fire a trigger when a class is started/stopped

  • This allows us to react to these events without messing
    with the master config.

Change-Id: Ifc72efc7b4cc0718838c711395f5fdc3b043827a

更改概述

差异

--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -63,6 +63,8 @@
6363 #include "signal_handler.h"
6464 #include "util.h"
6565
66+using android::base::StringPrintf;
67+
6668 #define chmod DO_NOT_USE_CHMOD_USE_FCHMODAT_SYMLINK_NOFOLLOW
6769 #define UNMOUNT_CHECK_MS 5000
6870 #define UNMOUNT_CHECK_TIMES 10
@@ -225,24 +227,39 @@ static void unmount_and_fsck(const struct mntent *entry) {
225227 }
226228
227229 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+ */
232234 ServiceManager::GetInstance().
233235 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+ }
234241 return 0;
235242 }
236243
237244 static int do_class_stop(const std::vector<std::string>& args) {
238245 ServiceManager::GetInstance().
239246 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+ }
240252 return 0;
241253 }
242254
243255 static int do_class_reset(const std::vector<std::string>& args) {
244256 ServiceManager::GetInstance().
245257 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+ }
246263 return 0;
247264 }
248265