#include <aul/aul.h>
#include <bundle.h>
-#include <app_manager.h>
-#include <Ecore.h>
-#include <Ecore_X.h>
-#include <X11/Xlib.h>
-#include <FBaseInteger.h>
#include <FBaseObject.h>
#include <FBaseString.h>
#include <FBaseColArrayList.h>
#include <FBase_StringConverter.h>
#include <FBaseRt_LibraryImpl.h>
-#include <FIo_DataControlResultSetImpl.h>
+#include <FSys_SystemInfoImpl.h>
#include "FApp_AppControlRegistry.h"
#include "FApp_AppImpl.h"
#include "FApp_AppInfo.h"
-#include "FApp_AppManagerEventArg.h"
#include "FApp_AppManagerImpl.h"
#include "FApp_AppManagerProxy.h"
#include "FApp_AppMessageImpl.h"
#include "FApp_AppControlImpl.h"
#include "FApp_ConditionManagerProxy.h"
-#include "FApp_IAppManagerEventListener.h"
#include "FApp_IAppEventListener.h"
#include "FApp_MapDataControlImpl.h"
#include "FApp_SqlDataControlImpl.h"
#include "FAppPkg_PackageManagerImpl.h"
#include "FAppPkg_PackageInfoImpl.h"
#include "FApp_AppControlManager.h"
+#include "FApp_TemplateUtil.h"
#include "FApp_Aul.h"
-#include "FSys_SystemInfoImpl.h"
-
#include "FApp_AppLifecycleEvent.h"
#include "FApp_AppLifecycleEventArg.h"
#include "FApp_IAppLifecycleEventListener.h"
+#include "FApp_ActiveWindowManager.h"
+
using namespace Tizen::App::Package;
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
const long MAX_APPCONTROL_ARGUMENT = 1024;
const long MAX_CONDITION_LENGTH = 400;
-// ActiveWindow related function and variable from shared library.
-// libecore_x.so.1
-static Ecore_X_Atom(* p_ecore_x_atom_get)(const char* name) = null;
-static int(* p_ecore_x_window_prop_window_get)(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window* val, unsigned int len) = null;
-static Eina_Bool(* p_ecore_x_netwm_pid_get)(Ecore_X_Window win, int* pid) = null;
-static int(* p_ecore_x_netwm_name_get)(Ecore_X_Window win, char** name) = null;
-static Ecore_X_Window* (* p_ecore_x_window_root_list)(int* num_ret) = null;
-static int* p_ECORE_X_EVENT_WINDOW_PROPERTY = null;
-// libecore.so.1
-static Ecore_Event_Handler* (* p_ecore_event_handler_add)(int type, Ecore_Event_Handler_Cb func, const void* data) = null;
-static void* (* p_ecore_event_handler_del)(Ecore_Event_Handler* event_handler) = null;
-// libX11.so
-static int (* p_XSelectInput)(Display* display, Window w, long event_mask) = null;
-static Display* (* p_XOpenDisplay)(_Xconst char* display_name) = null;
-static int (* p_XCloseDisplay)(Display* display) = null;
-
-Ecore_Event_Handler* pWindowPropertyChanged = null;
-
-struct _DisplayDeleter
-{
- void operator()(Display* pDisplay)
- {
- if (p_XOpenDisplay)
- {
- p_XCloseDisplay(pDisplay);
- }
- }
-};
-
int
GetTotalSize(const Tizen::Base::Collection::ICollection& col)
{
return size;
}
-Eina_Bool
-OnPropertyChanged(void* pData, int type, void* pEvent)
-{
- using namespace Tizen::App;
-
- if (p_ecore_x_atom_get == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_atom_get = reinterpret_cast<Ecore_X_Atom(*)(const char* name)>(lib.GetProcAddress(L"ecore_x_atom_get"));
- SysTryReturnResult(NID_APP, p_ecore_x_atom_get != null, EINA_FALSE,
- "A system error has been occurred. Failed to get ecore_x_atom_get.");
- }
- if (p_ecore_x_window_prop_window_get == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_window_prop_window_get = reinterpret_cast<int(*)(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window* val, unsigned int len)>(lib.GetProcAddress(L"ecore_x_window_prop_window_get"));
- SysTryReturnResult(NID_APP, p_ecore_x_window_prop_window_get != null, EINA_FALSE,
- "A system error has been occurred. Failed to get ecore_x_window_prop_window_get.");
- }
- if (p_ecore_x_netwm_pid_get == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_netwm_pid_get = reinterpret_cast<Eina_Bool(*)(Ecore_X_Window win, int* pid)>(lib.GetProcAddress(L"ecore_x_netwm_pid_get"));
- SysTryReturnResult(NID_APP, p_ecore_x_netwm_pid_get != null, EINA_FALSE,
- "A system error has been occurred. Failed to get ecore_x_netwm_pid_get.");
- }
- if (p_ecore_x_netwm_name_get == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_netwm_name_get = reinterpret_cast<int(*)(Ecore_X_Window win, char** name)>(lib.GetProcAddress(L"ecore_x_netwm_name_get"));
- SysTryReturnResult(NID_APP, p_ecore_x_netwm_name_get != null, EINA_FALSE,
- "A system error has been occurred. Failed to get ecore_x_netwm_name_get.");
- }
-
- if (!pData)
- {
- SysLog(NID_UI, "The data is not valid.");
- return EINA_FALSE;
- }
- if (!pEvent)
- {
- SysLog(NID_UI, "The event is not valid.");
- return EINA_FALSE;
- }
-
- Ecore_X_Event_Window_Property* pE = (Ecore_X_Event_Window_Property*) pEvent;
- Ecore_X_Atom atom = pE->atom;
- Ecore_X_Atom activeAtom = p_ecore_x_atom_get("_NET_ACTIVE_WINDOW");
-
- if (atom != activeAtom)
- {
- return ECORE_CALLBACK_PASS_ON;
- }
-
- Ecore_X_Window win = pE->win;
- Ecore_X_Window activeWin = 0;
- p_ecore_x_window_prop_window_get(win, activeAtom, &activeWin, 1);
-
- int pid = 0;
- p_ecore_x_netwm_pid_get(activeWin, &pid);
-
- char* pAppName = null;
- p_ecore_x_netwm_name_get(activeWin, &pAppName);
-
- Tizen::App::_AppManagerImpl* pAppManagerImpl = static_cast<Tizen::App::_AppManagerImpl*>(pData);
- pAppManagerImpl->FireActiveAppEvent(activeWin, pid, pAppName);
-
- if (pAppName)
- {
- free(pAppName);
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
} // anonymous name-space
const wchar_t LEGACY_LAUNCH_REASON_NORMAL[] = L"LAUNCH_NORMAL";
const wchar_t LEGACY_LAUNCH_REASON_CONDITIONAL[] = L"LAUNCH_CONDITIONAL";
const wchar_t OSP_UI_SONAME[] = L"libosp-uifw.so.1";
-const wchar_t OSP_ECORE_X_SONAME[] = L"libecore_x.so.1";
-const wchar_t OSP_ECORE_SONAME[] = L"libecore.so.1";
-const wchar_t OSP_X11_SONAME[] = L"libX11.so.6";
const int _MAX_PACKAGE_ID_LENGTH = 10;
-_LibraryImpl* _AppManagerImpl::__pEcoreLibrary = null;
-_LibraryImpl* _AppManagerImpl::__pEcoreXLibrary = null;
_AppManagerImpl::_AppManagerImpl(void)
: __pConditionManager(null)
- , __eventListenerCount(0)
+ , __pActiveWindowManager(new (std::nothrow) _ActiveWindowManager)
, __pUiLibrary(null)
- , __pX11Library(null)
{
SysLog(NID_APP, "");
}
{
SysLog(NID_APP, "");
- if (__activeAppEventListenerList.GetCount() > 0)
- {
- if (p_ecore_event_handler_del == null)
- {
- _LibraryImpl& lib = GetEcoreLibraryImpl();
- p_ecore_event_handler_del = reinterpret_cast<void*(*)(Ecore_Event_Handler* event_handler)>(lib.GetProcAddress(L"ecore_event_handler_del"));
- }
- if (p_ecore_event_handler_del)
- {
- if (pWindowPropertyChanged)
- {
- p_ecore_event_handler_del(pWindowPropertyChanged);
- pWindowPropertyChanged = null;
- }
- }
- }
-
delete __pConditionManager;
delete __pUiLibrary;
- delete __pX11Library;
- delete __pEcoreXLibrary;
- __pEcoreXLibrary = null;
- delete __pEcoreLibrary;
- __pEcoreLibrary = null;
}
result
_AppManagerImpl::Construct(void)
{
- __appManagerEvent.Construct();
__appLifecycleEvent.Construct();
- __appListForAppLifecycle.Construct(0, 0, __strHashCodeProvider, __comparer);
+ __appListForAppLifecycle.Construct();
result r = __mutex.Create();
SysTryLog(NID_APP, r == E_SUCCESS, "Creating mutex failed.");
AppControl* pAc = null;
pAc = pRegs->GetTizenAppControlN(aId, oId);
- if (pAc != null)
- {
- SetLastResult(E_SUCCESS);
- return pAc;
- }
-
- pAc = pRegs->GetAppControlN(aId, oId);
-
SysTryReturn(NID_APP, pAc != null, null, E_OBJ_NOT_FOUND, "[%s] No matching AppControl instance found (%ls, %ls).",
GetErrorMessage(E_OBJ_NOT_FOUND), aId.GetPointer(), oId.GetPointer());
SetLastResult(E_SUCCESS);
// "The length of appid exceeded the limit(%d).",
// WIDGET_APP_MAX_APPID_LENGTH);
- std::unique_ptr<AppControl> pAc(_AppControlRegistry::GetInstance()->GetAppControlN(appId, TIZEN_OPERATION_MAIN));
+ std::unique_ptr<AppControl> pAc(FindAppControlN(appId, TIZEN_OPERATION_MAIN));
SysTryReturnResult(NID_APP, pAc.get() != null, E_OBJ_NOT_FOUND, "The target application (%ls) is not found.", appId.GetPointer());
if (pArguments)
return _AppImpl::GetInstance()->SetListener(appEvent, pListener);
}
-result
-_AppManagerImpl::OnServiceEventReceived(int clientId, const _AppManagerEventArg& arg)
-{
- SysLog(NID_APP, "app:%ls, appType:0x%x", arg.GetAppId().GetPointer(), arg.GetAppType());
-
- _AppManagerEventArg* pArg = new (std::nothrow)_AppManagerEventArg(arg);
- SysTryReturnResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
- __appManagerEvent.FireAsync(*pArg);
- return E_SUCCESS;
-}
result
_AppManagerImpl::OnTerminateApplicationRequested(int clientId)
return E_SUCCESS;
}
-result
-_AppManagerImpl::AddEventListener(_IAppManagerEventListener& listener)
-{
- _IAppManager* pMgr = _AppManagerProxy::GetService();
- SysTryReturnResult(NID_APP, pMgr != null, E_INVALID_STATE, "");
-
- result r = __appManagerEvent.AddListener(listener);
- SysTryReturn(NID_APP, IsFailed(r) == false, r, r, "[%s]", GetErrorMessage(r));
-
- __eventListenerCount++;
- SysLog(NID_APP, "registered event listener(s) # %d", __eventListenerCount);
-
- if( __eventListenerCount > 1)
- {
- return E_SUCCESS;
- }
-
- return pMgr->AddEventListener(-1);
-}
-
-result
-_AppManagerImpl::RemoveEventListener(_IAppManagerEventListener& listener)
-{
- _IAppManager* pMgr = _AppManagerProxy::GetService();
- SysTryReturnResult(NID_APP, pMgr != null, E_INVALID_STATE, "");
-
- result r = __appManagerEvent.RemoveListener(listener);
- SysTryReturn(NID_APP, IsFailed(r) == false, r, r, "[%s]", GetErrorMessage(r));
-
- __eventListenerCount--;
- SysLog(NID_APP, "registered event listener(s) # %d", __eventListenerCount);
-
- if (__eventListenerCount == 0)
- {
- return pMgr->RemoveEventListener(-1);
- }
-
- return E_SUCCESS;
-}
-
///////////////////////////////////////////////////////////////////////////////
// LifecycleManager begins.
return *__pUiLibrary;
}
-_LibraryImpl&
-_AppManagerImpl::GetEcoreXLibraryImpl(void)
-{
- if (__pEcoreXLibrary == null)
- {
- __pEcoreXLibrary = new (std::nothrow) _LibraryImpl;
- SysAssertf(__pEcoreXLibrary != null, "_LibraryImpl allocation failure.");
-
- result r = __pEcoreXLibrary->Construct(OSP_ECORE_X_SONAME);
- SysAssertf(r == E_SUCCESS, "Dynamic loading error : %s.", GetErrorMessage(r));
- }
- return *__pEcoreXLibrary;
-}
-
-_LibraryImpl&
-_AppManagerImpl::GetEcoreLibraryImpl(void)
-{
- if (__pEcoreLibrary == null)
- {
- __pEcoreLibrary = new (std::nothrow) _LibraryImpl;
- SysAssertf(__pEcoreLibrary != null, "_LibraryImpl allocation failure.");
-
- result r = __pEcoreLibrary->Construct(OSP_ECORE_SONAME);
- SysAssertf(r == E_SUCCESS, "Dynamic loading error : %s.", GetErrorMessage(r));
- }
- return *__pEcoreLibrary;
-}
-
-_LibraryImpl&
-_AppManagerImpl::GetX11LibraryImpl(void)
-{
- if (__pX11Library == null)
- {
- __pX11Library = new (std::nothrow) _LibraryImpl;
- SysAssertf(__pX11Library != null, "_LibraryImpl allocation failure.");
-
- result r = __pX11Library->Construct(OSP_X11_SONAME);
- SysAssertf(r == E_SUCCESS, "Dynamic loading error : %s.", GetErrorMessage(r));
- }
- return *__pX11Library;
-}
-
-void
-_AppManagerImpl::FireActiveAppEvent(unsigned int xid, int pid, char* pAppName)
-{
- static int oldPid = 0;
- 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<IEnumeratorT<Tizen::App::IActiveAppEventListener* > > pEnum(__activeAppEventListenerList.GetEnumeratorN());
- if (pEnum.get())
- {
- while (pEnum->MoveNext() == E_SUCCESS)
- {
- Tizen::App::IActiveAppEventListener* pListener = null;
- pEnum->GetCurrent(pListener);
- if (pListener)
- {
- pListener->OnActiveAppChanged(appId);
- }
- }
- }
- }
-}
-
-unsigned int
-_AppManagerImpl::GetActiveWindow(void)
-{
- if (p_ecore_x_window_root_list == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_window_root_list = reinterpret_cast<Ecore_X_Window*(*)(int* num_ret)>(lib.GetProcAddress(L"ecore_x_window_root_list"));
- SysTryReturnResult(NID_APP, p_ecore_x_window_root_list != null, 0,
- "A system error has been occurred. Failed to get p_ecore_x_window_root_list.");
- }
- if (p_ecore_x_atom_get == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_atom_get = reinterpret_cast<Ecore_X_Atom(*)(const char* name)>(lib.GetProcAddress(L"ecore_x_atom_get"));
- SysTryReturnResult(NID_APP, p_ecore_x_atom_get != null, 0,
- "A system error has been occurred. Failed to get ecore_x_atom_get.");
- }
- if (p_ecore_x_window_prop_window_get == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_window_prop_window_get = reinterpret_cast<int(*)(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window* val, unsigned int len)>(lib.GetProcAddress(L"ecore_x_window_prop_window_get"));
- SysTryReturnResult(NID_APP, p_ecore_x_window_prop_window_get != null, EINA_FALSE,
- "A system error has been occurred. Failed to get ecore_x_window_prop_window_get.");
- }
-
- int num = 0;
- Ecore_X_Window* pRoots = p_ecore_x_window_root_list(&num);
-
- Ecore_X_Window activeWin = 0;
- if (pRoots)
- {
- Ecore_X_Atom activeAtom = p_ecore_x_atom_get("_NET_ACTIVE_WINDOW");
- p_ecore_x_window_prop_window_get(pRoots[0], activeAtom, &activeWin, 1);
- free(pRoots);
- }
-
- return activeWin;
-}
-
-int
-_AppManagerImpl::GetProcessId(unsigned int window)
-{
- if (p_ecore_x_netwm_pid_get == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_netwm_pid_get = reinterpret_cast<Eina_Bool(*)(Ecore_X_Window win, int* pid)>(lib.GetProcAddress(L"ecore_x_netwm_pid_get"));
- SysTryReturnResult(NID_APP, p_ecore_x_netwm_pid_get != null, EINA_FALSE,
- "A system error has been occurred. Failed to get ecore_x_netwm_pid_get.");
- }
-
- int pid = 0;
- p_ecore_x_netwm_pid_get(window, &pid);
-
- return pid;
-}
result
_AppManagerImpl::AddActiveAppEventListener(IActiveAppEventListener& listener)
{
- if (p_ecore_x_window_root_list == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ecore_x_window_root_list = reinterpret_cast<Ecore_X_Window*(*)(int* num_ret)>(lib.GetProcAddress(L"ecore_x_window_root_list"));
- SysTryReturnResult(NID_APP, p_ecore_x_window_root_list != null, E_SYSTEM,
- "A system error has been occurred. Failed to get p_ecore_x_window_root_list.");
- }
- if (p_ECORE_X_EVENT_WINDOW_PROPERTY == null)
- {
- _LibraryImpl& lib = _AppManagerImpl::GetEcoreXLibraryImpl();
- p_ECORE_X_EVENT_WINDOW_PROPERTY = reinterpret_cast<int*>(lib.GetProcAddress(L"ECORE_X_EVENT_WINDOW_PROPERTY"));
- SysTryReturnResult(NID_APP, p_ECORE_X_EVENT_WINDOW_PROPERTY != null, E_SYSTEM,
- "A system error has been occurred. Failed to get p_ECORE_X_EVENT_WINDOW_PROPERTY.");
- }
- if (p_XOpenDisplay == null)
- {
- _LibraryImpl& lib = GetX11LibraryImpl();
- p_XOpenDisplay = reinterpret_cast<Display*(*)(_Xconst char* display_name)>(lib.GetProcAddress(L"XOpenDisplay"));
- SysTryReturnResult(NID_APP, p_XOpenDisplay != null, E_SYSTEM,
- "A system error has been occurred. Failed to get p_XOpenDisplay.");
- }
- if (p_XCloseDisplay == null)
- {
- _LibraryImpl& lib = GetX11LibraryImpl();
- p_XCloseDisplay = reinterpret_cast<int(*)(Display* display)>(lib.GetProcAddress(L"XCloseDisplay"));
- SysTryReturnResult(NID_APP, p_XCloseDisplay != null, E_SYSTEM,
- "A system error has been occurred. Failed to get p_XCloseDisplay.");
- }
- if (p_XSelectInput == null)
- {
- _LibraryImpl& lib = GetX11LibraryImpl();
- p_XSelectInput = reinterpret_cast<int(*)(Display* display, Window w, long event_mask)>(lib.GetProcAddress(L"XSelectInput"));
- SysTryReturnResult(NID_APP, p_XSelectInput != null, E_SYSTEM,
- "A system error has been occurred. Failed to get p_XSelectInput.");
- }
- if (p_ecore_event_handler_add == null)
- {
- _LibraryImpl& lib = GetEcoreLibraryImpl();
- p_ecore_event_handler_add = reinterpret_cast<Ecore_Event_Handler*(*)(int type, Ecore_Event_Handler_Cb func, const void* data)>(lib.GetProcAddress(L"ecore_event_handler_add"));
- SysTryReturnResult(NID_APP, p_ecore_event_handler_add != null, E_SYSTEM,
- "A system error has been occurred. Failed to get p_ecore_event_handler_add.");
- }
-
- bool alreadyExist = __activeAppEventListenerList.Contains(&listener);
- SysTryReturnResult(NID_APP, !alreadyExist, E_OBJ_ALREADY_EXIST, "The event listener already exist.");
- result r = __activeAppEventListenerList.Add(&listener);
- SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- if (!pWindowPropertyChanged)
- {
- std::unique_ptr<Display, _DisplayDeleter> pDisplay(p_XOpenDisplay(NULL));
- SysTryReturnResult(NID_APP, pDisplay != null, E_SYSTEM, "A system error has been occurred. Failed to XOpenDisplay.");
-
- int num = 0;
- Ecore_X_Window* pRoots = p_ecore_x_window_root_list(&num);
- SysTryReturnResult(NID_APP, pRoots != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
-
- for (int i = 0; i < num; i++)
- {
- p_XSelectInput(pDisplay.get(), pRoots[i], PropertyChangeMask);
- }
-
- pWindowPropertyChanged = p_ecore_event_handler_add(*p_ECORE_X_EVENT_WINDOW_PROPERTY, OnPropertyChanged, (void*) this);
- free(pRoots);
- SysTryReturnResult(NID_APP, pWindowPropertyChanged, E_SYSTEM, "A system error has been occurred.");
- }
-
- return r;
+ return __pActiveWindowManager->AddActiveAppEventListener(listener);
}
+
result
_AppManagerImpl::RemoveActiveAppEventListener(IActiveAppEventListener& listener)
{
- if (p_ecore_event_handler_del == null)
- {
- _LibraryImpl& lib = GetEcoreLibraryImpl();
- p_ecore_event_handler_del = reinterpret_cast<void*(*)(Ecore_Event_Handler* event_handler)>(lib.GetProcAddress(L"ecore_event_handler_del"));
- SysTryReturnResult(NID_APP, p_ecore_event_handler_del != null, E_SYSTEM,
- "A system error has been occurred. Failed to get p_ecore_event_handler_del.");
- }
-
- result r = __activeAppEventListenerList.Remove(&listener);
- SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- if (__activeAppEventListenerList.GetCount() == 0)
- {
- p_ecore_event_handler_del(pWindowPropertyChanged);
- pWindowPropertyChanged = null;
- }
-
- return r;
+ return __pActiveWindowManager->RemoveActiveAppEventListener(listener);
}
+
result
_AppManagerImpl::GetActiveApp(AppId& appId)
{
- const unsigned int windowId = GetActiveWindow();
- const int processId = GetProcessId(windowId);
- char pkgname[255] = {0, };
- aul_app_get_pkgname_bypid(processId, pkgname, 255);
-
- appId = _Aul::GetRealAppId(String(pkgname));
-
- SysLog(NID_APP, "ActiveApp is %ls.", appId.GetPointer());
- return E_SUCCESS;
+ return __pActiveWindowManager->GetActiveApp(appId);
}
+
bool
_AppManagerImpl::IsUserPreferredAppForAppControlResolution(const AppId& appId) const
{
{
SysLog(NID_APP, "Enter");
- result r = __mutex.Acquire();
- SysTryLog(NID_APP, r == E_SUCCESS, "Acquiring mutex failed.");
+ result res = __mutex.Acquire();
+ SysTryLog(NID_APP, res == E_SUCCESS, "Acquiring mutex failed.");
bool isContained = false;
- r = __appListForAppLifecycle.ContainsKey(appId, isContained);
+ result r = __appListForAppLifecycle.ContainsKey(appId, isContained);
int currentRefCnt = 0;
if(isContained)
r = pMgr->RegisterAppForAppLifecycleEvent(appId, -1);
SysLog(NID_APP, "The appId(%ls) is registered.", appId.GetPointer());
}
- r = __mutex.Release();
- SysTryLog(NID_APP, r == E_SUCCESS, "Releasing mutex failed.");
+ res = __mutex.Release();
+ SysTryLog(NID_APP, res == E_SUCCESS, "Releasing mutex failed.");
SysLog(NID_APP, "Exit");
{
SysLog(NID_APP, "Enter");
- result r = __mutex.Acquire();
- SysTryLog(NID_APP, r == E_SUCCESS, "Acquiring mutex failed.");
+ result res = __mutex.Acquire();
+ SysTryLog(NID_APP, res == E_SUCCESS, "Acquiring mutex failed.");
bool isContained = false;
- r = __appListForAppLifecycle.ContainsKey(appId, isContained);
+ result r = __appListForAppLifecycle.ContainsKey(appId, isContained);
if(isContained)
{
if (currentRefCnt < 0)
{
r = __appListForAppLifecycle.Remove(appId);
-
+
_IAppManager* pMgr = _AppManagerProxy::GetService();
SysTryReturnResult(NID_APP, pMgr, E_SYSTEM, "_AppManagerProxy::GetService() is failed.");
else
{
r = __appListForAppLifecycle.SetValue(appId, currentRefCnt);
- }
+ }
}
else
{
SysLog(NID_APP, "The appId(%ls) is not registered.", appId.GetPointer());
}
- r = __mutex.Release();
- SysTryLog(NID_APP, r == E_SUCCESS, "Releasing mutex failed.");
+ res = __mutex.Release();
+ SysTryLog(NID_APP, res == E_SUCCESS, "Releasing mutex failed.");
SysLog(NID_APP, "Exit");