remove badge dependency for legacy NotificationManager 42/11642/2 accepted/tizen/20131101.063356 submit/tizen/20131101.051136
authorYoung Ik Cho <youngik.cho@samsung.com>
Mon, 21 Oct 2013 02:58:23 +0000 (11:58 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Fri, 1 Nov 2013 04:56:43 +0000 (13:56 +0900)
Change-Id: Ifd71c8084d6da1d620a8c2fef538d8c10d29bf3e
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
packaging/osp-appfw.spec
src/CMakeLists.txt
src/app/FApp_NotificationManagerImpl.cpp
src/app/FApp_NotificationManagerImpl.h

index f27cf1c..b558e20 100755 (executable)
@@ -16,7 +16,6 @@ BuildRequires:  pkgconfig(alarm-service)
 BuildRequires:  pkgconfig(appinfo) >= 0.1.0
 BuildRequires:  pkgconfig(appsvc)
 BuildRequires:  pkgconfig(aul)
-BuildRequires:  pkgconfig(badge)
 BuildRequires:  pkgconfig(bundle)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
 BuildRequires:  pkgconfig(capi-appfw-application)
index 932efac..b596a9f 100644 (file)
@@ -15,7 +15,6 @@ pkg_check_modules(pkgs REQUIRED
        ecore
        glib-2.0
        haptic
-       badge
        icu-i18n
        iniparser
        libpcre
index 82fbbf4..a3b2224 100644 (file)
  * @brief              This is the placeholder for _NotificationManagerImpl class.
  */
 
-#include <unique_ptr.h>
-
-#include <appsvc/appsvc.h>
-#include <bundle.h>
-#include <badge.h>
-#include <notification/notification.h>
-#include <appfw/app.h>
-#include <appfw/app_ui_notification.h>
-#include <appinfo.h>
-
 #include <FBaseSysLog.h>
-#include <FAppNotificationManager.h>
 
-#include <FBaseInternalTypes.h>
-#include <FBase_StringConverter.h>
+#include <FBaseRt_LibraryImpl.h>
+
 #include "FApp_NotificationManagerImpl.h"
-#include "FApp_AppInfo.h"
-#include "FIoFile.h"
-#include "FAppPkg_PackageManagerImpl.h"
-#include "FApp_Aul.h"
-#include "FApp_AppArg.h"
-#include "FAppPkgPackageAppInfo.h"
-#include "FAppPkg_PackageAppInfoImpl.h"
+#include "FApp_INotificationManagerImpl.h"
 
 using namespace Tizen::Base;
-using namespace Tizen::App;
-using namespace Tizen::App::Package;
-using namespace Tizen::Io;
-
-extern "C" int service_create_request(bundle *data, service_h *service);
+using namespace Tizen::Base::Runtime;
 
 namespace
 {
 
-result
-ConvertNotificationResult(int error)
-{
-       switch (error)
-       {
-       case UI_NOTIFICATION_ERROR_NONE:
-               return E_SUCCESS;
-       case UI_NOTIFICATION_ERROR_INVALID_PARAMETER:
-               return E_INVALID_ARG;
-       case UI_NOTIFICATION_ERROR_OUT_OF_MEMORY:
-               return E_OUT_OF_MEMORY;
-       case UI_NOTIFICATION_ERROR_DB_FAILED:
-               return E_DATABASE;
-       case UI_NOTIFICATION_ERROR_NO_SUCH_FILE:
-               return E_SYSTEM;
-       case UI_NOTIFICATION_ERROR_INVALID_STATE:
-               return E_SYSTEM;
-       default:
-               return E_SYSTEM;
-       }
-}
+const wchar_t OSP_SHELL_SONAME[] = L"libosp-shell-core.so.1";
 
 }
 
@@ -81,512 +40,225 @@ namespace Tizen { namespace App
 {
 
 _NotificationManagerImpl::_NotificationManagerImpl(void)
+: __pNotiImpl(null)
 {
 }
 
-_NotificationManagerImpl::~_NotificationManagerImpl(void)
-{
-}
-
-result
-_NotificationManagerImpl::Construct(void)
-{
-       return E_SUCCESS;
-}
-
-const _NotificationManagerImpl*
-_NotificationManagerImpl::GetInstance(const NotificationManager& notiMgr)
-{
-       return notiMgr.__pNotificationManagerImpl;
-}
-
-_NotificationManagerImpl*
-_NotificationManagerImpl::GetInstance(NotificationManager& notiMgr)
-{
-       return notiMgr.__pNotificationManagerImpl;
-}
-
-int
-_NotificationManagerImpl::GetBadgeNumber(void) const
-{
-       unsigned int count = 0;
-
-       badge_error_e badgeError = badge_get_count(appinfo_get_appid(), &count);
-
-       if (badgeError == BADGE_ERROR_NONE)
-       {
-               SysLog(NID_APP, "badge_get_count(%d)", count);
-       }
-        else
-       {
-               SysLog(NID_APP, "badge_get_count failed(%d).", badgeError);
-               return -1;
-       }
-       return count;
-}
-
-result
-_NotificationManagerImpl::OngoingImpl(const String& messageText, const String& launchArguments) const
-{
-       return NotifyImpl(messageText, -1, launchArguments, true);
-}
-
-result
-_NotificationManagerImpl::OngoingImpl(const AppId& appId, const String& messageText, const String& launchArguments) const
-{
-
-       return NotifyImpl(appId, messageText, -1, launchArguments, true);
-}
-
-result
-_NotificationManagerImpl::NotifyImpl(const String& messageText, int badgeNumber,
-                                                                        const String& launchArguments,
-                                                                        bool isOngoing) const
-{
-       result r = E_SUCCESS;
-       int retcode = 0;
-       char* pMsg = null;
-       char* pkgname = NULL;
-       char* pIcon = NULL;
-       bundle* pKb = NULL;
-       service_h svc = NULL;
-       _AppArg arg;
-       String iconPath;
-       ui_notification_h core = NULL;
-       PackageAppInfo* pPackageAppInfo = NULL;
-
-       if (!messageText.IsEmpty())
-       {
-               SysTryReturnResult(NID_APP,
-                                         messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                         "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
-
-               retcode = ui_notification_create(isOngoing, &core);
-               SysTryReturnResult(NID_APP, retcode == UI_NOTIFICATION_ERROR_NONE, E_SYSTEM, "Notification creation error : 0x%x.", retcode);
-
-               pMsg = _StringConverter::CopyToCharArrayN(messageText);
-
-               int ret = ui_notification_set_content(core, pMsg);
-               SysTryLog(NID_APP, ret == UI_NOTIFICATION_ERROR_NONE, "Setting notification content failure : %d.", ret);
-
-               const String& currappId = _AppInfo::GetApplicationId();
-
-               pPackageAppInfo = _PackageManagerImpl::GetInstance()->GetPackageAppInfoN(currappId);
-               iconPath = _PackageAppInfoImpl::GetInstance(pPackageAppInfo)->GetAppNotificationIconPath();
-
-               if (!iconPath.IsEmpty() && File::IsFileExist(iconPath))
-               {
-                       pIcon = _StringConverter::CopyToCharArrayN(iconPath);
-                       r = ConvertNotificationResult(ui_notification_set_icon(core, pIcon));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
-               }
-
-               app_get_package(&pkgname);
-               SysTryCatch(NID_APP, pkgname != NULL, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Cannot acquire package name for current application.");
-
-               r = arg.Construct(launchArguments);
-               if (IsFailed(r))
-               {
-                       SysPropagate(NID_APP, r);
-                       goto CATCH;
-               }
-
-               pKb = arg.GetBundle();
-               service_create_request(pKb, &svc);
-
-               service_set_package(svc, pkgname);
-               r = ConvertNotificationResult(ui_notification_set_service(core, svc));
-               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set service failed.", GetErrorMessage(r));
-
-               SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
-
-               r = ConvertNotificationResult(ui_notification_post(core));
-               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
-       }
-
-       if (badgeNumber >= 0)
-       {
-               badge_error_e badgeError = badge_set_count(appinfo_get_appid(), badgeNumber);
-               SysTryLog(NID_APP, badgeError == BADGE_ERROR_NONE, "badge_set_count failed(%d).", badgeError);
-       }
 
-CATCH:
-       delete pPackageAppInfo;
-       delete[] pMsg;
-       delete[] pIcon;
-
-       if (pkgname)
-       {
-               free(pkgname);
-       }
-       if (core)
-       {
-               ui_notification_destroy(core);
-       }
-       service_destroy(svc);
-       return r;
-}
-
-result
-_NotificationManagerImpl::NotifyImpl(const AppId& appId, const String& messageText, int badgeNumber,
-                                                                        const String& launchArguments,
-                                                                        bool isOngoing) const
+_NotificationManagerImpl::~_NotificationManagerImpl(void)
 {
-       result r = E_SUCCESS;
-       int retcode = 0;
-       String iconPath;
-       char* pMsg = null;
-       char* pIcon = null;
-       char* pName = null;
-       ui_notification_h core = NULL;
-       char buffer[256];
-       bundle* pKb = NULL;
-       service_h svc = NULL;
-       _AppArg arg;
-       PackageAppInfo* pPackageAppInfo = null;
-
-       memset(buffer, 0, 256);
-
-       bool inInstalled = _Aul::IsInstalled(appId);
-       SysTryReturnResult(NID_APP, inInstalled == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer());
-
-       if (!isOngoing || !messageText.IsEmpty())
+       if (__pNotiImpl)
        {
-               SysTryReturnResult(NID_APP,
-                                         messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                         "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
-
-               retcode = ui_notification_create(isOngoing, &core);
-               SysTryReturnResult(NID_APP, retcode == UI_NOTIFICATION_ERROR_NONE, E_SYSTEM, "Notification creation error : 0x%x.", retcode);
-
-               pMsg = _StringConverter::CopyToCharArrayN(messageText);
-
-               int ret = ui_notification_set_content(core, pMsg);
-               SysTryLog(NID_APP, ret == UI_NOTIFICATION_ERROR_NONE, "Setting notification content failure : %d.", ret);
-
-               snprintf(buffer, 256, "%ls", appId.GetPointer());
+               typedef void (*NotificationDeletor)(_INotificationManagerImpl*);
 
-               pPackageAppInfo = _PackageManagerImpl::GetInstance()->GetPackageAppInfoN(appId);
-               if (pPackageAppInfo)
+               NotificationDeletor pDeleter = reinterpret_cast<NotificationDeletor>(__lib.GetProcAddress(L"DeleteNotificationManagerInstance"));
+               if (pDeleter)
                {
-                       iconPath = pPackageAppInfo->GetAppNotificationIconPath();
-
-                       if (!iconPath.IsEmpty() && File::IsFileExist(iconPath))
-                       {
-                               pIcon = _StringConverter::CopyToCharArrayN(iconPath);
-                               r = ConvertNotificationResult(ui_notification_set_icon(core, pIcon));
-                               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
-                       }
-                       else
-                       {
-                               iconPath = pPackageAppInfo->GetAppMenuIconPath();
-                               pIcon = _StringConverter::CopyToCharArrayN(iconPath);
-                               r = ConvertNotificationResult(ui_notification_set_icon(core, pIcon));
-                               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set icon path  failed.", GetErrorMessage(r));
-                       }
-
-                       const String& displayName = pPackageAppInfo->GetAppDisplayName();
-                       pName = _StringConverter::CopyToCharArrayN(displayName);
-
-                       r = ConvertNotificationResult(ui_notification_set_title(core, pName));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title failed.", GetErrorMessage(r));
+                       (*pDeleter)(__pNotiImpl);
+                       SysLog(NID_APP, "NotificationManager stub deleted.");
                }
-               else
-               {
-                       SysLog(NID_APP, "No packageInfo found for %ls", appId.GetPointer());
-               }
-
-
-               r = arg.Construct(launchArguments);
-               if (IsFailed(r))
-               {
-                       SysPropagate(NID_APP, r);
-                       goto CATCH;
-               }
-
-               pKb = arg.GetBundle();
-               service_create_request(pKb, &svc);
-
-               service_set_app_id(svc, buffer);
-               r = ConvertNotificationResult(ui_notification_set_service(core, svc));
-               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set service failed.", GetErrorMessage(r));
-
-               SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), buffer);
-
-               r = ConvertNotificationResult(ui_notification_post(core));
-               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
-       }
-
-       if (badgeNumber >= 0)
-       {
-               badge_error_e badgeError = badge_set_count(buffer, badgeNumber);
-               SysTryLog(NID_APP, badgeError == BADGE_ERROR_NONE, "badge_set_count failed(%d).", badgeError);
-       }
-
-CATCH:
-       delete pPackageAppInfo;
-       delete[] pMsg;
-       delete[] pIcon;
-       delete[] pName;
-       
-       if (core)
-       {
-               ui_notification_destroy(core);
        }
-       service_destroy(svc);
-       return r;
 }
 
 
 result
-_NotificationManagerImpl::RemoveImpl(const char* pAppId, notification_type_e type)
+_NotificationManagerImpl::Construct(void)
 {
-       result r = E_SUCCESS;
-
-       notification_error_e err = notification_delete_all_by_type(pAppId, type);
-       switch (err)
-       {
-       case NOTIFICATION_ERROR_NONE:
-               r = E_SUCCESS;
-               break;
+       result r = __lib.Construct(OSP_SHELL_SONAME, _LIBRARY_LOAD_OPTION_NODELETE | _LIBRARY_LOAD_OPTION_LAZY);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_SYSTEM, "A system error has occurred : %s.", GetErrorMessage(r));
 
-       case NOTIFICATION_ERROR_INVALID_DATA:
-               r = E_INVALID_ARG;
-               break;
+       typedef _INotificationManagerImpl* (*NotificationCreator)(void);
+       NotificationCreator pCreator = reinterpret_cast<NotificationCreator>(__lib.GetProcAddress(L"CreateNotificationManagerInstance"));
+       SysTryReturnResult(NID_APP, pCreator != null, E_SYSTEM, "No notification instance factory found.");
 
-       default:
-               r = E_SYSTEM;
-               break;
-       }
+       __pNotiImpl = (*pCreator)();
 
        return r;
 }
 
 
-result
-_NotificationManagerImpl::RemoveImpl(const AppId& appId, bool isOngoing)
+int
+_NotificationManagerImpl::GetBadgeNumber(void) const
 {
-       const bool isValidAppId = _Aul::IsInstalled(appId);
-       SysTryReturnResult(NID_APP, isValidAppId, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer());
+       SysTryReturn(NID_APP, __pNotiImpl != null, -1, E_SYSTEM, "[E_SYSTEM] Notification interface error.");
 
-       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-       const notification_type_e notiType = (isOngoing) ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
-
-       return RemoveImpl(pAppId.get(), notiType);
+       return __pNotiImpl->GetBadgeNumber();
 }
 
+
 result
 _NotificationManagerImpl::Notify(int badgeNumber) const
 {
-       SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
-
-       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
-       {
-               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
-       }
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
        String messageText = String(L"");
        String appMessage = String(L"");
 
-       return NotifyImpl(messageText, badgeNumber, appMessage, false);
+       return __pNotiImpl->Notify(messageText, badgeNumber, appMessage);
 }
 
+
 result
 _NotificationManagerImpl::Notify(const String& messageText) const
 {
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
        String appMessage = String(L"");
 
-       return NotifyImpl(messageText, -1, appMessage, false);
+       return __pNotiImpl->Notify(messageText, -1, appMessage);
 }
 
+
 result
 _NotificationManagerImpl::Notify(const String& messageText, int badgeNumber) const
 {
-       SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-
-       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
-       {
-               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
-       }
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
        String appMessage = String(L"");
 
-       return NotifyImpl(messageText, badgeNumber, appMessage, false);
+       return __pNotiImpl->Notify(messageText, badgeNumber, appMessage);
 }
 
+
 result
 _NotificationManagerImpl::Notify(const String& messageText, int badgeNumber, const String& launchArguments) const
 {
-       SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-       SysTryReturnResult(NID_APP,
-                                         launchArguments != null && launchArguments.GetLength() > 0, E_INVALID_ARG,
-                                         "launchArguments is less than 0.");
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
-       SysTryReturnResult(NID_APP,
-                                         launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
-                                         "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
-
-       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
-       {
-               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
-       }
-
-       return NotifyImpl(messageText, badgeNumber, launchArguments, false);
+       return __pNotiImpl->Notify(messageText, badgeNumber, launchArguments);
 }
 
 int
 _NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const
 {
-       bool b = _Aul::IsInstalled(appId);
-
-       SysTryReturn(NID_APP, b == true, -1, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The application %ls is not installed",
-                               appId.GetPointer());
+       SysTryReturn(NID_APP, __pNotiImpl != null, -1, E_SYSTEM, "[E_SYSTEM] Notification interface error.");
 
-       char buffer[256];
-       unsigned int count = 0;
-
-       memset(buffer, 0, 256);
-
-       snprintf(buffer, 256, "%ls", appId.GetPointer());
-
-       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-
-       badge_error_e badgeError = badge_get_count(pAppId.get(), &count);
-
-       if (badgeError == BADGE_ERROR_NONE)
-       {
-               SysLog(NID_APP, "badge_get_count(%d)", count);
-       }
-       else
-       {
-               SysLog(NID_APP, "badge_get_count failed(%d).", badgeError);
-               return -1;
-       }
-
-       return count;
+       return __pNotiImpl->GetBadgeNumber(appId);
 }
 
 
 result
 _NotificationManagerImpl::NotifyOnBehalf(const AppId& appId, int badgeNumber) const
 {
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
        SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
 
        String messageText = String(L"");
        String appMessage = String(L"");
-       return NotifyImpl(appId, messageText, badgeNumber, appMessage);
+
+       return __pNotiImpl->NotifyByAppId(appId, messageText, -1, appMessage);
 }
 
+
 result
 _NotificationManagerImpl::NotifyOnBehalf(const AppId& appId, const String& messageText) const
 {
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
-       return NotifyImpl(appId, messageText, -1, String(L""));
+       return __pNotiImpl->NotifyByAppId(appId, messageText, -1, String(L""));
 }
 
+
 result
 _NotificationManagerImpl::NotifyOnBehalf(const AppId& appId, const String& messageText, int badgeNumber) const
 {
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
        SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
 
-       return NotifyImpl(appId, messageText, badgeNumber, String(L""));
+       return __pNotiImpl->NotifyByAppId(appId, messageText, badgeNumber, String(L""));
 }
 
+
 result
 _NotificationManagerImpl::NotifyOnBehalf(const AppId& appId, const String& messageText, const String& launchArguments) const
 {
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-       SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
-       SysTryReturnResult(NID_APP,
-                                         launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
-                                         "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
-       return NotifyImpl(appId, messageText, -1, launchArguments);
+       return __pNotiImpl->NotifyByAppId(appId, messageText, -1, launchArguments);
 }
 
+
 result
 _NotificationManagerImpl::NotifyOnBehalf(const AppId& appId, const String& messageText, int badgeNumber,
                                                                                 const String& launchArguments) const
 {
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
        SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-       SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
-       SysTryReturnResult(NID_APP,
-                                         launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
-                                         "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
 
-       return NotifyImpl(appId, messageText, badgeNumber, launchArguments);
+       return __pNotiImpl->NotifyByAppId(appId, messageText, badgeNumber, launchArguments);
 }
 
+
 result
 _NotificationManagerImpl::NotifyOngoingActivity(const String& messageText) const
 {
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
-       return OngoingImpl(messageText, String(L""));
+       return __pNotiImpl->NotifyOngoingActivity(messageText, String(L""));
 }
 
+
 result
 _NotificationManagerImpl::NotifyOngoingActivity(const String& messageText, const String& launchArguments) const
 {
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-       SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
-       SysTryReturnResult(NID_APP,
-                                         launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
-                                         "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
-       return OngoingImpl(messageText, launchArguments);
+       return __pNotiImpl->NotifyOngoingActivity(messageText, launchArguments);
 }
 
+
 result
 _NotificationManagerImpl::NotifyOngoingActivityOnBehalf(const AppId& appId, const String& messageText) const
 {
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
-       return OngoingImpl(appId, messageText, String(L""));
+       return __pNotiImpl->NotifyOngoingActivityByAppId(appId, messageText, String(L""));
 }
 
+
 result
 _NotificationManagerImpl::NotifyOngoingActivityOnBehalf(const AppId& appId, const String& messageText,
                                                                                                                const String& launchArguments) const
 {
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-       SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
-       SysTryReturnResult(NID_APP,
-                                         launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
-                                         "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
 
-       return OngoingImpl(appId, messageText, launchArguments);
+       return __pNotiImpl->NotifyOngoingActivityByAppId(appId, messageText, launchArguments);
 }
 
+
 result
 _NotificationManagerImpl::RemoveOngoingActivityNotification(void)
 {
-       return RemoveImpl(NULL, NOTIFICATION_TYPE_ONGOING);
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
+
+       return __pNotiImpl->RemoveOngoingActivityNotification();
 }
 
+
 result
 _NotificationManagerImpl::RemoveOngoingActivityNotificationOnBehalf(const AppId& appId)
 {
-       return RemoveImpl(appId, true);
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
+
+       return __pNotiImpl->RemoveOngoingActivityNotificationByAppId(appId);
 }
 
+
 result
 _NotificationManagerImpl::RemoveNotification(void)
 {
-       return RemoveImpl(NULL, NOTIFICATION_TYPE_NOTI);
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
+
+       return __pNotiImpl->RemoveNotification();
 }
 
+
 result
 _NotificationManagerImpl::RemoveNotificationOnBehalf(const AppId& appId)
 {
-       return RemoveImpl(appId, false);
+       SysTryReturnResult(NID_APP, __pNotiImpl != null, E_SYSTEM, "Notification interface error.");
+
+       return __pNotiImpl->RemoveNotificationByAppId(appId);
 }
 
 };
index 77868e8..af580a0 100644 (file)
 #ifndef _FAPP_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
 #define _FAPP_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
 
-#include <notification/notification_type.h>
-
 #include <FBaseObject.h>
 #include <FAppTypes.h>
 #include <FOspConfig.h>
 
+#include <FBaseRt_LibraryImpl.h>
+
+
 namespace Tizen { namespace App
 {
 
-class NotificationManager;
+class _INotificationManagerImpl;
 
 class _NotificationManagerImpl
 {
@@ -49,7 +50,7 @@ public:
         *
         * @since               1.0
         */
-       virtual ~_NotificationManagerImpl(void);
+       ~_NotificationManagerImpl(void);
 
        /**
         * Initializes this instance of %_NotificationManagerImpl.
@@ -422,28 +423,14 @@ public:
         */
        result RemoveNotificationOnBehalf(const AppId& appId);
 
-       static const _NotificationManagerImpl* GetInstance(const NotificationManager& notiMgr);
-
-       static _NotificationManagerImpl* GetInstance(NotificationManager& notiMgr);
-
 private:
-       result NotifyImpl(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
-
-       result NotifyImpl(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
-
-       inline result OngoingImpl(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
-
-       inline result OngoingImpl(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
-
-       result RemoveImpl(const AppId& appId, bool isOngoing);
-
-       result RemoveImpl(const char* pAppId, notification_type_e type);
-
        _NotificationManagerImpl(const _NotificationManagerImpl& rhs);
 
        _NotificationManagerImpl& operator =(const _NotificationManagerImpl& rhs);
 
 private:
+       _INotificationManagerImpl* __pNotiImpl;
+       Tizen::Base::Runtime::_LibraryImpl __lib;
 };     //_NotificationManagerImpl
 
 } } // Tizen::App