X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=NativeLauncher%2Ftool%2Fprivilege_common.cc;h=66f38eb64e7af878a3db886ac70c0e6c0394b0b0;hb=e13a51071869d132412452660504c235be058aa5;hp=737a971f3978c36ad17cb68cb772c5a36afcd0dc;hpb=21fb9cc94d130340384105d4a7e29e43ff6a2bd2;p=platform%2Fcore%2Fdotnet%2Flauncher.git diff --git a/NativeLauncher/tool/privilege_common.cc b/NativeLauncher/tool/privilege_common.cc index 737a971..66f38eb 100644 --- a/NativeLauncher/tool/privilege_common.cc +++ b/NativeLauncher/tool/privilege_common.cc @@ -64,8 +64,22 @@ void checkInternetPrivilegeAndDisableIPv6(const char* pkgId, const std::string& static int checkAppPrivilegeListCb(pkgmgrinfo_appinfo_h handle, void *user_data) { + int ret = 0; + char* appType = NULL; + + ret = pkgmgrinfo_appinfo_get_apptype(handle, &appType); + if (ret != PMINFO_R_OK) { + _SERR("Failed to get apptype"); + return 0; + } + + // skip if appType is NULL or appType does not contains "dotnet", + if (appType == NULL || (appType != NULL && strstr(appType, "dotnet") == NULL)) { + return 0; + } + char *pkgId = NULL; - int ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId); + ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId); if (ret != PMINFO_R_OK || pkgId == NULL) { _SERR("Failed to get package id"); return 0; @@ -83,40 +97,10 @@ static int checkAppPrivilegeListCb(pkgmgrinfo_appinfo_h handle, void *user_data) return 0; } -static void checkAppPrivilegeByAppType(const char* type) -{ - pkgmgrinfo_appinfo_filter_h filter; - - int ret = pkgmgrinfo_appinfo_filter_create(&filter); - if (ret != PMINFO_R_OK) { - _SERR("Failed to create appinfo filter"); - return; - } - - ret = pkgmgrinfo_appinfo_filter_add_string(filter, PMINFO_APPINFO_PROP_APP_TYPE, type); - if (ret != PMINFO_R_OK) { - pkgmgrinfo_appinfo_filter_destroy(filter); - _SERR("Failed to add appinfo filter (%s)", type); - return; - } - - ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(filter, checkAppPrivilegeListCb, NULL); - if (ret != PMINFO_R_OK) { - _SERR("Failed to pkgmgrinfo_appinfo_filter_foreach_appinfo"); - pkgmgrinfo_appinfo_filter_destroy(filter); - return; - } - - pkgmgrinfo_appinfo_filter_destroy(filter); - - return; -} - void checkAllAppPrivilege() { - std::vector appTypeList = {"dotnet", "dotnet-nui", "dotnet-inhouse"}; - - for (auto& type : appTypeList) { - checkAppPrivilegeByAppType(type); + int ret = pkgmgrinfo_appinfo_get_installed_list(checkAppPrivilegeListCb, NULL); + if (ret != PMINFO_R_OK) { + _SERR("Failed to get installed list"); } }