Fix log level and message 54/141754/1
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 1 Aug 2017 09:23:59 +0000 (18:23 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Tue, 1 Aug 2017 09:24:27 +0000 (18:24 +0900)
Change-Id: Ic73f64b58b612ee41bba88ea87c4c5d241341d09
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
src/widget_instance.c
src/widget_service.c

index e6a2c4f..0a22bea 100644 (file)
@@ -752,9 +752,9 @@ static int __status_handler(const char *endpoint, aul_app_com_result_e e, bundle
        sender_pid = atoi(sender_pid_str);
        if (__check_valid_sender(widget_id, sender_pid) == -1) {
                bundle_get_str(envelope, AUL_K_PKGID, &sender_pkgid);
+               LOGW("It's not my widget(%s), let's check package");
                if (__check_valid_sender_v2(sender_pkgid) < 0) {
-                       _E("invalid sender, pid %d do not have widget_id %s",
-                                       sender_pid, widget_id);
+                       LOGW("My package do not have widget_id %s", widget_id);
                        return 0;
                }
        }
index 322ef40..f3d6bf6 100644 (file)
@@ -877,12 +877,16 @@ static char *_get_main_app_id(const char *widget_id, uid_t uid)
 
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
-               _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                sqlite3_close_v2(db);
                /* TODO: which error should be set? */
-               set_last_result(ret == SQLITE_DONE ? WIDGET_ERROR_NOT_EXIST :
-                               WIDGET_ERROR_FAULT);
+               if (ret == SQLITE_DONE) {
+                       set_last_result(WIDGET_ERROR_NOT_EXIST);
+                       LOGW("No data for uid (%d)", uid);
+               } else {
+                       set_last_result(WIDGET_ERROR_FAULT);
+                       _E("step error: %s", sqlite3_errmsg(db));
+               }
                return NULL;
        }
 
@@ -1014,12 +1018,16 @@ static char *_get_app_id_of_setup_app(const char *widget_id, uid_t uid)
 
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
-               _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                sqlite3_close_v2(db);
                /* TODO: which error should be set? */
-               set_last_result(ret == SQLITE_DONE ? WIDGET_ERROR_NOT_EXIST :
-                               WIDGET_ERROR_FAULT);
+               if (ret == SQLITE_DONE) {
+                       set_last_result(WIDGET_ERROR_NOT_EXIST);
+                       LOGW("No data for uid (%d)", uid);
+               } else {
+                       set_last_result(WIDGET_ERROR_FAULT);
+                       _E("step error: %s", sqlite3_errmsg(db));
+               }
                return NULL;
        }
 
@@ -1090,12 +1098,16 @@ static int _get_nodisplay(const char *widget_id, uid_t uid)
 
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
-               _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                sqlite3_close_v2(db);
                /* TODO: which error should be set? */
-               set_last_result(ret == SQLITE_DONE ? WIDGET_ERROR_NOT_EXIST :
-                               WIDGET_ERROR_FAULT);
+               if (ret == SQLITE_DONE) {
+                       set_last_result(WIDGET_ERROR_NOT_EXIST);
+                       LOGW("No data for uid (%d)", uid);
+               } else {
+                       set_last_result(WIDGET_ERROR_FAULT);
+                       _E("step error: %s", sqlite3_errmsg(db));
+               }
                return 0;
        }
 
@@ -1133,13 +1145,15 @@ static int _get_update_period(const char *widget_id, uid_t uid, double *period)
 
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
-               _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                sqlite3_close_v2(db);
-               if (ret == SQLITE_DONE)
-                      return WIDGET_ERROR_NOT_EXIST;
-
-               return WIDGET_ERROR_FAULT;
+               if (ret == SQLITE_DONE) {
+                       LOGW("No data for uid (%d)", uid);
+                       return WIDGET_ERROR_NOT_EXIST;
+               } else {
+                       _E("step error: %s", sqlite3_errmsg(db));
+                       return WIDGET_ERROR_FAULT;
+               }
        }
 
        _get_column_double(stmt, 0, period);
@@ -1284,12 +1298,16 @@ static char *_get_preview_image_path(const char *widget_id, int width,
 
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
-               _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                sqlite3_close_v2(db);
                /* TODO: which error should be set? */
-               set_last_result(ret == SQLITE_DONE ? WIDGET_ERROR_NOT_EXIST :
-                               WIDGET_ERROR_FAULT);
+               if (ret == SQLITE_DONE) {
+                       set_last_result(WIDGET_ERROR_NOT_EXIST);
+                       LOGW("No data for uid (%d)", uid);
+               } else {
+                       set_last_result(WIDGET_ERROR_FAULT);
+                       _E("step error: %s", sqlite3_errmsg(db));
+               }
                return NULL;
        }
 
@@ -1459,7 +1477,8 @@ static char *_get_main_widget_id(const char *pkg_id, uid_t uid)
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
                if (ret == SQLITE_DONE)
-                       _E("cannot find widget_id for pkg_id %s", pkg_id);
+                       LOGW("cannot find widget_id for pkg_id %s, uid(%d)"
+                                       , pkg_id, uid);
                else
                        _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
@@ -1516,7 +1535,8 @@ static char *_get_icon(const char *widget_id, const char *lang, uid_t uid)
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
                if (ret == SQLITE_DONE)
-                       _E("cannot find icon for widget %s", widget_id);
+                       LOGW("cannot find icon for widget_id %s, uid(%d)"
+                                       , widget_id, uid);
                else
                        _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
@@ -1608,7 +1628,8 @@ static char *_get_name(const char *widget_id, const char *lang, uid_t uid)
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
                if (ret == SQLITE_DONE)
-                       _E("cannot find label for widget %s", widget_id);
+                       LOGW("cannot find label for widget_id %s, uid(%d)"
+                                       , widget_id, uid);
                else
                        _E("step error: %s", sqlite3_errmsg(db));
                _E("step error: %s", sqlite3_errmsg(db));
@@ -1936,12 +1957,16 @@ static char *_get_package_id(const char *widget_id, uid_t uid)
 
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
-               _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                sqlite3_close_v2(db);
                /* TODO: which error should be set? */
-               set_last_result(ret == SQLITE_DONE ? WIDGET_ERROR_NOT_EXIST :
-                               WIDGET_ERROR_FAULT);
+               if (ret == SQLITE_DONE) {
+                       set_last_result(WIDGET_ERROR_NOT_EXIST);
+                       LOGW("No data for uid (%d)", uid);
+               } else {
+                       set_last_result(WIDGET_ERROR_FAULT);
+                       _E("step error: %s", sqlite3_errmsg(db));
+               }
                return NULL;
        }
 
@@ -2246,13 +2271,15 @@ static int __get_max_instance(const char *widget_id, uid_t uid)
 
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_ROW) {
-               _E("step error: %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                sqlite3_close_v2(db);
-               if (ret == SQLITE_DONE)
+               if (ret == SQLITE_DONE) {
+                       LOGW("No data for uid (%d)", uid);
                        return WIDGET_ERROR_NOT_EXIST;
-
-               return WIDGET_ERROR_FAULT;
+               } else {
+                       _E("step error: %s", sqlite3_errmsg(db));
+                       return WIDGET_ERROR_FAULT;
+               }
        }
 
        _get_column_int(stmt, 0, &max_instance);