fix code cleanup with file property change
[platform/framework/native/appfw.git] / src / app / FApp_AppManagerImpl.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 76b13f4..5aaf297
@@ -695,10 +695,9 @@ _AppManagerImpl::TerminateApplications(const PackageId& packageId)
 bool
 _AppManagerImpl::IsRunning(const AppId& appId) const
 {
-       _IAppManager* pMgr = _AppManagerProxy::GetService();
-       SysTryReturnResult(NID_APP, pMgr, E_SYSTEM, "Failed to _AppManagerProxy::GetService().");
+       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
 
-       return pMgr->IsRunning(appId);
+       return aul_app_is_running(pAppId.get());
 }
 
 static int
@@ -858,25 +857,34 @@ _AppManagerImpl::AppEventCallback(app_context_h app_context, app_context_event_e
 
                free(pAppId);
 
-               // ugly comparson inside loop
-               while (pEnum->MoveNext() == E_SUCCESS)
+               pid_t pid = -1;
+               app_context_get_pid(app_context, &pid);
+               const int val = event;
+
+               // loop unfolding
+               switch (val)
                {
-                       _IAppEventListener* pListener = null;
-                       pEnum->GetCurrent(pListener);
+               case APP_CONTEXT_EVENT_LAUNCHED:
+                       while (pEnum->MoveNext() == E_SUCCESS)
+                       {
+                               _IAppEventListener* pListener = null;
+                               pEnum->GetCurrent(pListener);
 
-                       const int val = event;
-                       switch (val)
+                               pListener->OnApplicationLaunched(appId, pid);
+                       }
+                       break;
+               case APP_CONTEXT_EVENT_TERMINATED:
+                       while (pEnum->MoveNext() == E_SUCCESS)
                        {
-                       case APP_CONTEXT_EVENT_LAUNCHED:
-                               pListener->OnApplicationLaunched(appId, 0);
-                               break;
-                       case APP_CONTEXT_EVENT_TERMINATED:
-                               pListener->OnApplicationTerminated(appId, 0);
-                               break;
-                       default:
-                               SysLog(NID_APP, "Invalid state.");
-                               break;
+                               _IAppEventListener* pListener = null;
+                               pEnum->GetCurrent(pListener);
+
+                               pListener->OnApplicationTerminated(appId, pid);
                        }
+                       break;
+               default:
+                       SysLog(NID_APP, "Invalid state.");
+                       break;
                }
        }