From: SeungWon Lee Date: Thu, 11 Jul 2013 00:35:25 +0000 (+0900) Subject: Ignore callback for null AppId case and optimize the loop body. X-Git-Tag: submit/tizen/20131210.080830^2^2~275 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86951b192bc698e49669e4827b366969745d7e15;p=platform%2Fframework%2Fnative%2Fappfw.git Ignore callback for null AppId case and optimize the loop body. Change-Id: If4623eb0e0726aae9cdb8f5647523ea3dd7d694a Signed-off-by: SeungWon Lee --- diff --git a/src/app/FApp_AppManagerImpl.cpp b/src/app/FApp_AppManagerImpl.cpp index 6b08626..f696327 100755 --- a/src/app/FApp_AppManagerImpl.cpp +++ b/src/app/FApp_AppManagerImpl.cpp @@ -1062,6 +1062,14 @@ _AppManagerImpl::FireActiveAppEvent(unsigned int xid, int pid, char* pAppName) if (oldPid != pid) { oldPid = pid; + char pkgname[255] = {0, }; + if ((AUL_R_OK != aul_app_get_pkgname_bypid(pid, pkgname, 255)) || pkgname[0] == 0) + { + SysSecureLog(NID_APP, "Failed to get the package name from pid=%x pAppName=%s", pid, pAppName ? pAppName : "null"); + return; + } + AppId appId(_Aul::GetRealAppId(String(pkgname))); + std::unique_ptr > pEnum(__activeAppEventListenerList.GetEnumeratorN()); if (pEnum.get()) { @@ -1071,10 +1079,7 @@ _AppManagerImpl::FireActiveAppEvent(unsigned int xid, int pid, char* pAppName) pEnum->GetCurrent(pListener); if (pListener) { - char pkgname[255] = {0, }; - aul_app_get_pkgname_bypid(pid, pkgname, 255); - // TODO: Translate it to package name --> AppId - pListener->OnActiveAppChanged(AppId(pkgname)); + pListener->OnActiveAppChanged(appId); } } }