#include <glib.h>
#include <bundle.h>
#include <bundle_internal.h>
+#include <tzplatform_config.h>
#include "aul.h"
#include "aul_api.h"
return ret;
}
+static const char *__get_widget_db_path(uid_t uid)
+{
+#define ROOT_USER 0
+#define GLOBALAPP_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
+ const char *path;
+
+ if (uid == ROOT_USER || uid == GLOBALAPP_USER) {
+ path = tzplatform_mkpath(TZ_SYS_DB, WIDGET_SERVICE_DB);
+ } else {
+ tzplatform_set_user(uid);
+ path = tzplatform_mkpath(TZ_USER_DB, WIDGET_SERVICE_DB);
+ tzplatform_reset_user();
+ }
+
+ return path;
+}
+
static sqlite3 *__open_widget_service_db(uid_t uid, bool readonly)
{
- sqlite3 *db;
- char *path;
+ const char *path;
- path = aul_db_get_path(WIDGET_SERVICE_DB, uid);
+ path = __get_widget_db_path(uid);
if (!path) {
_E("Failed to get db path");
return NULL;
}
- db = aul_db_open(path, readonly);
- free(path);
-
- return db;
+ return aul_db_open(path, readonly);
}
API int aul_widget_service_set_disable_db(const char *widget_id, bool is_disable)