fix bug
[apps/agl-service-homescreen.git] / src / hs-apprecover.cpp
index 5ccd039..c2464b1 100644 (file)
@@ -71,9 +71,9 @@ HS_AppRecover* HS_AppRecover::instance(void)
  */
 int HS_AppRecover::init(afb_api_t api)
 {
+    setEventHook("windowmanager/screenUpdated", on_screen_update_event);
     HS_WmProxy wm_proxy;
     wm_proxy.subscribe(api, HS_WmProxy::Event_ScreenUpdated);
-    setEventHook("windowmanager/screenUpdated", on_screen_update_event);
     return 0;
 }
 
@@ -102,8 +102,11 @@ void HS_AppRecover::startRecovery(afb_api_t api, recover_map &map)
             }
 
             // recover application
-            m_recovering_set.insert(m.appid);
-            afm_proxy.start(api,  HS_AppInfo::instance()->getAppProperty(m.appid, _keyId));
+            auto it = m_recovering_set.find(m.appid);
+            if(it == m_recovering_set.end()) {
+                m_recovering_set.insert(m.appid);
+                afm_proxy.start(api,  HS_AppInfo::instance()->getAppProperty(m.appid, _keyId));
+            }
         }
     }
 }
@@ -126,6 +129,7 @@ bool HS_AppRecover::registerRecoveredApp(const std::string &appid)
         return ret;
     }
 
+    AFB_INFO("recover appid=[%s].", appid.c_str());
     auto it = m_recovering_set.find(appid);
     if(it != m_recovering_set.end()) {
         m_recovering_set.erase(appid);