fix AppControl result code for calendar AppControl
authorYoung Ik Cho <youngik.cho@samsung.com>
Thu, 18 Apr 2013 09:52:11 +0000 (18:52 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Thu, 18 Apr 2013 09:52:11 +0000 (18:52 +0900)
Change-Id: I32d6a8354a582170239d3e5b6c6b448fca3828da
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
src/app/FApp_AppControlImpl.cpp
src/app/FApp_AppControlManager.cpp
src/app/inc/FApp_AppControlManager.h

index 086b0fd..93f595a 100755 (executable)
@@ -561,7 +561,6 @@ _AppControlImpl::AppControlCb(void* data, _AppArg* pArg, _AppArg* pResArg, servi
 
        if (prop & _APPCONTROL_PROPERTY_ALIAS)
        {
-               SysLog(NID_APP, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
                const _AppControlRegistry::_AppControlAliasEntry* pEntry = null;
                pEntry = _AppControlRegistry::GetInstance()->GetReverseRuntimeAliasEntry(provider, oId);
                if (pEntry)
@@ -571,7 +570,6 @@ _AppControlImpl::AppControlCb(void* data, _AppArg* pArg, _AppArg* pResArg, servi
 
                        SysLog(NID_APP, "Original AppControl name (%ls, %ls).", provider.GetPointer(), oId.GetPointer());
                }
-               SysLog(NID_APP, "CCCCCCCCCCCCCCCCCCCCCCCCCCCCC 0x%x", pEntry);
        }
 
        if (prop & _APPCONTROL_PROPERTY_APPID_CHANGE)
@@ -587,30 +585,7 @@ _AppControlImpl::AppControlCb(void* data, _AppArg* pArg, _AppArg* pResArg, servi
 
        std::unique_ptr<HashMap> pMap(pResArg->GetArgMapN());
 
-       AppCtrlResult ret = APP_CTRL_RESULT_FAILED;
-       // to prevent enum overflow;
-       int resCode = res;
-       switch(resCode)
-       {
-       case SERVICE_RESULT_SUCCEEDED:
-               ret = APP_CTRL_RESULT_SUCCEEDED;
-               break;
-       case SERVICE_RESULT_FAILED:
-               ret = APP_CTRL_RESULT_CANCELED;
-               break;
-       case SERVICE_RESULT_CANCELED:
-               ret = APP_CTRL_RESULT_ABORTED;
-               break;
-       case APPSVC_OSP_RES_FAIL:
-               ret = APP_CTRL_RESULT_FAILED;
-               break;
-       case APPSVC_OSP_RES_TERMINATE:
-               ret = APP_CTRL_RESULT_TERMINATED;
-               break;
-       default:
-               ret = APP_CTRL_RESULT_FAILED;
-               break;
-       }
+       AppCtrlResult ret = _AppControlManager::ConvertAppControlResultCode(res);
 
        SysLog(NID_APP, "Result code : 0x%x.", ret);
 
index 4742158..deb13b1 100755 (executable)
@@ -252,7 +252,7 @@ _AppControlManager::OnAppControlEventReceivedN(int reqId, const AppId& appId, co
 void
 _AppControlManager::OnAppControlEventReceivedN(int reqId, int res, const IMap* pArgs)
 {
-       SysLog(NID_APP, "Received request Id %d, args 0x%x", reqId, pArgs);
+       SysLog(NID_APP, "Received request Id %d, res %d, args 0x%x", reqId, res, pArgs);
 
        // process proper callback
        _InProcessInfo* pInfo = __inAppManager.FindItem(reqId);
@@ -314,7 +314,7 @@ _AppControlManager::OnAppControlEventReceivedN(int reqId, int res, const IMap* p
                                }
                                else
                                {
-                                       pListener->OnAppControlCompleteResponseReceived(aId, oId, static_cast<AppCtrlResult>(res), pArgs);
+                                       pListener->OnAppControlCompleteResponseReceived(aId, oId, ConvertAppControlResultCode(res), pArgs);
                                        SysLog(NID_APP, "OnAppControlCompleteResponseReceived called directly");
                                }
                        }
@@ -834,7 +834,7 @@ _AppControlManager::LaunchAppImplicit(_AppArg* pArg, int req)
 void
 _AppControlManager::FinishAppControl(int reqId, int res, IMap* pMap)
 {
-       SysLog(NID_APP, "Enter.");
+       SysLog(NID_APP, "req %d, res %d.", reqId, res);
        _NativeAppControlEventArg* pArg = new (std::nothrow) _NativeAppControlEventArg(reqId, res, pMap);
        SysTryReturnVoidResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Return argument allocation failure.");
 
@@ -917,6 +917,38 @@ _AppControlManager::IsAllowedAppControl(const char aTable[][2][96], int count, c
        return false;
 }
 
+
+AppCtrlResult
+_AppControlManager::ConvertAppControlResultCode(int resCode)
+{
+       AppCtrlResult ret = APP_CTRL_RESULT_FAILED;
+
+       switch(resCode)
+       {
+               case SERVICE_RESULT_SUCCEEDED:
+                       ret = APP_CTRL_RESULT_SUCCEEDED;
+                       break;
+               case SERVICE_RESULT_FAILED:
+                       ret = APP_CTRL_RESULT_CANCELED;
+                       break;
+               case SERVICE_RESULT_CANCELED:
+                       ret = APP_CTRL_RESULT_ABORTED;
+                       break;
+               case APPSVC_OSP_RES_FAIL:
+                       ret = APP_CTRL_RESULT_FAILED;
+                       break;
+               case APPSVC_OSP_RES_TERMINATE:
+                       ret = APP_CTRL_RESULT_TERMINATED;
+                       break;
+               default:
+                       ret = APP_CTRL_RESULT_FAILED;
+                       break;
+       }
+
+       return ret;
+}
+
+
 void
 _AppControlManager::OnAppControlResponseEventReceivedN(const Tizen::Base::Runtime::IEventArg* arg)
 {
index 17faf91..422b2f6 100755 (executable)
@@ -282,6 +282,8 @@ public:
        int GetLaunchRequestCount(void);
        virtual void OnAppControlResponseEventReceivedN(const Tizen::Base::Runtime::IEventArg* arg);
 
+       static AppCtrlResult ConvertAppControlResultCode(int res);
+
 private:
        _OSP_LOCAL_ _AppControlManager(void);