Fix alarm conditional app launch bug
authordavid_kim31 <david_kim31@samsung.com>
Wed, 27 Mar 2013 00:44:48 +0000 (09:44 +0900)
committerdavid_kim31 <david_kim31@samsung.com>
Wed, 27 Mar 2013 00:44:48 +0000 (09:44 +0900)
Change-Id: Ide1414a20f2080c466a1546173087f9108f6cd26
Signed-off-by: david_kim31 <david_kim31@samsung.com>
src/app/FApp_AppImpl.cpp
src/app/FApp_ServiceAppImpl.cpp
src/system/FSys_AlarmManager.cpp

index 32a13af..a6179bf 100644 (file)
@@ -336,7 +336,7 @@ _AppImpl::OnService(service_s* service, void* user_data)
                int errVal = service_get_operation(service, &pBuf);
                pOperation.reset(pBuf);
 
-               if((errVal == SERVICE_ERROR_NONE) && (!strcmp((const char*)pOperation.get(), "osp.appsvc.operation.ALARM")))
+               if((errVal == SERVICE_ERROR_NONE) && (!strcmp((const char*)pOperation.get(), "osp.operation.ALARM")))
                {
                        std::unique_ptr<char[], charDeleter> pAlarmId(null);
                        char* pBuf = null;
index 29fd2c2..da9267b 100755 (executable)
@@ -40,6 +40,7 @@ using namespace Tizen::App::Package;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Runtime;
+using namespace Tizen::System;
 
 const wchar_t USE_UI_KEY[] = L"UseUi";
 const wchar_t USE_UI_VAL_TRUE[] = L"True";
@@ -49,6 +50,9 @@ static const RequestId  HANDLER_REQUEST_ALARMID = 2;
 namespace Tizen { namespace App
 {
 
+static const wchar_t* ALARM_PLUGIN_LIBRARY_PATH = L"/opt/apps/aospd00043/lib/libosp-cond-alarm.so";
+typedef void (*OnAlarmForLaunch)(int alarmId);
+
 _ServiceAppImpl* _ServiceAppImpl::__pServiceAppImpl = null;
 
 
@@ -84,21 +88,41 @@ _ServiceAppImpl::OnService(service_s* service, bool initial)
        SysLog(NID_APP, "Service requested.");
        char* pOperation = NULL;
        int errVal = service_get_operation(service, &pOperation);
+       result r = E_SUCCESS;
 
        if ( (errVal == SERVICE_ERROR_NONE) && (!strcmp(pOperation, "osp.appsvc.operation.ALARM")) )
        {
                char* pAlarmId = NULL;
 
-
                errVal = service_get_extra_data(service, SERVICE_DATA_ALARM_ID, &pAlarmId);
                if (errVal == SERVICE_ERROR_NONE)
                {
-                       //int alarmId = atoi(pAlarmId);
+                       int alarmId = atoi(pAlarmId);
+
+                       SysLog(NID_SYS, "Start to load external lib");
+                       Library lib;
+                       OnAlarmForLaunch pOnAlarmForLaunch = null;
+                       r = lib.Construct(ALARM_PLUGIN_LIBRARY_PATH);
 
-                       String* pAlarmStr = new (std::nothrow) String(pAlarmId);
-                       ArrayList alarmArg;
-                       alarmArg.Add(*pAlarmStr);
-                       __pServiceApp->OnUserEventReceivedN(HANDLER_REQUEST_ALARMID, &alarmArg);
+                       if(r == E_SUCCESS)
+                       {
+                               SysLog(NID_SYS, "Open alarm condition library");
+                               pOnAlarmForLaunch = (OnAlarmForLaunch)lib.GetProcAddress(L"OnAlarmForLaunch");
+                               if(pOnAlarmForLaunch != null)
+                               {
+                                       SysLog(NID_SYS, "Function is found");
+                                       pOnAlarmForLaunch(alarmId);
+                                       SysLog(NID_SYS, "Requested to check current alarm id to AlarmConditionHandler %d", alarmId);
+                               }
+                               else
+                               {
+                                       SysLog(NID_SYS, "Fail to find alarm function");
+                               }
+                       }
+                       else
+                       {
+                               SysLog(NID_SYS, "Fail to open alarm condition library");
+                       }
                }
 
                if (pAlarmId)
index e7ac796..a06363e 100644 (file)
@@ -106,7 +106,7 @@ _AlarmManager::ReserveAlarm(Tizen::Base::String appId, Tizen::Base::DateTime sta
        pBundle = bundle_create();
        SysTryCatch(NID_SYS, pBundle != null, r = E_SYSTEM, r, "It is failed to create bundle");
 
-       ret = appsvc_set_operation(pBundle,"osp.appsvc.operation.ALARM");
+       ret = appsvc_set_operation(pBundle,"osp.operation.ALARM");
        SysTryCatch(NID_SYS, ret == SERVICE_ERROR_NONE, r = E_SYSTEM, r, "It is failed to set operation");
 
        ret = appsvc_set_appid(pBundle, (const char*)(pId.get()));