aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2019-05-24 14:28:18 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2019-05-24 14:28:18 +0800
commit11fdeef6122c86f21f7fab72fa8cdb99ef5d68b5 (patch)
treec70ee2a8aba5cab752e69647ec07000b127d1df8
parente24c504de6e4e98d500c6587bede79c7c93c84c2 (diff)
improvement
Change-Id: I654800d1d467ff1d5b858dc048bb4271485fb46a
-rw-r--r--src/hs-apprecover.cpp18
-rw-r--r--src/hs-config.cpp2
2 files changed, 12 insertions, 8 deletions
diff --git a/src/hs-apprecover.cpp b/src/hs-apprecover.cpp
index 025b6fb..bd34eda 100644
--- a/src/hs-apprecover.cpp
+++ b/src/hs-apprecover.cpp
@@ -92,14 +92,13 @@ void HS_AppRecover::startRecovery(afb_api_t api, recover_map &map)
{
for(auto &key : HS_Config::keys_recover_type) {
for(auto &m : map[key]){
- struct app_recover_info recover_info;
- recover_info.recover_type = key;
- recover_info.visibility = m.visibility;
- recover_info.after = m.after;
+ struct app_recover_info recover_info = {
+ .recover_type = key,
+ .visibility = m.visibility,
+ .after = m.after
+ };
m_recover_apps_list[m.appid] = std::move(recover_info);
- if(key == HS_Config::keys_recover_type[1]) {
- m_lastmode_list.insert(m.appid);
- }
+
// recover application
auto it = m_recovering_set.find(m.appid);
if(it == m_recovering_set.end()) {
@@ -176,6 +175,11 @@ bool HS_AppRecover::registerRecoveredApp(afb_api_t api, const std::string &appid
*/
void HS_AppRecover::screenUpdated(struct json_object *obj)
{
+ if(m_lastmode_list.empty()) {
+ AFB_NOTICE("init lastmode is null, so don't record lastmode.");
+ return;
+ }
+
std::set<std::string> s_mode;
struct json_object *ids_obj;
if(json_object_object_get_ex(obj, key_ids.c_str(), &ids_obj)) {
diff --git a/src/hs-config.cpp b/src/hs-config.cpp
index a227d30..f043d46 100644
--- a/src/hs-config.cpp
+++ b/src/hs-config.cpp
@@ -49,7 +49,7 @@ int HS_Config::readConfig(void)
path = root_dir + "/etc/" + lastmode_json;
if(readJsonFile(path.c_str(), &m_lastmode) < 0) {
- AFB_ERROR("read %s failed.", lastmode_json.c_str());
+ AFB_WARNING("read %s failed.", lastmode_json.c_str());
m_lastmode = nullptr;
}