void *user_data);
/**
+ * @fn int (*pkgmgrinfo_app_permission_list_cb ) (const char *permission_type, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
+ *
+ * @param[in] permission_name the name of the permission
+ * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_appinfo_foreach_category()
+ */
+typedef int (*pkgmgrinfo_app_permission_list_cb ) (const char *permission_type,
+ void *user_data);
+
+/**
* @fn int (*pkgmgrinfo_pkg_privilege_list_cb ) (const char *privilege_name, void *user_data)
*
* @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_foreach_privilege()
*/
int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
pkgmgrinfo_app_list_cb app_func, void *user_data);
+/**
+ * @fn int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+ * @brief This API gets list of installed applications from all packages with minimum informaion.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] app_func iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *pkgid1 = NULL;
+ char *pkgid2 = NULL;
+ pkgid1 = (char *)user_data;
+ pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
+ if (strcmp(pkgid1, pkgid2) == 0) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+static int list_apps()
+{
+ int ret = 0;
+ char *name = "helloworld";
+ ret = pkgmgrinfo_appinfo_get_install_list(app_list_cb, (void *)name);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
/**
* @fn int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission);
/**
+ * @fn int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
+ * @brief This API gets the list of permission for a particular application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle pointer to the application info handle.
+ * @param[in] permission_func callback function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+int permission_func(const char *name, void *user_data)
+{
+ if (strcmp(name, (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+}
+
+static int list_permission(const char *appid, char *permission)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_permission(handle, permission_func, (void *)permission);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
+
+/**
* @fn int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
pkgmgrinfo_app_category_list_cb category_func, void *user_data);
* @brief This API gets the list of category for a particular application
Name: pkgmgr-info
Summary: Packager Manager infomation api for package
-Version: 0.0.108
-Release: 2
+Version: 0.0.110
+Release: 1
Group: Application Framework/Package Management
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
<xs:attribute name="exec" use="required"/>
<xs:attribute name="on-boot" use="required" type="xs:boolean"/>
<xs:attribute name="type" use="required" type="packages:TypeType"/>
+ <xs:attribute name="permission-type" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="ui-application">
<xs:attribute name="landscape-effectimage" type="xs:string"/>
<xs:attribute name="guestmode-visibility" type="xs:string"/>
<xs:attribute name="launchcondition" type="xs:boolean"/>
+ <xs:attribute name="permission-type" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="ime-application">
free((void *)uiapplication->guestmode_visibility);
uiapplication->guestmode_visibility = NULL;
}
+ if (uiapplication->app_component) {
+ free((void *)uiapplication->app_component);
+ uiapplication->app_component = NULL;
+ }
+ if (uiapplication->permission_type) {
+ free((void *)uiapplication->permission_type);
+ uiapplication->permission_type = NULL;
+ }
+
free((void*)uiapplication);
uiapplication = NULL;
}
free((void *)serviceapplication->package);
serviceapplication->package = NULL;
}
+ if (serviceapplication->permission_type) {
+ free((void *)serviceapplication->permission_type);
+ serviceapplication->permission_type = NULL;
+ }
/*Free Label*/
if (serviceapplication->label) {
label_x *label = serviceapplication->label;
} else {
uiapplication->guestmode_visibility = strdup("true");
}
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type"))) {
+ uiapplication->permission_type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type")));
+ if (uiapplication->permission_type == NULL)
+ uiapplication->permission_type = strdup("normal");
+ } else {
+ uiapplication->permission_type = strdup("normal");
+ }
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
} else {
serviceapplication->autorestart = strdup("false");
}
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type"))) {
+ serviceapplication->permission_type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type")));
+ if (serviceapplication->permission_type == NULL)
+ serviceapplication->permission_type = strdup("normal");
+ } else {
+ serviceapplication->permission_type = strdup("normal");
+ }
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
{
- char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", NULL};
+ char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", "font", NULL};
if (manifest == NULL) {
DBG("argument supplied is NULL\n");
return PMINFO_R_EINVAL;
API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
{
- char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", NULL};
+ char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", "font", NULL};
if (manifest == NULL) {
DBG("argument supplied is NULL\n");
return PMINFO_R_EINVAL;
API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
{
- char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", NULL};
+ char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", "font", NULL};
if (manifest == NULL) {
DBG("argument supplied is NULL\n");
return PMINFO_R_EINVAL;
const char *portraitimg;
const char *landscapeimg;
const char *guestmode_visibility;
+ const char *app_component;
+ const char *permission_type;
struct label_x *label;
struct icon_x *icon;
struct image_x *image;
const char *enabled;
const char *type;
const char *package;
+ const char *permission_type;
struct label_x *label;
struct icon_x *icon;
struct appsvc_x *appsvc;
"app_portraitimg text, " \
"app_landscapeimg text, " \
"app_guestmodevisibility text DEFAULT 'true', " \
+ "app_permissiontype text DEFAULT 'normal', " \
"package text not null, " \
"FOREIGN KEY(package) " \
"REFERENCES package_info(package) " \
"(app_id text not null, " \
"pm_type text not null, " \
"pm_value text not null, " \
- "PRIMARY KEY(app_id) " \
+ "PRIMARY KEY(app_id, pm_type, pm_value) " \
"FOREIGN KEY(app_id) " \
"REFERENCES package_app_info(app_id) " \
"ON DELETE CASCADE)"
{
snprintf(query, MAX_QUERY_LEN,
"insert into package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \
- "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_mainapp , app_recentimage, app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, package) " \
- "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_mainapp , app_recentimage, " \
+ "app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, package) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
up->appid, "uiapp", up->exec, up->nodisplay, up->type, "\0", up->multiple,
- "\0", up->taskmanage, up->enabled, up->hwacceleration,up->mainapp, up->recentimage, up->launchcondition, up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_visibility, mfx->package);
+ "\0", up->taskmanage, up->enabled, up->hwacceleration,up->mainapp, up->recentimage,
+ up->launchcondition, up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_visibility, up->permission_type, mfx->package);
ret = __exec_query(query);
if (ret == -1) {
DBG("Package UiApp Info DB Insert Failed\n");
{
snprintf(query, MAX_QUERY_LEN,
"insert into package_app_info(app_id, app_component, app_exec, app_type, app_onboot, " \
- "app_multiple, app_autorestart, app_enabled, package) " \
- "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ "app_multiple, app_autorestart, app_enabled, app_permissiontype, package) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
sp->appid, "svcapp", sp->exec, sp->type, sp->onboot, "\0",
- sp->autorestart, sp->enabled, mfx->package);
+ sp->autorestart, sp->enabled, sp->permission_type, mfx->package);
ret = __exec_query(query);
if (ret == -1) {
DBG("Package ServiceApp Info DB Insert Failed\n");
info->manifest_info->uiapplication->icon->lang = NULL;
info->manifest_info->uiapplication->label->lang = NULL;
}
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->permission_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->permission_type = NULL;
} else
continue;
}
info->manifest_info->serviceapplication->icon->lang = NULL;
info->manifest_info->serviceapplication->label->lang = NULL;
}
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->permission_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->permission_type = NULL;
} else
continue;
}
info->manifest_info->uiapplication->icon->lang = NULL;
info->manifest_info->uiapplication->label->lang = NULL;
}
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->permission_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->permission_type = NULL;
} else
continue;
}
info->manifest_info->serviceapplication->icon->lang = NULL;
info->manifest_info->serviceapplication->label->lang = NULL;
}
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->permission_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->permission_type = NULL;
} else
continue;
}
return 0;
}
+static int __mini_appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)data;
+ int i = 0;
+ uiapplication_x *uiapp = NULL;
+ uiapp = calloc(1, sizeof(uiapplication_x));
+ if (uiapp == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return -1;
+ }
+
+ LISTADD(info->uiapp_info, uiapp);
+
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_id") == 0) {
+ /*appid being foreign key, is column in every table
+ Hence appid gets strduped every time leading to memory leak.
+ If appid is already set, just continue.*/
+ if (info->uiapp_info->appid)
+ continue;
+ if (coltxt[i])
+ info->uiapp_info->appid = strdup(coltxt[i]);
+ else
+ info->uiapp_info->appid = NULL;
+ } else if (strcmp(colname[i], "app_exec") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->exec = strdup(coltxt[i]);
+ else
+ info->uiapp_info->exec = NULL;
+ } else if (strcmp(colname[i], "app_nodisplay") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->nodisplay = strdup(coltxt[i]);
+ else
+ info->uiapp_info->nodisplay = NULL;
+ } else if (strcmp(colname[i], "app_type") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->type = strdup(coltxt[i]);
+ else
+ info->uiapp_info->type = NULL;
+ } else if (strcmp(colname[i], "app_multiple") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->multiple = strdup(coltxt[i]);
+ else
+ info->uiapp_info->multiple = NULL;
+ } else if (strcmp(colname[i], "app_taskmanage") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->taskmanage = strdup(coltxt[i]);
+ else
+ info->uiapp_info->taskmanage = NULL;
+ } else if (strcmp(colname[i], "app_hwacceleration") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->hwacceleration = strdup(coltxt[i]);
+ else
+ info->uiapp_info->hwacceleration = NULL;
+ } else if (strcmp(colname[i], "app_enabled") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->enabled= strdup(coltxt[i]);
+ else
+ info->uiapp_info->enabled = NULL;
+ } else if (strcmp(colname[i], "app_indicatordisplay") == 0){
+ if (coltxt[i])
+ info->uiapp_info->indicatordisplay = strdup(coltxt[i]);
+ else
+ info->uiapp_info->indicatordisplay = NULL;
+ } else if (strcmp(colname[i], "app_portraitimg") == 0){
+ if (coltxt[i])
+ info->uiapp_info->portraitimg = strdup(coltxt[i]);
+ else
+ info->uiapp_info->portraitimg = NULL;
+ } else if (strcmp(colname[i], "app_landscapeimg") == 0){
+ if (coltxt[i])
+ info->uiapp_info->landscapeimg = strdup(coltxt[i]);
+ else
+ info->uiapp_info->landscapeimg = NULL;
+ } else if (strcmp(colname[i], "app_guestmodevisibility") == 0){
+ if (coltxt[i])
+ info->uiapp_info->guestmode_visibility = strdup(coltxt[i]);
+ else
+ info->uiapp_info->guestmode_visibility = NULL;
+ } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->recentimage = strdup(coltxt[i]);
+ else
+ info->uiapp_info->recentimage = NULL;
+ } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->mainapp = strdup(coltxt[i]);
+ else
+ info->uiapp_info->mainapp = NULL;
+ } else if (strcmp(colname[i], "package") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->package = strdup(coltxt[i]);
+ else
+ info->uiapp_info->package = NULL;
+ } else if (strcmp(colname[i], "app_component") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->app_component = strdup(coltxt[i]);
+ else
+ info->uiapp_info->app_component = NULL;
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->permission_type = strdup(coltxt[i]);
+ else
+ info->uiapp_info->permission_type = NULL;
+ } else
+ continue;
+ }
+
+ return 0;
+}
+
static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
{
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)data;
info->uiapp_info->image->section= strdup(coltxt[i]);
else
info->uiapp_info->image->section = NULL;
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->permission_type = strdup(coltxt[i]);
+ else
+ info->uiapp_info->permission_type = NULL;
} else
continue;
}
info->svcapp_info->icon->lang = NULL;
info->svcapp_info->label->lang = NULL;
}
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->permission_type = strdup(coltxt[i]);
+ else
+ info->svcapp_info->permission_type = NULL;
} else
continue;
}
return ret;
}
+API int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
+
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ pkgmgr_appinfo_x *info = NULL;
+ pkgmgr_appinfo_x *appinfo = NULL;
+ uiapplication_x *ptr1 = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open_with_options(MANIFEST_DB, &appinfo_db, SQLITE_OPEN_READONLY, NULL);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*calloc appinfo*/
+ info = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc uiapplication_x*/
+ info->uiapp_info= (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
+ tryvm_if(info->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*query package_app_info*/
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
+ ret = __exec_db_query(appinfo_db, query, __mini_appinfo_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ LISTHEAD(info->uiapp_info, ptr1);
+
+ /*call back*/
+ for(ptr1 = ptr1->next ; ptr1 ; ptr1 = ptr1->next)
+ {
+ appinfo->uiapp_info= ptr1;
+ appinfo->package = strdup(ptr1->package);
+ if (strcmp(ptr1->app_component, "uiapp") == 0)
+ appinfo->app_component = PMINFO_UI_APP;
+ else
+ appinfo->app_component = PMINFO_SVC_APP;
+
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+
+catch:
+ sqlite3_close(appinfo_db);
+
+ if (appinfo) {
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_appinfo(info);
+ return ret;
+}
+
API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
{
retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
retvm_if(permission == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
char *val = NULL;
- permission_x *ptr = NULL;
- permission_x *start = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
if (info->app_component == PMINFO_UI_APP)
- start = info->uiapp_info->permission;
+ val = info->uiapp_info->permission_type;
else if (info->app_component == PMINFO_SVC_APP)
- start = info->svcapp_info->permission;
- else
+ val = info->svcapp_info->permission_type;
+ else {
+ _LOGE("app_component is not supported\n");
return PMINFO_R_EINVAL;
+ }
- for(ptr = start; ptr != NULL; ptr = ptr->next)
- {
- if (ptr->type) {
- val = (char *)ptr->type;
+ if (strcmp(val, "signature") == 0)
+ *permission = PMINFO_PERMISSION_SIGNATURE;
+ else if (strcmp(val, "privilege") == 0)
+ *permission = PMINFO_PERMISSION_PRIVILEGE;
+ else
+ *permission = PMINFO_PERMISSION_NORMAL;
- if (strcmp(val, "signature") == 0)
- *permission = PMINFO_PERMISSION_SIGNATURE;
- else if (strcmp(val, "privilege") == 0)
- *permission = PMINFO_PERMISSION_PRIVILEGE;
- else
- *permission = PMINFO_PERMISSION_NORMAL;
+ return PMINFO_R_OK;
+}
+API int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_permission_list_cb permission_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(permission_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+ int ret = -1;
+ permission_x *ptr = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->app_component == PMINFO_UI_APP)
+ ptr = info->uiapp_info->permission;
+ else if (info->app_component == PMINFO_SVC_APP)
+ ptr = info->svcapp_info->permission;
+ else
+ return PMINFO_R_EINVAL;
+ for (; ptr; ptr = ptr->next) {
+ ret = permission_func(ptr->value, user_data);
+ if (ret < 0)
break;
- }
}
return PMINFO_R_OK;
}