sync with Tizen:Main
authorJinkun Jang <jinkun.jang@samsung.com>
Sun, 17 Mar 2013 05:25:53 +0000 (14:25 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Sun, 17 Mar 2013 05:25:53 +0000 (14:25 +0900)
inc/NfcMessageRegisterService.h
src/ConnectivityService.cpp
src/NfcConnectivityIpcStub.cpp
src/NfcMessagePushDelegate.cpp
src/NfcMessageRegisterService.cpp

index 079db62..d4f3212 100644 (file)
@@ -73,10 +73,8 @@ public:
 
 private:
        result InitializeAppIdList(void);
-       result SetSelectedMessageAppId(const Tizen::Base::String& appId);
 
 public:
-       static const wchar_t* _SELECTED_APP_ID_NONE;
        static const wchar_t* _META_DATA_DB_NAME;
        static const wchar_t* _PUSH_MESSAGE_DIRECTORY;
        static const wchar_t* _PUSH_MESSAGE_EXT_NAME;
index 155c66d..9cfd4d0 100644 (file)
@@ -63,7 +63,7 @@ ConnectivityService::OnAppInitializing(Tizen::App::AppRegistry& appRegistry)
        SysTryReturn(NID_NET, pNetIpcStub != null, false, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
        unique_ptr<WifiConnectivityIpcStub> pWifiIpcStub(new (std::nothrow) WifiConnectivityIpcStub);
-       SysTryReturn(NID_NET_WIFI, pWifiIpcStub != null, false, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       SysTryReturn(NID_NET, pWifiIpcStub != null, false, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
        unique_ptr<NfcConnectivityIpcStub> pNfcIpcStub(new (std::nothrow) NfcConnectivityIpcStub);
        SysTryReturn(NID_NET_NFC, pNfcIpcStub != null, false, E_OUT_OF_MEMORY, "The memory is insufficient.");
@@ -78,7 +78,7 @@ ConnectivityService::OnAppInitializing(Tizen::App::AppRegistry& appRegistry)
        SysTryReturn(NID_NET, r == E_SUCCESS, false, r, "Construction of NetConnectivityIpcStub has failed.");
 
        r = pWifiIpcStub->Construct();
-       SysTryReturn(NID_NET_WIFI, r == E_SUCCESS, false, r, "Construction of WifiConnectivityIpcStub has failed.");
+       SysTryReturn(NID_NET, r == E_SUCCESS, false, r, "Construction of WifiConnectivityIpcStub has failed.");
 
        r = pNfcIpcStub->Construct();
        SysTryReturn(NID_NET_NFC, r == E_SUCCESS, false, r, "Construction of NfcConnectivityIpcStub has failed.");
index 7a4e5ae..40feed8 100644 (file)
@@ -207,7 +207,7 @@ NfcConnectivityIpcStub::OnActivateReservedPush(unsigned long* pResult)
        SysLog(NID_NET_NFC, "Received the request of activating the NFC Reserved Push with clientId : %d, AppPkgId : %ls",
                                __pIpcServer->GetClientId(), packageId.GetPointer());
 
-       *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
+/*     *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
 
        if (*pResult != E_SUCCESS)
        {
@@ -215,7 +215,7 @@ NfcConnectivityIpcStub::OnActivateReservedPush(unsigned long* pResult)
                SysLogException(NID_NET_NFC, E_PRIVILEGE_DENIED,
                                "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
        }
-       else if (__pNfcService == null)
+       else */if (__pNfcService == null)
        {
                *pResult = E_SYSTEM;
        }
@@ -233,7 +233,7 @@ NfcConnectivityIpcStub::OnDeactivateReservedPush(unsigned long* pResult)
        SysLog(NID_NET_NFC, "Received the request of deactivating the NFC Reserved Push with clientId : %d, AppPkgId : %ls",
                                __pIpcServer->GetClientId(), packageId.GetPointer());
 
-       *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
+/*     *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
 
        if (*pResult != E_SUCCESS)
        {
@@ -241,7 +241,7 @@ NfcConnectivityIpcStub::OnDeactivateReservedPush(unsigned long* pResult)
                SysLogException(NID_NET_NFC, E_PRIVILEGE_DENIED,
                                "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
        }
-       else if (__pNfcService == null)
+       else */if (__pNfcService == null)
        {
                *pResult = E_SYSTEM;
        }
@@ -291,7 +291,7 @@ NfcConnectivityIpcStub::OnPickReservedPushMessage(const Tizen::Base::String& app
        SysLog(NID_NET_NFC, "Received the request of picking the NFC Reserved Push message with clientId : %d, AppPkgId : %ls",
                                __pIpcServer->GetClientId(), packageId.GetPointer());
 
-       *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
+/*     *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
 
        if (*pResult != E_SUCCESS)
        {
@@ -299,7 +299,7 @@ NfcConnectivityIpcStub::OnPickReservedPushMessage(const Tizen::Base::String& app
                SysLogException(NID_NET_NFC, E_PRIVILEGE_DENIED,
                                "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
        }
-       else if (__pNfcService == null)
+       else */if (__pNfcService == null)
        {
                *pResult = E_SYSTEM;
        }
index 6e20251..a88f794 100644 (file)
@@ -255,11 +255,7 @@ NfcMessagePushDelegate::GetSelectedMessageAppId(void)
        pAppIdStr.reset(vconf_get_str(VCONFKEY_NFC_PREDEFINED_ITEM));
        SysTryReturn(NID_NET_NFC, pAppIdStr != null, L"", E_SYSTEM, "[E_SYSTEM] Failed to get the selected app ID from vconf.");
 
-       String selectedAppId(pAppIdStr.get());
-       SysTryReturn(NID_NET_NFC, selectedAppId != String(NfcMessageRegisterService::_SELECTED_APP_ID_NONE), L"", E_OBJ_NOT_FOUND,
-                       "[E_OBJ_NOT_FOUND] No element in the candidate list.");
-
-       return selectedAppId;
+       return String(pAppIdStr.get()); // free 'pSelectedItem' after return
 }
 
 result
index 33351e8..0f8d213 100644 (file)
 #include <FBaseRtMutexGuard.h>
 #include <FBaseColHashMap.h>
 #include <FAppPkgPackageInfo.h>
-#include <FAppPkgPackageAppInfo.h>
 #include <FIoFile.h>
 #include <FIoDbStatement.h>
 #include <FIoDbEnumerator.h>
 #include <FAppPkg_PackageManagerImpl.h>
-#include <FAppPkg_PackageAppInfoImpl.h>
 #include <FBase_StringConverter.h>
 #include "NfcMessageRegisterService.h"
 
@@ -45,7 +43,6 @@ using namespace Tizen::App;
 using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 
-const wchar_t* NfcMessageRegisterService::_SELECTED_APP_ID_NONE = L"None";
 const wchar_t* NfcMessageRegisterService::_META_DATA_DB_NAME = L"/opt/usr/dbspace/.net-nfcpush.db";
 const wchar_t* NfcMessageRegisterService::_PUSH_MESSAGE_DIRECTORY = L"/opt/usr/share/nfcpush/";
 const wchar_t* NfcMessageRegisterService::_PUSH_MESSAGE_EXT_NAME = L".ndef";
@@ -100,8 +97,7 @@ NfcMessageRegisterService::RegisterPushMessage(const Tizen::Base::String& appPkg
        String msgFilePath;
        unique_ptr<DbStatement> pInsertStmt;
        unique_ptr<DbEnumerator> pInsertEnum;
-       unique_ptr<PackageInfo> pPackageInfo;
-       unique_ptr<PackageAppInfo> pPackageAppInfo;
+    PackageInfo* pPackageInfo = null;
     String appName;
     String appIconPath;
 
@@ -109,14 +105,13 @@ NfcMessageRegisterService::RegisterPushMessage(const Tizen::Base::String& appPkg
        msgFilePath = _PUSH_MESSAGE_DIRECTORY + appPkgId + _PUSH_MESSAGE_EXT_NAME;
 
        // get the app name and icon path from the package manager
-       pPackageInfo.reset(_PackageManagerImpl::GetInstance()->GetPackageInfoN(appPkgId));
+       pPackageInfo = _PackageManagerImpl::GetInstance()->GetPackageInfoN(appPkgId);
        SysTryReturnResult(NID_NET_NFC, pPackageInfo != null, E_SYSTEM, "Getting package information has failed.");
 
-       pPackageAppInfo.reset(pPackageInfo->GetPackageAppInfoN(pPackageInfo->GetMainAppId()));
-       SysTryReturnResult(NID_NET_NFC, pPackageInfo != null, E_SYSTEM, "Getting package app information has failed.");
-
        appName = pPackageInfo->GetDisplayName();
-       appIconPath = _PackageAppInfoImpl::GetInstance(pPackageAppInfo.get())->GetAppMenuIconPath();
+       //appIconPath = packageInfo.GetAppIconPath();
+
+       delete pPackageInfo;
 
        MutexGuard locked(__listMutex);
 
@@ -155,7 +150,7 @@ NfcMessageRegisterService::RegisterPushMessage(const Tizen::Base::String& appPkg
                // Modify vconf - the selected item - value if the new message (appPkgId) becomes the first element of the list
                if (__reserverList.GetCount() == 1)
                {
-                       r = SetSelectedMessageAppId(appPkgId);
+                       r = PickReservedPushMessage(appPkgId);
                        SysTryReturnResult(NID_NET_NFC, r == E_SUCCESS, r, "Propagating.");
                }
        }
@@ -218,7 +213,7 @@ NfcMessageRegisterService::UnregisterPushMessage(const Tizen::Base::String& appP
 
                if (appPkgId.Equals(String(pSelectedAppIdStr.get())))
                {
-                       String newAppId(_SELECTED_APP_ID_NONE); // Especially, if no more element in the list, set the default value
+                       String newAppId(L"None"); // Especially, if no more element in the list, set the value by "None"
 
                        if (__reserverList.GetCount() > 0)
                        {
@@ -226,7 +221,7 @@ NfcMessageRegisterService::UnregisterPushMessage(const Tizen::Base::String& appP
                                __reserverList.GetAt(0, newAppId); // Ignore the result
                        }
 
-                       r = SetSelectedMessageAppId(newAppId);
+                       r = PickReservedPushMessage(newAppId);
                        SysTryReturnResult(NID_NET_NFC, r == E_SUCCESS, r, "Propagating.");
                }
        }
@@ -274,20 +269,10 @@ NfcMessageRegisterService::GetReservedPushCandidates(Tizen::Base::Collection::Ha
 result
 NfcMessageRegisterService::PickReservedPushMessage(const Tizen::Base::String& ownerAppId)
 {
-       // check the owner application ID exists in the candidate list
-       SysTryReturnResult(NID_NET_NFC, __reserverList.Contains(ownerAppId) == true, E_OBJ_NOT_FOUND,
-                       "The specified application ID is not found in the candidate list.");
-
-       return SetSelectedMessageAppId(ownerAppId);
-}
-
-result
-NfcMessageRegisterService::SetSelectedMessageAppId(const Tizen::Base::String& appId)
-{
        int vconfRes = -1;
        unique_ptr<char, _CharDeleter> pAppIdStr;
 
-       pAppIdStr.reset(_StringConverter::CopyToCharArrayN(appId));
+       pAppIdStr.reset(_StringConverter::CopyToCharArrayN(ownerAppId));
        SysTryReturnResult(NID_NET_NFC, pAppIdStr != null, E_SYSTEM, "Failed to set the selected App ID to vconf.");
 
        // set the value for the predefined item