diff options
author | Konrad Lipinski <k.lipinski2@partner.samsung.com> | 2018-10-04 13:56:14 +0200 |
---|---|---|
committer | Konrad Lipinski <k.lipinski2@partner.samsung.com> | 2018-10-04 14:01:40 +0200 |
commit | 4e5b938c96cf8a76606417c4ae2bfadb0b6e7fbe (patch) | |
tree | 61dd3210450fc6c11418c907f433b7fa046e9abc | |
parent | 4e944753dadb336befa4f870c2c613e40b4963d4 (diff) | |
download | security-manager-4e5b938c96cf8a76606417c4ae2bfadb0b6e7fbe.tar.gz security-manager-4e5b938c96cf8a76606417c4ae2bfadb0b6e7fbe.tar.bz2 security-manager-4e5b938c96cf8a76606417c4ae2bfadb0b6e7fbe.zip |
Optimize package installation
appInstallSmackRules no longer updates the same rules repeatedly for
non-hybrid packages with multiple applications (every application has
the same process label so it's enough to do just one).
Change-Id: I4ba581a9ad5c297f87d591c647a6c56780d4978a
-rw-r--r-- | src/common/service_impl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp index 31527946..e8cff86e 100644 --- a/src/common/service_impl.cpp +++ b/src/common/service_impl.cpp @@ -668,12 +668,14 @@ int ServiceImpl::appInstallSmackRules(app_inst_req &req, InstallHelper &ih) SmackRules::Labels pkgLabels; try { - for (auto &app : req.apps) { - // Check if hybridity is changed if the package is installed - if (ih.isUserPkgInstalled and ih.isOldPkgHybrid != req.isHybrid) { + // Check if hybridity is changed if the package is installed + if (ih.isUserPkgInstalled && ih.isOldPkgHybrid != req.isHybrid) { + for (auto &app : req.apps) { std::string oldAppLabel = SmackLabels::generateProcessLabel( app.appName, req.pkgName, ih.isOldPkgHybrid); SmackRules::uninstallApplicationRules(app.appName, oldAppLabel); + if (req.isHybrid) // was not hybrid - all labels were the same + break; } } @@ -690,6 +692,8 @@ int ServiceImpl::appInstallSmackRules(app_inst_req &req, InstallHelper &ih) SmackRules::installApplicationRules(app.appName, appLabel, req.pkgName, authorId, pkgLabels); + if (!req.isHybrid) // is not hybrid - all labels are the same + break; } SmackRules::generateSharedRORules(pkgsProcessLabels, pkgsInfo); |