Lines Matching refs:saProfile

102 void ParseUtil::CloseHandle(SaProfile& saProfile)
104 if (saProfile.handle == nullptr) {
107 int32_t ret = dlclose(saProfile.handle);
111 saProfile.handle = nullptr;
116 for (auto& saProfile : saProfiles_) {
117 CloseHandle(saProfile);
123 for (auto& saProfile : saProfiles_) {
124 if (saProfile.saId == systemAbilityId) {
125 CloseHandle(saProfile);
139 for (auto& saProfile : saProfiles_) {
140 if (saProfile.runOnCreate && saProfile.bootPhase == bootPhase) {
141 OpenSo(saProfile);
146 void ParseUtil::OpenSo(SaProfile& saProfile)
148 if (saProfile.handle == nullptr) {
149 string dlopenTag = ToString(saProfile.saId) + "_DLOPEN";
153 if (saProfile.runOnCreate) {
154 handle = dlopen(saProfile.libPath.c_str(), RTLD_NOW);
156 SamgrXCollie samgrXCollie("safwk--openso_" + ToString(saProfile.saId), MAX_DLOPEN_SECONDS);
157 handle = dlopen(saProfile.libPath.c_str(), RTLD_NOW);
160 ReportSaLoadDuration(saProfile.saId, SA_LOAD_OPENSO, duration);
162 saProfile.saId, duration);
166 SplitStr(saProfile.libPath, "/", libPathVec);
170 ReportAddSystemAbilityFailed(saProfile.saId, getpid(), getuid(), fileName);
172 saProfile.saId, fileName.c_str(), dlerror());
175 saProfile.handle = handle;
177 KHILOGI("SA:%{public}d handle is not null", saProfile.saId);
183 for (auto& saProfile : saProfiles_) {
184 if (saProfile.saId == systemAbilityId) {
185 OpenSo(saProfile);
197 bool ParseUtil::GetProfile(int32_t saId, SaProfile& saProfile)
199 auto iter = std::find_if(saProfiles_.begin(), saProfiles_.end(), [saId](auto saProfile) {
200 return saProfile.saId == saId;
203 saProfile = *iter;
336 SaProfile saProfile = { procName_ };
337 if (!ParseSystemAbility(saProfile, systemAbilityJson[i])) {
340 saProfiles_.emplace_back(saProfile);
345 bool ParseUtil::ParseSystemAbilityGetExtension(SaProfile& saProfile, nlohmann::json& systemAbilityJson)
355 if (saProfile.extension.size() >= MAX_EXTENSIONO_NUM) {
360 if (std::find(saProfile.extension.begin(), saProfile.extension.end(), extension) ==
361 saProfile.extension.end()) {
362 saProfile.extension.push_back(extension);
369 bool ParseUtil::ParseSystemAbilityGetSaBaseInfo(SaProfile& saProfile, nlohmann::json& systemAbilityJson)
371 GetInt32FromJson(systemAbilityJson, SA_TAG_NAME, saProfile.saId);
372 if (saProfile.saId == 0) {
376 if (saProfile.saId < FIRST_SYS_ABILITY_ID || saProfile.saId > LAST_SYS_ABILITY_ID) {
380 GetStringFromJson(systemAbilityJson, SA_TAG_LIB_PATH, saProfile.libPath);
381 if (saProfile.libPath.empty()) {
385 if (saProfile.libPath.length() > MAX_JSON_STRING_LENGTH) {
392 bool ParseUtil::ParseSystemAbilityGetSaExtInfo(SaProfile& saProfile, nlohmann::json& systemAbilityJson)
394 GetBoolFromJson(systemAbilityJson, SA_TAG_RUN_ON_CREATE, saProfile.runOnCreate);
395 GetBoolFromJson(systemAbilityJson, SA_TAG_MODULE_UPDATE, saProfile.moduleUpdate);
396 GetBoolFromJson(systemAbilityJson, SA_TAG_AUTO_RESTART, saProfile.autoRestart);
397 GetBoolFromJson(systemAbilityJson, SA_TAG_DISTRIBUTED, saProfile.distributed);
398 GetBoolFromJson(systemAbilityJson, SA_TAG_CACHE_COMMON_EVENT, saProfile.cacheCommonEvent);
399 GetIntArrayFromJson(systemAbilityJson, SA_TAG_DEPEND, saProfile.dependSa);
400 GetInt32FromJson(systemAbilityJson, SA_TAG_DEPEND_TIMEOUT, saProfile.dependTimeout);
401 if (saProfile.dependTimeout == 0) {
402 GetInt32FromJson(systemAbilityJson, SA_TAG_DEPEND_TIMEOUT_COMPATIBILITY, saProfile.dependTimeout);
404 GetInt32FromJson(systemAbilityJson, SA_TAG_DUMP_LEVEL, saProfile.dumpLevel);
407 saProfile.capability = capability.length() <= MAX_JSON_STRING_LENGTH ? Str8ToStr16(capability) : u"";
410 saProfile.permission = permission.length() <= MAX_JSON_STRING_LENGTH ? Str8ToStr16(permission) : u"";
413 saProfile.bootPhase = GetBootPriorityPara(bootPhase);
415 ParseStartOndemandTag(systemAbilityJson, SA_TAG_START_ON_DEMAND, saProfile.startOnDemand);
417 ParseStopOndemandTag(systemAbilityJson, SA_TAG_STOP_ON_DEMAND, saProfile.stopOnDemand);
420 if (!CheckRecycleStrategy(recycleStrategy, saProfile.recycleStrategy)) {
425 if (!ParseSystemAbilityGetExtension(saProfile, systemAbilityJson)) {
431 bool ParseUtil::ParseSystemAbility(SaProfile& saProfile, nlohmann::json& systemAbilityJson)
434 if (!ParseSystemAbilityGetSaBaseInfo(saProfile, systemAbilityJson)) {
437 if (!ParseSystemAbilityGetSaExtInfo(saProfile, systemAbilityJson)) {