+API int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(const char *providerid,
+ const char *type, uid_t uid, char **appid, bool *is_trusted)
+{
+ retvm_if(providerid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ int ret = PMINFO_R_OK;
+ char *query = NULL;
+ sqlite3_stmt *stmt = NULL;
+
+ /*open db*/
+ ret = __open_manifest_db(uid, true);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*Start constructing query*/
+ query = sqlite3_mprintf("SELECT app_id, trusted FROM package_app_data_control WHERE providerid=%Q AND type=%Q", providerid, type);
+ tryvm_if(query == NULL, ret = PMINFO_R_ERROR, "Out of memory");
+
+ /*prepare query*/
+ ret = sqlite3_prepare_v2(GET_DB(manifest_db), query, strlen(query), &stmt, NULL);
+ tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
+
+ /*step query*/
+ ret = sqlite3_step(stmt);
+ tryvm_if((ret != SQLITE_ROW) || (ret == SQLITE_DONE), ret = PMINFO_R_ERROR, "No records found");
+
+ _save_column_str(stmt, 0, appid);
+ *is_trusted = _get_bool_value((char *)sqlite3_column_text(stmt, 1));
+
+ ret = PMINFO_R_OK;
+
+catch:
+ sqlite3_free(query);
+ sqlite3_finalize(stmt);
+ __close_manifest_db();
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_datacontrol_trsuted_info(const char *providerid,
+ const char *type, char **appid, bool *is_trusted)
+{
+ return pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(providerid,
+ type, _getuid(), appid, is_trusted);
+}
+
+