fix appcontrol result behavior from service callee
[platform/framework/native/appfw.git] / src / app / FApp_AppImpl.cpp
index bfa3875..8dd78e2 100644 (file)
@@ -140,7 +140,6 @@ _AppImpl::Construct(const IList* pArgs)
        return E_SUCCESS;
 }
 
-
 result
 _AppImpl::Execute(_IAppImpl* pIAppImpl)
 {
@@ -237,7 +236,7 @@ _AppImpl::OnCreate(void* user_data)
 
        if (pAppManager != null)
        {
-               result r = pAppManager->RegisterApplication(_AppInfo::GetPackageId(), _AppInfo::GetAppExecutableName(), static_cast<_AppType>(_AppInfo::GetAppType()), _AppInfo::GetProcessId());
+               result r = pAppManager->RegisterApplication(_AppInfo::GetApplicationId(), static_cast<_AppType>(_AppInfo::GetAppType()), _AppInfo::GetProcessId());
                SysTryLog(NID_APP, !IsFailed(r), "[%s] Application registration failed.", GetErrorMessage(r));
        }
        SysLogTag(NID_APP, "LAUNCH","[%ls:<RegisterApplication>:done]", _AppInfo::GetAppExecutableName().GetPointer());
@@ -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;