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));
263 int dp_notification_ongoing_new(const char *pkgname, const char *subject, unsigned char *raws_buffer, const int raws_length)
265 int err = NOTIFICATION_ERROR_NONE;
266 notification_h noti_handle = NULL;
267 noti_handle = notification_create(NOTIFICATION_TYPE_ONGOING);
268 if (noti_handle == NULL) {
269 TRACE_ERROR("failed to create notification handle");
273 if (subject != NULL) {
274 err = notification_set_text(noti_handle,
275 NOTIFICATION_TEXT_TYPE_TITLE, subject, NULL,
276 NOTIFICATION_VARIABLE_TYPE_NONE);
278 err = notification_set_text(noti_handle,
279 NOTIFICATION_TEXT_TYPE_TITLE, DP_NOTIFICATION_NO_SUBJECT, NULL,
280 NOTIFICATION_VARIABLE_TYPE_NONE);
282 if (err != NOTIFICATION_ERROR_NONE)
283 TRACE_ERROR("failed to set subject error:%s", __dp_noti_error_str(err));
285 err = notification_set_image(noti_handle,
286 NOTIFICATION_IMAGE_TYPE_ICON,
287 DP_NOTIFICATION_ONGOING_ICON_PATH);
288 if (err != NOTIFICATION_ERROR_NONE)
289 TRACE_ERROR("failed to set icon error:%s", __dp_noti_error_str(err));
291 if (raws_buffer != NULL && raws_length > 0) {
293 b = bundle_decode_raw((bundle_raw *)raws_buffer, raws_length);
295 err = notification_set_execute_option(noti_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
298 if (b != NULL && pkgname != NULL) {
299 if (appsvc_set_pkgname(b, pkgname) != APPSVC_RET_OK)
300 TRACE_ERROR("failed to set set pkgname");
302 err = notification_set_execute_option(noti_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
304 TRACE_ERROR("failed to create bundle");
307 if (err != NOTIFICATION_ERROR_NONE)
308 TRACE_ERROR("failed to set service error:%s", __dp_noti_error_str(err));
314 err = notification_set_property(noti_handle,
315 NOTIFICATION_PROP_DISABLE_TICKERNOTI);
316 if (err != NOTIFICATION_ERROR_NONE) {
317 TRACE_ERROR("failed to set property error:%s", __dp_noti_error_str(err));
318 notification_free(noti_handle);
321 err = notification_set_image(noti_handle,
322 NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR,
323 DP_NOTIFICATION_DOWNLOADING_ICON_PATH);
324 if (err != NOTIFICATION_ERROR_NONE) {
325 TRACE_ERROR("failed to set icon indicator error:%s", __dp_noti_error_str(err));
326 notification_free(noti_handle);
329 err = notification_set_display_applist(noti_handle,
330 NOTIFICATION_DISPLAY_APP_ALL);
331 if (err != NOTIFICATION_ERROR_NONE) {
332 TRACE_ERROR("failed to set display app all error:%s", __dp_noti_error_str(err));
333 notification_free(noti_handle);
338 err = notification_insert(noti_handle, &priv_id);
339 if (err != NOTIFICATION_ERROR_NONE) {
340 TRACE_ERROR("failed to set priv_id error:%s", __dp_noti_error_str(err));
341 notification_free(noti_handle);
345 //TRACE_DEBUG("m_noti_id [%d]", priv_id);
346 notification_free(noti_handle);
348 return priv_id; // store on memory for reuse it
353 int dp_notification_ongoing_update(const int noti_priv_id, const double received_size, const double file_size, const char *subject)
355 if (noti_priv_id > 0) {
356 int err = NOTIFICATION_ERROR_NONE;
358 err = notification_update_progress(NULL, noti_priv_id, (received_size / file_size));
360 err = notification_update_size(NULL, noti_priv_id, received_size);
361 if (err != NOTIFICATION_ERROR_NONE) {
362 TRACE_ERROR("failed to update error:%s", __dp_noti_error_str(err));
363 // return 0 because progress is called frequently
365 if (subject != NULL) {
366 notification_h noti_handle = NULL;
367 noti_handle = notification_load(NULL, noti_priv_id);
368 if (noti_handle != NULL) {
369 err = notification_set_text(noti_handle,
370 NOTIFICATION_TEXT_TYPE_TITLE, subject, NULL,
371 NOTIFICATION_VARIABLE_TYPE_NONE);
372 err = notification_update(noti_handle);
373 if (err != NOTIFICATION_ERROR_NONE)
374 TRACE_ERROR("failed to update by priv_id:%d", noti_priv_id);
375 notification_free(noti_handle);
377 TRACE_ERROR("failed to load handle by priv_id:%d", noti_priv_id);
386 int dp_notification_delete_ongoing(const int noti_priv_id)
388 int err = NOTIFICATION_ERROR_NONE;
389 err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_ONGOING, noti_priv_id);
390 if (err != NOTIFICATION_ERROR_NONE)
391 TRACE_ERROR("failed to delete notification by priv_id:%d error:%s", noti_priv_id, __dp_noti_error_str(err));
396 int dp_notification_delete(const int noti_priv_id)
398 int err = NOTIFICATION_ERROR_NONE;
399 err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, noti_priv_id);
400 if (err != NOTIFICATION_ERROR_NONE)
401 TRACE_ERROR("failed to delete notification by priv_id:%d error:%s", noti_priv_id, __dp_noti_error_str(err));
407 int dp_notification_new(void *dbhandle, const int download_id, const int state, int content_type, const char *pkgname)
409 int errorcode = DP_ERROR_NONE;
410 int err = NOTIFICATION_ERROR_NONE;
412 if (state != DP_STATE_COMPLETED &&
413 state != DP_STATE_CANCELED &&
414 state != DP_STATE_FAILED) {
415 TRACE_ERROR("deny by invalid state:%d id:%d", state, download_id);
420 notification_h noti_handle = NULL;
421 noti_handle = notification_create(NOTIFICATION_TYPE_NOTI);
422 if (noti_handle == NULL) {
423 TRACE_ERROR("failed to create notification handle");
427 err = notification_set_layout(noti_handle, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
428 if (err != NOTIFICATION_ERROR_NONE) {
429 TRACE_ERROR("Fail to set notification layout [%d]", err);
430 notification_free(noti_handle);
434 err = notification_set_text_domain(noti_handle, DP_DOMAIN, DP_LOCALEDIR);
435 if (err != NOTIFICATION_ERROR_NONE) {
436 TRACE_ERROR("Fail to set text domain [%d]", err);
437 notification_free(noti_handle);
443 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_NOTIFICATION, DP_DB_COL_NOTI_DESCRIPTION, (unsigned char **)&string, &length, &errorcode) < 0)
444 TRACE_ERROR("failed to get description id:%d error:%s", download_id, dp_print_errorcode(errorcode));
446 if (string != NULL) {
448 err = notification_set_text(noti_handle,
449 NOTIFICATION_TEXT_TYPE_CONTENT, string, NULL,
450 NOTIFICATION_VARIABLE_TYPE_NONE);
452 err = notification_set_text(noti_handle,
453 NOTIFICATION_TEXT_TYPE_TITLE, string, NULL,
454 NOTIFICATION_VARIABLE_TYPE_NONE);
457 if (err != NOTIFICATION_ERROR_NONE)
458 TRACE_ERROR("failed to set state id:%d error:%s", download_id, __dp_noti_error_str(err));
460 string = __dp_noti_status(state);
462 err = notification_set_text(noti_handle,
463 NOTIFICATION_TEXT_TYPE_CONTENT, __(string), string,
464 NOTIFICATION_VARIABLE_TYPE_NONE);
466 err = notification_set_text(noti_handle,
467 NOTIFICATION_TEXT_TYPE_TITLE, __(string), string,
468 NOTIFICATION_VARIABLE_TYPE_NONE);
470 if (err != NOTIFICATION_ERROR_NONE)
471 TRACE_ERROR("failed to set state id:%d error:%s", download_id, __dp_noti_error_str(err));
475 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_NOTIFICATION, DP_DB_COL_NOTI_SUBJECT, (unsigned char **)&string, &length, &errorcode) < 0)
476 TRACE_ERROR("failed to get subject id:%d error:%s", download_id, dp_print_errorcode(errorcode));
477 err = NOTIFICATION_ERROR_NONE;
478 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)
479 TRACE_ERROR("failed to get content_name id:%d error:%s", download_id, dp_print_errorcode(errorcode));
481 string = dp_strdup(DP_NOTIFICATION_NO_SUBJECT);
482 if (string != NULL) {
484 err = notification_set_text(noti_handle,
485 NOTIFICATION_TEXT_TYPE_TITLE, string, NULL,
486 NOTIFICATION_VARIABLE_TYPE_NONE);
488 err = notification_set_text(noti_handle,
489 NOTIFICATION_TEXT_TYPE_CONTENT, string, NULL,
490 NOTIFICATION_VARIABLE_TYPE_NONE);
494 if (err != NOTIFICATION_ERROR_NONE)
495 TRACE_ERROR("failed to set state id:%d error:%s", download_id, __dp_noti_error_str(err));
497 err = notification_set_time(noti_handle, time(NULL));
498 if (err != NOTIFICATION_ERROR_NONE)
499 TRACE_ERROR("failed to set time id:%d error:%s", download_id, __dp_noti_error_str(err));
502 bundle_raw *raws_buffer = NULL;
503 if (state == DP_STATE_COMPLETED) {
504 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_NOTIFICATION, DP_DB_COL_NOTI_RAW_COMPLETE, &raws_buffer, &length, &errorcode) < 0)
505 TRACE_ERROR("failed to get bundle raws id:%d", download_id);
507 if (raws_buffer != NULL) {
508 b = bundle_decode_raw(raws_buffer, length);
509 bundle_free_encoded_rawdata(&raws_buffer);
512 err = notification_set_execute_option(noti_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
515 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_DOWNLOAD, DP_DB_COL_SAVED_PATH, (unsigned char **)&string, &length, &errorcode) < 0)
516 TRACE_ERROR("failed to get saved_path id:%d error:%s", download_id, dp_print_errorcode(errorcode));
518 if (b != NULL && string != NULL) {
519 if (appsvc_set_operation(b, APPSVC_OPERATION_VIEW) != APPSVC_RET_OK) {
520 TRACE_ERROR("failed to set service operation id:%d", download_id);
522 if (appsvc_set_uri(b, string) != APPSVC_RET_OK) {
523 TRACE_ERROR("failed to set service uri id:%d", download_id);
525 err = notification_set_execute_option(noti_handle,
526 NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
530 TRACE_SECURE_ERROR("failed to create bundle id:%d path:%s", download_id, string);
535 if (err != NOTIFICATION_ERROR_NONE)
536 TRACE_ERROR("failed to set service id:%d error:%s", download_id, __dp_noti_error_str(err));
538 char *file_type_icon = DP_NOTIFICATION_UNKNOWN_ICON_PATH;
539 if (content_type > 0 && content_type < DP_MAX_ICONS_TABLE_COUNT)
540 file_type_icon = file_icons_table[content_type];
542 err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON, file_type_icon);
543 if (err != NOTIFICATION_ERROR_NONE)
544 TRACE_ERROR("failed to set icon id:%d error:%s", download_id, __dp_noti_error_str(err));
546 err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR,
547 DP_NOTIFICATION_COMPLETED_INDICATOR_ICON_PATH);
548 if (err != NOTIFICATION_ERROR_NONE)
549 TRACE_ERROR("failed to set icon id:%d error:%s", download_id, __dp_noti_error_str(err));
550 } else if (state == DP_STATE_CANCELED || state == DP_STATE_FAILED) {
552 if (dp_db_get_property_string(dbhandle, download_id, DP_TABLE_NOTIFICATION, DP_DB_COL_NOTI_RAW_FAIL, &raws_buffer, &length, &errorcode) < 0)
553 TRACE_ERROR("failed to get bundle raws id:%d", download_id);
555 if (raws_buffer != NULL) {
556 b = bundle_decode_raw(raws_buffer, length);
557 bundle_free_encoded_rawdata(&raws_buffer);
560 err = notification_set_execute_option(noti_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
563 if (b != NULL && pkgname != NULL) {
564 if (appsvc_set_pkgname(b, pkgname) != APPSVC_RET_OK) {
565 TRACE_ERROR("failed to set set pkgname id:%d", download_id);
567 err = notification_set_execute_option(noti_handle,
568 NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "View", NULL, b);
571 TRACE_ERROR("failed to create bundle id:%d", download_id);
574 if (err != NOTIFICATION_ERROR_NONE)
575 TRACE_ERROR("failed to set service id:%d error:%s", download_id, __dp_noti_error_str(err));
577 err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON,
578 DP_NOTIFICATION_FAILED_ICON_PATH);
579 if (err != NOTIFICATION_ERROR_NONE)
580 TRACE_ERROR("failed to set icon id:%d error:%s", download_id, __dp_noti_error_str(err));
582 err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR,
583 DP_NOTIFICATION_FAILED_INDICATOR_ICON_PATH);
584 if (err != NOTIFICATION_ERROR_NONE)
585 TRACE_ERROR("failed to set icon id:%d error:%s", download_id, __dp_noti_error_str(err));
591 err = notification_set_property(noti_handle,
592 NOTIFICATION_PROP_DISABLE_TICKERNOTI);
593 if (err != NOTIFICATION_ERROR_NONE)
594 TRACE_ERROR("failed to set property id:%d error:%s", download_id, __dp_noti_error_str(err));
596 err = notification_set_display_applist(noti_handle,
597 NOTIFICATION_DISPLAY_APP_ALL ^ NOTIFICATION_DISPLAY_APP_INDICATOR);
598 if (err != NOTIFICATION_ERROR_NONE)
599 TRACE_ERROR("failed to set display app all id:%d error:%s", download_id, __dp_noti_error_str(err));
602 err = notification_insert(noti_handle, &priv_id);
603 if (err != NOTIFICATION_ERROR_NONE)
604 TRACE_ERROR("failed to set priv_id id:%d error:%s", download_id, __dp_noti_error_str(err));
606 //TRACE_DEBUG("m_noti_id [%d]", priv_id);
607 notification_free(noti_handle);
612 void dp_notification_clear_ongoings()