remove redundant IPC calls
authorYoung Ik Cho <youngik.cho@samsung.com>
Thu, 29 Aug 2013 06:54:51 +0000 (15:54 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Thu, 29 Aug 2013 06:54:51 +0000 (15:54 +0900)
Change-Id: I0b23364af761dfd54cbc317f5286ea007814b830
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
src/app/FApp_AppArg.cpp
src/app/FApp_AppImpl.cpp
src/app/FApp_AppManagerProxy.cpp
src/app/inc/FApp_AppManagerIpcMessage.h [changed mode: 0755->0644]
src/app/inc/FApp_AppManagerProxy.h [changed mode: 0755->0644]
src/app/inc/FApp_IAppManager.h
src/system/FSys_SystemTimeImpl.cpp

index 843b47f..46ad3c5 100644 (file)
@@ -1051,21 +1051,10 @@ _AppArg::CreateBundleFromSvc(void* svc)
 bundle*
 _AppArg::GetBundleFromSvc(void* svc)
 {
-       struct DummyS
-       {
-               int dummy1;
-               int dummy2;
-               bundle* pData;
-       };
-
-       DummyS* pDummy = static_cast<DummyS*>(svc);
-
-       if (pDummy && pDummy->pData)
-       {
-               return pDummy->pData;
-       }
+       bundle* pBundle = NULL;
+       int ret = service_to_bundle(static_cast<service_h>(svc), &pBundle);
 
-       return NULL;
+       return (ret == SERVICE_ERROR_NONE) ? pBundle : NULL;
 }
 
 
index bfa3875..79b0799 100644 (file)
@@ -237,7 +237,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());
index eac9cac..1ad7cfb 100755 (executable)
@@ -107,19 +107,6 @@ _AppManagerProxy::SetService(_IAppManager* pAppManager)
 
 
 result
-_AppManagerProxy::LaunchApplication(const AppId& appId, int req)
-{
-       SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
-       SysLog(NID_APP, "");
-
-       std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) AppManager_LaunchApplication(appId, req));
-       result r = __pIpcClient->SendRequest(*pMsg.get());
-       SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
-
-       return E_SUCCESS;
-}
-
-result
 _AppManagerProxy::TerminateApplication(const AppId& appId)
 {
        SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
@@ -133,39 +120,13 @@ _AppManagerProxy::TerminateApplication(const AppId& appId)
        return response;
 }
 
-bool
-_AppManagerProxy::IsRunning(const AppId& appId)
-{
-       bool isRunning = false;
-
-       std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) AppManager_IsRunning(appId, &isRunning));
-       result r = __pIpcClient->SendRequest(*pMsg.get());
-       SysTryReturn(NID_APP, !IsFailed(r), false, r, "SendRequest is failed.");
-
-       return isRunning;
-}
-result
-_AppManagerProxy::GetRunningAppList(Collection::ArrayList* pArray)
-{
-       SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
-
-       SysLog(NID_APP, "");
-
-       result response = E_SUCCESS;
-       std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) AppManager_GetRunningAppList(pArray, &response));
-       result r = __pIpcClient->SendRequest(*pMsg.get());
-       SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
-
-       return response;
-}
-
 result
-_AppManagerProxy::RegisterApplication(const String& packageId, const String& executableName, _AppType appType, int pId)
+_AppManagerProxy::RegisterApplication(const AppId& appId, _AppType appType, int pId)
 {
        SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
        SysLog(NID_APP, "");
 
-       std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) AppManager_RegisterApplication(packageId, executableName, static_cast<int>(appType), pId));
+       std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) AppManager_RegisterApplication(appId, static_cast<int>(appType), pId));
        result r = __pIpcClient->SendRequest(*pMsg.get());
        SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
 
old mode 100755 (executable)
new mode 100644 (file)
index de90495..accb4e2
 
 #define IPC_MESSAGE_START AppManagerServiceStart
 
-IPC_MESSAGE_CONTROL2(AppManager_LaunchApplication, Tizen::App::AppId, int)
 IPC_SYNC_MESSAGE_CONTROL1_1(AppManager_TerminateApplication, Tizen::App::AppId, result)
-IPC_SYNC_MESSAGE_CONTROL1_1(AppManager_IsRunning, Tizen::App::AppId, bool)
 IPC_SYNC_MESSAGE_CONTROL1_2(AppManager_IsUserPreferredAppForAppControlResolution, Tizen::App::AppId, bool, result)
 IPC_SYNC_MESSAGE_CONTROL1_1(AppManager_ClearUserPreferenceForAppControlResolution, Tizen::App::AppId, result)
-IPC_SYNC_MESSAGE_CONTROL0_2(AppManager_GetRunningAppList, Tizen::Base::Collection::ArrayList, result)
-IPC_MESSAGE_CONTROL4(AppManager_RegisterApplication, Tizen::App::AppId, Tizen::Base::String, int, int)
+IPC_MESSAGE_CONTROL3(AppManager_RegisterApplication, Tizen::App::AppId, int, int)
 IPC_MESSAGE_CONTROL1(AppManager_UnregisterApplication, int)
 IPC_MESSAGE_CONTROL1(AppManager_OnEventReceived, Tizen::App::_AppManagerEventArg)
 IPC_MESSAGE_CONTROL1(AppManager_AddEventListener, int)
old mode 100755 (executable)
new mode 100644 (file)
index 1cccff8..9aff035
@@ -51,22 +51,16 @@ class _OSP_EXPORT_ _AppManagerProxy
 public:
        virtual ~_AppManagerProxy(void);
 
-       virtual result LaunchApplication(const AppId& appId, int req);
-
        virtual result TerminateApplication(const AppId& appId);
 
-       virtual bool IsRunning(const AppId& appId);
-
-       virtual result GetRunningAppList(Tizen::Base::Collection::ArrayList* pList);
-
        // for platform
        virtual result InitEventListener(_IAppManagerServiceEventListener* pListener);
 
-       virtual result AddEventListener(int clientId );
+       virtual result AddEventListener(int clientId);
 
-       virtual result RemoveEventListener(int clientId );
+       virtual result RemoveEventListener(int clientId);
 
-       virtual result RegisterApplication(const Tizen::Base::String& packageId, const Tizen::Base::String& executableName, _AppType appType, int pid);
+       virtual result RegisterApplication(const AppId& appId, _AppType appType, int pid);
 
        virtual result UnregisterApplication(int pid);
 
index 483e3f5..555f554 100644 (file)
@@ -39,11 +39,8 @@ class _IAppManager
 public:
        virtual ~_IAppManager() {}
 
-       virtual result LaunchApplication(const AppId& appId, int req) = 0;
        virtual result TerminateApplication(const AppId& appId) = 0;
-       virtual bool IsRunning(const AppId& appId) = 0;
-       virtual result GetRunningAppList(Tizen::Base::Collection::ArrayList* pArray) = 0;
-       virtual result RegisterApplication(const Tizen::Base::String& packageId, const Tizen::Base::String& executableName, _AppType appType, int pid) = 0;
+       virtual result RegisterApplication(const AppId& appId, _AppType appType, int pid) = 0;
        virtual result UnregisterApplication(int pid) = 0;
 
        virtual result InitEventListener(_IAppManagerServiceEventListener* pListener) = 0;
index 199b8a0..8377698 100644 (file)
@@ -23,7 +23,7 @@
 #include <new>
 #include <sys/sysinfo.h>
 #include <sys/time.h>
-#include <time.h>
+#include <ctime>
 #include <vconf.h>
 
 #include <FBaseDateTime.h>