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
9 #ifndef CICOSCLIFECYCLECONTROLLER_H
10 #define CICOSCLIFECYCLECONTROLLER_H
16 #include <package-manager.h>
18 #include "CicoAilItems.h"
19 #include "CicoAulItems.h"
22 #ifndef __CICO_SC_WINDOW_H__
27 #ifndef CICOSCSYSRESOURCECONTROLLER_H
28 class CicoSCSysResourceController;
31 #ifndef CICOSCAPPRESOURCECONTROLLER_H
32 class CicoSCAppResourceController;
36 class CicoSCLifeCycleController {
38 CicoSCLifeCycleController();
39 ~CicoSCLifeCycleController();
41 static CicoSCLifeCycleController* getInstance(void);
43 // Starting application
44 int launch(const char* appid, bundle* b = NULL);
45 int launch(const std::string& appid, bundle* b = NULL);
46 // Stopping application
47 int terminate(const char* appid);
48 int terminate(const std::string& appid);
49 int terminate(int pid);
50 // suspend application
51 int suspend(const char* appid);
52 int suspend(const std::string& appid);
54 // run application check
55 bool isRunning(const char* appid);
56 bool isRunning(const std::string& appid);
58 const std::vector<CicoAilItems>& getAilList() const;
59 const CicoAilItems* findAIL(const char* appid) const;
60 const CicoAilItems* findAIL(const std::string& appid) const;
61 bool isAilRenew() const;
62 void ailRenewFlagOff();
64 const std::vector<CicoAulItems>& getAulList();
65 // TODO mk_k Should I think about the multiple return values start
67 const CicoAulItems* findAUL(const char* appid) const;
68 const CicoAulItems* findAUL(const std::string& appid) const;
70 const CicoAulItems* findAUL(int pid);
71 bool getPIDs(const char* appid, std::vector<int>& pids) const;
72 bool getPIDs(std::string& appid, std::vector<int>& pids) const;
73 void enterAUL(const char* appid, int pid, const CicoSCWindow* obj = NULL,
74 int aulstt = AUL_R_OK);
76 bool isAppResource() const;
77 bool startAppResource(const std::string& name);
78 void createAppResourceFile(const std::string& user);
81 friend ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
82 CicoSCLifeCycleController* x, uid_t uid);
83 bool createAilItems();
86 int CSCLCCpkgmgr_handlerX(int req_id, const char *pkg_type,
87 const char *pkg_name, const char *key,
88 const char *val, const void *pmsg,
89 CicoSCLifeCycleController *x);
91 void ailRenewFlagOn();
93 friend int CSCLCCapp_launch_handlerX(int pid,
94 CicoSCLifeCycleController *x);
95 friend int CSCLCCapp_dead_handlerX(int pid, CicoSCLifeCycleController *x);
97 int terminateR(int pid);
98 void getCategory(const char* sPkg, const char* sNm, const char* sCtg,
99 std::string& category);
100 bool addAIL(const char* sPkg, const char* sIco, const char* sNm,
101 const char* sCtg, const char* sTyp, const char* sExe,
103 bool removeAUL(int pid);
105 static CicoSCLifeCycleController* ms_myInstance;
108 std::vector<CicoAilItems> m_ail;
109 std::vector<CicoAulItems> m_aul;
113 CicoSCSysResourceController* m_RC;
115 CicoSCAppResourceController* m_RC;
121 * @brief AIL infomaton list
122 * @return AIL information item list Container
125 const std::vector<CicoAilItems>& CicoSCLifeCycleController::getAilList() const
132 * @brief AIL change flag is on?
134 * @retval true change flag on
135 * @retval false change flag off
137 inline bool CicoSCLifeCycleController::isAilRenew() const
143 * @brief AIL change flag off set
145 inline void CicoSCLifeCycleController::ailRenewFlagOff()
151 * @brief AIL change flag on set
153 inline void CicoSCLifeCycleController::ailRenewFlagOn()
158 #endif // CICOSCLIFECYCLECONTROLLER_H