Apply [ACR][2/28][Add] Add methods for text message notification and notifies with...
authorSeungWon Lee <lsw2000.lee@samsung.com>
Mon, 11 Mar 2013 13:56:06 +0000 (22:56 +0900)
committerSeungWon Lee <lsw2000.lee@samsung.com>
Mon, 11 Mar 2013 13:56:06 +0000 (22:56 +0900)
Change-Id: I186d0bb9bf6d73be1ad74cc1bd737a1a667f8fe2
Signed-off-by: SeungWon Lee <lsw2000.lee@samsung.com>
inc/FShellNotificationManager.h [changed mode: 0644->0755]
packaging/osp-shell.spec [changed mode: 0644->0755]
src/core/CMakeLists.txt [changed mode: 0644->0755]
src/core/FShellNotificationManager.cpp [changed mode: 0644->0755]
src/core/FShell_NotificationManagerImpl.cpp [changed mode: 0644->0755]
src/core/FShell_NotificationManagerProxy.cpp [changed mode: 0644->0755]
src/inc/FShell_NotificationManagerImpl.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index d98fa8e..df3014b
 #include <FBase.h>
 #include <FAppTypes.h>
 
+namespace Tizen { namespace Base
+{
+namespace Collection
+{
+class IMap;
+}
+} }
+
 namespace Tizen { namespace Shell
 {
 
@@ -70,11 +78,24 @@ static const int MAX_NOTIFICATION_TITLE_LENGTH = 1024;
  */
 enum OngoingActivityType
 {
-       ONGOING_ACTIVITY_TYPE_TEXT = 1,                 /**< The progress is indicated with a text */
-       ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE,    /**< The progress is indicated with the number of bytes */
+       ONGOING_ACTIVITY_TYPE_TEXT = 1,                         /**< The progress is indicated with a text */
+       ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE,            /**< The progress is indicated with the number of bytes */
        ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE       /**< The progress is indicated with percentage */
 };
 
+/**
+ * @enum       NotificationStyle
+ *
+ * Defines the notification style.
+ *
+ * @since      2.1
+ */
+enum NotificationStyle
+{
+       NOTIFICATION_STYLE_MESSAGE_NORMAL = 1,          /**< The notification is normal style */
+       NOTIFICATION_STYLE_MESSAGE_IMAGE                        /**< The notification is image style */
+};
+
 
 /**
  * @class              NotificationManager
@@ -112,23 +133,23 @@ public:
        /**
         * This is the default constructor for this class.
         *
-        * @since       2.0
+        * @since               2.0
         */
        NotificationManager(void);
 
        /**
         * This destructor overrides Tizen::Base::Object::~Object().
         *
-        * @since       2.0
+        * @since               2.0
         */
        virtual ~NotificationManager(void);
 
        /**
         * Initializes this instance of %NotificationManager.
         *
-        * @since       2.0
+        * @since               2.0
         *
-        * @return      An error code
+        * @return              An error code
         * @exception   E_SUCCESS       The method is successful.
         */
        result Construct(void);
@@ -136,7 +157,7 @@ public:
        /**
         * Gets the current badge number of an application icon.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
@@ -144,8 +165,8 @@ public:
                                        else @c -1 if the method fails
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
-        * @remarks The specific error code can be accessed using the GetLastResult() method.
+        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @remarks             The specific error code can be accessed using the GetLastResult() method.
         *
         */
        int GetBadgeNumber(void);
@@ -153,7 +174,7 @@ public:
        /**
         * Notifies the user who has @c badgeNumber as a badge number.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
@@ -161,7 +182,7 @@ public:
         * @param[in]   badgeNumber                     The badge number
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_INVALID_ARG           The specified input parameter is invalid, or
-        *                                  the specified @c badgeNumber is less than @c 0.
+        *                                                                      the specified @c badgeNumber is less than @c 0.
         * @exception   E_OPERATION_FAILED      The operation has failed.
         * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
         */
@@ -170,7 +191,7 @@ public:
        /**
         * Notifies the user with a message.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
@@ -180,14 +201,14 @@ public:
         * @exception   E_INVALID_ARG           The specified input parameter is invalid, or
         *                                                                      the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result Notify(const Tizen::Base::String& messageText);
 
        /**
         * Notifies the user who has @c badgeNumber as badge number with a message.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
@@ -198,7 +219,7 @@ public:
         * @exception   E_INVALID_ARG           The specified @c badgeNumber is less than @c 0, or
         *                                                                      the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result Notify(const Tizen::Base::String& messageText, int badgeNumber);
 
@@ -208,7 +229,7 @@ public:
         * @c launchArguments is delivered as the value of the http://tizen.org/appcontrol/data/notification key
         * for IAppControlProviderEventListener::OnAppControlRequestReceived().
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
@@ -223,7 +244,7 @@ public:
         *                                                                      - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
         *                                                                      - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments);
 
@@ -231,19 +252,19 @@ public:
         * Notifies the user with a request message. @n
         * The notification request may have various pieces of information such as alert text, title text, launch arguments, and so on.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
         * @return              An error code
-        * @param[in]   request                 The notification request
-        * @exception   E_SUCCESS               The method is successful.
+        * @param[in]   request                         The notification request
+        * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified @c request does not have valid badge number value. @n
-        *                                                                      - The specified @c request does not have alert text. @n
-        *                                                                      - The specified @c request has invalid icon file path.
+        *                                                                      - The specified @c request does not have valid badge number value in @c request. @n
+        *                                                                      - The specified @c request does not have alert text in @c request. @n
+        *                                                                      - The specified @c request has invalid icon file path in @c request.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result Notify(const NotificationRequest& request);
 
@@ -251,44 +272,44 @@ public:
         * The user who is identified with the @c appId is notified with a request message. @n
         * The request may have various pieces of information such as alert text, title text, launch arguments, and so on.
         *
-        * @since       2.0
+        * @since               2.0
         *
         * @privlevel   partner
         * @privilege   http://tizen.org/privilege/notificationmanager
         *
         * @return              An error code
         * @param[in]   appId                           The application ID
-        * @param[in]   request                 The notification request
-        * @exception   E_SUCCESS               The method is successful.
+        * @param[in]   request                         The notification request
+        * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_APP_NOT_INSTALLED     The application is not installed.
         * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified @c request does not have valid badge number value. @n
-        *                                                                      - The specified @c request does not have alert text. @n
-        *                                                                      - The specified @c request has invalid icon file path.
+        *                                                                      - The specified @c request does not have valid badge number value in @c request. @n
+        *                                                                      - The specified @c request does not have alert text in @c request. @n
+        *                                                                      - The specified @c request has invalid icon file path in @c request.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result NotifyByAppId(const Tizen::App::AppId& appId, const NotificationRequest& request);
 
        /**
         * Removes the notification message.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
         * @return              An error code
-        * @exception   E_SUCCESS       The method is successful.
+        * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
-        * @remarks      This method returns @c E_SUCCESS when there is no outstanding notification.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
+        * @remarks             This method returns @c E_SUCCESS when there is no outstanding notification.
         */
        result RemoveNotification(void);
 
        /**
         * Removes the notification message on behalf of the specified application.
         *
-        * @since       2.0
+        * @since               2.0
         *
         * @privlevel   partner
         * @privilege   http://tizen.org/privilege/notificationmanager
@@ -298,7 +319,7 @@ public:
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_APP_NOT_INSTALLED     The application is not installed.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application did not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application did not have the privilege to call this method.
         * @remarks             Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
         */
        result RemoveNotificationByAppId(const Tizen::App::AppId& appId);
@@ -306,7 +327,7 @@ public:
        /**
         * Notifies the user about the ongoing activity using a message.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
@@ -316,7 +337,7 @@ public:
         * @exception   E_INVALID_ARG           The specified input parameter is invalid, or
         *                                                                      the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result NotifyOngoingActivity(const Tizen::Base::String& messageText);
 
@@ -326,20 +347,20 @@ public:
         * @c launchArguments is delivered as the value of the http://tizen.org/appcontrol/data/notification key
         * for IAppControlProviderEventListener::OnAppControlRequestReceived().
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
         * @return              An error code
         * @param[in]   messageText                     The notification message
-        * @param[in]  launchArguments  The launch arguments for the application
+        * @param[in]   launchArguments         The launch arguments for the application
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
         *                                                                      - A specified input parameter is invalid. @n
         *                                                                      - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
         *                                                                      - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
 
@@ -347,18 +368,18 @@ public:
         * Notifies the user about the ongoing activity using a request message. @n
         * The request may have various pieces of information such as alert text, title text, launch arguments, and so on.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
         * @return              An error code
-        * @param[in]   request                 The notification request
+        * @param[in]   request                         The notification request
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified @c request does not have either alert text or progress value. @n
-        *                                                                      - The specified @c request has invalid icon file path.
+        *                                                                      - The specified @c request does not have either alert text or progress value in @c request. @n
+        *                                                                      - The specified @c request has invalid icon file path in @c request.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result NotifyOngoingActivity(const NotificationRequest& request);
 
@@ -366,43 +387,43 @@ public:
         * Notifies the user about the ongoing activity using a request message. @n
         * The request may have various information like alert text, title text, launch arguments, and so on.
         *
-        * @since       2.0
+        * @since               2.0
         *
         * @privlevel   partner
         * @privilege   http://tizen.org/privilege/notificationmanager
         *
         * @return              An error code
         * @param[in]   appId                           The application ID
-        * @param[in]   request                 The notification request
+        * @param[in]   request                         The notification request
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified @c request does not have either alert text or progress value. @n
-        *                                                                      - The specified @c request has invalid icon file path.
+        *                                                                      - The specified @c request does not have either alert text or progress value in @c request. @n
+        *                                                                      - The specified @c request has invalid icon file path in @c request.
         * @exception   E_APP_NOT_INSTALLED     The application is not installed.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         */
        result NotifyOngoingActivityByAppId(const Tizen::App::AppId& appId, const NotificationRequest& request);
 
        /**
         * Removes the notification message for the ongoing activity.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
         * @return              An error code
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
-        * @remarks      This method returns @c E_SUCCESS when there is no outstanding notification.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
+        * @remarks             This method returns @c E_SUCCESS when there is no outstanding notification.
         */
        result RemoveOngoingActivityNotification(void);
 
        /**
         * Removes the notification message for ongoing activity on behalf of the specified application.
         *
-        * @since       2.0
+        * @since               2.0
         *
         * @privlevel   partner
         * @privilege   http://tizen.org/privilege/notificationmanager
@@ -412,7 +433,7 @@ public:
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_APP_NOT_INSTALLED     The application is not installed.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         * @remarks             Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
         */
        result RemoveOngoingActivityNotificationByAppId(const Tizen::App::AppId& appId);
@@ -420,7 +441,7 @@ public:
        /**
         * Gets the badge number of the application icon mentioned in the @c appId.
         *
-        * @since       2.0
+        * @since               2.0
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
@@ -429,17 +450,17 @@ public:
         * @param[in]   appId                           The application ID
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_APP_NOT_INSTALLED     The application is not installed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_APP_NOT_INSTALLED     The application is not installed.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
         * @remarks The specific error code can be accessed using the GetLastResult() method. @n
         *
         */
        int GetBadgeNumberByAppId(const Tizen::App::AppId& appId);
 
-       /*
-        * Notifies the user with a message.
+       /**
+        * Notifies the user with a message. It will disappear in a few seconds.
         *
-        * @since       2.1
+        * @since               2.1
         * @privlevel   public
         * @privilege   http://tizen.org/privilege/notification
         *
@@ -448,10 +469,65 @@ public:
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_INVALID_ARG           The specified input parameter is invalid.
         * @exception   E_OPERATION_FAILED      The operation has failed.
-        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
+        * @remarks             Message is displayed in the status bar.
         */
        result NotifyTextMessage(const Tizen::Base::String& messageText);
 
+       /**
+        * Notifies the user using a request message and try implicit AppControl resolution when the user selects the message on the notification area. @n
+        * The request may have various information like alert text, title text, launch arguments, and so on.
+        *
+        * @since               2.1
+        * @privlevel   public
+        * @privilege   http://tizen.org/privilege/notification
+        *
+        * @return              An error code
+        * @param[in]   operationId                     The operation ID
+        * @param[in]   pUriData                        A pointer to the URI data
+        * @param[in]   pDataType                       A pointer to the MIME type (RFC 2046) data
+        * @param[in]   pExtraData                      A pointer to an argument map of key and value pair where the key is of type Tizen::Base::String and the value is of type Tizen::Base::String to deliver to the resolved application @n
+        *                                                                      The maximum size is 16 kilo bytes.
+        * @param[in]   request                         The notification request
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
+        *                                                                      - The specified @c request does not have valid badge number value in @c request. @n
+        *                                                                      - The specified @c request does not have alert text in @c request. @n
+        *                                                                      - The specified @c request has invalid icon file path in @c request.
+        * @exception   E_OPERATION_FAILED      The operation has failed.
+        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @remarks             For more information on the implicit AppControl resolution, see <a href="../org.tizen.native.appprogramming/html/guide/app/resolving_appcontrols.htm">Resolving AppControls</a>.
+        *
+        */
+       result NotifyByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+                                                         const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request);
+
+       /**
+        * Notifies the user about the ongoing activity using a request message and try implicit AppControl resolution when the user selects the message on the notification area. @n
+        * The request may have various information like alert text, title text, launch arguments, and so on.
+        *
+        * @since               2.1
+        * @privlevel   public
+        * @privilege   http://tizen.org/privilege/notification
+        *
+        * @return              An error code
+        * @param[in]   operationId                     The operation ID
+        * @param[in]   pUriData                        A pointer to the URI data
+        * @param[in]   pDataType                       A pointer to the MIME type (RFC 2046) data
+        * @param[in]   pExtraData                      A pointer to an argument map of key and value pair where the key is of type Tizen::Base::String and the value is of type Tizen::Base::String to deliver to the resolved application @n
+        *                                                                      The maximum size is 16 kilo bytes.
+        * @param[in]   request                         The notification request
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
+        *                                                                      - The specified @c request does not have either alert text or progress value in @c request. @n
+        *                                                                      - The specified @c request has invalid icon file path in @c request.
+        * @exception   E_OPERATION_FAILED      The operation has failed.
+        * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
+        * @remarks             For more information on the implicit AppControl resolution, see <a href="../org.tizen.native.appprogramming/html/guide/app/resolving_appcontrols.htm">Resolving AppControls</a>.
+        */
+       result NotifyOngoingActivityByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+                                                                                        const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request);
+
 private:
        /**
         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
old mode 100644 (file)
new mode 100755 (executable)
index 5a20a55..e736747
@@ -40,6 +40,8 @@ BuildRequires:  osp-image-core-internal-devel
 BuildRequires:  osp-appfw-internal-devel
 BuildRequires:  osp-uifw-internal-devel
 BuildRequires:  boost-devel
+BuildRequires:  pkgconfig(badge)
+
 
 # runtime requires
 Requires: chromium
old mode 100644 (file)
new mode 100755 (executable)
index db04c83..683b0d7
@@ -25,6 +25,7 @@ INCLUDE_DIRECTORIES(
        /usr/include/libxml2
        /usr/include/system
        /usr/include/vconf
+       /usr/include/badge
 )
 
 SET (${this_target}_SOURCE_FILES
@@ -68,6 +69,7 @@ TARGET_LINK_LIBRARIES(${this_target} "-leina" )
 TARGET_LINK_LIBRARIES(${this_target} "-lecore_evas" )
 TARGET_LINK_LIBRARIES(${this_target} "-lshortcut" )
 TARGET_LINK_LIBRARIES(${this_target} "-lvconf" )
+TARGET_LINK_LIBRARIES(${this_target} "-lbadge" )
 
 SET_TARGET_PROPERTIES(${this_target}
        PROPERTIES
old mode 100644 (file)
new mode 100755 (executable)
index ee7a1bc..576c0da
@@ -22,7 +22,6 @@
 
 #include <new>
 
-#include <FAppTypes.h>
 #include <FShellNotificationManager.h>
 
 #include <FBaseSysLog.h>
@@ -248,5 +247,28 @@ NotificationManager::NotifyTextMessage(const String& messageText)
        return __pNotificationManagerImpl->NotifyTextMessage(messageText);
 }
 
-};
-};    // Tizen::Shell
+result
+NotificationManager::NotifyByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+                                                                               const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request)
+{
+       SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+       SysTryReturnResult(NID_APP,  !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+       return __pNotificationManagerImpl->NotifyByAppControl(operationId, pUriData, pDataType, pExtraData, request);
+}
+
+result
+NotificationManager::NotifyOngoingActivityByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+                                                                                                          const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request)
+{
+       SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+       SysTryReturnResult(NID_APP,  !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+       return __pNotificationManagerImpl->NotifyOngoingActivityByAppControl(operationId, pUriData, pDataType, pExtraData, request);
+}
+
+} }    // Tizen::Shell
old mode 100644 (file)
new mode 100755 (executable)
index fa156a7..37b4140
 #include <appfw/app.h>
 #include <appfw/app_manager.h>
 #include <appfw/app_ui_notification.h>
+#include <badge.h>
 
 #include <FBaseSysLog.h>
-#include <FAppTypes.h>
+#include <FApp.h>
+//#include <FAppTypes.h>
 #include <FShellNotificationManager.h>
 #include <FShellNotificationRequest.h>
 
-#include <FBaseInternalTypes.h>
+//#include <FBaseInternalTypes.h>
 #include <FBase_StringConverter.h>
 #include "FApp_AppInfo.h"
 #include "FApp_Aul.h"
@@ -107,13 +109,16 @@ IsPosted(ui_notification_h handle)
        return pStruct->posted;
 }
 
-}
+} // namespace
+
 
 namespace Tizen { namespace Shell
 {
 
 _NotificationManagerImpl::_NotificationManagerImpl(void)
-: __pNotificationManager(null)
+       : __pNotificationManagerProxy(null)
+       , __notifyPrivitId(-1)
+       , __notifyPrivitIdForOngoing(-1)
 {
 }
 
@@ -124,21 +129,7 @@ _NotificationManagerImpl::~_NotificationManagerImpl(void)
 result
 _NotificationManagerImpl::Construct(void)
 {
-       result r = E_SUCCESS;
-
-       __pNotificationManager = new (std::nothrow) _NotificationManagerProxy;
-       SysTryReturnResult(NID_APP, __pNotificationManager != null, E_OUT_OF_MEMORY, "__pNotificationManagerProxy creation failed.");
-
-       r = __pNotificationManager->Construct();
-       SysTryCatch(NID_APP, !IsFailed(r), , r, "__pNotificationManager->Construct() failed [%s].", GetErrorMessage(r));
-
        return E_SUCCESS;
-
-CATCH:
-       delete __pNotificationManager;
-       __pNotificationManager = null;
-
-       return r;
 }
 
 const _NotificationManagerImpl*
@@ -156,600 +147,673 @@ _NotificationManagerImpl::GetInstance(NotificationManager& notiMgr)
 int
 _NotificationManagerImpl::GetBadgeNumber(void) const
 {
-       int count = -1;
-       notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
+       Tizen::App::App* pApp = Tizen::App::App::GetInstance();
+       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(pApp->GetAppId()));
+
+       int count = GetBadgeCount(pAppId.get());
+       SysTryReturn(NID_APP, count != -1, count, E_OPERATION_FAILED, "[%s] The operation has failed. Badge may not exist.",
+                                GetErrorMessage(E_OPERATION_FAILED));
+
+       ClearLastResult();
        return count;
 }
 
 result
-_NotificationManagerImpl::OngoingImpl(const String& messageText, const String& launchArguments) const
+_NotificationManagerImpl::NotifyMessageImpl(const NotificationRequest& notiMessage, bool isOngoing)
 {
-       return NotifyImpl(messageText, -1, launchArguments, true);
+       return NotifyMessage(NOTIFY_TYPE_SIMPLE, isOngoing, notiMessage);
 }
 
 result
-_NotificationManagerImpl::OngoingImpl(const AppId& appId, const String& messageText, const String& launchArguments) const
+_NotificationManagerImpl::NotifyMessageImpl(const AppId& appId, const NotificationRequest& notiMessage, bool isOngoing)
 {
-
-       return NotifyImpl(appId, messageText, -1, launchArguments, true);
+       return NotifyMessage(NOTIFY_TYPE_APP_ID, isOngoing, notiMessage, &appId);
+       // No more partner, no need to use IPC.
+       //return __pNotificationManagerProxy->NotifyMessage(appId, notiMessage, isOngoing);
 }
 
+
 result
-_NotificationManagerImpl::NotifyImpl(const String& messageText, int badgeNumber,
-                                                                        const String& launchArguments,
-                                                                        bool isOngoing) const
+_NotificationManagerImpl::Notify(int badgeNumber)
 {
-       result r = E_SUCCESS;
-       char* pMsg = null;
-       notification_h core = NULL;
-       char* pkgname = NULL;
-       char* pIcon = null;
-       bundle* pKb = NULL;
-       bundle* service_data = NULL;
-       service_h svc = NULL;
-       _AppArg arg;
-       String iconPath;
-       PackageAppInfo* pPackageAppInfo = null;
+       SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
 
-       if (!messageText.IsEmpty())
+       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
        {
-               SysTryReturnResult(NID_APP,
-                                         messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                         "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+       }
 
-               if (isOngoing)
-               {
-                       core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
-                       SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
-               }
-               else
-               {
-                       core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
-                       SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
-               }
+       Tizen::App::App* pApp = Tizen::App::App::GetInstance();
+       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(pApp->GetAppId()));
 
-               pMsg = _StringConverter::CopyToCharArrayN(messageText);
-               notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (badgeNumber == 0)
+       {
+               RemoveBadge(pAppId.get());
+       }
+       else
+       if (badgeNumber > 0)
+       {
+               SetBadgeCount(pAppId.get(), badgeNumber);
+       }
 
-               const String& currappId = _AppInfo::GetApplicationId();
+       return E_SUCCESS;
+}
 
-               pPackageAppInfo = _PackageManagerImpl::GetInstance()->GetPackageAppInfoN(currappId);
-               iconPath = _PackageAppInfoImpl::GetInstance(pPackageAppInfo)->GetAppNotificationIconPath();
+result
+_NotificationManagerImpl::Notify(const String& messageText)
+{
+       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
 
-               if (!iconPath.IsEmpty() && File::IsFileExist(iconPath))
-               {
-                       pIcon = _StringConverter::CopyToCharArrayN(iconPath);
-                       r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIcon));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
-               }
+       NotificationRequest request;
+       request.SetAlertText(messageText);
+       request.SetAppMessage(L"");
 
-               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.");
+       return NotifyMessage(NOTIFY_TYPE_SIMPLE, false, request);
+}
 
-               r = arg.Construct(launchArguments);
-               SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+result
+_NotificationManagerImpl::Notify(const String& messageText, int badgeNumber)
+{
+       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.");
 
-               pKb = arg.GetBundle();
-               service_create_request(pKb, &svc);
-               service_set_package(svc, pkgname);
+       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
+       {
+               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+       }
 
-               if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
-               {
-                        notification_set_property(core, 0);
-                        notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
-                        SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
-               }
+       NotificationRequest request;
+       request.SetAlertText(messageText);
+       request.SetBadgeNumber(badgeNumber);
+       request.SetAppMessage(L"");
 
-               r = ConvertNotificationResult(notification_insert(core, NULL));
-               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
-       }
+       return NotifyMessage(NOTIFY_TYPE_SIMPLE, false, request);
+}
 
-       if (badgeNumber >= 0)
-       {
-               notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
-               SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
-       }
+result
+_NotificationManagerImpl::Notify(const String& messageText, int badgeNumber, const String& launchArguments)
+{
+       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.");
 
-CATCH:
-       delete pPackageAppInfo;
-       delete[] pMsg;
-       delete[] pIcon;
-       if (pkgname)
-       {
-               free(pkgname);
-       }
-       if (core)
+       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)
        {
-               notification_free(core);
+               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
        }
-       service_destroy(svc);
-       return r;
+
+       NotificationRequest request;
+       request.SetAlertText(messageText);
+       request.SetBadgeNumber(badgeNumber);
+       request.SetAppMessage(launchArguments);
+
+       return NotifyMessage(NOTIFY_TYPE_SIMPLE, false, request);
 }
 
-result
-_NotificationManagerImpl::NotifyImpl(const AppId& appId, const String& messageText, int badgeNumber,
-                                                                        const String& launchArguments,
-                                                                        bool isOngoing) const
+int
+_NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const
 {
-       result r = E_SUCCESS;
-       char* pMsg = null;
-       char* pIcon = null;
-       char* pDefaultIconPath = NULL;
-       char* pName = NULL;
-       notification_h core = NULL;
-       char buffer[256];
-       bundle* pKb = NULL;
-       bundle* service_data = NULL;
-       service_h svc = NULL;
-       _AppArg arg;
-       String iconPath;
-       PackageAppInfo* pPackageAppInfo = null;
+       bool b = _Aul::IsInstalled(appId);
+       SysTryReturn(NID_APP, b == true, -1, E_APP_NOT_INSTALLED, "[E_OBJ_NOT_FOUND] The application %ls is not installed",
+                                appId.GetPointer());
+       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
+       int count = GetBadgeCount(pAppId.get());
 
-       memset(buffer, 0, 256);
+       SysTryReturn(NID_APP, count != -1, count, E_OPERATION_FAILED, "[%s] The operation has failed. Badge may not exist.",
+                                GetErrorMessage(E_OPERATION_FAILED));
+       ClearLastResult();
 
-       bool isInstalled = _Aul::IsInstalled(appId);
-       SysTryReturnResult(NID_APP, isInstalled == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer());
+       return count;
+}
 
-       if (isOngoing || !messageText.IsEmpty())
-       {
-               SysTryReturnResult(NID_APP,
-                                         messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                         "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+result
+_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText)
+{
+       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
 
-               if (isOngoing)
-               {
-                       core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
-                       SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
-               }
-               else
-               {
-                       core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
-                       SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
-               }
+       NotificationRequest request;
+       request.SetAlertText(messageText);
 
-               pMsg = _StringConverter::CopyToCharArrayN(messageText);
-               notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+       return NotifyMessage(NOTIFY_TYPE_SIMPLE, true, request);
+}
 
-               snprintf(buffer, 256, "%ls", appId.GetPointer());
+result
+_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText, const String& launchArguments)
+{
+       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.");
 
-               pPackageAppInfo = _PackageManagerImpl::GetInstance()->GetPackageAppInfoN(appId);
-               iconPath = _PackageAppInfoImpl::GetInstance(pPackageAppInfo)->GetAppNotificationIconPath();
+       NotificationRequest request;
+       request.SetAlertText(messageText);
+       request.SetAppMessage(launchArguments);
 
-               if (!iconPath.IsEmpty() && File::IsFileExist(iconPath))
-               {
-                       pIcon = _StringConverter::CopyToCharArrayN(iconPath);
-                       r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIcon));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
-               }
-               else
-               {
-                       app_manager_get_app_icon_path(buffer, &pDefaultIconPath);
-                       r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pDefaultIconPath));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set icon path  failed.", GetErrorMessage(r));
-               }
+       return NotifyMessage(NOTIFY_TYPE_SIMPLE, true, request);
+}
 
-               app_manager_get_app_name(buffer, &pName);
-               r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_TITLE, pName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
-               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
+result
+_NotificationManagerImpl::RemoveOngoingActivityNotificationByAppId(const AppId& appId)
+{
+       return RemoveNotificationByAppId(appId, true);
+       // No more partner, no need to use IPC.
+       //return __pNotificationManagerProxy->RemoveNotification(appId, true);
+}
 
-               r = arg.Construct(launchArguments);
-               SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
 
-               pKb = arg.GetBundle();
-               service_create_request(pKb, &svc);
-               service_set_app_id(svc, buffer);
+result
+_NotificationManagerImpl::RemoveNotificationByAppId(const AppId& appId)
+{
+       return RemoveNotificationByAppId(appId, false);
 
-               if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
-               {
-                        notification_set_property(core, 0);
-                        notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
-                        SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), buffer);
-               }
+       // No more partner, no need to use IPC.
+       //return __pNotificationManagerProxy->RemoveNotification(appId,false);
+}
 
-               r = ConvertNotificationResult(notification_insert(core,NULL));
-               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
-       }
+result
+_NotificationManagerImpl::NotifyTextMessage(const String& messageText) const
+{
+       SysTryReturnResult(NID_APP, !messageText.IsEmpty(), E_INVALID_ARG, "MessageText is less than 0.");
 
-       if (badgeNumber >= 0)
-       {
-               notification_set_badge(buffer, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
-               SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
-       }
+       std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(messageText));
+       int res = notification_status_message_post(pMsg.get());
 
-CATCH:
-       delete[] pMsg;
-       delete[] pIcon;
-       delete pPackageAppInfo;
-       if (pDefaultIconPath)
-       {
-               free(pDefaultIconPath);
-       }
-       if (core)
+       result r = E_SUCCESS;
+       switch (res)
        {
-               notification_free(core);
+       case NOTIFICATION_ERROR_NONE:
+               // success
+               break;
+       case NOTIFICATION_ERROR_INVALID_DATA:
+               r = E_INVALID_ARG;
+               break;
+       case NOTIFICATION_ERROR_IO:
+               r = E_SYSTEM;
+               break;
+       default:
+               r = E_SYSTEM;
+               break;
        }
 
-       if (pName)
-       {
-               free(pName);
-       }
-       service_destroy(svc);
+       SysLog(NID_APP, "[%s] %ls posted.", GetErrorMessage(r), messageText.GetPointer());
        return r;
 }
 
+result
+_NotificationManagerImpl::NotifyByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+                                                                                        const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request)
+{
+       result r = E_SUCCESS;
+
+       r = NotifyMessage(NOTIFY_TYPE_APP_CONTROL, false, request, null, &operationId, pUriData, pDataType, pExtraData);
+       return r;
+}
 
 result
-_NotificationManagerImpl::NotifyMessageImpl(const NotificationRequest& notiMessage, bool isOngoing)
+_NotificationManagerImpl::NotifyOngoingActivityByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+                                                                                                                       const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request)
 {
        result r = E_SUCCESS;
-       int progress = -1;
-       notification_h core = NULL;
-       char* pkgname = NULL;
-       char* pTitleText = NULL;
-       char* pIconPath = null;
-       char* pSoundPath = NULL;
-       bundle* pKb = NULL;
-       bundle* service_data = NULL;
-       service_h svc = NULL;
-       _AppArg arg;
-       String appiconPath;
-       PackageAppInfo* pPackageAppInfo = null;
 
-       const String& messageText = notiMessage.GetAlertText();
-       const String& launchArguments = notiMessage.GetAppMessage();
-       const String& titleText = notiMessage.GetTitleText();
-       const String& iconPath = notiMessage.GetIconFilePath();
-       const String& soundPath = notiMessage.GetSoundFilePath();
-       const int badgeNumber = notiMessage.GetBadgeNumber();
-       const int badgeOffset = notiMessage.GetBadgeOffset();
+       r = NotifyMessage(NOTIFY_TYPE_APP_CONTROL, true, request, null, &operationId, pUriData, pDataType, pExtraData);
+       return r;
+}
 
-       if (isOngoing || !messageText.IsEmpty())
-       {
-               SysTryReturnResult(NID_APP,
-                                         messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                         "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
 
-               if (isOngoing)
-               {
-                       core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
-                               SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
-                       }
-               else
-               {
-                       core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
-                       SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
-               }
-
-               std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(messageText));
-
-               if (pMsg)
-               {
-                       r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
-               }
+result
+_NotificationManagerImpl::NotifyMessage(_NotifyType notifyType, bool isOngoing, const NotificationRequest& notifyRequest, const AppId* pAppId,
+                                                                               const Tizen::Base::String* pOperationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType, const Tizen::Base::Collection::IMap* pExtraData)
+{
+       result r = E_SUCCESS;
+       std::unique_ptr<char[]> pAppIdChar(null);
 
-               if (!titleText.IsEmpty())
-               {
-                       pTitleText = _StringConverter::CopyToCharArrayN(titleText);
-                       r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_TITLE, pTitleText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
-               }
+       // Set pAppIdChar
+       if ((notifyType == NOTIFY_TYPE_SIMPLE) || (notifyType == NOTIFY_TYPE_APP_CONTROL))
+       {
+//             // Below code not working for service appication context. So app_get_id API should be use for resolve this issue.
+//             char* pkgname = null;
+//             app_get_id(&pkgname);   // AppId. (Not package Id)
+//             SysTryReturnResult(NID_APP, pkgname != NULL, E_OBJ_NOT_FOUND,"Cannot acquire package name for current application.");
+//             const String currentAppId(pkgname);
+//             free(pkgname);
+               Tizen::App::App* pApp = Tizen::App::App::GetInstance();
+               const String currentAppId = pApp->GetAppId();
+               std::unique_ptr<char[]> pAppIdTemp(_StringConverter::CopyToCharArrayN(currentAppId));
+               pAppIdChar = std::move(pAppIdTemp);
+               SysLog(NID_APP, "app_get_id: %ls", currentAppId.GetPointer());
+       }
+       else
+       if (notifyType == NOTIFY_TYPE_APP_ID)
+       {
+               bool isAppInstalled = _Aul::IsInstalled(*pAppId);
+               SysTryReturnResult(NID_APP, isAppInstalled == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", pAppId->GetPointer());
+               std::unique_ptr<char[]> pAppIdTemp(_StringConverter::CopyToCharArrayN(*pAppId));
+               pAppIdChar = std::move(pAppIdTemp);
+       }
+       else
+       {
+               SysTryReturnResult(NID_APP, false, E_INVALID_ARG, "Invalid argument is used.");
+       }
 
-               if (!iconPath.IsEmpty() )
+       const int badgeNumber = notifyRequest.GetBadgeNumber();
+       const int badgeOffset = notifyRequest.GetBadgeOffset();
+       const String& contentText = notifyRequest.GetAlertText();
+       // Allow change the badge without other properties.
+       if (badgeNumber != -1 || badgeOffset != -1)
+       {
+               // Set - Badge
+               if (badgeOffset != 0)
                {
-                       pIconPath = _StringConverter::CopyToCharArrayN(iconPath);
-                       r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIconPath));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
+                       int badgeNumber = GetBadgeCount(pAppIdChar.get());
+                       if (badgeNumber <= 0)
+                       {
+                               SetBadgeCount(pAppIdChar.get(), badgeOffset);
+                       }
+                       else
+                       {
+                               SetBadgeCount(pAppIdChar.get(), badgeNumber + badgeOffset);
+                       }
                }
                else
                {
-                       const String& currappId = _AppInfo::GetApplicationId();
-                       pPackageAppInfo = _PackageManagerImpl::GetInstance()->GetPackageAppInfoN(currappId);
-
-                       appiconPath = _PackageAppInfoImpl::GetInstance(pPackageAppInfo)->GetAppNotificationIconPath();
-
-                       if (!appiconPath.IsEmpty() && File::IsFileExist(appiconPath))
+                       if (badgeNumber == 0)
+                       {
+                               RemoveBadge(pAppIdChar.get());
+                       }
+                       else
+                       if (badgeNumber > 0)
                        {
-                               pIconPath = _StringConverter::CopyToCharArrayN(appiconPath);
-                               r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIconPath));
-                               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
+                               SetBadgeCount(pAppIdChar.get(), badgeNumber);
                        }
                }
-
-               if (!soundPath.IsEmpty())
+               if (!(isOngoing || !contentText.IsEmpty()))
                {
-                       pSoundPath = _StringConverter::CopyToCharArrayN(soundPath);
-                       r = ConvertNotificationResult(notification_set_sound(core, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set sound failed.", GetErrorMessage(r));
+                       SysLog(NID_APP, "No valid for Notification, just for set a badgeNumber update.");
+                       return E_SUCCESS;
                }
+       }
+       SysTryReturnResult(NID_APP, (isOngoing || !contentText.IsEmpty()), E_INVALID_ARG, "Invalid argument is used. MessageText is Empty");
+
+       const String& titleText = notifyRequest.GetTitleText();
+       const String& launchArguments = notifyRequest.GetAppMessage();
+       const String& iconPath = notifyRequest.GetIconFilePath();
+       const String& soundPath = notifyRequest.GetSoundFilePath();
+       const notification_type_e notiType = isOngoing ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
+       int notiPrivateId = isOngoing ? __notifyPrivitIdForOngoing : __notifyPrivitId;
+       notification_h notiHandle = null;
+       bundle* pBundle = null;
+       bool needUpdate = false;
+       bundle* service_data = null;
+       _AppArg arg;
+       service_h hSvc = null;
+       notification_ly_type_e layout= NOTIFICATION_LY_NOTI_EVENT_SINGLE;
 
-               app_get_id(&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);
-               SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+       // Notification creation
+       if (notiPrivateId != -1)
+       {
+               notiHandle = notification_load(pAppIdChar.get(), notiPrivateId);
+               SysTryLog(NID_APP, notiHandle != null, "Get notiHandle(%d) from notiPrivateId(%d).", notiHandle, notiPrivateId);
+       }
 
-               pKb = arg.GetBundle();
-               service_create_request(pKb, &svc);
-               service_set_app_id(svc, pkgname);
+       if (notiHandle == null)
+       {
+               SysLog(NID_APP, "Previous notification(%d) no more valid - create new notification", notiPrivateId);
+               notiPrivateId = -1;             // reset
+               notiHandle = notification_create(notiType);
+       }
+       SysTryReturnResult(NID_APP, notiHandle != null , E_SYSTEM, "A system error has been occurred. Notification creation/load failed ");
 
-               if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
-               {
-                        notification_set_property(core, 0);
-                        notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
-                        SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
-               }
+       // Content text(Alert text)
+       std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(contentText));
 
-               if (isOngoing)
+       // Title text
+       std::unique_ptr<char[]> pTitleText(null);
+       if (!titleText.IsEmpty())
+       {
+               std::unique_ptr<char[]> pTitleTextTemp(_StringConverter::CopyToCharArrayN(titleText));
+               pTitleText = std::move(pTitleTextTemp);
+       }
+       else
+       {
+               char* pAppName = null;
+               app_manager_get_app_name(pAppIdChar.get(), &pAppName);
+               if (pAppName)
                {
-                       OngoingActivityType activityType = notiMessage.GetOngoingActivityType();
-                       progress = notiMessage.GetOngoingActivityProgress();
-                       switch (activityType)
-                       {
-                       case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE:
-                               r = ConvertNotificationResult(notification_insert(core,NULL));
-                               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
-                               r = ConvertNotificationResult(notification_update_progress(core, NOTIFICATION_PRIV_ID_NONE, progress/100.));
-                               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
-                               break;
-                       case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE:
-                               r = ConvertNotificationResult(notification_insert(core,NULL));
-                               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
-                               r = ConvertNotificationResult(notification_update_size(core, NOTIFICATION_PRIV_ID_NONE, progress));
-                               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
-                               break;
-                       case ONGOING_ACTIVITY_TYPE_TEXT:
-                               r = ConvertNotificationResult(notification_insert(core,NULL));
-                               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
-                               break;
-                       default:
-                               r = E_OPERATION_FAILED;
-                               // ui_notification_set_content() is done already
-                               break;
-                       }
+                       String appName(pAppName);
+                       std::unique_ptr<char[]> pTitleTextTemp(_StringConverter::CopyToCharArrayN(appName));
+                       pTitleText = std::move(pTitleTextTemp);
+                       free(pAppName);
+                       //SysLog(NID_APP, "Application Id is %ls.", appName.GetPointer());
                }
                else
                {
-                       r = ConvertNotificationResult(notification_insert(core,NULL));
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
+                       SysTryLog(NID_APP, pTitleText, "Failed to get title from app_manager_get_app_name for default setting.");
                }
        }
-       else
-       {
-               SysTryReturnResult(NID_APP, 0, E_INVALID_ARG, "MessageText is Empty");
-       }
-
-       if (badgeNumber >= 0)
+       // Icon file path
+       std::unique_ptr<char[]> pIconPath(null);
+       if (!iconPath.IsEmpty())
        {
-               notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
-               SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
+               std::unique_ptr<char[]> pIconPathTemp(_StringConverter::CopyToCharArrayN(iconPath));
+               pIconPath = std::move(pIconPathTemp);
        }
-
-       if (badgeOffset != 0)
+       else
        {
-               // badge offset is exclusive to badge number
+               std::unique_ptr<PackageAppInfo> pPackageAppInfo(_PackageManagerImpl::GetInstance()->GetPackageAppInfoN(pAppIdChar.get()));
+               const String& appIconPath(_PackageAppInfoImpl::GetInstance(pPackageAppInfo.get())->GetAppNotificationIconPath());
 
-               int count = 0;
-               notification_error_e noti_err = notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
-               if (noti_err == NOTIFICATION_ERROR_NONE)
+               if (!appIconPath.IsEmpty() && File::IsFileExist(appIconPath))
                {
-                       count += badgeOffset;
-                       if (count > 0)
+                       std::unique_ptr<char[]> pIconPathTemp(_StringConverter::CopyToCharArrayN(appIconPath));
+                       pIconPath = std::move(pIconPathTemp);
+               }
+               else
+               {
+                       char* pDefaultIconPath = null;
+                       app_manager_get_app_icon_path(pAppIdChar.get(), &pDefaultIconPath);
+                       if (pDefaultIconPath)
                        {
-                               notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, count);
-                               SysLog(NID_APP, "Badge number is set to %d.", count);
+                               String iconPath(pDefaultIconPath);
+                               std::unique_ptr<char[]> pIconPathTemp(_StringConverter::CopyToCharArrayN(iconPath));
+                               pIconPath = std::move(pIconPathTemp);
+                               free(pDefaultIconPath);
                        }
+                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set icon path  failed.", GetErrorMessage(r));
                }
        }
-
-CATCH:
-       delete[] pIconPath;
-       delete[] pTitleText;
-       delete[] pSoundPath;
-       delete pPackageAppInfo;
-
-       if (pkgname)
+       // Sound file path
+       std::unique_ptr<char[]> pSoundPath(null);
+       if (!soundPath.IsEmpty())
        {
-               free(pkgname);
+               std::unique_ptr<char[]> pSoundPathTemp(_StringConverter::CopyToCharArrayN(soundPath));
+               pSoundPath = std::move(pSoundPathTemp);
        }
-       if (core)
+       // Set - AppId
+       if (notifyType == NOTIFY_TYPE_APP_ID)
        {
-               notification_free(core);
+               r = ConvertNotificationResult(notification_set_pkgname(notiHandle, pAppIdChar.get()));
+               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Package name failed.", GetErrorMessage(r));
        }
-       service_destroy(svc);
-       return r;
-}
-
-result
-_NotificationManagerImpl::NotifyMessageImpl(const AppId& appId, const NotificationRequest& notiMessage, bool isOngoing)
-{
-       return __pNotificationManager->NotifyMessage(appId, notiMessage, isOngoing);
-}
-
-
-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)
+       // Set - title text
+       if (pTitleText.get())
        {
-               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+               r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_TITLE, pTitleText.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Title Text failed.", GetErrorMessage(r));
        }
-
-       String messageText = String(L"");
-       String appMessage = String(L"");
-
-       return NotifyImpl(messageText, badgeNumber, appMessage, false);
-}
-
-result
-_NotificationManagerImpl::Notify(const String& messageText) const
-{
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-
-       String appMessage = String(L"");
-
-       return NotifyImpl(messageText, -1, appMessage, false);
-}
-
-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)
+       // Set - content text
+       if (pMsg.get())
        {
-               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+               r = notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Title Text failed.", GetErrorMessage(r));
        }
+       // Set - icon file path
+       r = ConvertNotificationResult(notification_set_image(notiHandle, NOTIFICATION_IMAGE_TYPE_ICON, pIconPath.get()));
+       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set icon path  failed.", GetErrorMessage(r));
+       // Set - sound file path
+       r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath.get()));
+       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set sound  failed.", GetErrorMessage(r));
 
-       String appMessage = String(L"");
 
-       return NotifyImpl(messageText, badgeNumber, appMessage, false);
-}
+       // Set - service
+       r = arg.Construct(launchArguments);
+       SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagated.", GetErrorMessage(r));
 
-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.");
+       pBundle = arg.GetBundle();
 
-       SysTryReturnResult(NID_APP,
-                                         launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
-                                         "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+       service_create_request(pBundle, &hSvc);
+       SysTryCatch(NID_APP, hSvc != null, r = E_SYSTEM, r, "[%s] A system error has been occurred. service_create_request failed.", GetErrorMessage(E_SYSTEM));
 
-       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
+       if (notifyType == NOTIFY_TYPE_SIMPLE || notifyType == NOTIFY_TYPE_APP_ID)
        {
-               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+               service_set_app_id(hSvc, pAppIdChar.get());
        }
+       else
+       if (notifyType == NOTIFY_TYPE_APP_CONTROL)
+       {
 
-       return NotifyImpl(messageText, badgeNumber, launchArguments, false);
-}
-
-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());
-
-       char buffer[256];
-       int count = -1;
-
-       memset(buffer, 0, 256);
-
-       snprintf(buffer, 256, "%ls", appId.GetPointer());
-
-       notification_get_badge(buffer, NOTIFICATION_GROUP_ID_NONE, &count);
-
-       return count;
-}
-
-
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, int badgeNumber) const
-{
-       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);
-}
-
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText) const
-{
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-
-       return NotifyImpl(appId, messageText, -1, String(L""));
-}
-
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, 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.");
-
-       return NotifyImpl(appId, messageText, badgeNumber, String(L""));
-}
+               std::unique_ptr<char[]> pOperationIdChar(_StringConverter::CopyToCharArrayN(*pOperationId));
+               service_set_operation(hSvc, pOperationIdChar.get());
+               if (pUriData)
+               {
+                       std::unique_ptr<char[]> pUri(_StringConverter::CopyToCharArrayN(*pUriData));
+                       service_set_uri(hSvc, pUri.get());
+               }
+               if (pDataType)
+               {
+                       std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(*pDataType));
+                       service_set_mime(hSvc, pMime.get());
+               }
+               if (pExtraData)
+               {
+                       std::unique_ptr<Tizen::Base::Collection::IMapEnumerator> pMapEnum(pExtraData->GetMapEnumeratorN());
+                       if (pMapEnum)
+                       {
+                               while (pMapEnum->MoveNext() == E_SUCCESS)
+                               {
+                                       String* pKey = static_cast<String* > (pMapEnum->GetKey());
+                                       String* pValue = static_cast<String* > (pMapEnum->GetValue());
+                                       if (pKey && pValue)
+                                       {
+                                               std::unique_ptr<char[]> pKeyString(_StringConverter::CopyToCharArrayN(*pKey));
+                                               std::unique_ptr<char[]> pValueString(_StringConverter::CopyToCharArrayN(*pValue));
+                                               service_add_extra_data(hSvc, pKeyString.get(), pValueString.get());
+                                       }
+                                       else
+                                       {
+                                               SysLog(NID_APP, "pKey or pValue is ivalid.");
+                                       }
+                               }
+                       }
+               }
+       }
 
-result
-_NotificationManagerImpl::NotifyByAppId(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.");
+       if (service_to_bundle(hSvc, &service_data) == SERVICE_ERROR_NONE)
+       {
+               notification_set_property(notiHandle, 0);
+               notification_set_execute_option(notiHandle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+       }
+       else
+       {
+               SysLog(NID_APP, "service_to_bundle failed");
+       }
 
-       return NotifyImpl(appId, messageText, -1, launchArguments);
-}
+       // insert for new notification / update for exist one.
+       if (notiPrivateId == -1)
+       {       // new
+               r = ConvertNotificationResult(notification_insert(notiHandle, &notiPrivateId));
+               SysLog(NID_APP, "Insert notification and get new notiPrivateId(%d)", notiPrivateId);
+               SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
+               if (isOngoing)
+               {
+                       __notifyPrivitIdForOngoing  = notiPrivateId;
+               }
+               else
+               {
+                       __notifyPrivitId = notiPrivateId;
+               }
+       }
+       else
+       {
+               needUpdate = true;
+       }
 
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, 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.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.");
+       // Set layout
+       if (isOngoing)
+       {
+               OngoingActivityType activityType = notifyRequest.GetOngoingActivityType();
+               if (activityType == ONGOING_ACTIVITY_TYPE_TEXT)
+               {
+                       layout = NOTIFICATION_LY_ONGOING_EVENT;
+               }
+               else
+               {
+                       layout = NOTIFICATION_LY_ONGOING_PROGRESS;
+               }
+       }
+       else
+       {
+               // TODO: check and set from noti type.
+       }
+       notification_set_layout(notiHandle, layout);
 
-       return NotifyImpl(appId, messageText, badgeNumber, launchArguments);
-}
+       // For ongoing
+       if (isOngoing)
+       {
+               OngoingActivityType activityType = notifyRequest.GetOngoingActivityType();
+               int progress = notifyRequest.GetOngoingActivityProgress();
 
-result
-_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText) const
-{
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+               switch (activityType)
+               {
+               case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE:
+                       r = ConvertNotificationResult(notification_update_progress(notiHandle, notiPrivateId, progress/100.));
+                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
+                       r = ConvertNotificationResult(notification_update_content(notiHandle, notiPrivateId, pMsg.get()));
+                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
+                       break;
+
+               case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE:
+                       r = ConvertNotificationResult(notification_update_size(notiHandle, notiPrivateId, progress));
+                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
+                       r = ConvertNotificationResult(notification_update_content(notiHandle, notiPrivateId, pMsg.get()));
+                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
+                       break;
+
+               case ONGOING_ACTIVITY_TYPE_TEXT:
+                       r = ConvertNotificationResult(notification_update_content(notiHandle, notiPrivateId, pMsg.get()));
+                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
+                       break;
+
+               default:
+                       r = E_OPERATION_FAILED;
+                       break;
+               }
+       }
 
-       return OngoingImpl(messageText, String(L""));
-}
+       // notification_update call on Non ongoing or Text type ongoing only.
+       //if (needUpdate && !(isOngoing && (ONGOING_ACTIVITY_TYPE_TEXT != notifyRequest.GetOngoingActivityType())))
+       if (needUpdate && !isOngoing)
+       {
+               notification_update(notiHandle);
+               SysLog(NID_APP, "Notification update from notiPrivateId(%d)", notiPrivateId);
+       }
 
-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.");
 
-       return OngoingImpl(messageText, launchArguments);
+CATCH:
+       service_destroy(hSvc);
+       notification_free(notiHandle);
+       return r;
 }
 
 result
-_NotificationManagerImpl::NotifyOngoingActivityByAppId(const AppId& appId, const String& messageText) const
+_NotificationManagerImpl::RemoveNotification(void)
 {
-       SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-
-       return OngoingImpl(appId, messageText, String(L""));
+       return RemoveNotification(false);
+//     result r = E_SUCCESS;
+//     notification_error_e err = NOTIFICATION_ERROR_NONE;
+//
+//     if (__notifyPrivitId != -1)
+//     {
+//             notification_h notiHandle = notification_load(null, __notifyPrivitId);
+//             if (notiHandle)
+//             {
+//                     notification_delete(notiHandle);
+//             }
+//             notification_free(notiHandle);
+//     }
+//     else
+//     {
+//             err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
+//     }
+//
+//     switch (err)
+//     {
+//     case NOTIFICATION_ERROR_NONE:
+//             r = E_SUCCESS;
+//             break;
+//
+//     case NOTIFICATION_ERROR_INVALID_DATA:
+//             r = E_INVALID_ARG;
+//             break;
+//
+//     default:
+//             r = E_OPERATION_FAILED;
+//             break;
+//     }
+//
+//     return r;
 }
 
 result
-_NotificationManagerImpl::NotifyOngoingActivityByAppId(const AppId& appId, const String& messageText,
-                                                                                                               const String& launchArguments) const
+_NotificationManagerImpl::RemoveOngoingActivityNotification(void)
 {
-       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 OngoingImpl(appId, messageText, launchArguments);
+       return RemoveNotification(true);
+//     result r = E_SUCCESS;
+//     notification_error_e err = NOTIFICATION_ERROR_NONE;
+//
+//     if (__notifyPrivitIdForOngoing != -1)
+//     {
+//             notification_h notiHandle = notification_load(null, __notifyPrivitIdForOngoing);
+//             if (notiHandle)
+//             {
+//                     notification_delete(notiHandle);
+//             }
+//             notification_free(notiHandle);
+//     }
+//     else
+//     {
+//             err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_ONGOING);
+//     }
+//
+//     switch (err)
+//     {
+//     case NOTIFICATION_ERROR_NONE:
+//             r = E_SUCCESS;
+//             break;
+//
+//     case NOTIFICATION_ERROR_INVALID_DATA:
+//             r = E_INVALID_ARG;
+//             break;
+//
+//     default:
+//             r = E_OPERATION_FAILED;
+//             break;
+//     }
+//
+//     return r;
 }
 
 result
-_NotificationManagerImpl::RemoveOngoingActivityNotification(void)
+_NotificationManagerImpl::RemoveNotification(bool onGoing)
 {
        result r = E_SUCCESS;
+       notification_error_e err = NOTIFICATION_ERROR_NONE;
+       const notification_type_e notiType = onGoing ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
+       const int notiPrivateId = onGoing ? __notifyPrivitIdForOngoing : __notifyPrivitId;
+
+       if (notiPrivateId != -1)
+       {
+               notification_h notiHandle = notification_load(null, notiPrivateId);
+               if (notiHandle)
+               {
+                       err = notification_delete(notiHandle);
+                       SysLog(NID_APP, "Notification deleted.");
+               }
+               else
+               {
+                       SysLog(NID_APP, "Notification already deleted.");
+               }
+               notification_free(notiHandle);
+       }
+       else
+       {
+               err = notification_delete_all_by_type(null, notiType);
+               SysLog(NID_APP, "All [%s] notification deleted.", onGoing ? "Ongoing" : "Normal");
+       }
 
-       notification_error_e err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_ONGOING);
        switch (err)
        {
        case NOTIFICATION_ERROR_NONE:
@@ -761,7 +825,7 @@ _NotificationManagerImpl::RemoveOngoingActivityNotification(void)
                break;
 
        default:
-               r = E_OPERATION_FAILED;
+               r = E_SYSTEM;
                break;
        }
 
@@ -769,17 +833,37 @@ _NotificationManagerImpl::RemoveOngoingActivityNotification(void)
 }
 
 result
-_NotificationManagerImpl::RemoveOngoingActivityNotificationByAppId(const AppId& appId)
-{
-       return __pNotificationManager->RemoveNotification(appId, true);
-}
-
-result
-_NotificationManagerImpl::RemoveNotification(void)
+_NotificationManagerImpl::RemoveNotificationByAppId(const Tizen::App::AppId& appId, bool onGoing)
 {
        result r = E_SUCCESS;
+       notification_error_e err = NOTIFICATION_ERROR_NONE;
+       bool isValidAppId = _Aul::IsInstalled(appId);
+       SysTryReturnResult(NID_APP, isValidAppId == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer());
+
+       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
+       const notification_type_e notiType = onGoing ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
+       const int notiPrivateId = onGoing ? __notifyPrivitIdForOngoing : __notifyPrivitId;
+
+       if (notiPrivateId != -1)
+       {
+               notification_h notiHandle = notification_load(pAppId.get(), notiPrivateId);
+               if (notiHandle)
+               {
+                       err = notification_delete(notiHandle);
+                       SysLog(NID_APP, "Notification deleted.");
+               }
+               else
+               {
+                       SysLog(NID_APP, "Notification already deleted.");
+               }
+               notification_free(notiHandle);
+       }
+       else
+       {
+               err = notification_delete_all_by_type(pAppId.get(), notiType);
+               SysLog(NID_APP, "All [%s] notification deleted.", onGoing ? "Ongoing" : "Normal");
+       }
 
-       notification_error_e err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
        switch (err)
        {
        case NOTIFICATION_ERROR_NONE:
@@ -791,46 +875,59 @@ _NotificationManagerImpl::RemoveNotification(void)
                break;
 
        default:
-               r = E_OPERATION_FAILED;
+               r = E_SYSTEM;
                break;
        }
 
        return r;
 }
 
-result
-_NotificationManagerImpl::RemoveNotificationByAppId(const AppId& appId)
+void
+_NotificationManagerImpl::RemoveBadge(const char* pkgName) const
 {
-       return __pNotificationManager->RemoveNotification(appId,false);
+       bool badgeExist = false;
+       badge_error_e badgeError = badge_is_existing(pkgName, &badgeExist);
+       SysLog(NID_APP, "badge_is_existing: exitst= %d, error= %d.", badgeExist, badgeError);   //#####
+       if (badgeExist)
+       {
+               badgeError = badge_remove(pkgName);
+               SysLog(NID_APP, "badge_remove: error= %d.", badgeError);        //#####
+       }
+       SysLog(NID_APP, "Badge removed.");
 }
 
-result
-_NotificationManagerImpl::NotifyTextMessage(const String& messageText) const
+void
+_NotificationManagerImpl::SetBadgeCount(const char* pkgName, int badgeCount) const
 {
-       SysTryReturnResult(NID_APP, !messageText.IsEmpty(), E_INVALID_ARG, "MessageText is less than 0.");
+       bool badgeExist;
+       badge_error_e badgeError = badge_is_existing(pkgName, &badgeExist);
+       SysLog(NID_APP, "badge_is_existing: error= %d.", badgeError);   //#####
+       if (!badgeExist)
+       {
+               badgeError = badge_create(pkgName, pkgName);
+               SysLog(NID_APP, "badge_create: error= %d.", badgeError);        //#####
+       }
 
-       std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(messageText));
-       int res = notification_status_message_post(pMsg.get());
+       badge_set_count(pkgName, badgeCount);
+       SysLog(NID_APP, "badge_set_count: badgeNumber= %d.", badgeCount);
+}
 
-       result r = E_SUCCESS;
-       switch (res)
+int
+_NotificationManagerImpl::GetBadgeCount(const char* pkgName) const
+{
+       unsigned int count = 0;
+
+       badge_error_e badgeError = badge_get_count(pkgName, &count);
+       if (badgeError == BADGE_ERROR_NONE)
        {
-       case NOTIFICATION_ERROR_NONE:
-               // success
-               break;
-       case NOTIFICATION_ERROR_INVALID_DATA:
-               r = E_INVALID_ARG;
-               break;
-       case NOTIFICATION_ERROR_IO:
-               r = E_SYSTEM;
-               break;
-       default:
-               r = E_SYSTEM;
-               break;
+               SysLog(NID_APP, "badge_get_count: ret= %d.", count);
+               return count;
+       }
+       else
+       {
+               SysLog(NID_APP, "badge_get_count: error= %d.", badgeError);
+               return -1;
        }
-
-       SysLog(NID_APP, "[%s] %ls posted.", GetErrorMessage(r), messageText.GetPointer());
-       return r;
 }
 
-}}    // Tizen::Shell
+} }    // Tizen::Shell
old mode 100644 (file)
new mode 100755 (executable)
index 9b41084..9a4e42d
@@ -31,7 +31,6 @@
 #include <FIo_IpcClient.h>
 
 #include "FShell_NotificationManagerIpcMessages.h"
-#include "FShell_NotificationManagerEventParamTraits.h"
 #include "FShell_NotificationManagerProxy.h"
 
 using namespace Tizen::Base;
old mode 100644 (file)
new mode 100755 (executable)
index d1ed7cc..a9d4be1
@@ -32,6 +32,13 @@ namespace Tizen { namespace Shell
 class NotificationManager;
 class _NotificationManagerProxy;
 
+enum _NotifyType
+{
+       NOTIFY_TYPE_SIMPLE,             // Simple(Self)
+       NOTIFY_TYPE_APP_ID,             // Specific AppId
+       NOTIFY_TYPE_APP_CONTROL // AppControl
+};
+
 class _OSP_EXPORT_ _NotificationManagerImpl
        : public Tizen::Base::Object
 {
@@ -83,7 +90,7 @@ public:
         * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
         *                                  The Construct() method is not called.
         */
-       result Notify(int badgeNumber) const;
+       result Notify(int badgeNumber);
 
        /**
         * Notifies the user using a message.
@@ -98,7 +105,7 @@ public:
         * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
         *                                  The Construct() method is not called.
         */
-       result Notify(const Tizen::Base::String& messageText) const;
+       result Notify(const Tizen::Base::String& messageText);
 
        /**
         * Notifies the user using a message and badge number.
@@ -114,7 +121,7 @@ public:
         * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
         *                                  The Construct() method is not called.
         */
-       result Notify(const Tizen::Base::String& messageText, int badgeNumber) const;
+       result Notify(const Tizen::Base::String& messageText, int badgeNumber);
 
        /**
         * Notifies the user using a message and badge number. @n
@@ -138,7 +145,7 @@ public:
         *                                                                              The Construct() method is not called.
         * @see                 Application::OnUserEventReceivedN(), Application::GetAppArgumentListN()
         */
-       result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments) const;
+       result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments);
 
        /**
         * Notifies the user using a message. @n
@@ -196,7 +203,7 @@ public:
         * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
         *                                  The Construct() method is not called.
         */
-       result NotifyOngoingActivity(const Tizen::Base::String& messageText) const;
+       result NotifyOngoingActivity(const Tizen::Base::String& messageText);
 
        /**
         * Notifies the user about the ongoing activity using a message. @n
@@ -217,7 +224,7 @@ public:
         *                                  The Construct() method is not called.
         * @see                 Application::OnUserEventReceivedN(), Application::GetAppArgumentListN()
         */
-       result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
+       result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
 
        /**
         * Removes the notification message for the ongoing activity.
@@ -424,25 +431,37 @@ public:
         */
        result NotifyTextMessage(const Tizen::Base::String& messageText) const;
 
-       static const _NotificationManagerImpl* GetInstance(const NotificationManager& notiMgr);
-
-       static _NotificationManagerImpl* GetInstance(NotificationManager& notiMgr);
+       result NotifyByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+                                                         const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request);
 
-private:
-       result NotifyImpl(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
+       result NotifyOngoingActivityByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+                                                                                        const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request);
 
-       result NotifyImpl(const Tizen::App::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;
+       static const _NotificationManagerImpl* GetInstance(const NotificationManager& notiMgr);
 
-       inline result OngoingImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
+       static _NotificationManagerImpl* GetInstance(NotificationManager& notiMgr);
 
+private:
+       result NotifyMessage(_NotifyType notifyType, bool isOngoing, const NotificationRequest& notifyRequest, const Tizen::App::AppId* pAppId = null,
+                                                const Tizen::Base::String* pOperationId = null, const Tizen::Base::String* pUriData = null, const Tizen::Base::String* pDataType = null, const Tizen::Base::Collection::IMap* pExtraData = null);
+       result RemoveNotification(bool onGoing);
+       result RemoveNotificationByAppId(const Tizen::App::AppId& appId, bool onGoing);
+       //result NotifyImpl(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
+       //result NotifyImpl(const Tizen::App::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 Tizen::App::AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
        _NotificationManagerImpl(const _NotificationManagerImpl& rhs);
-
        _NotificationManagerImpl& operator =(const _NotificationManagerImpl& rhs);
 
+       void RemoveBadge(const char* pkgName) const;
+       void SetBadgeCount(const char* pkgName, int badgeCount) const;
+       int GetBadgeCount(const char* pkgName) const;
+
 private:
-       _NotificationManagerProxy* __pNotificationManager;
+       _NotificationManagerProxy* __pNotificationManagerProxy;
+       int __notifyPrivitId;
+       int __notifyPrivitIdForOngoing;
 };     //_NotificationManagerImpl
 
 } } // Tizen::Shell