}
std::vector<std::string> AppInfo::Builder::GetAppControlPrivileges(
- const char* operation) {
+ pkgmgrinfo_appinfo_app_control_h handle) {
std::vector<std::string> privileges;
- int ret = pkgmgrinfo_appinfo_foreach_appcontrol_privileges(
- app_id_.c_str(), operation,
+ int ret = pkgmgrinfo_appinfo_appcontrol_foreach_privilege(
+ handle,
[](const char* privilege_name, void* user_data) {
if (privilege_name == nullptr || privilege_name[0] == '\n') return 0;
},
static_cast<void*>(&privileges));
if (ret != PMINFO_R_OK)
- _E("pkgmgrinfo_appinfo_foreach_appcontrol_privileges() is failed");
+ _E("pkgmgrinfo_appinfo_appcontrol_foreach_privilege() is failed");
return privileges;
}
AppInfo::Builder& AppInfo::Builder::SetAppControl(pkgmgrinfo_appinfo_h handle) {
- int ret = pkgmgrinfo_appinfo_foreach_appcontrol_v2(
+ int ret = pkgmgrinfo_appinfo_foreach_appcontrol_v3(
handle,
- [](const char* operation, const char* uri, const char* mime,
- const char* id, void* user_data) -> int {
+ [](pkgmgrinfo_appinfo_app_control_h appcontrol, void* user_data) -> int {
auto* builder = static_cast<AppInfo::Builder*>(user_data);
std::vector<std::string> privileges =
- builder->GetAppControlPrivileges(operation);
+ builder->GetAppControlPrivileges(appcontrol);
+
+ const char* operation = nullptr;
+ pkgmgrinfo_appinfo_appcontrol_get_operation(appcontrol, &operation);
+ const char* uri = nullptr;
+ pkgmgrinfo_appinfo_appcontrol_get_uri(appcontrol, &uri);
+ const char* mime = nullptr;
+ pkgmgrinfo_appinfo_appcontrol_get_mime(appcontrol, &mime);
+ const char* id = nullptr;
+ pkgmgrinfo_appinfo_appcontrol_get_id(appcontrol, &id);
+
auto mime_type = Util::Split(mime ? mime : "NULL/", "/");
auto* app_control = new (std::nothrow) AppControlInfo(
operation, uri ? uri : "NULL", mime ? mime : "NULL", mime_type[0],