2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
19 #include "ico_syc_error.h"
21 #include "CicoAulItems.h"
22 #include "CicoAilItems.h"
23 #include "CicoHSLifeCycleController.h"
25 #include "CicoSystemConfig.h"
26 #include "Cico_aul_listen_app.h"
31 #define ICO_SYC_EOK 0 /* OK */
32 #define ICO_SYC_EPERM -1 /* Operation not permitted */
33 #define ICO_SYC_ENOENT -2 /* No such object */
34 #define ICO_SYC_ESRCH -3 /* Not initialized */
35 #define ICO_SYC_EIO -5 /* I/O(send/receive) error */
36 #define ICO_SYC_ENXIO -6 /* Not exist */
37 #define ICO_SYC_E2BIG -7 /* Buffer size too smale */
38 #define ICO_SYC_EBADF -9 /* Illegal data type */
39 #define ICO_SYC_EAGAIN -11 /* Try again */
40 #define ICO_SYC_ENOMEM -12 /* Out of memory */
41 #define ICO_SYC_EFAULT -14 /* Bad address */
42 #define ICO_SYC_EBUSY -16 /* Not available now */
43 #define ICO_SYC_EEXIST -17 /* Multiple define */
44 #define ICO_SYC_EINVAL -22 /* Invalid argument */
45 #define ICO_SYC_ENOSYS -38 /* System error */
48 CicoHSLifeCycleController* CicoHSLifeCycleController::ms_myInstance = NULL;
50 const char* DAilTypeFilPrm_Menu="menu";
51 const char* DAilTypeFilPrm_App="Application";
52 const char* DNil = "(nil)";
53 const char* sectAppAttr = "app-attributes";
54 const char* DNull = "(null)";
56 #define APP_CONF_AIL_NULL_STR DNull
62 * @param pkg_name package name
63 * @param key "start"/"end"/"install_percent"/"command" strings
64 * @param val "ok"/"error"/"0.000000"-"100.000000" strings
65 * @param pmsg pkgmgr message
66 * @param data user data
68 static int CSCLCCpkgmgr_handler(int req_id, const char *pkg_type,
69 const char *pkg_name, const char *key,
70 const char *val, const void *pmsg, void *data)
72 CicoHSLifeCycleController* x = (CicoHSLifeCycleController*)data;
74 CSCLCCpkgmgr_handlerX(req_id, pkg_type, pkg_name, key, val, pmsg, x);
78 * @brief ail_filter_list_appinfo_foreach callback function
79 * @param appinfo appinfo_h the appinfo's handle
80 * @param data user data
81 * @retval AIL_CB_RET_CONTINUE return if you continue iteration
82 * @retval AIL_CB_RET_CANCEL return if you cancel iteration
84 static ail_cb_ret_e CSCLCCail_list_appinfo_cb(const ail_appinfo_h appinfo,
87 CicoHSLifeCycleController* x = (CicoHSLifeCycleController*)data;
88 return CSCLCCail_list_appinfo_cbX(appinfo, x);
92 * @brief applications are launched. callback function
94 * @param data user data
96 static int CSCLCCapp_launch_handler(int pid, void *data)
98 CicoHSLifeCycleController* x = (CicoHSLifeCycleController*)data;
99 return CSCLCCapp_launch_handlerX(pid, x);
103 * @brief applications die. callback function
105 * @param data user data
107 static int CSCLCCapp_dead_handler(int pid, void *data)
109 CicoHSLifeCycleController* x = (CicoHSLifeCycleController*)data;
110 return CSCLCCapp_dead_handlerX(pid, x);
115 * @brief This API get application appid by pid
117 * @param appid store appid string
118 * @param len appid buffer size
119 * @ret aul_app_get_appid_bypid return value
120 * @retval AUL_R_OK - success
121 * @retval AUL_R_ERROR - no such a appid
123 int Xaul_app_get_appid_bypid(int pid, char *appid, int len)
125 int r = aul_app_get_appid_bypid(pid, appid, len);
130 sprintf(fn, "/proc/%d/cmdline", pid);
135 const char* p = tmp.c_str();
140 strncpy(appid, &p[i+1], len);
141 break; // break of while i
151 CicoHSLifeCycleController::CicoHSLifeCycleController()
153 m_gconf = (GKeyFile*)NULL;
154 m_pc = (pkgmgr_client*)NULL;
163 CicoHSLifeCycleController::~CicoHSLifeCycleController()
168 CicoHSLifeCycleController*
169 CicoHSLifeCycleController::getInstance(void)
171 if (NULL == ms_myInstance) {
172 ms_myInstance = new CicoHSLifeCycleController();
174 return ms_myInstance;
178 * @brief application launch
179 * @param appid application id
180 * @retval ICO_SYC_EOK success
181 * @retval ICO_SYC_ESRCH error(not initialized)
182 * @retval ICO_SYC_ENOENT error(does not exist)
183 * @retval ICO_SYC_EBUSY error(already launch)
184 * @retval ICO_SYC_EPERM error(no authority)
186 int CicoHSLifeCycleController::launch(const char* appid)
188 ICO_TRA("start %s", appid);
189 // appid check AIL table exist
190 if (NULL == findAIL(appid)) {
191 ICO_TRA("end fail(not find)");
192 return ICO_SYC_ENOSYS;
194 ICO_PRF("CHG_APP_STA 2.request app=%s", appid);
195 int r = aul_launch_app(appid, NULL);
197 ICO_TRA("end fail(%d)", r);
198 return ICO_SYC_ENOSYS;
200 ICO_TRA("end success(%d)", r);
205 * @brief application launch
206 * @param appid application id
207 * @retval ICO_SYC_EOK success
208 * @retval ICO_SYC_ESRCH error(not initialized)
209 * @retval ICO_SYC_ENOENT error(does not exist)
210 * @retval ICO_SYC_EBUSY error(already launch)
211 * @retval ICO_SYC_EPERM error(no authority)
213 int CicoHSLifeCycleController::launch(const std::string& appid)
215 return launch((const char*)appid.c_str());
219 * @brief application terminate
220 * @param appid application id
221 * @retval ICO_SYC_EOK success
222 * @retval ICO_SYC_ESRCH error(not initialized)
223 * @retval ICO_SYC_ENOENT error(does not exist)
224 * @retval ICO_SYC_EBUSY error(already launch)
225 * @retval ICO_SYC_EPERM error(no authority)
227 int CicoHSLifeCycleController::terminate(const char* appid)
229 ICO_TRA("CicoHSLifeCycleController::terminate %s", appid);
232 if (true == getPIDs(appid, pids)) {
233 vector<int>::iterator it;
234 for(it = pids.begin(); it != pids.end(); ++it) {
235 int tr = terminateR(*it);
236 if (ICO_SYC_EOK != tr) {
242 ICO_TRA("end ICO_SYC_EPERM");
243 return ICO_SYC_EPERM;
245 ICO_TRA("end %d", r);
250 * @brief application terminate
251 * @param appid application id
252 * @retval ICO_SYC_EOK success
253 * @retval ICO_SYC_ESRCH error(not initialized)
254 * @retval ICO_SYC_ENOENT error(does not exist)
255 * @retval ICO_SYC_EBUSY error(already launch)
256 * @retval ICO_SYC_EPERM error(no authority)
258 int CicoHSLifeCycleController::terminate(const std::string& appid)
260 return terminate((const char*)appid.c_str());
264 * @brief application terminate
266 * @retval ICO_SYC_EOK success
267 * @retval ICO_SYC_ESRCH error(not initialized)
268 * @retval ICO_SYC_ENOENT error(does not exist)
269 * @retval ICO_SYC_EBUSY error(already launch)
270 * @retval ICO_SYC_EPERM error(no authority)
272 int CicoHSLifeCycleController::terminate(int pid)
274 ICO_TRA("CicoHSLifeCycleController::terminate %d", pid);
275 const CicoAulItems* t = findAUL(pid);
276 if ((NULL == t) || (0 == t)) {
278 return ICO_SYC_EPERM;
280 return terminateR(pid);
284 * @brief application terminate
286 * @retval ICO_SYC_EOK success
287 * @retval ICO_SYC_ENOSYS error
289 int CicoHSLifeCycleController::terminateR(int pid)
291 ICO_TRA("CicoHSLifeCycleController::terminateR %d", pid);
292 int r = aul_terminate_pid(pid);
294 ICO_DBG("terminate error pid:%d, r:%d", pid, r);
295 return ICO_SYC_ENOSYS;
301 * @brief application suspend
302 * @param appid application id
303 * @retval ICO_SYC_EOK success
304 * @retval ICO_SYC_ESRCH error(not initialized)
305 * @retval ICO_SYC_ENOENT error(does not exist)
306 * @retval ICO_SYC_EBUSY error(already launch)
307 * @retval ICO_SYC_EPERM error(no authority)
309 int CicoHSLifeCycleController::suspend(const char* appid)
313 if (true == getPIDs(appid, pids)) {
314 vector<int>::iterator it;
315 for(it = pids.begin(); it != pids.end(); ++it) {
316 int tr = suspend(*it);
317 if (ICO_SYC_EOK != tr) {
323 ICO_TRA("end ICO_SYC_EPERM");
324 return ICO_SYC_EPERM;
326 ICO_TRA("end %d", r);
331 * @brief application suspend
332 * @param appid application id
333 * @retval ICO_SYC_EOK success
334 * @retval ICO_SYC_ESRCH error(not initialized)
335 * @retval ICO_SYC_ENOENT error(does not exist)
336 * @retval ICO_SYC_EBUSY error(already launch)
337 * @retval ICO_SYC_EPERM error(no authority)
339 int CicoHSLifeCycleController::suspend(const std::string& appid)
341 return suspend((const char*)appid.c_str());
345 * @brief application suspend
347 * @retval ICO_SYC_EOK success
348 * @retval ICO_SYC_ESRCH error(not initialized)
349 * @retval ICO_SYC_ENOENT error(does not exist)
350 * @retval ICO_SYC_EBUSY error(already launch)
351 * @retval ICO_SYC_EPERM error(no authority)
353 int CicoHSLifeCycleController::suspend(int pid)
357 return ICO_SYC_EPERM;
361 * @brief appid is running check
362 * @param appid package
363 * @return running status
364 * @retval true is running
365 * @retval false not running
367 bool CicoHSLifeCycleController::isRunning(const char* appid)
371 vector<CicoAulItems>::iterator it = m_aul.begin();
372 while (it != m_aul.end()) {
374 ICO_DBG("%s == %s", it->m_appid.c_str(), appid);
375 if (it->m_appid == appid) {
377 break; // break of while it
382 int sz = m_aul.size();
383 for (int i = 0; i < sz; i++) {
384 m_aul[i].update_appid();
385 // ICO_DBG("%s == %s", m_aul[i].m_appid.c_str(), appid);
386 if (m_aul[i].m_appid == appid) {
392 ICO_TRA("CicoHSLifeCycleController::isRunning %s=%s", appid, r ? "true" : "false");
397 * @brief appid is running check
398 * @param appid package
399 * @return running status
400 * @retval true is running
401 * @retval false not running
403 bool CicoHSLifeCycleController::isRunning(const std::string& appid)
405 return isRunning((const char*)appid.c_str());
409 * @brief find ail data
410 * @param appid find key
411 * @return CicoAilItems class pointer
412 * @retval NULL is not find
414 const CicoAilItems* CicoHSLifeCycleController::findAIL(const char* appid) const
417 const CicoAilItems* r = NULL;
418 int sz = m_ail.size();
419 for (int i = 0; i < sz; i++) {
420 if (0 == strcasecmp(m_ail[i].m_appid.c_str(), appid)) {
422 break; // break of for
425 ICO_TRA("end %x", r);
430 * @brief find ail data
431 * @param appid find key
432 * @return CicoAilItems class pointer
433 * @retval NULL is not find
435 const CicoAilItems* CicoHSLifeCycleController::findAIL(const std::string& appid) const
437 ICO_TRA("call findAIL(const chr*)");
438 return findAIL((const char*)appid.c_str());
442 * @brief get launched apprication pid
443 * @param appid target application appid
446 bool CicoHSLifeCycleController::getPIDs(const char* appid, std::vector<int>& pids) const
448 ICO_TRA("start %s", appid);
451 vector<CicoAulItems>::iterator it;
452 for (it = m_aul.begin(); it != m_aul.end(); ++it) {
454 if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
455 pids.push_back(it->m_pid);
460 int sz = m_aul.size();
461 for (int i = 0; i < sz; i++) {
462 CicoAulItems* t = (CicoAulItems*)m_aul[i].p();
464 if (0 == strcasecmp(t->m_appid.c_str(), appid)) {
465 pids.push_back(t->m_pid);
470 ICO_TRA("end %d %s", pids.size(), r? "true": "false");
475 * @brief get launched apprication pid
476 * @param appid target application appid
479 bool CicoHSLifeCycleController::getPIDs(std::string& appid, std::vector<int>& pids) const
481 return getPIDs((const char*)appid.c_str(), pids);
485 * @brief get launched apprication pid
486 * @param appid target application appid
489 const CicoAulItems* CicoHSLifeCycleController::findAUL(int pid)
491 ICO_TRA("start %d", pid);
492 const CicoAulItems* r = NULL;
493 int sz = m_aul.size();
494 for (int i = 0; i < sz; i++) {
495 CicoAulItems* t = (CicoAulItems*)m_aul[i].p();
496 if (t->m_pid == pid) {
499 ICO_DBG("find %d -> %s", pid, t->m_appid.c_str());
500 break; // break of for
503 ICO_TRA("end %x", r);
509 * @brief ail information data initialization
511 void CicoHSLifeCycleController::initAIL()
513 ICO_TRA("start %x", m_pc);
515 if ((pkgmgr_client*)NULL == m_pc) {
516 m_pc = pkgmgr_client_new(PC_LISTENING);
517 int r = pkgmgr_client_listen_status(m_pc, CSCLCCpkgmgr_handler,
519 ICO_TRA("pkgmgr_xxxx %x, %d", m_pc, r);
520 // if (PKGMGR_R_OK != r)
521 // pkgmgr_client_listen_status return is
522 // request_id (>0) if success, error code(<0) if fail
523 // PKGMGR_R_OK success (PKGMGR_R_OK is 0)
525 pkgmgr_client_free(m_pc);
529 ICO_TRA("end %x", m_pc);
535 int CSCLCCpkgmgr_handlerX(int req_id, const char *pkg_type, const char *pkg_name,
536 const char *key, const char *val, const void *pmsg,
537 CicoHSLifeCycleController* x)
540 ICO_TRA("pkgmgr t:%s, n:%s, k:%s, v:%s, m:%s",pkg_type, pkg_name, key,
542 if ((NULL == x) || (0 == x)) {
543 ICO_TRA("end user data none");
546 if (strcasecmp(key, "end") == 0) {
547 if (strcasecmp(val, "ok") == 0) {
557 * @brief AIL list renew
559 void CicoHSLifeCycleController::renewAIL()
561 vector<CicoAilItems> old = m_ail;
564 while (false == createAilItems()) {
574 ICO_TRA("error AIL I/F");
578 vector<string> add_appid;
579 vector<string> remove_appid;
581 vector<CicoAulItems>::iterator it_n;
582 vector<CicoAulItems>::iterator it_o;
583 for(it_n = m_aul.begin(); it_n != m_aul.end(); ++it_n) {
585 for(it_o = old.begin(); it_o != old.end(); ++it_o) {
586 if (it_n->m_appid.compaire(it_o->m_appid)) {
590 if (false == bingo) {
591 add_appid.push_back(it_n->m_appid);
594 for(it_o = old.begin(); it_o != old.end(); ++it_o) {
596 for(it_n = m_aul.begin(); it_n != m_aul.end(); ++it_n) {
597 if (it_o->m_appid.compaire(it_n->m_appid)) {
601 if (false == bingo) {
602 remove_appid.push_back(it_o->m_appid);
606 if (0 != add_appid.size()) {
609 if (0 != remove_appid.size()) {
610 // TODO mk_k uninstall
619 * @brief ail_filter_list_appinfo_foreach callback function
620 * @param appinfo appinfo_h the appinfo's handle
621 * @param x CicoHSLifeCycleController class pointer
622 * @retval AIL_CB_RET_CONTINUE return if you continue iteration
623 * @retval AIL_CB_RET_CANCEL return if you cancel iteration
626 ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
627 CicoHSLifeCycleController* x)
630 if ((NULL == x) || (0 == x)) {
631 ICO_TRA("end bad end")
632 return AIL_CB_RET_CANCEL;
641 /* get package name for appid */
642 ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg);
643 if (strcmp(pkg, APP_CONF_AIL_NULL_STR) == 0) {
647 ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icn);
648 if (strcmp(icn, APP_CONF_AIL_NULL_STR) == 0) {
651 else if (icn != NULL) {
654 memset(&buff, 0, sizeof(buff));
655 if (stat(icn, &buff) == 0) {
656 if (S_ISDIR(buff.st_mode)) {
658 ICO_DBG("%s is directory", icn);
668 ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &nm);
669 if (strcmp(nm, APP_CONF_AIL_NULL_STR) == 0) {
673 ail_appinfo_get_str(appinfo, AIL_PROP_CATEGORIES_STR, &ctgry);
674 if (strcmp(ctgry, APP_CONF_AIL_NULL_STR) == 0) {
678 ail_appinfo_get_str(appinfo, AIL_PROP_TYPE_STR, &typ);
679 if (strcmp(typ, APP_CONF_AIL_NULL_STR) == 0) {
683 ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &exe);
684 if (strcmp(exe, APP_CONF_AIL_NULL_STR) == 0) {
687 ail_appinfo_get_bool(appinfo, AIL_PROP_NODISPLAY_BOOL, &bndsp);
688 ICO_DBG("pkg:%s icn:%s nm:%s ctg:%s ty:%s exe:%s ds:%s", pkg? pkg:DNil,
689 icn? icn:DNil, nm? nm:DNil, ctgry? ctgry:DNil, typ? typ:DNil,
690 exe? exe:DNil, bndsp? "true":"false");
691 if (false == x->addAIL(pkg, icn, nm, ctgry, typ, exe, bndsp)) {
692 ICO_TRA("end bad end")
693 return AIL_CB_RET_CANCEL;
696 return AIL_CB_RET_CONTINUE;
700 * @brief create information ail data
701 * @retval true success
702 * @retval false fail create
704 bool CicoHSLifeCycleController::createAilItems()
707 m_ail.clear(); // clear items
708 if (NULL == m_gconf) {
709 m_gconf = g_key_file_new();
710 GString* gsfp = g_string_new("xx");
711 CicoSystemConfig* CSCSC = CicoSystemConfig::getInstance();
712 g_string_printf(gsfp, "%s/%s", CSCSC->getDefaultConf()->confdir.c_str(),
713 ICO_SYC_CONFIG_APPATTR);
716 flg = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
717 if (!g_key_file_load_from_file(m_gconf, gsfp->str, (GKeyFileFlags)flg, &gerr)) {
718 ICO_ERR("load error conf:%s %s", (char*)gsfp->str, gerr->message);
719 g_key_file_free(m_gconf);
721 g_string_free(gsfp, TRUE);
724 g_string_free(gsfp, TRUE);
729 ail_filter_new(&fil);
730 r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_Menu);
731 r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
733 ail_filter_destroy(fil);
734 if (r != AIL_ERROR_OK) {
736 g_key_file_free(m_gconf);
739 ICO_TRA("end menu read NG(AIL)=%d", r);
743 ail_filter_new(&fil);
744 r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_App);
745 r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
747 ail_filter_destroy(fil);
748 if (r != AIL_ERROR_OK) {
750 g_key_file_free(m_gconf);
753 ICO_TRA("end Application read NG(AIL)=%d", r);
757 g_key_file_free(m_gconf);
765 * @brief ail information data add one item
766 * @param sPkg string package (appid)
767 * @param sIco string icon full path
768 * @param sNm string name
769 * @param sCtg string categoies
770 * @param sTyp string type
771 * @param sExe string exec name
772 * @param bndsp bool nodisplay value
773 * @return method status
774 * @retval true success added item
775 * @retval false fail added item
777 bool CicoHSLifeCycleController::addAIL(const char* sPkg, const char* sIco,
778 const char* sNm, const char* sCtg,
779 const char* sTyp, const char* sExe,
783 getCategory(sPkg, sNm, sCtg, category);
784 CicoAilItems CSCAI(sPkg, sIco, sNm, sCtg, sTyp, sExe, category, bndsp);
785 m_ail.push_back(CSCAI);
790 * @brief get category data
791 * @param sPkg ail package(appid) (get key)
792 * @param sNm ail name (get key)
793 * @param sCtg ail categories (get key)
794 * @param category read config file category string define
796 void CicoHSLifeCycleController::getCategory(const char* sPkg, const char* sNm,
798 std::string& category)
808 /* get default category of this application */
811 appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, sPkg, &gerr);
816 g_clear_error(&gerr);
818 appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, sNm, &gerr);
825 g_clear_error(&gerr);
828 for (int i = 1;; i++) {
829 strncpy(&addCtgry[addCtgryLen],
830 appCtgry, sizeof(addCtgry)-addCtgryLen-2);
831 addCtgry[sizeof(addCtgry)-2] = 0;
832 addCtgryLen = strlen(addCtgry);
833 if (addCtgryLen > 0) {
834 if (addCtgry[addCtgryLen-1] != ';') {
835 strcpy(&addCtgry[addCtgryLen++], ";");
838 snprintf(work, sizeof(work)-1, "%s.%d",
839 appCtgryType == 0 ? sPkg : sNm, i);
841 appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, work, &gerr);
843 g_clear_error(&gerr);
848 g_clear_error(&gerr);
852 strncpy(&addCtgry[addCtgryLen], sCtg, sizeof(addCtgry)-addCtgryLen-1);
853 addCtgry[sizeof(addCtgry)-1] = 0;
856 category.assign(addCtgry);
861 * @brief aul information data initialization
863 void CicoHSLifeCycleController::initAUL()
866 aul_listen_app_launch_signal_add(CSCLCCapp_launch_handler, (void*)this);
867 aul_listen_app_dead_signal_add(CSCLCCapp_dead_handler, (void*)this);
874 void CicoHSLifeCycleController::enterAUL(const char* appid, int pid,
875 const CicoSCWindow* obj, int aulstt)
878 bool bPushBack = true;
879 int sz = m_aul.size();
880 for (int i = 0; i < sz; i++) {
881 CicoAulItems* t = (CicoAulItems*)m_aul[i].p();
882 if (t->m_pid == pid) {
883 bPushBack = false; // push_back flag off
885 // Do not replace to NULL
886 ICO_DBG("Do not replace to NULL %d", t->m_CSCWptrs.size());
887 break; // break of for
890 ICO_DBG("add window info. %d, %x", t->m_CSCWptrs.size(), obj);
892 break; // break of for
896 if (true == bPushBack) { // push back flag on?
897 // AUL list Unregistered
898 ICO_DBG("push_back(AUL(%s, %d, %d, %x))", appid, pid, aulstt, obj);
899 int ctgry = DINITm_categoryID;
900 const CicoAilItems* ailObj = findAIL(appid);
901 if ((NULL != ailObj) && (0 != ailObj)) {
902 ctgry = ailObj->m_categoryID;
904 m_aul.push_back(CicoAulItems(appid, pid, ctgry, aulstt, obj));
912 bool CicoHSLifeCycleController::removeAUL(int pid)
914 ICO_TRA("start %d", pid);
916 vector<CicoAulItems>::iterator it;
917 for(it = m_aul.begin(); it != m_aul.end(); ++it) {
918 if (pid == it->m_pid) {
919 ICO_DBG("erase appid=%s", it->m_appid.c_str());
925 ICO_TRA("end %s", r? "true":"false");
931 * @param x CicoHSLifeCycleController class pointer
933 int CSCLCCapp_launch_handlerX(int pid, CicoHSLifeCycleController* x)
935 ICO_TRA("start %d, %x", pid, x);
936 if ((NULL == x) || (0 == x)) {
937 ICO_TRA("end fail(user data is NULL)");
941 memset(appid, 0, sizeof(appid));
942 int iR = Xaul_app_get_appid_bypid(pid, appid, sizeof(appid));
943 ICO_PRF("CHG_APP_STA notice app=%s, pid=%d, rval=%d", appid, pid, iR);
944 x->enterAUL(appid, pid, NULL, iR);
945 ICO_TRA("end success(%d, %s)", pid, appid);
950 * @brief applications die. callback function
952 * @param data user data
953 * @param x CicoHSLifeCycleController class pointer
955 int CSCLCCapp_dead_handlerX(int pid, CicoHSLifeCycleController* x)
958 if ((NULL == x) || (0 == x)) {
959 ICO_TRA("end user data is NULL");
962 if (false == x->removeAUL(pid)) {
963 ICO_TRA("end dead %d fail", pid);
966 ICO_TRA("end dead %d success", pid);
971 * @brief AUL information list
972 * @return AUL information item list Container
974 const vector<CicoAulItems>& CicoHSLifeCycleController::getAulList()
976 int sz = m_aul.size();
977 for (int i = 0; i < sz; i++) {
978 CicoAulItems* t = (CicoAulItems*)m_aul[i].p();
983 // vim: set expandtab ts=4 sw=4: