From: wang_zhiqiang Date: Mon, 20 May 2019 02:40:21 +0000 (+0800) Subject: fix handshake bug X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;ds=sidebyside;h=e24c504de6e4e98d500c6587bede79c7c93c84c2;p=apps%2Fagl-service-homescreen.git fix handshake bug Change-Id: I28af770a9f8d5ac63209038ca5939a2aab0bc318 --- diff --git a/conf/lastmode.json b/conf/lastmode.json index 3d57f46..68ea81f 100644 --- a/conf/lastmode.json +++ b/conf/lastmode.json @@ -1,7 +1,6 @@ [ { "appid": "phone", - "visibility": "visible", - "after": "homescreen" + "visibility": "visible" } ] \ No newline at end of file diff --git a/src/homescreen.cpp b/src/homescreen.cpp index 7457f88..d63d5aa 100644 --- a/src/homescreen.cpp +++ b/src/homescreen.cpp @@ -73,6 +73,9 @@ int hs_handshake::hs_sts = hs_handshake::Handshake_Idle; void handshake_subscribe_callback(struct json_object *obj, const char *error, const char *info) { AFB_NOTICE("subscribe handshake reply: obj=%s, error=%s, info=%s", json_object_to_json_string(obj), error, info); + if(hs_handshake::hs_sts == hs_handshake::Handshake_Over) { + return; + } if(error == nullptr) { hs_handshake::hs_sts = hs_handshake::Handshake_WaitEvent; } diff --git a/src/hs-clientmanager.cpp b/src/hs-clientmanager.cpp index 86e1f28..3585bea 100644 --- a/src/hs-clientmanager.cpp +++ b/src/hs-clientmanager.cpp @@ -255,7 +255,7 @@ int HS_ClientManager::pushEvent(const char *event, struct json_object *param, st void HS_ClientManager::checkRegisterApp(afb_api_t api, const std::string &appid) { if(HS_AppRecover::instance()->registerRecoveredApp(api, appid)) { - AFB_INFO("register recover application."); + AFB_INFO("register recover application %s.", appid.c_str()); return; } diff --git a/src/hs-config.cpp b/src/hs-config.cpp index df45e42..a227d30 100644 --- a/src/hs-config.cpp +++ b/src/hs-config.cpp @@ -105,6 +105,11 @@ int HS_Config::parseConfig(void) if(json_object_get_type(m_lastmode) == json_type_array ) { struct std::vector v_lastmode = std::move(getRecoverAppInfo(m_lastmode)); if(!v_lastmode.empty()) { // got saving lastmode isn't null, instead of default lastmode + for(auto &it : v_lastmode) { + if(it.after.empty() && !m_recover_map[keys_recover_type[1]].empty()) { + it.after = m_recover_map[keys_recover_type[1]][0].after; + } + } m_recover_map[keys_recover_type[1]] = std::move(v_lastmode); } }