From befeeca1cdc6a1a555d0fa31cd8f0e24b319d074 Mon Sep 17 00:00:00 2001 From: david_kim31 Date: Wed, 27 Mar 2013 09:44:48 +0900 Subject: [PATCH] Fix alarm conditional app launch bug Change-Id: Ide1414a20f2080c466a1546173087f9108f6cd26 Signed-off-by: david_kim31 --- src/app/FApp_AppImpl.cpp | 2 +- src/app/FApp_ServiceAppImpl.cpp | 36 ++++++++++++++++++++++++++++++------ src/system/FSys_AlarmManager.cpp | 2 +- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/app/FApp_AppImpl.cpp b/src/app/FApp_AppImpl.cpp index 32a13af..a6179bf 100644 --- a/src/app/FApp_AppImpl.cpp +++ b/src/app/FApp_AppImpl.cpp @@ -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 pAlarmId(null); char* pBuf = null; diff --git a/src/app/FApp_ServiceAppImpl.cpp b/src/app/FApp_ServiceAppImpl.cpp index 29fd2c2..da9267b 100755 --- a/src/app/FApp_ServiceAppImpl.cpp +++ b/src/app/FApp_ServiceAppImpl.cpp @@ -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) diff --git a/src/system/FSys_AlarmManager.cpp b/src/system/FSys_AlarmManager.cpp index e7ac796..a06363e 100644 --- a/src/system/FSys_AlarmManager.cpp +++ b/src/system/FSys_AlarmManager.cpp @@ -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())); -- 2.7.4