Merge "remove badge dependency for legacy NotificationManager" into tizen_2.2
[platform/framework/native/appfw.git] / src / app / FApp_Aul.cpp
index 391773c..d5cf730 100644 (file)
@@ -29,7 +29,7 @@
 #include <aul.h>
 #include <bundle.h>
 #include <appsvc/appsvc.h>
-#include <heynoti.h>
+#include <vconf.h>
 
 #include <FBaseObject.h>
 #include <FBaseString.h>
@@ -114,7 +114,7 @@ _Aul::GetConvertedResult(const int aul_ret, const char* pFunctionName)
 }
 
 result
-_Aul::SendResult(bundle* b, appsvc_result_val res, bool isSubMode)
+_Aul::SendResult(bundle* b, appsvc_result_val res, bool isSubMode, bool isServiceApp)
 {
        // to skip error handling, of appsvc_send_result, use aul_send_service_result() directly.
        //int ret = appsvc_send_result(b, res);
@@ -128,6 +128,11 @@ _Aul::SendResult(bundle* b, appsvc_result_val res, bool isSubMode)
                _AppArg::UpdateSubMode(b);
        }
 
+       if (isServiceApp)
+       {
+               _AppArg::UpdateServiceApp(b);
+       }
+
        const int aul_ret = aul_send_service_result(b);
 
        result r = GetConvertedResult(aul_ret, "SendResult");
@@ -203,9 +208,16 @@ _Aul::SetOomAdj(int pid, int adj)
        return r;
 }
 
+typedef void (* cbForVconf)(keynode_t* node, void *pData);
+
 result
-_Aul::SetPowerOffNotiListener( void (*powerOffCb)(void *pData), void *pData)
+_Aul::SetPowerOffNotiListener( void (*powerOffCb)(void* node, void *pData), void *pData)
 {
+
+#if 1
+       int ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (cbForVconf)powerOffCb, pData);
+       SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "It failed to set power off");
+#else
        int heyFd = heynoti_init();
        SysTryReturnResult(NID_APP, heyFd >= 0, E_SYSTEM, "heynoti_init failed.");
 
@@ -214,6 +226,7 @@ _Aul::SetPowerOffNotiListener( void (*powerOffCb)(void *pData), void *pData)
 
        ret = heynoti_attach_handler(heyFd);
        SysTryReturnResult(NID_APP, ret >= 0, E_SYSTEM, "heynoti_attach_handler failed.");
+#endif
 
        return E_SUCCESS;
 }
@@ -275,7 +288,7 @@ _Aul::GetRealAppId(const AppId& appId)
        String temp;
        // [INFO] ugly code for submode callee
        appId.SubString(11, temp);
-       if (temp == L"_AppControl")
+       if (temp == String(SUBMODE_NAME))
        {
                String id;
                appId.SubString(0, 10, id);