- int res = 0;
- if (security_manager_app_has_privilege(pkgId, INTERNET_PRIVILEGE, UID_OWNER, &res) == SECURITY_MANAGER_SUCCESS) {
- if (res != 1) {
- std::string filePath = rootPath + "/bin/" + DISABLE_IPV6_FILE;
- std::ofstream output(filePath);
- if (exist(filePath)) {
- _INFO("File to disable IPv6 is created successfully");
- } else {
- _ERR("Failed to create file to disable IPv6 [%s]", pkgId);
- }
- output.close();
+ pkgmgrinfo_pkginfo_h pkg_handle;
+ int ret = pkgmgrGetPkgInfo(pkgId, &pkg_handle);
+ if (ret != 0) {
+ return;
+ }
+
+ ret = pkgmgrinfo_pkginfo_foreach_privilege(pkg_handle, checkInternetPrivilegeCb, NULL);
+ if (ret != PMINFO_R_OK) {
+ _SERR("Failed to pkgmgrinfo_pkginfo_foreach_privilege");
+ pkgmgrinfo_pkginfo_destroy_pkginfo(pkg_handle);
+ return;
+ }
+
+ if (!isInternetPrivilegeExisted) {
+ std::string filePath = rootPath + "/bin/" + DISABLE_IPV6_FILE;
+ std::ofstream output(filePath);
+ if (exist(filePath)) {
+ _INFO("File to disable IPv6 is created successfully");
+ } else {
+ _SERR("Failed to create file to disable IPv6 [%s]", pkgId);