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: accepted/tizen/20130912.081851^2~139 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c67bb1f001d9e8edf4074e61b2a3a104eb333dc3;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 d165d77..fe907a7 100755 --- a/src/app/FApp_AppManagerImpl.cpp +++ b/src/app/FApp_AppManagerImpl.cpp @@ -1068,6 +1068,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()) { @@ -1077,10 +1085,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); } } }