Download provider notification does not display URL information.
Added changes to show URL information in notification.
Also added changes to handle EBUSY case while releasing the acquired lock
on mutex.
Change-Id: I27bfff0495fb7da65fc0fb5deb7bd63b79d7a1a5
Signed-off-by: Sowmya B <sowmya.b1@samsung.com>
TRACE_DEBUG("failed to get bundle raws id:%d error:%s", download_id, dp_print_errorcode(errorcode));
CLIENT_MUTEX_UNLOCK(&slot->mutex);
}
- noti_priv_id = dp_notification_ongoing_new(slot->pkgname, subject, raws_buffer, length);
+
+ char *url = NULL;
+ unsigned int len = 0;
+ if (CLIENT_MUTEX_CHECKLOCK(&slot->mutex) == 0) {
+ if (dp_db_get_property_string(slot->client.dbhandle, download_id, DP_TABLE_REQUEST, DP_DB_COL_URL, (unsigned char **)&url, &len, &errorcode) < 0) {
+ TRACE_ERROR("failed to get url id:%d error:%s", download_id, dp_print_errorcode(errorcode));
+ }
+ CLIENT_MUTEX_UNLOCK(&slot->mutex);
+ }
+
+ noti_priv_id = dp_notification_ongoing_new(url, slot->pkgname, subject, raws_buffer, length);
TRACE_DEBUG("new ongoing(%d) id:%d type:%d state:%d", noti_priv_id, download_id, noti_type, state);
free(raws_buffer);
+ free(url);
if (noti_priv_id < 0) {
TRACE_ERROR("failed to update ongoing for id:%d", download_id);
} else {
#define DP_DOMAIN PKG_NAME
#define DP_LOCALEDIR LOCALE_DIR
-#define DP_NOTIFICATION_NO_SUBJECT "No Name"
+#define DP_NOTIFICATION_NO_SUBJECT "Preparing to download..."
#ifdef _TIZEN_2_3_UX
#define DP_NOTIFICATION_DRM_ICON_PATH IMAGE_DIR"/download_manager_icon_drm.png"
return;
}
-int dp_notification_ongoing_new(const char *pkgname, const char *subject, unsigned char *raws_buffer, const int raws_length)
+int dp_notification_ongoing_new(const char *url, const char *pkgname, const char *subject, unsigned char *raws_buffer, const int raws_length)
{
int err = NOTIFICATION_ERROR_NONE;
notification_h noti_handle = NULL;
if (err != NOTIFICATION_ERROR_NONE)
TRACE_ERROR("failed to set subject error:%s", __dp_noti_error_str(err));
+ if (url != NULL) {
+ err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, url, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (err != NOTIFICATION_ERROR_NONE)
+ {
+ TRACE_ERROR("failed to set url error:%s", __dp_noti_error_str(err));
+ }
+ }
+
+
+
err = notification_set_image(noti_handle,
NOTIFICATION_IMAGE_TYPE_ICON,
DP_NOTIFICATION_ONGOING_ICON_PATH);
if (g_dp_queue_manager_tid > 0 &&
pthread_kill(g_dp_queue_manager_tid, 0) != ESRCH) {
int locked = CLIENT_MUTEX_TRYLOCK(&g_dp_queue_manager_mutex);
- if (locked == 0) {
+ if (locked == 0 || locked == EBUSY) {
pthread_cond_signal(&g_dp_queue_manager_cond);
CLIENT_MUTEX_UNLOCK(&g_dp_queue_manager_mutex);
}
void dp_notification_clear_ongoings(void);
int dp_notification_delete_ongoing(const int noti_priv_id);
int dp_notification_delete(const int noti_priv_id);
-int dp_notification_ongoing_new(const char *pkgname, const char *subject, unsigned char *raws_buffer, const int raws_length);
+int dp_notification_ongoing_new(const char *url, const char *pkgname, const char *subject, unsigned char *raws_buffer, const int raws_length);
int dp_notification_ongoing_update(const int noti_priv_id, const double received_size, const double file_size, const char *subject);
int dp_notification_new(void *dbhandle, const int download_id, const int state, int content_type, const char *pkgname);
#else