X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fhs-apprecover.cpp;h=472a9fc8ebda0b6135822450a5372867c79e97d4;hb=de4ff7944811d8ad7ef0bd95c032df953034bab3;hp=bd34eda3199053a78b91f6c016121dc7b581f636;hpb=11fdeef6122c86f21f7fab72fa8cdb99ef5d68b5;p=apps%2Fagl-service-homescreen.git diff --git a/src/hs-apprecover.cpp b/src/hs-apprecover.cpp index bd34eda..472a9fc 100644 --- a/src/hs-apprecover.cpp +++ b/src/hs-apprecover.cpp @@ -88,10 +88,12 @@ int HS_AppRecover::init(afb_api_t api) * None * */ -void HS_AppRecover::startRecovery(afb_api_t api, recover_map &map) +void HS_AppRecover::startRecovery(afb_api_t api) { + HS_ClientManager::instance()->addListener(this); + for(auto &key : HS_Config::keys_recover_type) { - for(auto &m : map[key]){ + for(auto &m : recover_app_map[key]){ struct app_recover_info recover_info = { .recover_type = key, .visibility = m.visibility, @@ -120,36 +122,32 @@ void HS_AppRecover::startRecovery(afb_api_t api, recover_map &map) } } } + recover_app_map.clear(); } /** - * register started applications + * notify * * #### Parameters - * - appid : application id liked "dashboard" + * - api : the api + * - appid : application id * * #### Return - * false : not recover app - * true : recover app - * + * None + * */ -bool HS_AppRecover::registerRecoveredApp(afb_api_t api, const std::string &appid) +void HS_AppRecover::notify(afb_api_t api, std::string appid) { - bool ret = false; - if(m_recovering_set.empty()) { - return ret; - } - AFB_INFO("recover appid=[%s].", appid.c_str()); auto it = m_recovering_set.find(appid); if(it != m_recovering_set.end()) { + this->removeListenAppId(appid); m_recovering_set.erase(appid); auto ip = m_recover_apps_list.find(appid); if(ip != m_recover_apps_list.end() && ip->second.visibility) { HS_ClientManager::instance()->pushEvent("showWindow", nullptr, appid); } - ret = true; } // check wait recover application @@ -160,7 +158,11 @@ bool HS_AppRecover::registerRecoveredApp(afb_api_t api, const std::string &appid } m_wait_recover_set.erase(appid); } - return ret; + + if(m_recovering_set.empty()) { + clearListenAppSet(); + // HS_ClientManager::instance()->removeListener(this); + } } /** @@ -215,6 +217,7 @@ void HS_AppRecover::screenUpdated(struct json_object *obj) */ void HS_AppRecover::startApplication(afb_api_t api, const std::string &appid) { + this->addListenAppId(appid); HS_AfmMainProxy afm_proxy; afm_proxy.start(api, HS_AppInfo::instance()->getAppProperty(appid, _keyId)); }