Update for AppLifecycle Event
authorJaesung Ku <jaesung.ku@samsung.com>
Fri, 19 Jul 2013 07:33:24 +0000 (16:33 +0900)
committerJaesung Ku <jaesung.ku@samsung.com>
Fri, 19 Jul 2013 07:55:37 +0000 (16:55 +0900)
Change-Id: I977d0563c6052f948e449cf4876fc060ae973b7f
Signed-off-by: Jaesung Ku <jaesung.ku@samsung.com>
manifest.xml
src/FApp_AppManagerStub.cpp

index e627154..7d0fa32 100755 (executable)
@@ -16,6 +16,7 @@
             <Privilege>http://tizen.org/privilege/application.launch</Privilege>
             <Privilege>http://tizen.org/privilege/appmanager.launch</Privilege>
             <Privilege>http://tizen.org/privilege/alarm</Privilege>
+           <Privilege>http://tizen.org/privilege/privilegemanager.read</Privilege>
             <Privilege>http://tizen.org/privilege/packageinfo</Privilege>
         </Privileges>
         <ServiceApp SystemService="True" AutoRestart="False" Default="True" ExecutableName="osp-app-service" LaunchOnBoot="False">
index d23a0e3..f7f7785 100755 (executable)
@@ -20,6 +20,7 @@
  */
 
 #include <FBaseSysLog.h>
+#include <FSecAccessController.h>
 #include <FIo_IpcServer.h>
 #include <FSec_AccessController.h>
 
@@ -312,16 +313,16 @@ _AppManagerStub::OnIsUserPreferredAppForAppControlResolution(const AppId& appId,
        SysTryCatch(NID_APP, __pAppManagerService != null, *pResException = E_SYSTEM, E_SYSTEM, "__pAppManagerService is null!");
        SysLog(NID_APP, "app(%ls)", appId.GetPointer());
 
-/*
+
        *pResException = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientPackageId(), _PRV_APPMANAGER_SETTING);
 
        if (IsFailed(*pResException))
        {
-               SysLog(NID_APP, "[E_PRIVILEGE_DENIED]The application(%ls) does not have the privilege to call this method.", appId.GetPointer());
+               SysLog(NID_APP, "[E_PRIVILEGE_DENIED]The application(%ls) does not have the privilege to call this method.", __pIpcServer->GetClientApplicationId().GetPointer());
                *pResException = E_PRIVILEGE_DENIED;
                return true;
        }
-*/     
+
        *pRes = __pAppManagerService->IsUserPreferredAppForAppControlResolution(appId);
 
 CATCH:
@@ -334,16 +335,16 @@ _AppManagerStub::OnClearUserPreferenceForAppControlResolution(const AppId& appId
 {
        SysTryCatch(NID_APP, __pAppManagerService != null, *pRes = E_SYSTEM, E_SYSTEM, "__pAppManagerService is null!");
        SysLog(NID_APP, "app(%ls)", appId.GetPointer());
-/*
+
        *pRes = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientPackageId(), _PRV_APPMANAGER_SETTING);
 
        if (IsFailed(*pRes))
        {
-               SysLog(NID_APP, "[E_PRIVILEGE_DENIED]The application(%ls) does not have the privilege to call this method.", appId.GetPointer());
+               SysLog(NID_APP, "[E_PRIVILEGE_DENIED]The application(%ls) does not have the privilege to call this method.", __pIpcServer->GetClientApplicationId().GetPointer());
                *pRes = E_PRIVILEGE_DENIED;
                return true;    
        }
-*/
+
        *pRes = __pAppManagerService->ClearUserPreferenceForAppControlResolution(appId);
 
 CATCH:
@@ -356,16 +357,16 @@ _AppManagerStub::OnRegisterAppForAppLifecycleEvent(const AppId& appId, result *p
 {
        SysTryReturn(NID_APP, __pAppManagerService != null, false,*pRes = E_SYSTEM, "__pAppManagerService is null!");
        SysLog(NID_APP, "app(%ls)", appId.GetPointer());
-/*
-       *pRes = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientPackageId(), _PRV_APP_LIFECYCLE_EVENT);
+
+       *pRes = AccessController::CheckPrivilege(__pIpcServer->GetClientPackageId(), L"http://developer.samsung.com/tizen/privilege/applifecycleevent");
 
        if (IsFailed(*pRes))
        {
-               SysLog(NID_APP, "[E_PRIVILEGE_DENIED]The application(%ls) does not have the privilege to call this method.", appId.GetPointer());
+               SysLog(NID_APP, "[E_PRIVILEGE_DENIED]The application(%ls) does not have the privilege to call this method.", __pIpcServer->GetClientApplicationId().GetPointer());
                *pRes = E_PRIVILEGE_DENIED;
                return true;    
        }
-*/
+
        *pRes = __pAppManagerService->RegisterAppForAppLifecycleEvent(appId, __pIpcServer->GetClientId());
 
        return true;
@@ -376,16 +377,16 @@ _AppManagerStub::OnUnregisterAppForAppLifecycleEvent(const AppId& appId, result
 {
        SysTryReturn(NID_APP, __pAppManagerService != null, false,*pRes = E_SYSTEM, "__pAppManagerService is null!");
        SysLog(NID_APP, "app(%ls)", appId.GetPointer());
-/*
-       *pRes = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientPackageId(), _PRV_APP_LIFECYCLE_EVENT);
+
+       *pRes = AccessController::CheckPrivilege(__pIpcServer->GetClientPackageId(), L"http://developer.samsung.com/tizen/privilege/applifecycleevent");
 
        if (IsFailed(*pRes))
        {
-               SysLog(NID_APP, "[E_PRIVILEGE_DENIED]The application(%ls) does not have the privilege to call this method.", appId.GetPointer());
+               SysLog(NID_APP, "[E_PRIVILEGE_DENIED]The application(%ls) does not have the privilege to call this method.", __pIpcServer->GetClientApplicationId().GetPointer());
                *pRes = E_PRIVILEGE_DENIED;
                return true;    
        }
-*/
+
        *pRes = __pAppManagerService->UnregisterAppForAppLifecycleEvent(appId, __pIpcServer->GetClientId());
 
        return true;