fix appcontrol result behavior from service callee
[platform/framework/native/appfw.git] / src / app / FApp_AppImpl.cpp
index 79b0799..8dd78e2 100644 (file)
@@ -140,7 +140,6 @@ _AppImpl::Construct(const IList* pArgs)
        return E_SUCCESS;
 }
 
-
 result
 _AppImpl::Execute(_IAppImpl* pIAppImpl)
 {
@@ -1387,21 +1386,35 @@ _AppImpl::IsTerminationRequested(void)
        return __isTerminationRequested;
 }
 
+typedef void (*cbForVconf)(keynode_t* node, void *pData);
+
 void
-_AppImpl::OnPowerOffNotiReceived(void* user_data)
+_AppImpl::OnPowerOffNotiReceived(void* node, void* user_data)
 {
-       SysLog(NID_APP, "Application is being terminated by power off.");
-
-       _AppImpl* pAppImpl = _AppImpl::GetInstance();
-       if (pAppImpl != null)
+       int value = -1;
+       if (!vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &value))
        {
-               pAppImpl->__forcedTermination = true;
+               if (value == VCONFKEY_SYSMAN_POWER_OFF_DIRECT || value == VCONFKEY_SYSMAN_POWER_OFF_RESTART)
+               {
+                       SysLog(NID_APP, "Application is being terminated by power off.");
+
+                       if (vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (cbForVconf)_AppImpl::OnPowerOffNotiReceived))
+                       {
+                               SysLog(NID_APP, "Fail to ignore vconf for key(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
+                       }
+
+                       _AppImpl* pAppImpl = _AppImpl::GetInstance();
+                       if (pAppImpl != null)
+                       {
+                               pAppImpl->__forcedTermination = true;
+                       }
+
+                       app_efl_exit();
+               }
        }
-       
-       app_efl_exit();
 }
 
-bool 
+bool
 _AppImpl::IsForcedTermination(void)
 {
        return __forcedTermination;