- if(0 != ProcPreference::getPreference().get(msg.first, curState)){
- LOGE("%sProcPreference not found =%d",__func__,msg.first);
- return;
- }
- auto config = ConfigurationImpl::getInstance();
- std::vector<std::string> processes;
- if((msg.first != FG_SM) && (config->getProcess(static_cast<FG_TYPE>(msg.first), processes) != 0)){
- LOGE("can not find process info,fg=%d,process size=%d",msg.first,processes.size());
- return;
- }
- switch(curState.state){
- case EMStateBase::INVALID:{
- if(msg.second == EMStateBase::IDLE){
- std::string lunch;
- if(msg.first == FG_SM){
- //lunch = "SM&";printf("=== %d:\n",__LINE__);
- lunch = "on -T SM_t -u SM_u SM&";std::cout << " +sm lunch: " << lunch << std::endl;
- }else{
- //get corresponding process
- if(processes.front() == std::string("LogService")) {
- (void)system("setfacl -m user:LogService_u:rw /var/qlog/");
- }
- lunch = std::string("on -T ") + processes.front() + std::string("_t -u ") + processes.front() + std::string("_u ") + processes.front() + std::string("&");
- std::cout << " + lunch: " << lunch << std::endl;
- }
- //fork process
- LOGE("lunch process=%s ",lunch.c_str());
- (void)system(lunch.c_str());printf("=== %d:\n",__LINE__);
- //if((-1 != result) && (WIFEXITED(result)) && (!(WEXITSTATUS(result))))
- MonitorItem item;
- item.setTimeMS(1000);
- item.setMonitorItem(msg.first, EMStateBase::INVALID, EMStateBase::IDLE);
- }else{
- LOGE("%s current state=%d,expected state=%d",__func__,curState.state,msg.second);
- }
- }break;
|