QUERY_CREATE_TABLE_PACKAGE_APP_SHARE_ALLOWED, /* ? */
QUERY_CREATE_TABLE_PACKAGE_APP_SHARE_REQUEST, /* ? */
QUERY_CREATE_TABLE_PACKAGE_APP_DATA_CONTROL,
+ QUERY_CREATE_TABLE_PACKAGE_APP_DATA_CONTROL_PRIVILEGE,
QUERY_CREATE_TABLE_PACKAGE_APP_INFO_FOR_UID,
QUERY_CREATE_TRIGGER_UPDATE_PACKAGE_APP_INFO_FOR_UID,
QUERY_CREATE_TABLE_PACKAGE_APP_SPLASH_SCREEN,
if (ret != SQLITE_OK)
return ret;
+ ret = sqlite3_busy_handler(*db, __db_busy_handler, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("failed to register busy handler: %s",
+ sqlite3_errmsg(*db));
+ sqlite3_close_v2(*db);
+ return ret;
+ }
+
if (flags & SQLITE_OPEN_CREATE) {
ret = __initialize_db(*db, path, uid);
if (ret) {
return ret;
}
- ret = sqlite3_busy_handler(*db, __db_busy_handler, NULL);
- if (ret != SQLITE_OK) {
- _LOGE("failed to register busy handler: %s",
- sqlite3_errmsg(*db));
- sqlite3_close_v2(*db);
- return ret;
- }
-
return ret;
}
return 0;
}
+static int __insert_app_data_control_privilege_info(sqlite3 *db,
+ datacontrol_x *datacontrol)
+{
+ static const char query[] =
+ "INSERT INTO package_app_data_control_privilege (providerid,"
+ " privilege, type) VALUES (?, ?, ?)";
+
+ int ret;
+ sqlite3_stmt *stmt;
+ int idx;
+ GList *privileges;
+ char *priv;
+
+ if (datacontrol == NULL)
+ return 0;
+
+ ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("prepare failed: %s", sqlite3_errmsg(db));
+ return -1;
+ }
+
+ for (privileges = datacontrol->privileges; privileges;
+ privileges = privileges->next) {
+ priv = (char *)privileges->data;
+ if (priv == NULL)
+ continue;
+
+ idx = 1;
+ __BIND_TEXT(db, stmt, idx++, datacontrol->providerid);
+ __BIND_TEXT(db, stmt, idx++, priv);
+ __BIND_TEXT(db, stmt, idx++, datacontrol->type);
+
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_DONE) {
+ _LOGE("step failed: %s", sqlite3_errmsg(db));
+ sqlite3_finalize(stmt);
+ return -1;
+ }
+
+ sqlite3_reset(stmt);
+ }
+
+ sqlite3_finalize(stmt);
+ return 0;
+}
+
static int __insert_datacontrol_info(sqlite3 *db, application_x *app)
{
static const char query[] =
return -1;
}
+ if (dc->privileges &&
+ __insert_app_data_control_privilege_info(db, dc)) {
+ sqlite3_finalize(stmt);
+ return -1;
+ }
+
sqlite3_reset(stmt);
}
sqlite3_reset(stmt);
- if (strcasecmp(app->mainapp, "true")) {
+ if (strcasecmp(app->mainapp, "true") == 0) {
if (__insert_mainapp_localized_info(db, app, locale,
label, icon))
_LOGE("insert mainapp localized info failed");
__BIND_TEXT(db, stmt, idx++, mfx->api_version);
__BIND_TEXT(db, stmt, idx++, effective_appid);
__BIND_TEXT(db, stmt, idx++,
- __get_bool(app->splash_screen_display, false));
+ __get_bool(app->splash_screen_display, true));
__BIND_TEXT(db, stmt, idx++, __get_bool(mfx->system, false));
__BIND_TEXT(db, stmt, idx++, __get_bool(mfx->removable, false));
__BIND_TEXT(db, stmt, idx++, mfx->installed_time);
return PM_PARSER_R_EINVAL;
}
- dbpath = __get_parser_db_path(uid);
+ dbpath = __get_parser_db_path(GLOBAL_USER);
- ret = __open_db(uid, dbpath, &db, SQLITE_OPEN_READWRITE);
+ ret = __open_db(GLOBAL_USER, dbpath, &db, SQLITE_OPEN_READWRITE);
if (ret != SQLITE_OK) {
_LOGE("open db failed: %d", ret);
return PM_PARSER_R_ERROR;
return PM_PARSER_R_EINVAL;
}
- dbpath = __get_parser_db_path(uid);
+ dbpath = __get_parser_db_path(GLOBAL_USER);
- ret = __open_db(uid, dbpath, &db, SQLITE_OPEN_READWRITE);
+ ret = __open_db(GLOBAL_USER, dbpath, &db, SQLITE_OPEN_READWRITE);
if (ret != SQLITE_OK) {
_LOGE("open db failed: %d", ret);
return PM_PARSER_R_ERROR;