{
try {
for (unsigned appIdx = 0; appIdx < req.apps.size(); ++appIdx) {
- const std::string &appName = req.apps[appIdx].appName;
- std::string processLabel = getAppProcessLabel(appName, req.pkgName);
if (uh.removeApps[appIdx]) {
+ const std::string &appName = req.apps[appIdx].appName;
+ std::string processLabel = getAppProcessLabel(appName, req.pkgName);
LogDebug("Removing Smack rules for appName " << appName);
if (uh.isOldPkgHybrid || uh.removePkg || uh.isOldPkgHybrid != req.isHybrid) {
/*
* Nonhybrid apps have the same label, so revoking it is unnecessary
- * unless whole packagee is being removed.
+ * unless whole package is being removed.
*/
SmackRules::uninstallApplicationRules(appName, processLabel);
}
- LogDebug("Removing Smack rules for pkgName " << req.pkgName);
- SmackRules::uninstallPackageRules(req.pkgName);
if (!uh.removePkg) {
- LogDebug("Recreating Smack rules for pkgName " << req.pkgName);
uh.pkgLabels.erase(std::remove(uh.pkgLabels.begin(), uh.pkgLabels.end(), processLabel),
uh.pkgLabels.end());
- SmackRules::updatePackageRules(req.pkgName, uh.pkgLabels);
- }
-
- if (uh.removePkg) {
- // remove deinstalled package from packages list and generate SharedRO rules for others
- uh.pkgsProcessLabels.erase(
- std::remove_if(uh.pkgsProcessLabels.begin(), uh.pkgsProcessLabels.end(),
- [&](const std::pair<std::string, std::vector<std::string>> &pkg) {
- return pkg.first == req.pkgName;
- }),
- uh.pkgsProcessLabels.end());
-
- SmackRules::generateSharedRORules(uh.pkgsProcessLabels, uh.pkgsInfo);
- SmackRules::revokeSharedRORules(uh.pkgsProcessLabels, req.pkgName);
}
}
+ }
- if (uh.authorId != -1 && uh.removeAuthor) {
- LogDebug("Removing Smack rules for authorId " << uh.authorId);
- SmackRules::uninstallAuthorRules(uh.authorId);
- }
+ LogDebug("Removing Smack rules for pkgName " << req.pkgName);
+ SmackRules::uninstallPackageRules(req.pkgName);
+ if (!uh.removePkg) {
+ LogDebug("Recreating Smack rules for pkgName " << req.pkgName);
+ SmackRules::updatePackageRules(req.pkgName, uh.pkgLabels);
+ } else {
+ // remove deinstalled package from packages list and generate SharedRO rules for others
+ uh.pkgsProcessLabels.erase(
+ std::remove_if(uh.pkgsProcessLabels.begin(), uh.pkgsProcessLabels.end(),
+ [&](const std::pair<std::string, std::vector<std::string>> &pkg) {
+ return pkg.first == req.pkgName;
+ }),
+ uh.pkgsProcessLabels.end());
+
+ SmackRules::generateSharedRORules(uh.pkgsProcessLabels, uh.pkgsInfo);
+ SmackRules::revokeSharedRORules(uh.pkgsProcessLabels, req.pkgName);
+ }
+ if (uh.authorId != -1 && uh.removeAuthor) {
+ LogDebug("Removing Smack rules for authorId " << uh.authorId);
+ SmackRules::uninstallAuthorRules(uh.authorId);
}
SmackRules::mergeRules();