case NOTIFICATION_ERROR_NO_MEMORY:
return E_OUT_OF_MEMORY;
case NOTIFICATION_ERROR_FROM_DB:
- return E_DATABASE;
+ // fall through
case NOTIFICATION_ERROR_ALREADY_EXIST_ID:
- return E_OPERATION_FAILED;
+ // fall through
case NOTIFICATION_ERROR_NOT_EXIST_ID:
return E_OPERATION_FAILED;
default:
}
}
+result
+ConvertAppManagerResult(int error)
+{
+ switch (error)
+ {
+ case APP_MANAGER_ERROR_NONE:
+ return E_SUCCESS;
+ case APP_MANAGER_ERROR_INVALID_PARAMETER:
+ // fall through
+ case APP_MANAGER_ERROR_INVALID_PACKAGE:
+ return E_INVALID_ARG;
+ case NOTIFICATION_ERROR_NO_MEMORY:
+ return E_OUT_OF_MEMORY;
+ case APP_MANAGER_ERROR_DB_FAILED:
+ return E_OPERATION_FAILED;
+ default:
+ return E_OPERATION_FAILED;
+ }
+}
+
bool
IsPosted(ui_notification_h handle)
{
_NotificationManagerImpl::~_NotificationManagerImpl(void)
{
bool isListeningBadgeEvent = (__badgeEventListenerList.GetCount() > 0)? true : false;
- if( isListeningBadgeEvent == true )
+ if(isListeningBadgeEvent == true)
{
_BadgeManagerImpl::GetInstance()->RemovePrimaryBadgeEventListener(*this);
}
else
{
char* pAppName = null;
- app_manager_get_app_name(pAppIdChar.get(), &pAppName);
+ r = ConvertAppManagerResult(app_manager_get_app_name(pAppIdChar.get(), &pAppName));
if (pAppName)
{
String appName(pAppName);
free(pAppName);
//SysLog(NID_APP, "Application Id is %ls.", appName.GetPointer());
}
- else
- {
- SysTryLog(NID_APP, pTitleText, "Failed to get title from app_manager_get_app_name for default setting.");
- }
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Failed to get title from app_manager_get_app_name for default setting.", GetErrorMessage(r));
}
// Icon file path
std::unique_ptr<char[]> pIconPath(null);
}
else
{
- std::unique_ptr<PackageAppInfo> pPackageAppInfo(_PackageManagerImpl::GetInstance()->GetPackageAppInfoN(pAppIdChar.get()));
- const String& appIconPath(_PackageAppInfoImpl::GetInstance(pPackageAppInfo.get())->GetAppNotificationIconPath());
-
- if (!appIconPath.IsEmpty() && File::IsFileExist(appIconPath))
+ char* pDefaultIconPath = null;
+ r = ConvertAppManagerResult(app_manager_get_app_icon_path(pAppIdChar.get(), &pDefaultIconPath));
+ if (pDefaultIconPath)
{
- std::unique_ptr<char[]> pIconPathTemp(_StringConverter::CopyToCharArrayN(appIconPath));
+ String iconPath(pDefaultIconPath);
+ std::unique_ptr<char[]> pIconPathTemp(_StringConverter::CopyToCharArrayN(iconPath));
pIconPath = std::move(pIconPathTemp);
+ free(pDefaultIconPath);
}
- else
- {
- char* pDefaultIconPath = null;
- app_manager_get_app_icon_path(pAppIdChar.get(), &pDefaultIconPath);
- if (pDefaultIconPath)
- {
- 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));
- }
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set icon path failed.", GetErrorMessage(r));
}
// Sound file path
std::unique_ptr<char[]> pSoundPath(null);
}
// 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));
+ 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));
+ if (pSoundPath.get())
+ {
+ r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath.get()));
+ }
+ else
+ {
+ r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL));
+ }
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set sound failed.", GetErrorMessage(r));
// Set extended - text, thumbnail and background image
if (!isOngoing)