2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FShell_NotificationManagerImpl.cpp
20 * @brief This is the placeholder for _NotificationManagerImpl class.
23 #include <unique_ptr.h>
24 #include <appsvc/appsvc.h>
26 #include <notification/notification.h>
27 #include <appfw/app.h>
28 #include <appfw/app_manager.h>
29 #include <appfw/app_ui_notification.h>
31 #include <FBaseSysLog.h>
32 #include <FAppTypes.h>
33 #include <FShellNotificationManager.h>
34 #include <FShellNotificationRequest.h>
36 #include <FBaseInternalTypes.h>
37 #include <FBase_StringConverter.h>
38 #include "FApp_AppInfo.h"
39 #include "FAppPkg_PackageManagerImpl.h"
40 #include "FApp_AppArg.h"
41 #include "FShell_NotificationManagerImpl.h"
42 #include "FShell_NotificationManagerProxy.h"
44 using namespace Tizen::Base;
45 using namespace Tizen::App;
46 using namespace Tizen::App::Package;
47 using namespace Tizen::Shell;
49 extern "C" int service_create_request(bundle *data, service_h *service);
50 extern "C" int service_to_bundle(service_h service, bundle** data);
56 ConvertNotificationResult(int error)
60 case NOTIFICATION_ERROR_NONE:
62 case NOTIFICATION_ERROR_INVALID_DATA:
64 case NOTIFICATION_ERROR_NO_MEMORY:
65 return E_OUT_OF_MEMORY;
66 case NOTIFICATION_ERROR_FROM_DB:
68 case NOTIFICATION_ERROR_ALREADY_EXIST_ID:
69 return E_OPERATION_FAILED;
70 case NOTIFICATION_ERROR_NOT_EXIST_ID:
71 return E_OPERATION_FAILED;
73 return E_OPERATION_FAILED;
80 static int length = (_AppInfo::GetApiVersion() < _API_VERSION_2_1) ? 127 : MAX_NOTIFICATION_MESSAGE_LENGTH;
86 IsPosted(ui_notification_h handle)
88 struct ui_notification_s
108 ui_notification_s* pStruct = reinterpret_cast<ui_notification_s*>(handle);
110 return pStruct->posted;
115 namespace Tizen { namespace Shell
118 _NotificationManagerImpl::_NotificationManagerImpl(void)
119 : __pNotificationManager(null)
123 _NotificationManagerImpl::~_NotificationManagerImpl(void)
128 _NotificationManagerImpl::Construct(void)
130 result r = E_SUCCESS;
132 __pNotificationManager = new (std::nothrow) _NotificationManagerProxy;
133 SysTryReturnResult(NID_APP, __pNotificationManager != null, E_OUT_OF_MEMORY, "__pNotificationManagerProxy creation failed.");
135 r = __pNotificationManager->Construct();
136 SysTryCatch(NID_APP, !IsFailed(r), , r, "__pNotificationManager->Construct() failed [%s].", GetErrorMessage(r));
141 delete __pNotificationManager;
142 __pNotificationManager = null;
147 const _NotificationManagerImpl*
148 _NotificationManagerImpl::GetInstance(const NotificationManager& notiMgr)
150 return notiMgr.__pNotificationManagerImpl;
153 _NotificationManagerImpl*
154 _NotificationManagerImpl::GetInstance(NotificationManager& notiMgr)
156 return notiMgr.__pNotificationManagerImpl;
160 _NotificationManagerImpl::GetBadgeNumber(void) const
163 notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
168 _NotificationManagerImpl::OngoingImpl(const String& messageText, const String& launchArguments) const
170 return NotifyImpl(messageText, -1, launchArguments, true);
174 _NotificationManagerImpl::OngoingImpl(const AppId& appId, const String& messageText, const String& launchArguments) const
177 return NotifyImpl(appId, messageText, -1, launchArguments, true);
181 _NotificationManagerImpl::NotifyImpl(const String& messageText, int badgeNumber,
182 const String& launchArguments,
183 bool isOngoing) const
185 result r = E_SUCCESS;
187 notification_h core = NULL;
188 char* pkgname = NULL;
190 bundle* service_data = NULL;
191 service_h svc = NULL;
194 if (!messageText.IsEmpty())
196 SysTryReturnResult(NID_APP,
197 messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG,
198 "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
202 core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
203 SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
207 core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
208 SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
211 pMsg = _StringConverter::CopyToCharArrayN(messageText);
212 notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
214 app_get_package(&pkgname);
215 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.");
217 r = arg.Construct(launchArguments);
218 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
220 pKb = arg.GetBundle();
221 service_create_request(pKb, &svc);
222 service_set_package(svc, pkgname);
224 if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
226 notification_set_property(core, 0);
227 notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
228 SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
231 r = ConvertNotificationResult(notification_insert(core, NULL));
232 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
235 if (badgeNumber >= 0)
237 notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
238 SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
250 notification_free(core);
252 service_destroy(svc);
257 _NotificationManagerImpl::NotifyImpl(const AppId& appId, const String& messageText, int badgeNumber,
258 const String& launchArguments,
259 bool isOngoing) const
261 result r = E_SUCCESS;
265 notification_h core = NULL;
268 bundle* service_data = NULL;
269 service_h svc = NULL;
272 memset(buffer, 0, 256);
274 bool b = _PackageManagerImpl::IsAppInstalled(appId);
276 SysTryReturnResult(NID_APP, b == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer());
278 if (isOngoing || !messageText.IsEmpty())
280 SysTryReturnResult(NID_APP,
281 messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG,
282 "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
286 core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
287 SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
291 core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
292 SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
295 pMsg = _StringConverter::CopyToCharArrayN(messageText);
296 notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
298 snprintf(buffer, 256, "%ls", appId.GetPointer());
300 app_manager_get_app_icon_path(buffer, &pIcon);
301 r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIcon));
302 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
304 app_manager_get_app_name(buffer, &pName);
305 r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_TITLE, pName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
306 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
308 r = arg.Construct(launchArguments);
309 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
311 pKb = arg.GetBundle();
312 service_create_request(pKb, &svc);
313 service_set_app_id(svc, buffer);
315 if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
317 notification_set_property(core, 0);
318 notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
319 SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), buffer);
322 r = ConvertNotificationResult(notification_insert(core,NULL));
323 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
326 if (badgeNumber >= 0)
328 notification_set_badge(buffer, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
329 SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
337 notification_free(core);
349 service_destroy(svc);
355 _NotificationManagerImpl::NotifyMessageImpl(const NotificationRequest& notiMessage, bool isOngoing)
357 result r = E_SUCCESS;
359 notification_h core = NULL;
360 char* pkgname = NULL;
361 char* pTitleText = NULL;
362 char* pIconPath = NULL;
363 char* pSoundPath = NULL;
365 bundle* service_data = NULL;
366 service_h svc = NULL;
369 const String& messageText = notiMessage.GetAlertText();
370 const String& launchArguments = notiMessage.GetAppMessage();
371 const String& titleText = notiMessage.GetTitleText();
372 const String& iconPath = notiMessage.GetIconFilePath();
373 const String& soundPath = notiMessage.GetSoundFilePath();
374 const int badgeNumber = notiMessage.GetBadgeNumber();
375 const int badgeOffset = notiMessage.GetBadgeOffset();
377 if (isOngoing || !messageText.IsEmpty())
379 SysTryReturnResult(NID_APP,
380 messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG,
381 "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
385 core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
386 SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
390 core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
391 SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
394 std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(messageText));
398 r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
399 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
402 if (!titleText.IsEmpty())
404 pTitleText = _StringConverter::CopyToCharArrayN(titleText);
405 r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_TITLE, pTitleText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
406 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
409 if (!iconPath.IsEmpty())
411 pIconPath = _StringConverter::CopyToCharArrayN(iconPath);
412 r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIconPath));
413 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
416 if (!soundPath.IsEmpty())
418 pSoundPath = _StringConverter::CopyToCharArrayN(soundPath);
419 r = ConvertNotificationResult(notification_set_sound(core, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath));
420 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set sound failed.", GetErrorMessage(r));
423 app_get_id(&pkgname);
424 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.");
426 r = arg.Construct(launchArguments);
427 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
429 pKb = arg.GetBundle();
430 service_create_request(pKb, &svc);
431 service_set_app_id(svc, pkgname);
433 if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
435 notification_set_property(core, 0);
436 notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
437 SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
442 OngoingActivityType activityType = notiMessage.GetOngoingActivityType();
443 progress = notiMessage.GetOngoingActivityProgress();
444 switch (activityType)
446 case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE:
447 r = ConvertNotificationResult(notification_insert(core,NULL));
448 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
449 r = ConvertNotificationResult(notification_update_progress(core, NOTIFICATION_PRIV_ID_NONE, progress/100.));
450 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
452 case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE:
453 r = ConvertNotificationResult(notification_insert(core,NULL));
454 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
455 r = ConvertNotificationResult(notification_update_size(core, NOTIFICATION_PRIV_ID_NONE, progress));
456 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
458 case ONGOING_ACTIVITY_TYPE_TEXT:
459 r = ConvertNotificationResult(notification_insert(core,NULL));
460 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
463 r = E_OPERATION_FAILED;
464 // ui_notification_set_content() is done already
470 r = ConvertNotificationResult(notification_insert(core,NULL));
471 SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
476 SysTryReturnResult(NID_APP, 0, E_INVALID_ARG, "MessageText is Empty");
479 if (badgeNumber >= 0)
481 notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
482 SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
485 if (badgeOffset != 0)
487 // badge offset is exclusive to badge number
490 notification_error_e noti_err = notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
491 if (noti_err == NOTIFICATION_ERROR_NONE)
493 count += badgeOffset;
496 notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, count);
497 SysLog(NID_APP, "Badge number is set to %d.", count);
512 notification_free(core);
514 service_destroy(svc);
519 _NotificationManagerImpl::NotifyMessageImpl(const AppId& appId, const NotificationRequest& notiMessage, bool isOngoing)
521 return __pNotificationManager->NotifyMessage(appId, notiMessage, isOngoing);
526 _NotificationManagerImpl::Notify(int badgeNumber) const
528 SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
530 if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
532 badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
535 String messageText = String(L"");
536 String appMessage = String(L"");
538 return NotifyImpl(messageText, badgeNumber, appMessage, false);
542 _NotificationManagerImpl::Notify(const String& messageText) const
544 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
546 String appMessage = String(L"");
548 return NotifyImpl(messageText, -1, appMessage, false);
552 _NotificationManagerImpl::Notify(const String& messageText, int badgeNumber) const
554 SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
555 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
557 if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
559 badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
562 String appMessage = String(L"");
564 return NotifyImpl(messageText, badgeNumber, appMessage, false);
568 _NotificationManagerImpl::Notify(const String& messageText, int badgeNumber, const String& launchArguments) const
570 SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
571 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
572 SysTryReturnResult(NID_APP,
573 launchArguments != null && launchArguments.GetLength() > 0, E_INVALID_ARG,
574 "launchArguments is less than 0.");
576 SysTryReturnResult(NID_APP,
577 launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
578 "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
580 if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
582 badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
585 return NotifyImpl(messageText, badgeNumber, launchArguments, false);
589 _NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const
591 bool b = _PackageManagerImpl::IsAppInstalled(appId);
593 SysTryReturn(NID_APP, b == true, -1, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The application %ls is not installed",
599 memset(buffer, 0, 256);
601 snprintf(buffer, 256, "%ls", appId.GetPointer());
603 notification_get_badge(buffer, NOTIFICATION_GROUP_ID_NONE, &count);
610 _NotificationManagerImpl::NotifyByAppId(const AppId& appId, int badgeNumber) const
612 SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
614 String messageText = String(L"");
615 String appMessage = String(L"");
616 return NotifyImpl(appId, messageText, badgeNumber, appMessage);
620 _NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText) const
622 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
624 return NotifyImpl(appId, messageText, -1, String(L""));
628 _NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, int badgeNumber) const
630 SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
631 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
633 return NotifyImpl(appId, messageText, badgeNumber, String(L""));
637 _NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, const String& launchArguments) const
639 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
640 SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
641 SysTryReturnResult(NID_APP,
642 launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
643 "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
645 return NotifyImpl(appId, messageText, -1, launchArguments);
649 _NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, int badgeNumber,
650 const String& launchArguments) const
652 SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
653 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
654 SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
655 SysTryReturnResult(NID_APP,
656 launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
657 "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
659 return NotifyImpl(appId, messageText, badgeNumber, launchArguments);
663 _NotificationManagerImpl::NotifyOngoingActivity(const String& messageText) const
665 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
667 return OngoingImpl(messageText, String(L""));
671 _NotificationManagerImpl::NotifyOngoingActivity(const String& messageText, const String& launchArguments) const
673 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
674 SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
675 SysTryReturnResult(NID_APP,
676 launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
677 "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
679 return OngoingImpl(messageText, launchArguments);
683 _NotificationManagerImpl::NotifyOngoingActivityByAppId(const AppId& appId, const String& messageText) const
685 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
687 return OngoingImpl(appId, messageText, String(L""));
691 _NotificationManagerImpl::NotifyOngoingActivityByAppId(const AppId& appId, const String& messageText,
692 const String& launchArguments) const
694 SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
695 SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
696 SysTryReturnResult(NID_APP,
697 launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
698 "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
700 return OngoingImpl(appId, messageText, launchArguments);
704 _NotificationManagerImpl::RemoveOngoingActivityNotification(void)
706 result r = E_SUCCESS;
708 notification_error_e err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_ONGOING);
711 case NOTIFICATION_ERROR_NONE:
715 case NOTIFICATION_ERROR_INVALID_DATA:
720 r = E_OPERATION_FAILED;
728 _NotificationManagerImpl::RemoveOngoingActivityNotificationByAppId(const AppId& appId)
730 return __pNotificationManager->RemoveNotification(appId, true);
734 _NotificationManagerImpl::RemoveNotification(void)
736 result r = E_SUCCESS;
738 notification_error_e err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
741 case NOTIFICATION_ERROR_NONE:
745 case NOTIFICATION_ERROR_INVALID_DATA:
750 r = E_OPERATION_FAILED;
758 _NotificationManagerImpl::RemoveNotificationByAppId(const AppId& appId)
760 return __pNotificationManager->RemoveNotification(appId,false);