PkgmgrEventInsertHandler(handle, chunk.get());
pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ info = chunk->Get(appid);
+ if (info == nullptr) {
+ _E("Failed to find appinfo. appid(%s)", appid.c_str());
+ return -1;
+ }
+
+ if (ShouldBeBlocking(info->GetPkgId()))
+ info->SetStatus("blocking");
+
return 0;
}
+bool AppInfoManager::ShouldBeBlocking(const std::string& pkgid) {
+ for (auto const& iter : pkg_events_) {
+ auto& event_args = iter.second;
+ if (event_args->GetPkgId() == pkgid) {
+ _W("The event of the package(%s) is %s",
+ pkgid.c_str(), event_args->GetEventName().c_str());
+ return true;
+ }
+ }
+
+ return false;
+}
+
bool AppInfoManager::IsUpdating(const std::string& pkgid) {
for (auto const& iter : pkg_events_) {
auto& event_args = iter.second;
std::shared_ptr<AppInfoChunk> PrepareAppInfoChunk(uid_t uid);
+ bool ShouldBeBlocking(const std::string& pkgid);
void SetPackageBlocking(uid_t target_uid, const std::string& pkgid,
const std::string& global, bool do_kill);
void UnsetPackageBlocking(uid_t target_uid, const std::string& pkgid,