2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifdef SUPPORT_NOTIFICATION
23 #include "download-provider.h"
24 #include "download-provider-notification.h"
25 #include "download-provider-db-defs.h"
26 #include "download-provider-db.h"
27 #include "download-provider-log.h"
28 #include "download-provider-client.h"
29 #include "download-provider-utils.h"
32 #include <bundle_internal.h>
33 #include <notification.h>
35 #include "notification_text_domain.h"
36 #include "notification_internal.h"
37 #include "notification_error.h"
45 #include <tzplatform_config.h>
47 #define __(s) dgettext(PKG_NAME, s)
49 #define DP_DOMAIN PKG_NAME
50 #define DP_LOCALEDIR LOCALE_DIR
51 #define DP_NOTIFICATION_NO_SUBJECT "No Name"
54 #define DP_NOTIFICATION_DRM_ICON_PATH IMAGE_DIR"/download_manager_icon_drm.png"
55 #define DP_NOTIFICATION_UNKNOWN_ICON_PATH IMAGE_DIR"/download_manager_icon_unknown.png"
56 #define DP_NOTIFICATION_EXCEL_ICON_PATH IMAGE_DIR"/download_manager_icon_xls.png"
57 #define DP_NOTIFICATION_HTML_ICON_PATH IMAGE_DIR"/download_manager_icon_html.png"
58 #define DP_NOTIFICATION_MUSIC_ICON_PATH IMAGE_DIR"/download_manager_icon_music.png"
59 #define DP_NOTIFICATION_PDF_ICON_PATH IMAGE_DIR"/download_manager_icon_pdf.png"
60 #define DP_NOTIFICATION_PPT_ICON_PATH IMAGE_DIR"/download_manager_icon_ppt.png"
61 #define DP_NOTIFICATION_TEXT_ICON_PATH IMAGE_DIR"/download_manager_icon_text.png"
62 #define DP_NOTIFICATION_WORD_ICON_PATH IMAGE_DIR"/download_manager_icon_word.png"
63 #define DP_NOTIFICATION_VIDEO_ICON_PATH IMAGE_DIR"/download_manager_icon_movie.png"
64 #define DP_NOTIFICATION_IMAGE_ICON_PATH IMAGE_DIR"/download_manager_icon_img.png"
65 #define DP_NOTIFICATION_FALSH_ICON_PATH IMAGE_DIR"/download_manager_icon_swf.png"
66 #define DP_NOTIFICATION_TPK_ICON_PATH IMAGE_DIR"/download_manager_icon_tpk.png"
67 #define DP_NOTIFICATION_VCAL_ICON_PATH IMAGE_DIR"/download_manager_icon_date.png"
70 #define QP_PRELOAD_NOTI_ICON_PATH tzplatform_mkpath(TZ_SYS_RO_APP, "com.samsung.quickpanel/shared/res/noti_icons")
72 // each application path
73 #define QP_PRELOAD_COMMON_PATH tzplatform_mkpath(TZ_SYS_RO_APP, "com.samsung.quickpanel/shared/res/noti_icons/Common")
74 #define DP_NOTIFICATION_COMPLETED_ICON_PATH tzplatform_mkpath(TZ_SYS_RO_APP, "com.samsung.quickpanel/shared/res/noti_icons/Common/noti_download_complete.png")
75 #define DP_NOTIFICATION_FAILED_ICON_PATH tzplatform_mkpath(TZ_SYS_RO_APP, "com.samsung.quickpanel/shared/res/noti_icons/Common/noti_download_failed.png")
77 #define DP_NOTIFICATION_ONGOING_ICON_PATH "reserved://quickpanel/ani/downloading"
78 #define DP_NOTIFICATION_DOWNLOADING_ICON_PATH "reserved://indicator/ani/downloading"
79 #define DP_NOTIFICATION_FAILED_INDICATOR_ICON_PATH IMAGE_DIR"/B03_Processing_download_failed.png"
80 #define DP_NOTIFICATION_COMPLETED_INDICATOR_ICON_PATH IMAGE_DIR"/B03_Processing_download_complete.png"
82 #define DP_NOTIFICATION_DRM_ICON_PATH IMAGE_DIR"/U01_icon_drm.png"
83 #define DP_NOTIFICATION_UNKNOWN_ICON_PATH IMAGE_DIR"/U01_icon_unkown.png"
84 #define DP_NOTIFICATION_EXCEL_ICON_PATH IMAGE_DIR"/U01_icon_excel.png"
85 #define DP_NOTIFICATION_HTML_ICON_PATH IMAGE_DIR"/U01_icon_html.png"
86 #define DP_NOTIFICATION_MUSIC_ICON_PATH IMAGE_DIR"/U01_list_icon_mp3.png"
87 #define DP_NOTIFICATION_PDF_ICON_PATH IMAGE_DIR"/U01_icon_pdf.png"
88 #define DP_NOTIFICATION_PPT_ICON_PATH IMAGE_DIR"/U01_icon_ppt.png"
89 #define DP_NOTIFICATION_TEXT_ICON_PATH IMAGE_DIR"/U01_icon_text.png"
90 #define DP_NOTIFICATION_WORD_ICON_PATH IMAGE_DIR"/U01_icon_word.png"
91 #define DP_NOTIFICATION_VIDEO_ICON_PATH IMAGE_DIR"/U01_list_icon_mp4.png"
92 #define DP_NOTIFICATION_IMAGE_ICON_PATH IMAGE_DIR"/U01_list_icon_image.png"
93 #define DP_NOTIFICATION_FALSH_ICON_PATH IMAGE_DIR"/U01_icon_swf.png"
94 #define DP_NOTIFICATION_TPK_ICON_PATH IMAGE_DIR"/U01_icon_tpk.png"
95 #define DP_NOTIFICATION_VCAL_ICON_PATH IMAGE_DIR"/U01_icon_vcs.png"
97 #define DP_NOTIFICATION_FAILED_ICON_PATH IMAGE_DIR"/noti_download_failed.png"
98 #define DP_NOTIFICATION_COMPLETED_ICON_PATH IMAGE_DIR"/noti_download_complete.png"
100 #define DP_NOTIFICATION_ONGOING_ICON_PATH "reserved://quickpanel/ani/downloading"
101 #define DP_NOTIFICATION_DOWNLOADING_ICON_PATH "reserved://indicator/ani/downloading"
102 #define DP_NOTIFICATION_FAILED_INDICATOR_ICON_PATH IMAGE_DIR"/B03_processing_download_fail.png"
103 #define DP_NOTIFICATION_COMPLETED_INDICATOR_ICON_PATH IMAGE_DIR"/B03_processing_download_complete.png"
106 #define DP_MAX_ICONS_TABLE_COUNT 15
108 char *file_icons_table[DP_MAX_ICONS_TABLE_COUNT]={
110 DP_NOTIFICATION_UNKNOWN_ICON_PATH,
112 DP_NOTIFICATION_IMAGE_ICON_PATH,
114 DP_NOTIFICATION_VIDEO_ICON_PATH,
116 DP_NOTIFICATION_MUSIC_ICON_PATH,
118 DP_NOTIFICATION_PDF_ICON_PATH,
120 DP_NOTIFICATION_WORD_ICON_PATH,
122 DP_NOTIFICATION_PPT_ICON_PATH,
124 DP_NOTIFICATION_EXCEL_ICON_PATH,
126 DP_NOTIFICATION_HTML_ICON_PATH,
128 DP_NOTIFICATION_TEXT_ICON_PATH,
130 DP_NOTIFICATION_DRM_ICON_PATH,
131 DP_NOTIFICATION_DRM_ICON_PATH,
132 DP_NOTIFICATION_FALSH_ICON_PATH,
133 DP_NOTIFICATION_TPK_ICON_PATH,
134 DP_NOTIFICATION_VCAL_ICON_PATH,
137 static const char *__dp_noti_error_str(int err)
140 case NOTIFICATION_ERROR_INVALID_PARAMETER:
141 return "NOTIFICATION_ERROR_INVALID_PARAMETER";
142 case NOTIFICATION_ERROR_OUT_OF_MEMORY:
143 return "NOTIFICATION_ERROR_OUT_OF_MEMORY";
144 case NOTIFICATION_ERROR_FROM_DB:
145 return "NOTIFICATION_ERROR_FROM_DB";
146 case NOTIFICATION_ERROR_ALREADY_EXIST_ID:
147 return "NOTIFICATION_ERROR_ALREADY_EXIST_ID";
148 case NOTIFICATION_ERROR_FROM_DBUS:
149 return "NOTIFICATION_ERROR_FROM_DBUS";
150 case NOTIFICATION_ERROR_NOT_EXIST_ID:
151 return "NOTIFICATION_ERROR_NOT_EXIST_ID";
155 return "Unknown error";
158 char *__dp_noti_get_sender(char *url)
164 char *credential_sender = NULL;
169 found = strstr(url, "://");
175 found = strchr(temp, '/');
179 sender = calloc(len + 1, sizeof(char));
182 snprintf(sender, len + 1, "%s", temp);
184 sender = dp_strdup(temp);
189 // For credential URL
190 found = strchr(sender, '@');
191 found1 = strchr(sender, ':');
192 if (found != NULL && found1 != NULL && found1 < found) {
196 credential_sender = calloc(len + 1, sizeof(char));
197 if (credential_sender == NULL) {
201 snprintf(credential_sender, len + 1, "%s", found);
203 return credential_sender;
209 static char *__dp_noti_status(dp_state_type state)
211 char *message = NULL;
213 case DP_STATE_COMPLETED:
214 message = "IDS_DM_HEADER_DOWNLOAD_COMPLETE";
216 case DP_STATE_CANCELED:
217 case DP_STATE_FAILED:
218 message = "IDS_DM_BODY_DOWNLOAD_FAILED_M_STATUS_ABB";
226 void __lang_changed_cb(keynode_t *key, void* data)
229 str = vconf_get_str(VCONFKEY_LANGSET);
231 setlocale(LC_ALL, str);
232 bindtextdomain(PKG_NAME, LOCALE_DIR);
233 textdomain(PKG_NAME);
238 void dp_notification_set_locale()
240 // move to notification.c
242 __lang_changed_cb(NULL, NULL);
243 if (vconf_notify_key_changed(VCONFKEY_LANGSET, __lang_changed_cb, NULL) != 0)
244 TRACE_ERROR("Fail to set language changed vconf callback");
247 void dp_notification_clear_locale()
249 // move to notification.c
250 if (vconf_ignore_key_changed(VCONFKEY_LANGSET, __lang_changed_cb) != 0)
251 TRACE_ERROR("Fail to unset language changed vconf callback");
254 void dp_notification_clear_ongoings()
256 int err = NOTIFICATION_ERROR_NONE;
257 err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_ONGOING);
258 if (err != NOTIFICATION_ERROR_NONE) {
259 TRACE_DEBUG("[FAIL] clear noti [%s]", __dp_noti_error_str(err));
264 int dp_notification_ongoing_new(const char *pkgname, const char *subject, unsigned char *raws_buffer, const int raws_length)
266 int err = NOTIFICATION_ERROR_NONE;
267 notification_h noti_handle = NULL;
268 noti_handle = notification_create(NOTIFICATION_TYPE_ONGOING);
269 if (noti_handle == NULL) {
270 TRACE_ERROR("failed to create notification handle");
274 if (subject != NULL) {
275 err = notification_set_text(noti_handle,
276 NOTIFICATION_TEXT_TYPE_TITLE, subject, NULL,
277 NOTIFICATION_VARIABLE_TYPE_NONE);
279 err = notification_set_text(noti_handle,
280 NOTIFICATION_TEXT_TYPE_TITLE, DP_NOTIFICATION_NO_SUBJECT, NULL,
281 NOTIFICATION_VARIABLE_TYPE_NONE);
283 if (err != NOTIFICATION_ERROR_NONE) {
284 TRACE_ERROR("failed to set subject error:%s", __dp_noti_error_str(err));
287 err = notification_set_image(noti_handle,
288 NOTIFICATION_IMAGE_TYPE_ICON,
289 DP_NOTIFICATION_ONGOING_ICON_PATH);
290 if (err != NOTIFICATION_ERROR_NONE) {
291 TRACE_ERROR("failed to set icon error:%s", __dp_noti_error_str(err));
294 if (raws_buffer != NULL && raws_length > 0) {
296 b = bundle_decode_raw((bundle_raw *)raws_buffer, raws_length);
298 err = notification_set_execute_option(noti_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
301 if (b != NULL && pkgname != NULL) {
302 if (appsvc_set_pkgname(b, pkgname) != APPSVC_RET_OK) {
303 TRACE_ERROR("failed to set set pkgname");
305 err = notification_set_execute_option(noti_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
308 TRACE_ERROR("failed to create bundle");
311 if (err != NOTIFICATION_ERROR_NONE) {
312 TRACE_ERROR("failed to set service error:%s", __dp_noti_error_str(err));
318 err = notification_set_property(noti_handle,
319 NOTIFICATION_PROP_DISABLE_TICKERNOTI);
320 if (err != NOTIFICATION_ERROR_NONE) {
321 TRACE_ERROR("failed to set property error:%s", __dp_noti_error_str(err));
322 notification_free(noti_handle);
325 err = notification_set_image(noti_handle,
326 NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR,
327 DP_NOTIFICATION_DOWNLOADING_ICON_PATH);
328 if (err != NOTIFICATION_ERROR_NONE) {
329 TRACE_ERROR("failed to set icon indicator error:%s", __dp_noti_error_str(err));
330 notification_free(noti_handle);
333 err = notification_set_display_applist(noti_handle,
334 NOTIFICATION_DISPLAY_APP_ALL);
335 if (err != NOTIFICATION_ERROR_NONE) {
336 TRACE_ERROR("failed to set display app all error:%s", __dp_noti_error_str(err));
337 notification_free(noti_handle);
342 err = notification_insert(noti_handle, &priv_id);
343 if (err != NOTIFICATION_ERROR_NONE) {
344 TRACE_ERROR("failed to set priv_id error:%s", __dp_noti_error_str(err));
345 notification_free(noti_handle);
349 //TRACE_DEBUG("m_noti_id [%d]", priv_id);
350 notification_free(noti_handle);
352 return priv_id; // store on memory for reuse it
357 int dp_notification_ongoing_update(const int noti_priv_id, const double received_size, const double file_size, const char *subject)
359 if (noti_priv_id > 0) {
360 int err = NOTIFICATION_ERROR_NONE;
362 err = notification_update_progress(NULL, noti_priv_id, (received_size / file_size));
364 err = notification_update_size(NULL, noti_priv_id, received_size);
365 if (err != NOTIFICATION_ERROR_NONE) {
366 TRACE_ERROR("failed to update error:%s", __dp_noti_error_str(err));
367 // return 0 because progress is called frequently
369 if (subject != NULL) {
370 notification_h noti_handle = NULL;
371 noti_handle = notification_load(NULL, noti_priv_id);
372 if (noti_handle != NULL) {
373 err = notification_set_text(noti_handle,
374 NOTIFICATION_TEXT_TYPE_TITLE, subject, NULL,
375 NOTIFICATION_VARIABLE_TYPE_NONE);
376 err = notification_update(noti_handle);
377 if (err != NOTIFICATION_ERROR_NONE) {
378 TRACE_ERROR("failed to update by priv_id:%d", noti_priv_id);
380 notification_free(noti_handle);
382 TRACE_ERROR("failed to load handle by priv_id:%d", noti_priv_id);
391 int dp_notification_delete_ongoing(const int noti_priv_id)
393 int err = NOTIFICATION_ERROR_NONE;
394 err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_ONGOING, noti_priv_id);
395 if (err != NOTIFICATION_ERROR_NONE) {
396 TRACE_ERROR("failed to delete notification by priv_id:%d error:%s", noti_priv_id, __dp_noti_error_str(err));
401 int dp_notification_delete(const int noti_priv_id)
403 int err = NOTIFICATION_ERROR_NONE;
404 err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, noti_priv_id);
405 if (err != NOTIFICATION_ERROR_NONE) {
406 TRACE_ERROR("failed to delete notification by priv_id:%d error:%s", noti_priv_id, __dp_noti_error_str(err));
412 int dp_notification_new(void *dbhandle, const int download_id, const int state, int content_type, const char *pkgname)
414 int errorcode = DP_ERROR_NONE;
415 int err = NOTIFICATION_ERROR_NONE;
417 if (state != DP_STATE_COMPLETED &&
418 state != DP_STATE_CANCELED &&
419 state != DP_STATE_FAILED) {
420 TRACE_ERROR("deny by invalid state:%d id:%d", state, download_id);
425 notification_h noti_handle = NULL;
426 noti_handle = notification_create(NOTIFICATION_TYPE_NOTI);
427 if (noti_handle == NULL) {
428 TRACE_ERROR("failed to create notification handle");
432 err = notification_set_layout(noti_handle, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
433 if (err != NOTIFICATION_ERROR_NONE) {
434 TRACE_ERROR("Fail to set notification layout [%d]", err);
435 notification_free(noti_handle);
439 err = notification_set_text_domain(noti_handle, DP_DOMAIN, DP_LOCALEDIR);
440 if (err != NOTIFICATION_ERROR_NONE) {
441 TRACE_ERROR("Fail to set text domain [%d]", err);
442 notification_free(noti_handle);
448 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_NOTIFICATION, DP_DB_COL_NOTI_DESCRIPTION, (unsigned char **)&string, &length, &errorcode) < 0) {
449 TRACE_ERROR("failed to get description id:%d error:%s", download_id, dp_print_errorcode(errorcode));
451 if (string != NULL) {
453 err = notification_set_text(noti_handle,
454 NOTIFICATION_TEXT_TYPE_CONTENT, string, NULL,
455 NOTIFICATION_VARIABLE_TYPE_NONE);
457 err = notification_set_text(noti_handle,
458 NOTIFICATION_TEXT_TYPE_TITLE, string, NULL,
459 NOTIFICATION_VARIABLE_TYPE_NONE);
462 if (err != NOTIFICATION_ERROR_NONE) {
463 TRACE_ERROR("failed to set state id:%d error:%s", download_id, __dp_noti_error_str(err));
466 string = __dp_noti_status(state);
468 err = notification_set_text(noti_handle,
469 NOTIFICATION_TEXT_TYPE_CONTENT, __(string), string,
470 NOTIFICATION_VARIABLE_TYPE_NONE);
472 err = notification_set_text(noti_handle,
473 NOTIFICATION_TEXT_TYPE_TITLE, __(string), string,
474 NOTIFICATION_VARIABLE_TYPE_NONE);
476 if (err != NOTIFICATION_ERROR_NONE) {
477 TRACE_ERROR("failed to set state id:%d error:%s", download_id, __dp_noti_error_str(err));
482 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_NOTIFICATION, DP_DB_COL_NOTI_SUBJECT, (unsigned char **)&string, &length, &errorcode) < 0) {
483 TRACE_ERROR("failed to get subject id:%d error:%s", download_id, dp_print_errorcode(errorcode));
485 err = NOTIFICATION_ERROR_NONE;
486 if (string == NULL && dp_db_get_property_string(dbhandle, download_id, DP_TABLE_DOWNLOAD, DP_DB_COL_CONTENT_NAME, (unsigned char **)&string, &length, &errorcode) < 0) {
487 TRACE_ERROR("failed to get content_name id:%d error:%s", download_id, dp_print_errorcode(errorcode));
490 string = dp_strdup(DP_NOTIFICATION_NO_SUBJECT);
491 if (string != NULL) {
493 err = notification_set_text(noti_handle,
494 NOTIFICATION_TEXT_TYPE_TITLE, string, NULL,
495 NOTIFICATION_VARIABLE_TYPE_NONE);
497 err = notification_set_text(noti_handle,
498 NOTIFICATION_TEXT_TYPE_CONTENT, string, NULL,
499 NOTIFICATION_VARIABLE_TYPE_NONE);
503 if (err != NOTIFICATION_ERROR_NONE) {
504 TRACE_ERROR("failed to set state id:%d error:%s", download_id, __dp_noti_error_str(err));
507 err = notification_set_time(noti_handle, time(NULL));
508 if (err != NOTIFICATION_ERROR_NONE) {
509 TRACE_ERROR("failed to set time id:%d error:%s", download_id, __dp_noti_error_str(err));
513 bundle_raw *raws_buffer = NULL;
514 if (state == DP_STATE_COMPLETED) {
516 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_NOTIFICATION, DP_DB_COL_NOTI_RAW_COMPLETE, &raws_buffer, &length, &errorcode) < 0) {
517 TRACE_ERROR("failed to get bundle raws id:%d", download_id);
519 if (raws_buffer != NULL) {
520 b = bundle_decode_raw(raws_buffer, length);
521 bundle_free_encoded_rawdata(&raws_buffer);
524 err = notification_set_execute_option(noti_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
527 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_DOWNLOAD, DP_DB_COL_SAVED_PATH, (unsigned char **)&string, &length, &errorcode) < 0) {
528 TRACE_ERROR("failed to get saved_path id:%d error:%s", download_id, dp_print_errorcode(errorcode));
530 if (b != NULL && string != NULL) {
531 if (appsvc_set_operation(b, APPSVC_OPERATION_VIEW) != APPSVC_RET_OK) {
532 TRACE_ERROR("failed to set service operation id:%d", download_id);
534 if (appsvc_set_uri(b, string) != APPSVC_RET_OK) {
535 TRACE_ERROR("failed to set service uri id:%d", download_id);
537 err = notification_set_execute_option(noti_handle,
538 NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
542 TRACE_SECURE_ERROR("failed to create bundle id:%d path:%s", download_id, string);
547 if (err != NOTIFICATION_ERROR_NONE) {
548 TRACE_ERROR("failed to set service id:%d error:%s", download_id, __dp_noti_error_str(err));
551 char *file_type_icon = DP_NOTIFICATION_UNKNOWN_ICON_PATH;
552 if (content_type > 0 && content_type < DP_MAX_ICONS_TABLE_COUNT)
553 file_type_icon = file_icons_table[content_type];
555 err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON, file_type_icon);
556 if (err != NOTIFICATION_ERROR_NONE) {
557 TRACE_ERROR("failed to set icon id:%d error:%s", download_id, __dp_noti_error_str(err));
559 err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR,
560 DP_NOTIFICATION_COMPLETED_INDICATOR_ICON_PATH);
561 if (err != NOTIFICATION_ERROR_NONE) {
562 TRACE_ERROR("failed to set icon id:%d error:%s", download_id, __dp_noti_error_str(err));
565 } else if (state == DP_STATE_CANCELED || state == DP_STATE_FAILED) {
567 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_NOTIFICATION, DP_DB_COL_NOTI_RAW_FAIL, &raws_buffer, &length, &errorcode) < 0) {
568 TRACE_ERROR("failed to get bundle raws id:%d", download_id);
570 if (raws_buffer != NULL) {
571 b = bundle_decode_raw(raws_buffer, length);
572 bundle_free_encoded_rawdata(&raws_buffer);
575 err = notification_set_execute_option(noti_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
578 if (b != NULL && pkgname != NULL) {
579 if (appsvc_set_pkgname(b, pkgname) != APPSVC_RET_OK) {
580 TRACE_ERROR("failed to set set pkgname id:%d", download_id);
582 err = notification_set_execute_option(noti_handle,
583 NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
586 TRACE_ERROR("failed to create bundle id:%d", download_id);
589 if (err != NOTIFICATION_ERROR_NONE) {
590 TRACE_ERROR("failed to set service id:%d error:%s", download_id, __dp_noti_error_str(err));
593 err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON,
594 DP_NOTIFICATION_FAILED_ICON_PATH);
595 if (err != NOTIFICATION_ERROR_NONE) {
596 TRACE_ERROR("failed to set icon id:%d error:%s", download_id, __dp_noti_error_str(err));
598 err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR,
599 DP_NOTIFICATION_FAILED_INDICATOR_ICON_PATH);
600 if (err != NOTIFICATION_ERROR_NONE) {
601 TRACE_ERROR("failed to set icon id:%d error:%s", download_id, __dp_noti_error_str(err));
609 err = notification_set_property(noti_handle,
610 NOTIFICATION_PROP_DISABLE_TICKERNOTI);
611 if (err != NOTIFICATION_ERROR_NONE) {
612 TRACE_ERROR("failed to set property id:%d error:%s", download_id, __dp_noti_error_str(err));
614 err = notification_set_display_applist(noti_handle,
615 NOTIFICATION_DISPLAY_APP_ALL ^ NOTIFICATION_DISPLAY_APP_INDICATOR);
616 if (err != NOTIFICATION_ERROR_NONE) {
617 TRACE_ERROR("failed to set display app all id:%d error:%s", download_id, __dp_noti_error_str(err));
621 err = notification_insert(noti_handle, &priv_id);
622 if (err != NOTIFICATION_ERROR_NONE) {
623 TRACE_ERROR("failed to set priv_id id:%d error:%s", download_id, __dp_noti_error_str(err));
626 //TRACE_DEBUG("m_noti_id [%d]", priv_id);
627 notification_free(noti_handle);
632 void dp_notification_clear_ongoings()