summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-06-13 10:10:25 +0900
committerSung-jae Park <nicesj.park@samsung.com>2013-06-13 10:24:20 +0900
commitf03f18313ffa3d7b3709dea9eec42e94b0c8c661 (patch)
tree294835fce01dc1a1a299d9ebaf3ce0bd52af153d
parentb9419f21b905b2ea0be062aebeafd9c3d792e04c (diff)
downloadlivebox-service-f03f18313ffa3d7b3709dea9eec42e94b0c8c661.tar.gz
livebox-service-f03f18313ffa3d7b3709dea9eec42e94b0c8c661.tar.bz2
livebox-service-f03f18313ffa3d7b3709dea9eec42e94b0c8c661.zip
Update error code and mapping UI-app and DBox
[model] Tizen [binary_type] AP [customer] Tizen Developer [issue#] N/A [problem] Unable to find the UI App using DBox Id. [cause] There is no reference info for UI App in DBox tag. [solution] Use the UI-App field. [team] HomeTF [request] [horizontal_expansion] Change-Id: I28f5541936557e4680705fc7d34fdff800d29040
-rw-r--r--include/debug.h16
-rw-r--r--include/livebox-errno.h1
-rw-r--r--packaging/liblivebox-service.spec2
-rw-r--r--src/livebox-service.c25
4 files changed, 30 insertions, 14 deletions
diff --git a/include/debug.h b/include/debug.h
index cc2e49b..5021bfa 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -14,9 +14,21 @@
* limitations under the License.
*/
+#if !defined(SECURE_LOGD)
+#define SECURE_LOGD LOGD
+#endif
+
+#if !defined(SECURE_LOGE)
+#define SECURE_LOGE LOGE
+#endif
+
+#if !defined(SECURE_LOGW)
+#define SECURE_LOGW LOGW
+#endif
+
#if !defined(FLOG)
-#define DbgPrint(format, arg...) LOGD("[%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg)
-#define ErrPrint(format, arg...) LOGE("[%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg)
+#define DbgPrint(format, arg...) SECURE_LOGD("[%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg)
+#define ErrPrint(format, arg...) SECURE_LOGE("[%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg)
#else
extern FILE *__file_log_fp;
#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
diff --git a/include/livebox-errno.h b/include/livebox-errno.h
index 592037d..1884619 100644
--- a/include/livebox-errno.h
+++ b/include/livebox-errno.h
@@ -37,6 +37,7 @@ enum livebox_status {
LB_STATUS_ERROR_TIMEOUT = LB_STATUS_ERROR | 0x0400,
LB_STATUS_ERROR_NOT_IMPLEMENTED = LB_STATUS_ERROR | 0x0800,
LB_STATUS_ERROR_NO_SPACE = LB_STATUS_ERROR | 0x1000,
+ LB_STATUS_ERROR_DISABLED = LB_STATUS_ERROR | 0x2000,
};
#define LB_STATUS_IS_ERROR(s) (!!((s) & LB_STATUS_ERROR))
diff --git a/packaging/liblivebox-service.spec b/packaging/liblivebox-service.spec
index 25441de..78457aa 100644
--- a/packaging/liblivebox-service.spec
+++ b/packaging/liblivebox-service.spec
@@ -1,6 +1,6 @@
Name: liblivebox-service
Summary: Service API for gathering installed livebox information.
-Version: 0.4.5
+Version: 0.4.6
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/src/livebox-service.c b/src/livebox-service.c
index 5e76e78..7f24bea 100644
--- a/src/livebox-service.c
+++ b/src/livebox-service.c
@@ -622,6 +622,7 @@ static inline char *pkgmgr_get_mainapp(const char *pkgid)
} else {
ErrPrint("Failed to get mainappid\n");
ret = NULL; /* I cannot believe the pkgmgrinfo_pkginfo_get_mainappid. it maybe able to touch my "ret" even though it fails */
+
}
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
@@ -728,7 +729,7 @@ EAPI char *livebox_service_mainappid(const char *lbid)
{
sqlite3_stmt *stmt;
const char *tmp;
- char *pkgid;
+ const char *pkgid;
sqlite3 *handle;
char *ret = NULL;
@@ -739,7 +740,7 @@ EAPI char *livebox_service_mainappid(const char *lbid)
if (!handle)
return NULL;
- if (sqlite3_prepare_v2(handle, "SELECT appid FROM pkgmap WHERE (pkgid = ?) or (appid = ?)", -1, &stmt, NULL) != SQLITE_OK) {
+ if (sqlite3_prepare_v2(handle, "SELECT appid, uiapp FROM pkgmap WHERE (pkgid = ?) or (appid = ? and prime = 1)", -1, &stmt, NULL) != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
@@ -768,20 +769,22 @@ EAPI char *livebox_service_mainappid(const char *lbid)
goto out;
}
- pkgid = strdup(tmp);
- if (!pkgid) {
- ErrPrint("Error: %s\n", strerror(errno));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
+ pkgid = (const char *)sqlite3_column_text(stmt, 1);
+ if (!pkgid || !strlen(pkgid)) {
+ /*
+ * This record has no uiapp.
+ * Try to find the main ui-app id.
+ */
+ ret = pkgmgr_get_mainapp(tmp);
+ } else {
+ ret = strdup(pkgid);
+ if (!ret)
+ ErrPrint("Error: %s\n", strerror(errno));
}
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = pkgmgr_get_mainapp(pkgid);
- free(pkgid);
-
out:
close_db(handle);
return ret;