minor appid refactoring
authorYoung Ik Cho <youngik.cho@samsung.com>
Fri, 23 Aug 2013 07:29:29 +0000 (16:29 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Fri, 23 Aug 2013 07:29:29 +0000 (16:29 +0900)
Change-Id: I1b81ca955c28d1c831a505d838c5c722d91af9b2
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
src/app/FApp_AppControlManager.cpp
src/app/FApp_AppImpl.cpp
src/app/FApp_NotificationManagerImpl.cpp
src/app/FApp_RequestManagerT.cpp

index cd7d7eb..bc39ebd 100644 (file)
@@ -27,6 +27,7 @@
 #include <aul/aul.h>
 #include <bundle.h>
 #include <content/mime_type.h>
+#include <appinfo.h>
 
 #include <FBaseInteger.h>
 #include <FBaseObject.h>
@@ -75,22 +76,14 @@ using namespace Tizen::Base::Runtime;
 using namespace Tizen::Base::Utility;
 using namespace Tizen::Io;
 
-namespace Tizen { namespace App
-{
-
-const wchar_t TIZEN_OPERATION_PICK[] = L"http://tizen.org/appcontrol/operation/pick";
-const wchar_t SELECTOR_NOTI_KEY[] = L"__APP_SVC_CALLER_NOTI__";
-const int _MAX_PACKAGE_ID_LENGTH = 10;
-
-_InProcessInfo::~_InProcessInfo(void)
+namespace
 {
-       delete pLib;
+const char SELECTOR_NOTI_KEY[] = "__APP_SVC_CALLER_NOTI__";
 }
 
-_LaunchInfo::~_LaunchInfo(void)
+namespace Tizen { namespace App
 {
-       delete pArg;
-}
+const wchar_t TIZEN_OPERATION_PICK[] = L"http://tizen.org/appcontrol/operation/pick";
 
 
 _AppControlManager::_AppControlManager(void)
@@ -841,7 +834,7 @@ _AppControlManager::LaunchAppImplicit(_AppArg* pArg, int req)
        if (req >= 0)
        {
                pArg->UpdateRequestId(req);
-               _AppMessageImpl::AddData(kb, SELECTOR_NOTI_KEY, _AppInfo::GetApplicationId());
+               appsvc_add_data(kb, SELECTOR_NOTI_KEY, appinfo_get_appid());
        }
 
        if (_AppImpl::GetInstance() != null)
index 3f4386c..bfa3875 100644 (file)
@@ -195,9 +195,7 @@ _AppImpl::Execute(_IAppImpl* pIAppImpl)
        }
 
        // clear outstanding ongoing notification
-       const AppId& appId = _AppInfo::GetApplicationId();
-       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-       notification_delete_all_by_type(pAppId.get(), NOTIFICATION_TYPE_ONGOING);
+       notification_delete_all_by_type(appinfo_get_appid(), NOTIFICATION_TYPE_ONGOING);
 
        return r;
 }
@@ -688,7 +686,7 @@ _AppImpl::OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId)
                return;
        }
 
-       const String& appId = _AppInfo::GetApplicationId();
+       const char* pAppId = appinfo_get_appid();
 
        const char* p = appsvc_get_operation(arg.GetBundle());
        String operationId = (p) ? String(p) : TIZEN_OPERATION_MAIN;
@@ -697,7 +695,7 @@ _AppImpl::OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId)
                operationId = TIZEN_OPERATION_MAIN;
        }
 
-       SysLog(NID_APP, "AppControl (%ls, %ls).", appId.GetPointer(), operationId.GetPointer());
+       SysLog(NID_APP, "AppControl (%s, %ls).", pAppId, operationId.GetPointer());
 
        String uri;
        String mime;
@@ -728,7 +726,7 @@ _AppImpl::OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId)
 
        pAppControlProviderEventListener->OnAppControlRequestReceived(reqId, operationId, pUri, pMime, pMap.get());
 
-       SysLog(NID_APP, "AppControl (%ls, %ls) invocation finished.", appId.GetPointer(), operationId.GetPointer());
+       SysLog(NID_APP, "AppControl (%s, %ls) invocation finished.", pAppId, operationId.GetPointer());
 }
 
 
index c88337a..7b8233c 100644 (file)
@@ -27,6 +27,7 @@
 #include <notification/notification.h>
 #include <appfw/app.h>
 #include <appfw/app_ui_notification.h>
+#include <appinfo.h>
 
 #include <FBaseSysLog.h>
 #include <FAppNotificationManager.h>
@@ -138,11 +139,7 @@ _NotificationManagerImpl::GetBadgeNumber(void) const
 {
        unsigned int count = 0;
 
-       const AppId appId = _AppInfo::GetApplicationId();
-
-       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-
-       badge_error_e badgeError = badge_get_count(pAppId.get(), &count);
+       badge_error_e badgeError = badge_get_count(appinfo_get_appid(), &count);
 
        if (badgeError == BADGE_ERROR_NONE)
        {
@@ -233,9 +230,7 @@ _NotificationManagerImpl::NotifyImpl(const String& messageText, int badgeNumber,
 
        if (badgeNumber >= 0)
        {
-               const AppId appId = _AppInfo::GetApplicationId();
-               std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-               badge_error_e badgeError = badge_set_count(pAppId.get(), badgeNumber);
+               badge_error_e badgeError = badge_set_count(appinfo_get_appid(), badgeNumber);
                SysTryLog(NID_APP, badgeError == BADGE_ERROR_NONE, "badge_set_count failed(%d).", badgeError);
        }
 
index 8826226..8d1ea46 100644 (file)
 
 #include <limits.h>
 
+#include <FBaseRt_LibraryImpl.h>
+
 #include "FApp_RequestManagerT.h"
 #include "FApp_LaunchInfo.h"
 #include "FApp_AppArg.h"
 
+using namespace Tizen::Base::Runtime;
+
 
 namespace Tizen { namespace App
 {
@@ -35,6 +39,16 @@ _ResultInfo::~_ResultInfo(void)
        delete pArg;
 }
 
+_InProcessInfo::~_InProcessInfo(void)
+{
+       delete pLib;
+}
+
+_LaunchInfo::~_LaunchInfo(void)
+{
+       delete pArg;
+}
+
 
 template<typename T>
 _RequestManagerT<T>::_RequestManagerT(void)