{
int ret = 0;
char *type = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
if (ret != PMINFO_R_OK) {
LOGE("failed to get pkginfo handle! pkgid <%s>", pkgid);
return 0;
}
+static bool __is_disabled_package(uid_t uid, const char *pkgid)
+{
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ int ret = pkgmgrinfo_pkginfo_get_usr_disabled_pkginfo(pkgid, uid, &handle);
+
+ if (handle != NULL)
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+
+ if (ret == PMINFO_R_OK) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
int privilege_package_info_is_privacy_requestable(const uid_t uid, const char* pkgid, const char* privilege, bool* is_requestable)
{
TryReturn(pkgid != NULL, , PRVMGR_ERR_INVALID_PARAMETER, "[PRVMGR_ERR_INVALID_PARAMETER] pkgid must not be NULL.");
LOGE("privilege_db_manager_get_all_privacy_package_list failed. ret = %d", ret);
return PRVMGR_ERR_INTERNAL_ERROR;
}
+
+ GList *l = NULL;
+ for(l = *privacy_list; l != NULL;) { // Remove disabled packages
+ GList *ll = l->next;
+ if (__is_disabled_package(uid, (const char*)l->data)) {
+ LOGD("uid = %d, pkgid = %s is disabled package. Remove.", uid, (char*)l->data);
+ *privacy_list = g_list_remove(*privacy_list, l->data);
+ }
+ l = ll;
+ }
+
return PRVMGR_ERR_NONE;
}
}
return PRVMGR_ERR_NONE;
}
+
int privilege_package_info_get_package_list_by_privacy(const uid_t uid, const char* privacy, GList** package_list)
{
TryReturn(privacy != NULL, , PRVMGR_ERR_INVALID_PARAMETER, "[PRVMGR_ERR_INVALID_PARAMETER] privacy must not be null");
LOGE("privilege_db_manager_get_package_list_by_privacy failed. ret = %d", ret);
return PRVMGR_ERR_INTERNAL_ERROR;
}
+
+ GList *l = NULL;
+ for(l = *package_list; l != NULL;) { // Remove disabled packages
+ GList *ll = l->next;
+ if (__is_disabled_package(uid, (const char*)l->data)) {
+ LOGD("uid = %d, pkgid = %s is disabled package. Remove.", uid, (char*)l->data);
+ *package_list = g_list_remove(*package_list, l->data);
+ }
+ l = ll;
+ }
return PRVMGR_ERR_NONE;
}
+
int privilege_package_info_get_privilege_list_by_pkgid_and_privacy(const uid_t uid, const char* pkgid, const char* privacy, GList** privilege_list)
{
TryReturn(pkgid != NULL && privacy != NULL, , PRVMGR_ERR_INVALID_PARAMETER, "[PRVMGR_ERR_INVALID_PARAMETER] pkgid and privacy must not be null");