Revert "update codes for NotificationManager and NotificationRequest class"
authorJungmin, Park <jungmin76.park@samsung.com>
Wed, 3 Apr 2013 10:30:40 +0000 (19:30 +0900)
committerGerrit Code Review <gerrit2@kim11>
Wed, 3 Apr 2013 10:30:40 +0000 (19:30 +0900)
This reverts commit 706bff070946800c4414061e60bfc420208f017c

inc/FShellNotificationManager.h
inc/FShellNotificationRequest.h
src/core/FShellNotificationManager.cpp
src/core/FShell_NotificationManagerImpl.cpp
src/core/FShell_NotificationRequestImpl.cpp

index 6919ddd..f0c0c82 100644 (file)
@@ -182,9 +182,8 @@ public:
         * @return              An error code
         * @param[in]   badgeNumber                     The badge number
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified input parameter is invalid.
-        *                                                                      - The specified @c badgeNumber is less than @c 0 or the @c badgeNumber is greater than Shell::MAX_NOTIFICATION_BADGE_NUMBER.
+        * @exception   E_INVALID_ARG           The specified input parameter is invalid, or
+        *                                  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.
         */
@@ -200,9 +199,8 @@ public:
         * @return              An error code
         * @param[in]   messageText                     The notification message
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified input parameter is invalid.
-        *                                                                      - The specified @c messageText is empty or the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
+        * @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.
         */
@@ -219,9 +217,8 @@ public:
         * @param[in]   messageText                     The notification message
         * @param[in]   badgeNumber                     The badge number
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified @c messageText is empty or the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
-        *                                                                      - The specified @c badgeNumber is less than @c 0 or the @c badgeNumber is greater than Shell::MAX_NOTIFICATION_BADGE_NUMBER.
+        * @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.
         */
@@ -243,10 +240,10 @@ public:
         * @param[in]   launchArguments         The message 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.
-        *                                                                      - The specified @c badgeNumber is less than @c 0 or the @c badgeNumber is greater than Shell::MAX_NOTIFICATION_BADGE_NUMBER.
-        *                                                                      - The specified @c messageText is empty or the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
-        *                                                                      - The specified @c launchArguments is empty or the length of @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
+        *                                                                      - A specified input parameter is invalid. @n
+        *                                                                      - The specified @c badgeNumber is less than @c 0. @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.
         */
@@ -263,7 +260,10 @@ public:
         * @return              An error code
         * @param[in]   request                 The notification request
         * @exception   E_SUCCESS               The method is successful.
-        * @exception   E_INVALID_ARG           A specified input parameter is invalid.
+        * @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.
         */
@@ -283,7 +283,10 @@ public:
         * @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           A specified input parameter is invalid.
+        * @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.
         */
@@ -332,9 +335,8 @@ public:
         * @return              An error code
         * @param[in]   messageText                     The notification message
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified input parameter is invalid.
-        *                                                                      - The specified @c messageText is empty or the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
+        * @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.
         */
@@ -356,8 +358,8 @@ public:
         * @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 specified @c messageText is empty or the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
-        *                                                                      - The specified @c launchArguments is empty or the length of @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
+        *                                                                      - 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.
         */
@@ -374,7 +376,9 @@ public:
         * @return              An error code
         * @param[in]   request                 The notification request
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           A specified input parameter is invalid.
+        * @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.
         */
@@ -393,7 +397,9 @@ public:
         * @param[in]   appId                           The application ID
         * @param[in]   request                 The notification request
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           A specified input parameter is invalid.
+        * @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_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.
@@ -462,9 +468,7 @@ public:
         * @return              An error code
         * @param[in]   messageText                     The notification message
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The specified input parameter is invalid.
-        *                                                                      - The specified @c messageText is empty or the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
+        * @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.
         * @remarks             Message is displayed in the status bar.
@@ -487,7 +491,10 @@ public:
         *                                                                      The maximum size is 16 kilo bytes.
         * @param[in]   request                         The notification request
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           A specified input parameter is invalid.
+        * @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>.
@@ -512,7 +519,9 @@ public:
         *                                                                      The maximum size is 16 kilo bytes.
         * @param[in]   request                         The notification request
         * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_INVALID_ARG           A specified input parameter is invalid.
+        * @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>.
index 2f59995..18dbbf4 100644 (file)
@@ -210,7 +210,7 @@ public:
         * @return      An error code
         * @param[in]   appMessage              The message for the application
         * @exception   E_SUCCESS       The method is successful.
-        * @exception   E_INVALID_ARG   The specified @c appMessage is empty or the length of @c appMessage is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
+        * @exception   E_INVALID_ARG   The length of @c appMessage is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
         * @exception   E_INVALID_OPERATION     This instance is not bound to the application.
         * @remarks     This method returns @c E_INVALID_OPERATION if %NotificationRequest instance is not bound to the application.
         */
@@ -233,7 +233,7 @@ public:
         * @return      An error code
         * @param[in]   title   The title text
         * @exception   E_SUCCESS       The method is successful.
-        * @exception   E_INVALID_ARG   The specified @c title is empty or the length of @c title is greater than Shell::MAX_NOTIFICATION_TITLE_LENGTH.
+        * @exception   E_INVALID_ARG   The length of @c title is greater than Shell::MAX_NOTIFICATION_TITLE_LENGTH.
         */
        result SetTitleText(const Tizen::Base::String& title);
 
index 8b38bc2..8c0b36c 100644 (file)
@@ -64,7 +64,7 @@ NotificationManager::GetBadgeNumber(void)
        SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
-       SysTryReturn(NID_SHELL, !IsFailed(r), -1, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
+       SysTryReturnResult(NID_SHELL,  !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
 
        return __pNotificationManagerImpl->GetBadgeNumber();
 }
@@ -141,7 +141,7 @@ NotificationManager::GetBadgeNumberByAppId(const AppId& appId)
        SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
-       SysTryReturn(NID_SHELL, !IsFailed(r), -1, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
+       SysTryReturnResult(NID_SHELL,  !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
 
        return __pNotificationManagerImpl->GetBadgeNumber(appId);
 }
index 8874293..1f0166a 100644 (file)
@@ -245,8 +245,6 @@ _NotificationManagerImpl::GetInstance(NotificationManager& notiMgr)
 int
 _NotificationManagerImpl::GetBadgeNumber(void) const
 {
-       ClearLastResult();
-
        Tizen::App::App* pApp = Tizen::App::App::GetInstance();
        std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(pApp->GetAppId()));
 
@@ -254,6 +252,7 @@ _NotificationManagerImpl::GetBadgeNumber(void) const
        SysTryReturn(NID_SHELL, count != -1, count, E_OPERATION_FAILED, "[%s] The operation has failed. Badge may not exist.",
                                 GetErrorMessage(E_OPERATION_FAILED));
 
+       ClearLastResult();
        return count;
 }
 
@@ -273,8 +272,12 @@ _NotificationManagerImpl::NotifyMessageImpl(const AppId& appId, const Notificati
 result
 _NotificationManagerImpl::Notify(int badgeNumber)
 {
-       SysTryReturnResult(NID_SHELL, badgeNumber >= 0 && badgeNumber <= MAX_NOTIFICATION_BADGE_NUMBER, E_INVALID_ARG,
-                                               "badgeNumber is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER.");
+       SysTryReturnResult(NID_SHELL, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
+
+       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
+       {
+               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+       }
 
        Tizen::App::App* pApp = Tizen::App::App::GetInstance();
        std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(pApp->GetAppId()));
@@ -295,8 +298,7 @@ _NotificationManagerImpl::Notify(int badgeNumber)
 result
 _NotificationManagerImpl::Notify(const String& messageText)
 {
-       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0 && messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                               "messageText is less than 1 or greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
 
        NotificationRequest request;
        request.SetAlertText(messageText);
@@ -308,10 +310,13 @@ _NotificationManagerImpl::Notify(const String& messageText)
 result
 _NotificationManagerImpl::Notify(const String& messageText, int badgeNumber)
 {
-       SysTryReturnResult(NID_SHELL, badgeNumber >= 0 && badgeNumber <= MAX_NOTIFICATION_BADGE_NUMBER, E_INVALID_ARG,
-                                               "badgeNumber is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER.");
-       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0 && messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                               "messageText is less than 1 or greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+       SysTryReturnResult(NID_SHELL, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
+       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+
+       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
+       {
+               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+       }
 
        NotificationRequest request;
        request.SetAlertText(messageText);
@@ -324,12 +329,18 @@ _NotificationManagerImpl::Notify(const String& messageText, int badgeNumber)
 result
 _NotificationManagerImpl::Notify(const String& messageText, int badgeNumber, const String& launchArguments)
 {
-       SysTryReturnResult(NID_SHELL, badgeNumber >= 0 && badgeNumber <= MAX_NOTIFICATION_BADGE_NUMBER, E_INVALID_ARG,
-                                               "badgeNumber is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER.");
-       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0 && messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                               "messageText is less than 1 or greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
-       SysTryReturnResult(NID_SHELL, launchArguments.GetLength() > 0 && launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
-                                          "launchArguments is less than 1 or greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+       SysTryReturnResult(NID_SHELL, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
+       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+       SysTryReturnResult(NID_SHELL, launchArguments != null && launchArguments.GetLength() > 0, E_INVALID_ARG,
+                                          "launchArguments is less than 0.");
+
+       SysTryReturnResult(NID_SHELL, launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
+                                          "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+
+       if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
+       {
+               badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+       }
 
        NotificationRequest request;
        request.SetAlertText(messageText);
@@ -342,8 +353,6 @@ _NotificationManagerImpl::Notify(const String& messageText, int badgeNumber, con
 int
 _NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const
 {
-       ClearLastResult();
-
        bool b = _Aul::IsInstalled(appId);
        SysTryReturn(NID_SHELL, b == true, -1, E_APP_NOT_INSTALLED, "[E_OBJ_NOT_FOUND] The application %ls is not installed",
                                 appId.GetPointer());
@@ -352,6 +361,7 @@ _NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const
 
        SysTryReturn(NID_SHELL, count != -1, count, E_OPERATION_FAILED, "[%s] The operation has failed. Badge may not exist.",
                                 GetErrorMessage(E_OPERATION_FAILED));
+       ClearLastResult();
 
        return count;
 }
@@ -359,8 +369,7 @@ _NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const
 result
 _NotificationManagerImpl::NotifyOngoingActivity(const String& messageText)
 {
-       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0 && messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                               "messageText is less than 1 or greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
 
        NotificationRequest request;
        request.SetAlertText(messageText);
@@ -371,8 +380,7 @@ _NotificationManagerImpl::NotifyOngoingActivity(const String& messageText)
 result
 _NotificationManagerImpl::NotifyOngoingActivity(const String& messageText, const String& launchArguments)
 {
-       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0 && messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                               "messageText is less than 1 or greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
        SysTryReturnResult(NID_SHELL, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
        SysTryReturnResult(NID_SHELL, launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
                                           "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
@@ -400,8 +408,7 @@ _NotificationManagerImpl::RemoveNotificationByAppId(const AppId& appId)
 result
 _NotificationManagerImpl::NotifyTextMessage(const String& messageText) const
 {
-       SysTryReturnResult(NID_SHELL, messageText.GetLength() > 0 && messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                               "messageText is less than 1 or greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+       SysTryReturnResult(NID_SHELL, !messageText.IsEmpty(), E_INVALID_ARG, "MessageText is less than 0.");
 
        std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(messageText));
        int res = notification_status_message_post(pMsg.get());
@@ -416,10 +423,10 @@ _NotificationManagerImpl::NotifyTextMessage(const String& messageText) const
                r = E_INVALID_ARG;
                break;
        case NOTIFICATION_ERROR_IO:
-               r = E_OPERATION_FAILED;
+               r = E_SYSTEM;
                break;
        default:
-               r = E_OPERATION_FAILED;
+               r = E_SYSTEM;
                break;
        }
 
@@ -622,7 +629,7 @@ _NotificationManagerImpl::NotifyMessage(_NotifyType notifyType, bool isOngoing,
        // Set - content text
        if (pMsg.get())
        {
-               r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+               r = notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
                SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Notification Set Title Text failed.", GetErrorMessage(r));
        }
        // Set - icon file path
@@ -631,25 +638,11 @@ _NotificationManagerImpl::NotifyMessage(_NotifyType notifyType, bool isOngoing,
        // Set - sound file path
        if (pSoundPath.get())
        {
-               if (isOngoing && needUpdate)
-               {
-                       r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_NONE, NULL));
-               }
-               else
-               {
-                       r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath.get()));
-               }
+               r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath.get()));
        }
        else
        {
-               if (isOngoing && needUpdate)
-               {
-                       r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_NONE, NULL));
-               }
-               else
-               {
-                       r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL));
-               }
+               r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL));
        }
        SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Notification Set sound failed.", GetErrorMessage(r));
 
@@ -801,7 +794,7 @@ _NotificationManagerImpl::NotifyMessage(_NotifyType notifyType, bool isOngoing,
        pBundle = arg.GetBundle();
 
        service_create_request(pBundle, &hSvc);
-       SysTryCatch(NID_SHELL, hSvc != null, r = E_OPERATION_FAILED, r, "[E_OPERATION_FAILED] A system error has been occurred. service_create_request failed.");
+       SysTryCatch(NID_SHELL, hSvc != null, r = E_SYSTEM, r, "[%s] A system error has been occurred. service_create_request failed.", GetErrorMessage(E_SYSTEM));
 
        if (notifyType == NOTIFY_TYPE_SIMPLE || notifyType == NOTIFY_TYPE_APP_ID)
        {
@@ -810,10 +803,9 @@ _NotificationManagerImpl::NotifyMessage(_NotifyType notifyType, bool isOngoing,
        else
        if (notifyType == NOTIFY_TYPE_APP_CONTROL)
        {
-               std::unique_ptr<char[]> pOperationIdChar(_StringConverter::CopyToCharArrayN(*pOperationId));
-               int retVal = service_set_operation(hSvc, pOperationIdChar.get());
-               SysTryCatch(NID_SHELL, retVal == SERVICE_ERROR_NONE, r = E_OPERATION_FAILED, r, "[E_OPERATION_FAILED] A system error has been occurred. service_create_request failed.");
 
+               std::unique_ptr<char[]> pOperationIdChar(_StringConverter::CopyToCharArrayN(*pOperationId));
+               service_set_operation(hSvc, pOperationIdChar.get());
                if (pUriData)
                {
                        std::unique_ptr<char[]> pUri(_StringConverter::CopyToCharArrayN(*pUriData));
@@ -1002,7 +994,21 @@ _NotificationManagerImpl::RemoveNotification(bool onGoing)
                SysLog(NID_SHELL, "All [%s] notification deleted.", onGoing ? "Ongoing" : "Normal");
        }
 
-       SysTryReturnResult(NID_SHELL, err == NOTIFICATION_ERROR_NONE, E_OPERATION_FAILED, "Failed to RemoveNotification with reason (%d).", err);
+       switch (err)
+       {
+       case NOTIFICATION_ERROR_NONE:
+               r = E_SUCCESS;
+               break;
+
+       case NOTIFICATION_ERROR_INVALID_DATA:
+               r = E_INVALID_ARG;
+               break;
+
+       default:
+               r = E_SYSTEM;
+               break;
+       }
+
        return r;
 }
 
@@ -1038,7 +1044,21 @@ _NotificationManagerImpl::RemoveNotificationByAppId(const Tizen::App::AppId& app
                SysLog(NID_SHELL, "All [%s] notification deleted.", onGoing ? "Ongoing" : "Normal");
        }
 
-       SysTryReturnResult(NID_SHELL, err == NOTIFICATION_ERROR_NONE, E_OPERATION_FAILED, "Failed to RemoveNotificationByAppId with reason (%d).", err);
+       switch (err)
+       {
+       case NOTIFICATION_ERROR_NONE:
+               r = E_SUCCESS;
+               break;
+
+       case NOTIFICATION_ERROR_INVALID_DATA:
+               r = E_INVALID_ARG;
+               break;
+
+       default:
+               r = E_SYSTEM;
+               break;
+       }
+
        return r;
 }
 
@@ -1094,7 +1114,7 @@ result
 _NotificationManagerImpl::AddBadgeEventListener(IBadgeEventListener& listener)
 {
        SysTryReturnResult(NID_SHELL, !__badgeEventListenerList.Contains(&listener), E_OBJ_ALREADY_EXIST, "The listener is already added.");
-       SysLog(NID_SHELL, "AddBadgeEventListener (%x)", &listener);
+       SysLog(NID_SHELL, "(%x)", &listener);
 
        result r = _BadgeManagerImpl::GetInstance()->AddPrimaryBadgeEventListener(*this);
        SysTryReturnResult(NID_SHELL, !IsFailed(r), E_SYSTEM, "Failed to AddPrimaryBadgeEventListener with reason (%s)", GetErrorMessage(r) );
@@ -1105,7 +1125,7 @@ _NotificationManagerImpl::AddBadgeEventListener(IBadgeEventListener& listener)
 result
 _NotificationManagerImpl::RemoveBadgeEventListener(IBadgeEventListener& listener)
 {
-       SysLog(NID_SHELL, "RemoveBadgeEventListener (%x)", &listener);
+       SysLog(NID_SHELL, "(%x)", &listener);
        result r = __badgeEventListenerList.Remove(&listener);
        SysTryReturn(NID_SHELL, !IsFailed(r), r, r, "Failed to RemoveBadgeEventListener with reason (%s)", GetErrorMessage(r) );
 
index 42898dd..bfc3193 100644 (file)
@@ -262,7 +262,7 @@ result
 _NotificationRequestImpl::SetAlertText(const String& alertText)
 {
        SysTryReturnResult(NID_SHELL, alertText.GetLength() > 0 && alertText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                          "alertText is less than 1 or alertText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+                                          "AlertText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
 
        __alertText = alertText;
        return E_SUCCESS;
@@ -278,8 +278,8 @@ _NotificationRequestImpl::GetAppMessage() const
 result
 _NotificationRequestImpl::SetAppMessage(const String& appMessage)
 {
-       SysTryReturnResult(NID_SHELL, appMessage.GetLength() > 0 && appMessage.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                          "appMessage is less than 1 or appMessage is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+       SysTryReturnResult(NID_SHELL, appMessage.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
+                                          "AppMessage is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
        SysTryReturnResult(NID_SHELL, __appBinding, E_INVALID_OPERATION,
                                           "The Notification instance is not bound to Application");
 
@@ -296,9 +296,8 @@ _NotificationRequestImpl::GetTitleText() const
 result
 _NotificationRequestImpl::SetTitleText(const String& titleText)
 {
-       SysTryReturnResult(NID_SHELL, titleText.GetLength() > 0 && titleText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                          "titleText is less than 1 or titleText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
-
+       SysTryReturnResult(NID_SHELL, titleText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
+                                          "TitleText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
        __titleText = titleText;
        return E_SUCCESS;
 }
@@ -383,7 +382,7 @@ _NotificationRequestImpl::SetOngoingActivityProgress(int progressValue)
 
        // use int type instead of OngoingActivityType to evade weired gcc optimization
        int activitytype = static_cast<int>(GetOngoingActivityType());
-       SysTryReturnResult(NID_SHELL, activitytype > ONGOING_ACTIVITY_TYPE_TEXT && activitytype <= ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE,
+       SysTryReturnResult(NID_SHELL, activitytype >= ONGOING_ACTIVITY_TYPE_TEXT && activitytype <= ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE,
                                           E_INVALID_OPERATION,"Invalid activity Type %d.", activitytype);
 
        if (activitytype == ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE)
@@ -515,8 +514,8 @@ _NotificationRequestImpl::GetNotificationCountText(void) const
 result
 _NotificationRequestImpl::SetNotificationCountText(const Tizen::Base::String& notificationCountText)
 {
-       SysTryReturnResult(NID_SHELL, notificationCountText.GetLength() > 0 && notificationCountText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
-                                          "notificationCountText is less than 1 or notificationCountText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+       SysTryReturnResult(NID_SHELL, notificationCountText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
+                                          "Invalid argument is used. CountText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
        __notificationCountText = notificationCountText;
        return E_SUCCESS;
 }