mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-12-11 20:03:42 +00:00
0808 Signed-off-by: 帝俊 <yexinjie@huawei.com>
This commit is contained in:
parent
a8f7d292bb
commit
064e148fd5
@ -57,7 +57,7 @@ void CheckArrayType(
|
||||
case ArrayType::STRING:
|
||||
for (const auto &array : arrays) {
|
||||
if (!array.is_string()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s is not string type", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s not string", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
}
|
||||
}
|
||||
@ -68,7 +68,7 @@ void CheckArrayType(
|
||||
case ArrayType::OBJECT:
|
||||
for (const auto &array : arrays) {
|
||||
if (!array.is_object()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s is not object type", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s not object", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
break;
|
||||
}
|
||||
@ -80,7 +80,7 @@ void CheckArrayType(
|
||||
case ArrayType::NUMBER:
|
||||
for (const auto &array : arrays) {
|
||||
if (!array.is_number()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s is not number type", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s not number", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ void CheckArrayType(
|
||||
}
|
||||
break;
|
||||
case ArrayType::NOT_ARRAY:
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s is not string type", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s not string", key.c_str());
|
||||
break;
|
||||
default:
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "array %{public}s type error", key.c_str());
|
||||
@ -109,7 +109,7 @@ void GetValueIfFindKey(const nlohmann::json &jsonObject, const nlohmann::detail:
|
||||
switch (jsonType) {
|
||||
case JsonType::BOOLEAN:
|
||||
if (!jsonObject.at(key).is_boolean()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type is error %{public}s is not boolean", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type:%{public}s not bool", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
break;
|
||||
}
|
||||
@ -117,7 +117,7 @@ void GetValueIfFindKey(const nlohmann::json &jsonObject, const nlohmann::detail:
|
||||
break;
|
||||
case JsonType::NUMBER:
|
||||
if (!jsonObject.at(key).is_number()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type is error %{public}s is not number", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type:%{public}s not number", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
break;
|
||||
}
|
||||
@ -125,7 +125,7 @@ void GetValueIfFindKey(const nlohmann::json &jsonObject, const nlohmann::detail:
|
||||
break;
|
||||
case JsonType::OBJECT:
|
||||
if (!jsonObject.at(key).is_object()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type is error %{public}s is not object", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type:%{public}s not object", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
break;
|
||||
}
|
||||
@ -133,7 +133,7 @@ void GetValueIfFindKey(const nlohmann::json &jsonObject, const nlohmann::detail:
|
||||
break;
|
||||
case JsonType::ARRAY:
|
||||
if (!jsonObject.at(key).is_array()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type is error %{public}s is not array", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type:%{public}s not array", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
break;
|
||||
}
|
||||
@ -141,7 +141,7 @@ void GetValueIfFindKey(const nlohmann::json &jsonObject, const nlohmann::detail:
|
||||
break;
|
||||
case JsonType::STRING:
|
||||
if (!jsonObject.at(key).is_string()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type is error %{public}s is not string", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type:%{public}s not string", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
break;
|
||||
}
|
||||
@ -151,10 +151,10 @@ void GetValueIfFindKey(const nlohmann::json &jsonObject, const nlohmann::detail:
|
||||
}
|
||||
break;
|
||||
case JsonType::NULLABLE:
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type is error %{public}s is nullable", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type:%{public}s is nullable", key.c_str());
|
||||
break;
|
||||
default:
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type is error %{public}s is not jsonType", key.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "type:%{public}s not jsonType", key.c_str());
|
||||
parseResult = ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR;
|
||||
}
|
||||
return;
|
||||
@ -176,13 +176,13 @@ template<typename T>
|
||||
bool ParseInfoFromJsonStr(const char *data, T &t)
|
||||
{
|
||||
if (data == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "%{public}s failed due to data is nullptr", __func__);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "null data");
|
||||
return false;
|
||||
}
|
||||
|
||||
nlohmann::json jsonObject = nlohmann::json::parse(data, nullptr, false);
|
||||
if (jsonObject.is_discarded()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "%{public}s failed due to data is discarded", __func__);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "discarded data");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -54,31 +54,31 @@ void AbilityContext::SetOptions(const Options &options)
|
||||
{
|
||||
options_ = options;
|
||||
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.bundleName: %{public}s", options.bundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.moduleName: %{public}s", options.moduleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.modulePath: %{public}s", options.modulePath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.resourcePath: %{public}s", options.resourcePath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.debugPort: %{public}d", options.debugPort);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.assetPath: %{public}s", options.assetPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.systemResourcePath: %{public}s", options.systemResourcePath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.appResourcePath: %{public}s", options.appResourcePath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.containerSdkPath: %{public}s", options.containerSdkPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.url: %{public}s", options.url.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.language: %{public}s", options.language.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.region: %{public}s", options.region.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.script: %{public}s", options.script.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.themeId: %{public}d", options.themeId);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.deviceWidth: %{public}d", options.deviceWidth);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.deviceHeight: %{public}d", options.deviceHeight);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.isRound: %{public}d", options.themeId);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.compatibleVersion: %{public}d", options.compatibleVersion);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.installationFree: %{public}d", options.installationFree);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.labelId: %{public}d", options.labelId);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.compileMode: %{public}s", options.compileMode.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.pageProfile: %{public}s", options.pageProfile.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.targetVersion: %{public}d", options.targetVersion);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.releaseType: %{public}s", options.releaseType.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Options.enablePartialUpdate: %{public}d", options.enablePartialUpdate);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "bundleName:%{public}s", options.bundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "moduleName:%{public}s", options.moduleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "modulePath:%{public}s", options.modulePath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "resourcePath:%{public}s", options.resourcePath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "debugPort:%{public}d", options.debugPort);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "assetPath:%{public}s", options.assetPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "systemResourcePath:%{public}s", options.systemResourcePath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "appResourcePath:%{public}s", options.appResourcePath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "containerSdkPath:%{public}s", options.containerSdkPath.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "url:%{public}s", options.url.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "language:%{public}s", options.language.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "region:%{public}s", options.region.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "script:%{public}s", options.script.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "themeId:%{public}d", options.themeId);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "deviceWidth:%{public}d", options.deviceWidth);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "deviceHeight:%{public}d", options.deviceHeight);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "isRound:%{public}d", options.themeId);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "compatibleVersion:%{public}d", options.compatibleVersion);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "installationFree:%{public}d", options.installationFree);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "labelId:%{public}d", options.labelId);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "compileMode:%{public}s", options.compileMode.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "pageProfile:%{public}s", options.pageProfile.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "targetVersion:%{public}d", options.targetVersion);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "releaseType:%{public}s", options.releaseType.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "enablePartialUpdate:%{public}d", options.enablePartialUpdate);
|
||||
}
|
||||
|
||||
std::string AbilityContext::GetBundleName()
|
||||
|
@ -200,9 +200,9 @@ std::string AbilityStageContext::GetCloudFileDir()
|
||||
|
||||
void AbilityStageContext::SwitchArea(int mode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called, mode:%{public}d.", mode);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called, mode:%{public}d", mode);
|
||||
if (mode < 0 || mode >= static_cast<int>(sizeof(CONTEXT_ELS) / sizeof(CONTEXT_ELS[0]))) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "mode is invalid.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "mode invalid");
|
||||
return;
|
||||
}
|
||||
currArea_ = CONTEXT_ELS[mode];
|
||||
@ -219,7 +219,7 @@ int AbilityStageContext::GetArea()
|
||||
}
|
||||
}
|
||||
if (mode == -1) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Not find mode.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Not find mode");
|
||||
return EL_DEFAULT;
|
||||
}
|
||||
return mode;
|
||||
@ -247,7 +247,7 @@ bool AbilityStageContext::Access(const std::string &path)
|
||||
std::unique_ptr<uv_fs_t, decltype(AbilityStageContext::FsReqCleanup)*> access_req = {
|
||||
new uv_fs_t, AbilityStageContext::FsReqCleanup };
|
||||
if (!access_req) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to request heap memory.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "request heap memory failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -260,25 +260,25 @@ void AbilityStageContext::Mkdir(const std::string &path)
|
||||
std::unique_ptr<uv_fs_t, decltype(AbilityStageContext::FsReqCleanup)*> mkdir_req = {
|
||||
new uv_fs_t, AbilityStageContext::FsReqCleanup };
|
||||
if (!mkdir_req) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to request heap memory.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "request heap memory failed");
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = uv_fs_mkdir(nullptr, mkdir_req.get(), path.c_str(), DIR_DEFAULT_PERM, nullptr);
|
||||
if (ret < 0) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to create directory");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create directory failed");
|
||||
}
|
||||
}
|
||||
|
||||
bool AbilityStageContext::CreateMultiDir(const std::string &path)
|
||||
{
|
||||
if (path.empty()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "path is empty");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "empty path");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Access(path)) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "path is already exist");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "path existed");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ void to_json(nlohmann::json &jsonObject, const Metadata &metadata)
|
||||
|
||||
void to_json(nlohmann::json &jsonObject, const AbilityInfo &abilityInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "AbilityInfo to_json begin");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
jsonObject = nlohmann::json {
|
||||
{JSON_KEY_NAME, abilityInfo.name},
|
||||
{JSON_KEY_LABEL, abilityInfo.label},
|
||||
@ -288,13 +288,13 @@ void from_json(const nlohmann::json &jsonObject, Metadata &metadata)
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGD(
|
||||
AAFwkTag::ABILITY_SIM, "read Ability Metadata from database error, error code : %{public}d", parseResult);
|
||||
AAFwkTag::ABILITY_SIM, "read Ability Metadata error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &jsonObject, AbilityInfo &abilityInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "AbilityInfo from_json begin");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
const auto &jsonObjectEnd = jsonObject.end();
|
||||
int32_t parseResult = ERR_OK;
|
||||
GetValueIfFindKey<std::string>(jsonObject,
|
||||
@ -850,7 +850,7 @@ void from_json(const nlohmann::json &jsonObject, AbilityInfo &abilityInfo)
|
||||
parseResult,
|
||||
ArrayType::STRING);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "AbilityInfo from_json error, error code : %{public}d", parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "AbilityInfo from_json error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
@ -148,7 +148,7 @@ void from_json(const nlohmann::json &jsonObject, Resource &resource)
|
||||
parseResult,
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "read Resource from database error, error code : %{public}d", parseResult);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "read Resource from database error,:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -865,7 +865,7 @@ void from_json(const nlohmann::json &jsonObject, ApplicationInfo &applicationInf
|
||||
parseResult,
|
||||
ArrayType::NUMBER);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "from_json error, error code : %{public}d", parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "from_json error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
@ -33,7 +33,7 @@ void BundleContainer::LoadBundleInfos(const std::vector<uint8_t> &buffer)
|
||||
{
|
||||
bundleInfo_ = std::make_shared<InnerBundleInfo>();
|
||||
if (!bundleInfo_) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "bundleInfo_ is nullptr");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "null bundleInfo_");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ std::shared_ptr<HapModuleInfo> BundleContainer::GetHapModuleInfo(const std::stri
|
||||
if (bundleInfo_ != nullptr) {
|
||||
auto uid = Constants::UNSPECIFIED_USERID;
|
||||
TAG_LOGI(AAFwkTag::ABILITY_SIM,
|
||||
"BundleContainer GetHapModuleInfo by modulePackage %{public}s", modulePackage.c_str());
|
||||
"modulePackage %{public}s", modulePackage.c_str());
|
||||
std::optional<HapModuleInfo> hapMouduleInfo = bundleInfo_->FindHapModuleInfo(modulePackage, uid);
|
||||
if (hapMouduleInfo) {
|
||||
auto hapInfo = std::make_shared<HapModuleInfo>();
|
||||
|
@ -52,7 +52,7 @@ const std::string UID = "uid";
|
||||
}; // namespace
|
||||
void to_json(nlohmann::json &jsonObject, const ExtensionAbilityInfo &extensionInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "ExtensionAbilityInfo to_json begin");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
jsonObject = nlohmann::json {
|
||||
{Constants::BUNDLE_NAME, extensionInfo.bundleName},
|
||||
{Constants::MODULE_NAME, extensionInfo.moduleName},
|
||||
@ -83,7 +83,7 @@ void to_json(nlohmann::json &jsonObject, const ExtensionAbilityInfo &extensionIn
|
||||
|
||||
void from_json(const nlohmann::json &jsonObject, ExtensionAbilityInfo &extensionInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "ExtensionAbilityInfo from_json begin");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
const auto &jsonObjectEnd = jsonObject.end();
|
||||
int32_t parseResult = ERR_OK;
|
||||
GetValueIfFindKey<std::string>(jsonObject,
|
||||
@ -279,7 +279,7 @@ void from_json(const nlohmann::json &jsonObject, ExtensionAbilityInfo &extension
|
||||
parseResult,
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "ExtensionAbilityInfo from_json error, error code : %{public}d", parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "ExtensionAbilityInfo from_json error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
@ -99,7 +99,7 @@ void from_json(const nlohmann::json &jsonObject, PreloadItem &preloadItem)
|
||||
parseResult,
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "read PreloadItem from database error, error code : %{public}d", parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "read PreloadItem from database error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ void from_json(const nlohmann::json &jsonObject, ProxyData &proxyData)
|
||||
parseResult,
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "read ProxyData from database error, error code : %{public}d", parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "read ProxyData from database error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ void from_json(const nlohmann::json &jsonObject, HapModuleInfo &hapModuleInfo)
|
||||
parseResult,
|
||||
ArrayType::STRING);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "HapModuleInfo from_json error, error code : %{public}d", parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "HapModuleInfo from_json error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
@ -133,9 +133,9 @@ InnerBundleInfo::InnerBundleInfo()
|
||||
{
|
||||
baseApplicationInfo_ = std::make_shared<ApplicationInfo>();
|
||||
if (baseApplicationInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "baseApplicationInfo_ is nullptr, create failed");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null baseApplicationInfo_");
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "inner bundle info instance is created");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "instance created");
|
||||
}
|
||||
|
||||
InnerBundleInfo &InnerBundleInfo::operator=(const InnerBundleInfo &info)
|
||||
@ -166,7 +166,7 @@ InnerBundleInfo &InnerBundleInfo::operator=(const InnerBundleInfo &info)
|
||||
|
||||
InnerBundleInfo::~InnerBundleInfo()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "inner bundle info instance is destroyed");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "instance destroyed");
|
||||
}
|
||||
|
||||
void to_json(nlohmann::json &jsonObject, const Distro &distro)
|
||||
@ -703,7 +703,7 @@ void from_json(const nlohmann::json &jsonObject, InnerModuleInfo &info)
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(
|
||||
AAFwkTag::ABILITY_SIM, "read InnerModuleInfo from database error, error code : %{public}d", parseResult);
|
||||
AAFwkTag::ABILITY_SIM, "read InnerModuleInfo from database error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -736,13 +736,13 @@ void from_json(const nlohmann::json &jsonObject, Dependency &dependency)
|
||||
parseResult,
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Dependency from_json error, error code : %{public}d", parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Dependency from_json error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &jsonObject, Distro &distro)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "from_json start.");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
const auto &jsonObjectEnd = jsonObject.end();
|
||||
int32_t parseResult = ERR_OK;
|
||||
GetValueIfFindKey<bool>(jsonObject,
|
||||
@ -779,7 +779,7 @@ void from_json(const nlohmann::json &jsonObject, Distro &distro)
|
||||
parseResult,
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Distro from_json error, error code : %{public}d", parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Distro from_json error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -885,7 +885,7 @@ int32_t InnerBundleInfo::FromJson(const nlohmann::json &jsonObject)
|
||||
ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(
|
||||
AAFwkTag::ABILITY_SIM, "read InnerBundleInfo from database error, error code : %{public}d", parseResult);
|
||||
AAFwkTag::ABILITY_SIM, "read InnerBundleInfo from database error:%{public}d", parseResult);
|
||||
}
|
||||
return parseResult;
|
||||
}
|
||||
@ -894,7 +894,7 @@ std::optional<HapModuleInfo> InnerBundleInfo::FindHapModuleInfo(const std::strin
|
||||
{
|
||||
auto it = innerModuleInfos_.find(modulePackage);
|
||||
if (it == innerModuleInfos_.end()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "can not find module %{public}s", modulePackage.c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "not find module %{public}s", modulePackage.c_str());
|
||||
return std::nullopt;
|
||||
}
|
||||
HapModuleInfo hapInfo;
|
||||
|
@ -65,7 +65,7 @@ void from_json(const nlohmann::json &jsonObject, ModuleInfo &moduleInfo)
|
||||
ArrayType::STRING);
|
||||
if (parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM,
|
||||
"read module moduleInfo from jsonObject error, error code : %{public}d", parseResult);
|
||||
"read module moduleInfo from jsonObject error:%{public}d", parseResult);
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
@ -57,7 +57,7 @@ const std::unordered_map<std::string, ExtensionAbilityType> EXTENSION_TYPE_MAP =
|
||||
|
||||
ExtensionAbilityType ConvertToExtensionAbilityType(const std::string &type)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "ConvertToExtensionAbilityType start");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
if (EXTENSION_TYPE_MAP.find(type) != EXTENSION_TYPE_MAP.end()) {
|
||||
return EXTENSION_TYPE_MAP.at(type);
|
||||
}
|
||||
@ -67,7 +67,7 @@ ExtensionAbilityType ConvertToExtensionAbilityType(const std::string &type)
|
||||
|
||||
std::string ConvertToExtensionTypeName(ExtensionAbilityType type)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "ConvertToExtensionTypeName start");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
for (const auto &[key, val] : EXTENSION_TYPE_MAP) {
|
||||
if (val == type) {
|
||||
return key;
|
||||
@ -1424,7 +1424,7 @@ bool CheckModuleNameIsValid(const std::string &moduleName)
|
||||
return false;
|
||||
}
|
||||
if (moduleName.find(Constants::MODULE_NAME_SEPARATOR) != std::string::npos) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "module name should not contain ,");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "module name contain");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1725,7 +1725,7 @@ bool ParseExtensionInfo(const Profile::ModuleJson &moduleJson, InnerBundleInfo &
|
||||
for (const Profile::Extension &extension : moduleJson.module.extensionAbilities) {
|
||||
ExtensionAbilityInfo extensionInfo;
|
||||
if (!ToExtensionInfo(moduleJson, extension, transformParam, extensionInfo)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "To extensionInfo failed");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "extensionInfo failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1807,7 +1807,7 @@ ErrCode ModuleProfile::TransformTo(const std::vector<uint8_t> &buf, InnerBundleI
|
||||
|
||||
Profile::ModuleJson moduleJson = jsonObject.get<Profile::ModuleJson>();
|
||||
if (Profile::g_parseResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "g_parseResult is %{public}d", Profile::g_parseResult);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "g_parseResult:%{public}d", Profile::g_parseResult);
|
||||
int32_t ret = Profile::g_parseResult;
|
||||
// need recover parse result to ERR_OK
|
||||
Profile::g_parseResult = ERR_OK;
|
||||
|
@ -58,13 +58,13 @@ bool CommonFunc::ParsePropertyArray(napi_env env, napi_value args, const std::st
|
||||
bool hasKey = false;
|
||||
napi_has_named_property(env, args, propertyName.c_str(), &hasKey);
|
||||
if (!hasKey) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "%{public}s is not exist", propertyName.c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "%{public}s not exist", propertyName.c_str());
|
||||
return true;
|
||||
}
|
||||
napi_value property = nullptr;
|
||||
napi_status status = napi_get_named_property(env, args, propertyName.c_str(), &property);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "get name property failed, propertyName: %{public}s", propertyName.c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "get name property failed, propertyName:%{public}s", propertyName.c_str());
|
||||
return false;
|
||||
}
|
||||
bool isArray = false;
|
||||
|
@ -111,7 +111,7 @@ napi_value JsAbilityContext::TerminateSelf(napi_env env, napi_callback_info info
|
||||
|
||||
napi_value JsAbilityContext::OnTerminateSelf(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "TerminateSelf");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
auto abilityContext = context_.lock();
|
||||
if (abilityContext == nullptr) {
|
||||
return nullptr;
|
||||
@ -183,10 +183,10 @@ napi_value JsAbilityContext::IsTerminating(napi_env env, napi_callback_info info
|
||||
|
||||
napi_value JsAbilityContext::OnIsTerminating(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "IsTerminating");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
auto context = context_.lock();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "OnIsTerminating context is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null context");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
return CreateJsValue(env, context->IsTerminating());
|
||||
@ -205,20 +205,20 @@ void JsAbilityContext::ConfigurationUpdated(napi_env env, std::shared_ptr<Native
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
if (jsContext == nullptr || config == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "jsContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null jsContext");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value value = jsContext->GetNapiValue();
|
||||
if (value == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "value is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null value");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env, value, "onUpdateConfiguration", &method);
|
||||
if (method == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to get onUpdateConfiguration from object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,24 +42,23 @@ void JsAbilityStageContext::ConfigurationUpdated(napi_env env, std::shared_ptr<N
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
if (!jsContext || !config) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "jsContext or config is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null jsContext or config");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value value = jsContext->GetNapiValue();
|
||||
if (value == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "value is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null value");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env, value, "onUpdateConfiguration", &method);
|
||||
if (!method) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to get onUpdateConfiguration from object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "JsAbilityStageContext call onUpdateConfiguration.");
|
||||
napi_value argv[] = { CreateJsConfiguration(env, *config) };
|
||||
napi_value callResult = nullptr;
|
||||
napi_call_function(env, value, method, 1, argv, &callResult);
|
||||
|
@ -43,7 +43,7 @@ napi_value JsApplicationContextUtils::OnSwitchArea(napi_env env, NapiCallbackInf
|
||||
{
|
||||
napi_value object = info.thisVar;
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "object is null");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null object");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
BindNativeProperty(env, object, "cacheDir", GetCacheDir);
|
||||
@ -78,7 +78,7 @@ napi_value JsApplicationContextUtils::OnGetTempDir(napi_env env, NapiCallbackInf
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetTempDir();
|
||||
@ -94,7 +94,7 @@ napi_value JsApplicationContextUtils::OnGetResourceDir(napi_env env, NapiCallbac
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetResourceDir();
|
||||
@ -110,7 +110,7 @@ napi_value JsApplicationContextUtils::OnGetArea(napi_env env, NapiCallbackInfo &
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int area = context->GetArea();
|
||||
@ -126,7 +126,7 @@ napi_value JsApplicationContextUtils::OnGetCacheDir(napi_env env, NapiCallbackIn
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetCacheDir();
|
||||
@ -142,7 +142,7 @@ napi_value JsApplicationContextUtils::OnGetFilesDir(napi_env env, NapiCallbackIn
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetFilesDir();
|
||||
@ -159,7 +159,7 @@ napi_value JsApplicationContextUtils::OnGetDistributedFilesDir(napi_env env, Nap
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetDistributedFilesDir();
|
||||
@ -175,7 +175,7 @@ napi_value JsApplicationContextUtils::OnGetDatabaseDir(napi_env env, NapiCallbac
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetDatabaseDir();
|
||||
@ -192,7 +192,7 @@ napi_value JsApplicationContextUtils::OnGetPreferencesDir(napi_env env, NapiCall
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetPreferencesDir();
|
||||
@ -209,7 +209,7 @@ napi_value JsApplicationContextUtils::OnGetBundleCodeDir(napi_env env, NapiCallb
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetBundleCodeDir();
|
||||
@ -226,7 +226,7 @@ napi_value JsApplicationContextUtils::OnGetCloudFileDir(napi_env env, NapiCallba
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetCloudFileDir();
|
||||
@ -291,7 +291,7 @@ napi_value JsApplicationContextUtils::OnGetApplicationContext(napi_env env, Napi
|
||||
napi_value value = CreateJsApplicationContext(env, context_.lock());
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.ApplicationContext", &value, 1);
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "OnGetApplicationContext, invalid systemModule.");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "invalid systemModule");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
return systemModule->GetNapiValue();
|
||||
|
@ -43,7 +43,7 @@ std::string MakeLogContent(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
if (value == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to convert to string object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "convert to string failed");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ std::string MakeLogContent(napi_env env, napi_callback_info info)
|
||||
|
||||
auto buff = new (std::nothrow) char[bufferLen + 1];
|
||||
if (buff == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to allocate buffer, size = %zu", bufferLen + 1);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "allocate buffer failed, size = %zu", bufferLen + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ template<LogLevel LEVEL>
|
||||
napi_value ConsoleLog(napi_env env, napi_callback_info info)
|
||||
{
|
||||
if (env == nullptr || info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "env or callback info is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null env/callback info");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ void InitConsoleLogModule(napi_env env, napi_value globalObject)
|
||||
napi_value consoleObj = nullptr;
|
||||
napi_create_object(env, &consoleObj);
|
||||
if (consoleObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to create console object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create console object failed");
|
||||
return;
|
||||
}
|
||||
const char *moduleName = "console";
|
||||
|
@ -90,13 +90,13 @@ napi_value JsBaseContext::SwitchArea(napi_env env, napi_callback_info info)
|
||||
napi_value JsBaseContext::OnSwitchArea(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
if (info.argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "invalid argc");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ napi_value JsBaseContext::OnSwitchArea(napi_env env, NapiCallbackInfo &info)
|
||||
|
||||
napi_value object = info.thisVar;
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "object is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null object");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
BindNativeProperty(env, object, "cacheDir", GetCacheDir);
|
||||
@ -144,7 +144,7 @@ napi_value JsBaseContext::OnGetArea(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int area = context->GetArea();
|
||||
@ -160,7 +160,7 @@ napi_value JsBaseContext::OnGetCacheDir(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetCacheDir();
|
||||
@ -176,7 +176,7 @@ napi_value JsBaseContext::OnGetTempDir(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetTempDir();
|
||||
@ -192,7 +192,7 @@ napi_value JsBaseContext::OnGetResourceDir(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetResourceDir();
|
||||
@ -208,7 +208,7 @@ napi_value JsBaseContext::OnGetFilesDir(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetFilesDir();
|
||||
@ -224,7 +224,7 @@ napi_value JsBaseContext::OnGetDistributedFilesDir(napi_env env, NapiCallbackInf
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetDistributedFilesDir();
|
||||
@ -240,7 +240,7 @@ napi_value JsBaseContext::OnGetDatabaseDir(napi_env env, NapiCallbackInfo &info)
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetDatabaseDir();
|
||||
@ -256,7 +256,7 @@ napi_value JsBaseContext::OnGetPreferencesDir(napi_env env, NapiCallbackInfo &in
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetPreferencesDir();
|
||||
@ -272,7 +272,7 @@ napi_value JsBaseContext::OnGetBundleCodeDir(napi_env env, NapiCallbackInfo &inf
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetBundleCodeDir();
|
||||
@ -288,7 +288,7 @@ napi_value JsBaseContext::OnGetCloudFileDir(napi_env env, NapiCallbackInfo &info
|
||||
{
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context is already released");
|
||||
TAG_LOGW(AAFwkTag::ABILITY_SIM, "context released");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string path = context->GetCloudFileDir();
|
||||
|
@ -52,7 +52,7 @@ int32_t ConvertDisplayId(const std::string &displayId)
|
||||
|
||||
Global::Resource::ScreenDensity ConvertDensity(const std::string &density)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "ConvertDensity is called");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
auto resolution = Global::Resource::ScreenDensity::SCREEN_DENSITY_NOT_SET;
|
||||
|
||||
static const std::vector<std::pair<std::string, Global::Resource::ScreenDensity>> resolutions = {
|
||||
@ -98,7 +98,7 @@ napi_value CreateJsConfiguration(napi_env env, const AppExecFwk::Configuration &
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Native object is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null Native object");
|
||||
return object;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ napi_value CreateJsApplicationInfo(napi_env env, const AppExecFwk::ApplicationIn
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Create object failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Create object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ napi_value CreateJsHapModuleInfo(napi_env env, const AppExecFwk::HapModuleInfo &
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Create object failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Create object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ napi_value CreateJsAbilityInfo(napi_env env, const AppExecFwk::AbilityInfo &abil
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Create object failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Create object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void NapiAsyncTask::Schedule(const std::string &name, napi_env env, std::unique_
|
||||
|
||||
void NapiAsyncTask::Resolve(napi_env env, napi_value value)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "NapiAsyncTask::Resolve is called");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
if (deferred_) {
|
||||
napi_resolve_deferred(env, deferred_, value);
|
||||
deferred_ = nullptr;
|
||||
@ -165,12 +165,11 @@ void NapiAsyncTask::Resolve(napi_env env, napi_value value)
|
||||
napi_delete_reference(env, callbackRef_);
|
||||
callbackRef_ = nullptr;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "NapiAsyncTask::Resolve is called end.");
|
||||
}
|
||||
|
||||
void NapiAsyncTask::ResolveWithNoError(napi_env env, napi_value value)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "NapiAsyncTask::Resolve is called");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
if (deferred_) {
|
||||
napi_resolve_deferred(env, deferred_, value);
|
||||
deferred_ = nullptr;
|
||||
@ -186,7 +185,6 @@ void NapiAsyncTask::ResolveWithNoError(napi_env env, napi_value value)
|
||||
napi_delete_reference(env, callbackRef_);
|
||||
callbackRef_ = nullptr;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "NapiAsyncTask::Resolve is called end.");
|
||||
}
|
||||
|
||||
void NapiAsyncTask::Reject(napi_env env, napi_value error)
|
||||
@ -210,7 +208,7 @@ void NapiAsyncTask::Reject(napi_env env, napi_value error)
|
||||
|
||||
void NapiAsyncTask::ResolveWithCustomize(napi_env env, napi_value error, napi_value value)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "NapiAsyncTask::ResolveWithCustomize is called");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
if (deferred_) {
|
||||
napi_resolve_deferred(env, deferred_, value);
|
||||
deferred_ = nullptr;
|
||||
@ -226,12 +224,11 @@ void NapiAsyncTask::ResolveWithCustomize(napi_env env, napi_value error, napi_va
|
||||
napi_delete_reference(env, callbackRef_);
|
||||
callbackRef_ = nullptr;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "NapiAsyncTask::ResolveWithCustomize is called end.");
|
||||
}
|
||||
|
||||
void NapiAsyncTask::RejectWithCustomize(napi_env env, napi_value error, napi_value value)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "NapiAsyncTask::RejectWithCustomize is called");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
if (deferred_) {
|
||||
napi_reject_deferred(env, deferred_, error);
|
||||
deferred_ = nullptr;
|
||||
@ -247,7 +244,6 @@ void NapiAsyncTask::RejectWithCustomize(napi_env env, napi_value error, napi_val
|
||||
napi_delete_reference(env, callbackRef_);
|
||||
callbackRef_ = nullptr;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "NapiAsyncTask::RejectWithCustomize is called end.");
|
||||
}
|
||||
|
||||
void NapiAsyncTask::Execute(napi_env env, void *data)
|
||||
@ -339,9 +335,9 @@ std::unique_ptr<NapiAsyncTask> CreateEmptyAsyncTask(napi_env env, napi_value las
|
||||
std::unique_ptr<NativeReference> JsRuntime::LoadSystemModuleByEngine(napi_env env,
|
||||
const std::string &moduleName, napi_value const *argv, size_t argc)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "JsRuntime::LoadSystemModule(%{public}s)", moduleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "LoadSystemModule(%{public}s)", moduleName.c_str());
|
||||
if (env == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "JsRuntime::LoadSystemModule: invalid env.");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "invalid env");
|
||||
return std::unique_ptr<NativeReference>();
|
||||
}
|
||||
|
||||
@ -354,7 +350,7 @@ std::unique_ptr<NativeReference> JsRuntime::LoadSystemModuleByEngine(napi_env en
|
||||
napi_create_reference(env, ref, 1, &methodRequireNapiRef);
|
||||
methodRequireNapiRef_.reset(reinterpret_cast<NativeReference *>(methodRequireNapiRef));
|
||||
if (!methodRequireNapiRef_) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to create reference for global.requireNapi");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create reference for global.requireNapi failed");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value className = nullptr;
|
||||
@ -365,7 +361,7 @@ std::unique_ptr<NativeReference> JsRuntime::LoadSystemModuleByEngine(napi_env en
|
||||
napi_value instanceValue = nullptr;
|
||||
napi_new_instance(env, classValue, argc, argv, &instanceValue);
|
||||
if (instanceValue == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to create object instance");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create object instance failed");
|
||||
return std::unique_ptr<NativeReference>();
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
uv_loop_s* loop = nullptr;
|
||||
napi_get_uv_event_loop(env_, &loop);
|
||||
if (loop == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "loop == nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null loop");
|
||||
return;
|
||||
}
|
||||
uv_timer_init(loop, &timerReq_);
|
||||
@ -96,7 +96,7 @@ private:
|
||||
napi_value StartTimeoutOrInterval(napi_env env, napi_callback_info info, bool isInterval)
|
||||
{
|
||||
if (env == nullptr || info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Start timeout or interval failed with env or callback info is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null env/callback info");
|
||||
return nullptr;
|
||||
}
|
||||
size_t argc = ARGC_MAX_COUNT;
|
||||
@ -107,7 +107,7 @@ napi_value StartTimeoutOrInterval(napi_env env, napi_callback_info info, bool is
|
||||
// parameter check, must have at least 2 params
|
||||
if (argc < 2 ||!CheckTypeForNapiValue(env, argv[0], napi_function)
|
||||
|| !CheckTypeForNapiValue(env, argv[1], napi_number)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Set callback timer failed with invalid parameter.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "invalid parameter");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ napi_value StartInterval(napi_env env, napi_callback_info info)
|
||||
napi_value StopTimeoutOrInterval(napi_env env, napi_callback_info info)
|
||||
{
|
||||
if (env == nullptr || info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Stop timeout or interval failed with env or callback info is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null env/callback info");
|
||||
return nullptr;
|
||||
}
|
||||
size_t argc = ARGC_MAX_COUNT;
|
||||
@ -164,7 +164,7 @@ napi_value StopTimeoutOrInterval(napi_env env, napi_callback_info info)
|
||||
|
||||
// parameter check, must have at least 1 param
|
||||
if (argc < 1 || !CheckTypeForNapiValue(env, argv[0], napi_number)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Clear callback timer failed with invalid parameter.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "invalid parameter");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
uint32_t callbackId = 0;
|
||||
|
@ -73,7 +73,7 @@ constexpr char ARK_DEBUGGER_LIB_PATH[] = "libark_debugger.dylib";
|
||||
|
||||
int32_t PrintVmLog(int32_t, int32_t, const char*, const char*, const char *message)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "ArkLog: %{public}s", message);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "ArkLog:%{public}s", message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ void DebuggerTask::HandleTask(const uv_async_t *req)
|
||||
{
|
||||
auto *debuggerTask = reinterpret_cast<DebuggerTask*>(req->data);
|
||||
if (debuggerTask == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "HandleTask debuggerTask is null");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null HandleTask debuggerTask");
|
||||
return;
|
||||
}
|
||||
debuggerTask->func();
|
||||
@ -200,7 +200,7 @@ SimulatorImpl::~SimulatorImpl()
|
||||
bool SimulatorImpl::Initialize(const Options &options)
|
||||
{
|
||||
if (nativeEngine_) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Simulator is already initialized");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "initialized");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -226,18 +226,18 @@ bool SimulatorImpl::Initialize(const Options &options)
|
||||
void CallObjectMethod(napi_env env, napi_value obj, const char *name, napi_value const *argv, size_t argc)
|
||||
{
|
||||
if (obj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "%{public}s, Failed to get Ability object", __func__);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "get Ability object failed");
|
||||
return;
|
||||
}
|
||||
napi_value methodOnCreate = nullptr;
|
||||
napi_get_named_property(env, obj, name, &methodOnCreate);
|
||||
if (methodOnCreate == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to get '%{public}s' from Ability object", name);
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "get '%{public}s' from Ability object failed", name);
|
||||
return;
|
||||
}
|
||||
napi_status status = napi_call_function(env, obj, methodOnCreate, argc, argv, nullptr);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to napi call function");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "napi call function failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ bool SimulatorImpl::ParseBundleAndModuleInfo()
|
||||
AppExecFwk::BundleContainer::GetInstance().LoadBundleInfos(options_.moduleJsonBuffer);
|
||||
appInfo_ = AppExecFwk::BundleContainer::GetInstance().GetApplicationInfo();
|
||||
if (appInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "appinfo parse failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "appinfo parse failed");
|
||||
return false;
|
||||
}
|
||||
nlohmann::json appInfoJson;
|
||||
@ -275,7 +275,7 @@ bool SimulatorImpl::ParseBundleAndModuleInfo()
|
||||
options_.compileMode = "esmodule";
|
||||
|
||||
if (appInfo_->moduleInfos.empty()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "module name is not exist");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "module name not exist");
|
||||
return false;
|
||||
}
|
||||
options_.moduleName = appInfo_->moduleInfos[0].moduleName;
|
||||
@ -283,7 +283,7 @@ bool SimulatorImpl::ParseBundleAndModuleInfo()
|
||||
|
||||
moduleInfo_ = AppExecFwk::BundleContainer::GetInstance().GetHapModuleInfo(options_.moduleName);
|
||||
if (moduleInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "module info parse failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "module info parse failed");
|
||||
return false;
|
||||
}
|
||||
nlohmann::json moduleInfoJson;
|
||||
@ -307,14 +307,14 @@ bool SimulatorImpl::ParseAbilityInfo(const std::string &abilitySrcPath, const st
|
||||
abilityInfo_ = AppExecFwk::BundleContainer::GetInstance().GetAbilityInfo(options_.moduleName, abilityName);
|
||||
} else {
|
||||
auto path = abilitySrcPath;
|
||||
path.erase(path.rfind("."));
|
||||
path.erase(path.rfind(""));
|
||||
auto abilityNameFromPath = path.substr(path.rfind('/') + 1, path.length());
|
||||
abilityInfo_ = AppExecFwk::BundleContainer::GetInstance().GetAbilityInfo(
|
||||
options_.moduleName, abilityNameFromPath);
|
||||
}
|
||||
|
||||
if (abilityInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "ability info parse failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "ability info parse failed");
|
||||
return false;
|
||||
}
|
||||
nlohmann::json json;
|
||||
@ -342,7 +342,7 @@ int64_t SimulatorImpl::StartAbility(
|
||||
|
||||
std::ifstream stream(options_.modulePath, std::ios::ate | std::ios::binary);
|
||||
if (!stream.is_open()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to open: %{public}s", options_.modulePath.c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "open:%{public}s failed", options_.modulePath.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -354,19 +354,19 @@ int64_t SimulatorImpl::StartAbility(
|
||||
|
||||
auto buf = buffer.release();
|
||||
if (!LoadAbilityStage(buf, len)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Load ability stage failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Load ability stage failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
abilityPath_ = BUNDLE_INSTALL_PATH + options_.moduleName + "/" + abilitySrcPath;
|
||||
if (!reinterpret_cast<NativeEngine*>(nativeEngine_)->RunScriptBuffer(abilityPath_, buf, len, false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to run script: %{public}s", abilityPath_.c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "run script:%{public}s failed", abilityPath_.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
napi_value instanceValue = LoadScript(abilityPath_);
|
||||
if (instanceValue == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to create object instance");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create object instance failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -384,17 +384,17 @@ int64_t SimulatorImpl::StartAbility(
|
||||
bool SimulatorImpl::LoadAbilityStage(uint8_t *buffer, size_t len)
|
||||
{
|
||||
if (moduleInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "moduleInfo is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null moduleInfo");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (moduleInfo_->srcEntrance.empty()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "module src path is empty.");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "module src path empty");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (nativeEngine_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "nativeEngine_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null nativeEngine_");
|
||||
return false;
|
||||
}
|
||||
std::string srcEntrance = moduleInfo_->srcEntrance;
|
||||
@ -405,13 +405,13 @@ bool SimulatorImpl::LoadAbilityStage(uint8_t *buffer, size_t len)
|
||||
auto moduleSrcPath = BUNDLE_INSTALL_PATH + options_.moduleName + "/" + srcEntrance;
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "moduleSrcPath is %{public}s", moduleSrcPath.c_str());
|
||||
if (!reinterpret_cast<NativeEngine*>(nativeEngine_)->RunScriptBuffer(moduleSrcPath, buffer, len, false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to run ability stage script: %{public}s", moduleSrcPath.c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "run ability stage script:%{public}s failed", moduleSrcPath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
napi_value instanceValue = LoadScript(moduleSrcPath);
|
||||
if (instanceValue == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to create ability stage instance");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create ability stage instance failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -432,25 +432,25 @@ void SimulatorImpl::InitJsAbilityStageContext(napi_value obj)
|
||||
{
|
||||
napi_value contextObj = CreateJsAbilityStageContext(nativeEngine_, stageContext_);
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "contextObj is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null contextObj");
|
||||
return;
|
||||
}
|
||||
|
||||
jsStageContext_ = std::shared_ptr<NativeReference>(
|
||||
JsRuntime::LoadSystemModuleByEngine(nativeEngine_, "application.AbilityStageContext", &contextObj, 1));
|
||||
if (jsStageContext_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to get LoadSystemModuleByEngine");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null get LoadSystemModuleByEngine failed");
|
||||
return;
|
||||
}
|
||||
|
||||
contextObj = jsStageContext_->GetNapiValue();
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "contextObj is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null contextObj");
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "obj is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null obj");
|
||||
return;
|
||||
}
|
||||
napi_set_named_property(nativeEngine_, obj, "context", contextObj);
|
||||
@ -500,7 +500,7 @@ void SimulatorImpl::UpdateConfiguration(const AppExecFwk::Configuration &config)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
if (abilityStage_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "abilityStage_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null abilityStage_");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ void SimulatorImpl::UpdateConfiguration(const AppExecFwk::Configuration &config)
|
||||
|
||||
auto abilityStage = abilityStage_->GetNapiValue();
|
||||
if (abilityStage == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "abilityStage is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null abilityStage");
|
||||
return;
|
||||
}
|
||||
CallObjectMethod(nativeEngine_, abilityStage, "onConfigurationUpdated", configArgv, ArraySize(configArgv));
|
||||
@ -529,7 +529,7 @@ void SimulatorImpl::UpdateConfiguration(const AppExecFwk::Configuration &config)
|
||||
for (auto iter = abilities_.begin(); iter != abilities_.end(); iter++) {
|
||||
auto ability = iter->second->GetNapiValue();
|
||||
if (ability == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "ability is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null ability");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -550,14 +550,14 @@ void SimulatorImpl::InitResourceMgr()
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
resourceMgr_ = std::shared_ptr<Global::Resource::ResourceManager>(Global::Resource::CreateResourceManager());
|
||||
if (resourceMgr_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "resourceMgr is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "resourceMgr");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!resourceMgr_->AddResource(options_.resourcePath.c_str())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Add resource failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Add resource failed");
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Add resource success.");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "Add resource success");
|
||||
}
|
||||
|
||||
void SimulatorImpl::InitJsAbilityContext(napi_env env, napi_value obj)
|
||||
@ -574,17 +574,17 @@ void SimulatorImpl::InitJsAbilityContext(napi_env env, napi_value obj)
|
||||
auto systemModule = std::shared_ptr<NativeReference>(
|
||||
JsRuntime::LoadSystemModuleByEngine(nativeEngine_, "application.AbilityContext", &contextObj, 1));
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "systemModule is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null systemModule");
|
||||
return;
|
||||
}
|
||||
contextObj = systemModule->GetNapiValue();
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "contextObj is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null contextObj");
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "obj is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null obj");
|
||||
return;
|
||||
}
|
||||
napi_set_named_property(env, obj, "context", contextObj);
|
||||
@ -656,7 +656,7 @@ std::unique_ptr<NativeReference> SimulatorImpl::CreateJsWindowStage(
|
||||
{
|
||||
napi_value jsWindowStage = Rosen::CreateJsWindowStage(nativeEngine_, windowScene);
|
||||
if (jsWindowStage == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to create jsWindowSatge object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null jsWindowSatge");
|
||||
return nullptr;
|
||||
}
|
||||
return JsRuntime::LoadSystemModuleByEngine(nativeEngine_, "application.WindowStage", &jsWindowStage, 1);
|
||||
@ -680,7 +680,7 @@ panda::ecmascript::EcmaVM *SimulatorImpl::CreateJSVM()
|
||||
bool SimulatorImpl::OnInit()
|
||||
{
|
||||
if (!ParseBundleAndModuleInfo()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "parse bundle and module info failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "parse bundle and module info failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -696,7 +696,7 @@ bool SimulatorImpl::OnInit()
|
||||
|
||||
auto nativeEngine = new (std::nothrow) ArkNativeEngine(vm_, nullptr);
|
||||
if (nativeEngine == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "nativeEngine is nullptr");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null nativeEngine");
|
||||
return false;
|
||||
}
|
||||
napi_env env = reinterpret_cast<napi_env>(nativeEngine);
|
||||
@ -704,12 +704,12 @@ bool SimulatorImpl::OnInit()
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "uncaught exception");
|
||||
auto self = weak.lock();
|
||||
if (self == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "SimulatorImpl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null SimulatorImpl");
|
||||
return;
|
||||
}
|
||||
self->ReportJsError(value);
|
||||
if (self->terminateCallback_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "terminateCallback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null terminateCallback");
|
||||
return;
|
||||
}
|
||||
self->terminateCallback_(self->currentId_);
|
||||
@ -720,13 +720,13 @@ bool SimulatorImpl::OnInit()
|
||||
napi_get_global(env, &globalObj);
|
||||
if (globalObj == nullptr) {
|
||||
delete nativeEngine;
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to get global object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "null global object");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!LoadRuntimeEnv(env, globalObj)) {
|
||||
delete nativeEngine;
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Load runtime env failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Load runtime env failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -769,7 +769,7 @@ void SimulatorImpl::LoadJsMock(const std::string &fileName)
|
||||
{
|
||||
std::ifstream stream(fileName, std::ios::ate | std::ios::binary);
|
||||
if (!stream.is_open()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to open: %{public}s", fileName.c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "open: %{public}s failed", fileName.c_str());
|
||||
return;
|
||||
}
|
||||
size_t len = stream.tellg();
|
||||
@ -814,7 +814,7 @@ bool SimulatorImpl::LoadRuntimeEnv(napi_env env, napi_value globalObj)
|
||||
}
|
||||
|
||||
std::string fileName = options_.containerSdkPath + fileSeparator + "apiMock" + fileSeparator + "jsMockHmos.abc";
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "file name: %{public}s", fileName.c_str());
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "file name:%{public}s", fileName.c_str());
|
||||
if (!fileName.empty() && AbilityStageContext::Access(fileName)) {
|
||||
LoadJsMock(fileName);
|
||||
}
|
||||
@ -850,7 +850,7 @@ std::shared_ptr<Simulator> Simulator::Create(const Options &options)
|
||||
void SimulatorImpl::SetHostResolveBufferTracker(ResolveBufferTrackerCallback cb)
|
||||
{
|
||||
if (vm_ == nullptr || cb == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Params invalid.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Params invalid");
|
||||
return;
|
||||
}
|
||||
panda::JSNApi::SetHostResolveBufferTracker(vm_, cb);
|
||||
@ -941,7 +941,7 @@ void SimulatorImpl::GetPkgContextInfoListInner(nlohmann::json &itemObject, std::
|
||||
std::string SimulatorImpl::GetNativeStrFromJsTaggedObj(napi_value obj, const char* key)
|
||||
{
|
||||
if (obj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to get value from key.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "get value from key failed");
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -950,7 +950,7 @@ std::string SimulatorImpl::GetNativeStrFromJsTaggedObj(napi_value obj, const cha
|
||||
napi_valuetype valueType = napi_undefined;
|
||||
napi_typeof(nativeEngine_, valueStr, &valueType);
|
||||
if (valueType != napi_string) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "Failed to convert value from key.");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "convert value from key failed");
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -960,7 +960,7 @@ std::string SimulatorImpl::GetNativeStrFromJsTaggedObj(napi_value obj, const cha
|
||||
size_t valueStrLength = 0;
|
||||
napi_get_value_string_utf8(nativeEngine_, valueStr, valueCStr.get(), valueStrBufLength + 1, &valueStrLength);
|
||||
std::string ret(valueCStr.get(), valueStrLength);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "GetNativeStrFromJsTaggedObj Success.");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "GetNativeStrFromJsTaggedObj Success");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -979,11 +979,11 @@ void SimulatorImpl::ReportJsError(napi_value obj)
|
||||
summary += "Simulator error code:" + errorCode + "\n";
|
||||
}
|
||||
if (errorStack.empty()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "errorStack is empty");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "errorStack empty");
|
||||
return;
|
||||
}
|
||||
summary += "Stacktrace:\n" + errorStack;
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "summary: \n%{public}s", summary.c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "summary:\n%{public}s", summary.c_str());
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
@ -30,7 +30,7 @@ enum class MemoryLevel {
|
||||
|
||||
static napi_status SetEnumItem(napi_env env, napi_value object, const char* name, int32_t value)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "SetEnumItem start");
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "called");
|
||||
napi_status status;
|
||||
napi_value itemName;
|
||||
napi_value itemValue;
|
||||
@ -40,7 +40,6 @@ static napi_status SetEnumItem(napi_env env, napi_value object, const char* name
|
||||
|
||||
NAPI_CALL_BASE(env, status = napi_set_property(env, object, itemName, itemValue), status);
|
||||
NAPI_CALL_BASE(env, status = napi_set_property(env, object, itemValue, itemName), status);
|
||||
TAG_LOGD(AAFwkTag::ABILITY_SIM, "SetEnumItem end");
|
||||
|
||||
return napi_ok;
|
||||
}
|
||||
@ -151,43 +150,43 @@ static napi_value AbilityConstantInit(napi_env env, napi_value exports)
|
||||
{
|
||||
napi_value launchReason = InitLaunchReasonObject(env);
|
||||
if (launchReason == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed to create launch reason object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create launch reason object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value lastExitReason = InitLastExitReasonObject(env);
|
||||
if (lastExitReason == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed to create last exit reason object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create last exit reason object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value onContinueResult = InitOnContinueResultObject(env);
|
||||
if (onContinueResult == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed to create onContinue result object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create onContinue result object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value windowMode = InitWindowModeObject(env);
|
||||
if (windowMode == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed to create window mode object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create window mode object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value memoryLevel = InitMemoryLevelObject(env);
|
||||
if (memoryLevel == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed to create memory level object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create memory level object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value stateType = InitStateTypeEnum(env);
|
||||
if (stateType == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed to create state type object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create state type object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value saveResult = InitOnSaveResultEnum(env);
|
||||
if (saveResult == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed to create save result object");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "create save result object failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -202,7 +201,7 @@ static napi_value AbilityConstantInit(napi_env env, napi_value exports)
|
||||
};
|
||||
napi_status status = napi_define_properties(env, exports, sizeof(exportObjs) / sizeof(exportObjs[0]), exportObjs);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "failed to define properties for exports");
|
||||
TAG_LOGE(AAFwkTag::ABILITY_SIM, "define properties for exports failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -36,13 +36,13 @@ void DataAbilityObserverProxy::OnChange()
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(DataAbilityObserverProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "data.WriteInterfaceToken(GetDescriptor()) return false");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write token false");
|
||||
return;
|
||||
}
|
||||
|
||||
int result = SendTransactCmd(IDataAbilityObserver::DATA_ABILITY_OBSERVER_CHANGE, data, reply, option);
|
||||
if (result != ERR_NONE) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "SendRequest error, result=%{public}d", result);
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "error,result:%{public}d", result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ void DataAbilityObserverProxy::OnChangeExt(const ChangeInfo &changeInfo)
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(DataAbilityObserverProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "data.WriteInterfaceToken(GetDescriptor()) return false");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write token false");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ void DataAbilityObserverProxy::OnChangeExt(const ChangeInfo &changeInfo)
|
||||
|
||||
int result = SendTransactCmd(IDataAbilityObserver::DATA_ABILITY_OBSERVER_CHANGE_EXT, data, reply, option);
|
||||
if (result != ERR_NONE) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "SendRequest error, result=%{public}d", result);
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "error result:%{public}d", result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,19 +85,19 @@ void DataAbilityObserverProxy::OnChangePreferences(const std::string &key)
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(DataAbilityObserverProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "data.WriteInterfaceToken(GetDescriptor()) return false");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write token false");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteString(key)) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "data.WriteString(key) return false");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write string false");
|
||||
return;
|
||||
}
|
||||
|
||||
int result =
|
||||
SendTransactCmd(IDataAbilityObserver::DATA_ABILITY_OBSERVER_CHANGE_PREFERENCES, data, reply, option);
|
||||
if (result != ERR_NONE) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "SendRequest error, result=%{public}d", result);
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "error result:%{public}d", result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ int32_t DataAbilityObserverProxy::SendTransactCmd(uint32_t code, MessageParcel &
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "Remote is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null remote ");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
|
@ -42,14 +42,14 @@ int DataAbilityObserverStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"local descriptor is not equal to remote, descriptor: %{public}s, remoteDescriptor: %{public}s",
|
||||
"local descriptor unequals to remote, descriptor: %{public}s, remoteDescriptor: %{public}s",
|
||||
CommonUtils::Anonymous(Str16ToStr8(descriptor)).c_str(),
|
||||
CommonUtils::Anonymous(Str16ToStr8(remoteDescriptor)).c_str());
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (code < TRANS_HEAD || code >= TRANS_BUTT || HANDLES[code] == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "not support code:%u, BUTT:%d", code, TRANS_BUTT);
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "invalid code:%u, BUTT:%d", code, TRANS_BUTT);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
return (this->*HANDLES[code])(data, reply);
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
void DataObsMgrClient::SystemAbilityStatusChangeListener::OnAddSystemAbility(
|
||||
int32_t systemAbilityId, const std::string &deviceId)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DBOBSMGR, "ObsManager restart");
|
||||
TAG_LOGI(AAFwkTag::DBOBSMGR, "called");
|
||||
if (systemAbilityId != DATAOBS_MGR_SERVICE_SA_ID) {
|
||||
return;
|
||||
}
|
||||
@ -152,19 +152,19 @@ std::pair<Status, sptr<IDataObsMgr>> DataObsMgrClient::GetObsMgr()
|
||||
|
||||
sptr<ISystemAbilityManager> systemManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (systemManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "fail to get Registry");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "registry failed");
|
||||
return std::make_pair(GET_DATAOBS_SERVICE_FAILED, nullptr);
|
||||
}
|
||||
|
||||
auto remoteObject = systemManager->CheckSystemAbility(DATAOBS_MGR_SERVICE_SA_ID);
|
||||
if (remoteObject == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "fail to get systemAbility");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "systemAbility failed");
|
||||
return std::make_pair(GET_DATAOBS_SERVICE_FAILED, nullptr);
|
||||
}
|
||||
|
||||
dataObsManger_ = iface_cast<IDataObsMgr>(remoteObject);
|
||||
if (dataObsManger_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "fail to get IDataObsMgr");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "iDataObsMgr failed");
|
||||
return std::make_pair(GET_DATAOBS_SERVICE_FAILED, nullptr);
|
||||
}
|
||||
sptr<ServiceDeathRecipient> serviceDeathRecipient(new (std::nothrow) ServiceDeathRecipient(GetInstance()));
|
||||
@ -246,7 +246,7 @@ void DataObsMgrClient::OnRemoteDied()
|
||||
if (errCode != SUCCESS) {
|
||||
sptr<ISystemAbilityManager> systemManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (systemManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "System mgr is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null systemmgr");
|
||||
return;
|
||||
}
|
||||
systemManager->SubscribeSystemAbility(DATAOBS_MGR_SERVICE_SA_ID, callback_);
|
||||
|
@ -33,14 +33,14 @@ int DataObsMgrInner::HandleRegisterObserver(const Uri &uri, sptr<IDataAbilityObs
|
||||
auto [obsPair, flag] = observers_.try_emplace(uri.ToString(), std::list<sptr<IDataAbilityObserver>>());
|
||||
if (!flag && obsPair->second.size() > OBS_NUM_MAX) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"The number of subscribers for this uri : %{public}s has reached the upper limit.",
|
||||
"subscribers num:%{public}s maxed",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATAOBS_SERVICE_OBS_LIMMIT;
|
||||
}
|
||||
|
||||
for (auto obs = obsPair->second.begin(); obs != obsPair->second.end(); obs++) {
|
||||
if ((*obs)->AsObject() == dataObserver->AsObject()) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "the obs has registered on this uri : %{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "obs registered: %{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return OBS_EXIST;
|
||||
}
|
||||
@ -60,11 +60,11 @@ int DataObsMgrInner::HandleUnregisterObserver(const Uri &uri, sptr<IDataAbilityO
|
||||
auto obsPair = observers_.find(uri.ToString());
|
||||
if (obsPair == observers_.end()) {
|
||||
TAG_LOGW(
|
||||
AAFwkTag::DBOBSMGR, "no obs on this uri : %{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
AAFwkTag::DBOBSMGR, "uri no obs: %{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return NO_OBS_FOR_URI;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "obs num is %{public}zu on this uri : %{public}s", obsPair->second.size(),
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "obs num:%{public}zu: %{public}s", obsPair->second.size(),
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
auto obs = obsPair->second.begin();
|
||||
for (; obs != obsPair->second.end(); obs++) {
|
||||
@ -74,7 +74,7 @@ int DataObsMgrInner::HandleUnregisterObserver(const Uri &uri, sptr<IDataAbilityO
|
||||
}
|
||||
if (obs == obsPair->second.end()) {
|
||||
TAG_LOGW(
|
||||
AAFwkTag::DBOBSMGR, "no obs on this uri : %{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
AAFwkTag::DBOBSMGR, "uri no obs: %{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return NO_OBS_FOR_URI;
|
||||
}
|
||||
obsPair->second.remove(*obs);
|
||||
@ -96,7 +96,7 @@ int DataObsMgrInner::HandleNotifyChange(const Uri &uri)
|
||||
{
|
||||
auto obsPair = observers_.find(uri.ToString());
|
||||
if (obsPair == observers_.end()) {
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "there is no obs on the uri : %{public}s",
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "uri no obs: %{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return NO_OBS_FOR_URI;
|
||||
}
|
||||
@ -109,7 +109,7 @@ int DataObsMgrInner::HandleNotifyChange(const Uri &uri)
|
||||
}
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "called end on the uri : %{public}s,obs num: %{public}zu",
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "uri end: %{public}s,obs num: %{public}zu",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str(), obsList.size());
|
||||
return NO_ERROR;
|
||||
}
|
||||
@ -122,7 +122,7 @@ void DataObsMgrInner::AddObsDeathRecipient(sptr<IDataAbilityObserver> dataObserv
|
||||
|
||||
auto it = obsRecipient_.find(dataObserver->AsObject());
|
||||
if (it != obsRecipient_.end()) {
|
||||
TAG_LOGW(AAFwkTag::DBOBSMGR, "this death recipient has been added.");
|
||||
TAG_LOGW(AAFwkTag::DBOBSMGR, "called");
|
||||
return;
|
||||
} else {
|
||||
std::weak_ptr<DataObsMgrInner> thisWeakPtr(shared_from_this());
|
||||
@ -134,7 +134,7 @@ void DataObsMgrInner::AddObsDeathRecipient(sptr<IDataAbilityObserver> dataObserv
|
||||
}
|
||||
});
|
||||
if (!dataObserver->AsObject()->AddDeathRecipient(deathRecipient)) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "AddDeathRecipient failed.");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed.");
|
||||
}
|
||||
obsRecipient_.emplace(dataObserver->AsObject(), deathRecipient);
|
||||
}
|
||||
@ -163,7 +163,7 @@ void DataObsMgrInner::OnCallBackDied(const wptr<IRemoteObject> &remote)
|
||||
std::lock_guard<ffrt::mutex> lock(innerMutex_);
|
||||
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ void DataObsMgrInner::RemoveObs(sptr<IRemoteObject> dataObserver)
|
||||
auto &obsList = iter->second;
|
||||
for (auto it = obsList.begin(); it != obsList.end(); it++) {
|
||||
if ((*it)->AsObject() == dataObserver) {
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "Erase an observer form list.");
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "erase");
|
||||
obsList.erase(it);
|
||||
break;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ Status DataObsMgrInnerExt::HandleRegisterObserver(Uri &uri, sptr<IDataAbilityObs
|
||||
uri.GetPathSegments(path);
|
||||
if (root_ != nullptr && !root_->AddObserver(path, 0, Entry(dataObserver, deathRecipientRef, isDescendants))) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"The number of subscribers for this uri : %{public}s has reached the upper limits.",
|
||||
"subscribers: %{public}s num maxed",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
RemoveObsDeathRecipient(dataObserver->AsObject());
|
||||
return DATAOBS_SERVICE_OBS_LIMMIT;
|
||||
@ -52,7 +52,7 @@ Status DataObsMgrInnerExt::HandleRegisterObserver(Uri &uri, sptr<IDataAbilityObs
|
||||
Status DataObsMgrInnerExt::HandleUnregisterObserver(Uri &uri, sptr<IDataAbilityObserver> dataObserver)
|
||||
{
|
||||
if (dataObserver->AsObject() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is null, uri : %{public}s has reached the upper limit.",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver, uri : %{public}s num maxed",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATA_OBSERVER_IS_NULL;
|
||||
}
|
||||
@ -69,7 +69,7 @@ Status DataObsMgrInnerExt::HandleUnregisterObserver(Uri &uri, sptr<IDataAbilityO
|
||||
Status DataObsMgrInnerExt::HandleUnregisterObserver(sptr<IDataAbilityObserver> dataObserver)
|
||||
{
|
||||
if (dataObserver->AsObject() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is null");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver");
|
||||
return DATA_OBSERVER_IS_NULL;
|
||||
}
|
||||
std::lock_guard<ffrt::mutex> lock(nodeMutex_);
|
||||
@ -96,8 +96,8 @@ Status DataObsMgrInnerExt::HandleNotifyChange(const ChangeInfo &changeInfo)
|
||||
}
|
||||
if (changeRes.empty()) {
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR,
|
||||
"no obs for this uris, changeType:%{public}ud, num of uris:%{public}zu, data is "
|
||||
"nullptr:%{public}d, size:%{public}ud",
|
||||
"uris no obs, changeType:%{public}ud, uris num:%{public}zu,"
|
||||
"null data:%{public}d, size:%{public}ud",
|
||||
changeInfo.changeType_, changeInfo.uris_.size(), changeInfo.data_ == nullptr, changeInfo.size_);
|
||||
return NO_OBS_FOR_URI;
|
||||
}
|
||||
@ -117,7 +117,7 @@ std::shared_ptr<DataObsMgrInnerExt::DeathRecipientRef> DataObsMgrInnerExt::AddOb
|
||||
auto it = obsRecipientRefs.find(dataObserver);
|
||||
if (it != obsRecipientRefs.end()) {
|
||||
if (std::numeric_limits<uint32_t>::max() - 1 < it->second->ref) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "the num of observer reach max limit");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "observer num maxed");
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
@ -132,7 +132,7 @@ std::shared_ptr<DataObsMgrInnerExt::DeathRecipientRef> DataObsMgrInnerExt::AddOb
|
||||
dataObserver->AddDeathRecipient(deathRecipient);
|
||||
it = obsRecipientRefs.emplace(dataObserver, std::make_shared<DeathRecipientRef>(deathRecipient)).first;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "this observer will be added, sum:%{public}ud",
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "add observer, sum:%{public}ud",
|
||||
it->second->ref.load(std::memory_order_relaxed));
|
||||
return it->second;
|
||||
}
|
||||
@ -145,7 +145,7 @@ void DataObsMgrInnerExt::RemoveObsDeathRecipient(const sptr<IRemoteObject> &data
|
||||
}
|
||||
|
||||
if (isForce || it->second->ref <= 1) {
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "this observer deathRecipient will be remove, sum:%{public}ud",
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "remove deathRecipient, sum:%{public}ud",
|
||||
it->second->ref.load(std::memory_order_relaxed));
|
||||
dataObserver->RemoveDeathRecipient(it->second->deathRecipient);
|
||||
obsRecipientRefs.erase(it);
|
||||
@ -155,7 +155,7 @@ void DataObsMgrInnerExt::RemoveObsDeathRecipient(const sptr<IRemoteObject> &data
|
||||
|
||||
void DataObsMgrInnerExt::OnCallBackDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "this observer died");
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "observer died");
|
||||
auto dataObserver = remote.promote();
|
||||
if (dataObserver == nullptr) {
|
||||
return;
|
||||
|
@ -33,14 +33,14 @@ int DataObsMgrInnerPref::HandleRegisterObserver(const Uri &uri, sptr<IDataAbilit
|
||||
auto [obsPair, flag] = observers_.try_emplace(uri.ToString(), std::list<sptr<IDataAbilityObserver>>());
|
||||
if (!flag && obsPair->second.size() > OBS_NUM_MAX) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"The number of subscribers for this uri : %{public}s has reached the upper limit.",
|
||||
"subscribers num: %{public}s num maxed",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATAOBS_SERVICE_OBS_LIMMIT;
|
||||
}
|
||||
|
||||
for (auto obs = obsPair->second.begin(); obs != obsPair->second.end(); obs++) {
|
||||
if ((*obs)->AsObject() == dataObserver->AsObject()) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "the obs has registered on this uri : %{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "registered obs: %{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return OBS_EXIST;
|
||||
}
|
||||
@ -59,11 +59,11 @@ int DataObsMgrInnerPref::HandleUnregisterObserver(const Uri &uri, sptr<IDataAbil
|
||||
auto obsPair = observers_.find(uri.ToString());
|
||||
if (obsPair == observers_.end()) {
|
||||
TAG_LOGW(
|
||||
AAFwkTag::DBOBSMGR, "no obs on this uri : %{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
AAFwkTag::DBOBSMGR, "uris no obs: %{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return NO_OBS_FOR_URI;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "obs num is %{public}zu on this uri : %{public}s", obsPair->second.size(),
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "obs num: %{public}zu : %{public}s", obsPair->second.size(),
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
auto obs = obsPair->second.begin();
|
||||
for (; obs != obsPair->second.end(); obs++) {
|
||||
@ -73,7 +73,7 @@ int DataObsMgrInnerPref::HandleUnregisterObserver(const Uri &uri, sptr<IDataAbil
|
||||
}
|
||||
if (obs == obsPair->second.end()) {
|
||||
TAG_LOGW(
|
||||
AAFwkTag::DBOBSMGR, "no obs on this uri : %{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
AAFwkTag::DBOBSMGR, "uris no obs: %{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return NO_OBS_FOR_URI;
|
||||
}
|
||||
obsPair->second.remove(*obs);
|
||||
@ -95,14 +95,14 @@ int DataObsMgrInnerPref::HandleNotifyChange(const Uri &uri)
|
||||
std::string uriStr = uri.ToString();
|
||||
size_t pos = uriStr.find('?');
|
||||
if (pos == std::string::npos) {
|
||||
TAG_LOGW(AAFwkTag::DBOBSMGR, "the current uri is missing the query section : %{public}s",
|
||||
TAG_LOGW(AAFwkTag::DBOBSMGR, "uri missing query: %{public}s",
|
||||
CommonUtils::Anonymous(uriStr).c_str());
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
std::string observerKey = uriStr.substr(0, pos);
|
||||
auto obsPair = observers_.find(observerKey);
|
||||
if (obsPair == observers_.end()) {
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "there is no obs on the uri : %{public}s",
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "uri no obs: %{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return NO_OBS_FOR_URI;
|
||||
}
|
||||
@ -115,7 +115,7 @@ int DataObsMgrInnerPref::HandleNotifyChange(const Uri &uri)
|
||||
}
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "called end on the uri : %{public}s,obs num: %{public}zu",
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "uri end: %{public}s,obs num: %{public}zu",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str(), obsList.size());
|
||||
return NO_ERROR;
|
||||
}
|
||||
@ -128,7 +128,7 @@ void DataObsMgrInnerPref::AddObsDeathRecipient(sptr<IDataAbilityObserver> dataOb
|
||||
|
||||
auto it = obsRecipient_.find(dataObserver->AsObject());
|
||||
if (it != obsRecipient_.end()) {
|
||||
TAG_LOGW(AAFwkTag::DBOBSMGR, "this death recipient has been added.");
|
||||
TAG_LOGW(AAFwkTag::DBOBSMGR, "called");
|
||||
return;
|
||||
} else {
|
||||
std::weak_ptr<DataObsMgrInnerPref> thisWeakPtr(shared_from_this());
|
||||
@ -140,7 +140,7 @@ void DataObsMgrInnerPref::AddObsDeathRecipient(sptr<IDataAbilityObserver> dataOb
|
||||
}
|
||||
});
|
||||
if (!dataObserver->AsObject()->AddDeathRecipient(deathRecipient)) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "AddDeathRecipient failed.");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed.");
|
||||
}
|
||||
obsRecipient_.emplace(dataObserver->AsObject(), deathRecipient);
|
||||
}
|
||||
@ -169,7 +169,7 @@ void DataObsMgrInnerPref::OnCallBackDied(const wptr<IRemoteObject> &remote)
|
||||
std::lock_guard<std::mutex> lock(preferenceMutex_);
|
||||
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ void DataObsMgrInnerPref::RemoveObs(sptr<IRemoteObject> dataObserver)
|
||||
auto &obsList = iter->second;
|
||||
for (auto it = obsList.begin(); it != obsList.end(); it++) {
|
||||
if ((*it)->AsObject() == dataObserver) {
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "Erase an observer form list.");
|
||||
TAG_LOGD(AAFwkTag::DBOBSMGR, "erase");
|
||||
obsList.erase(it);
|
||||
break;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace AAFwk {
|
||||
bool DataObsManagerProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
{
|
||||
if (!data.WriteInterfaceToken(DataObsManagerProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, write interface token error");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write token error");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -34,17 +34,17 @@ bool DataObsManagerProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
bool DataObsManagerProxy::WriteParam(MessageParcel &data, const Uri &uri, sptr<IDataAbilityObserver> dataObserver)
|
||||
{
|
||||
if (!data.WriteString(uri.ToString())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, write uri error");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write uri error");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, dataObserver is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(dataObserver->AsObject())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, write dataObserver error");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write dataObserver error");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -66,7 +66,7 @@ int32_t DataObsManagerProxy::RegisterObserver(const Uri &uri, sptr<IDataAbilityO
|
||||
|
||||
auto error = SendTransactCmd(IDataObsMgr::REGISTER_OBSERVER, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, SendRequest error: %{public}d, uri: %{public}s", error,
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "sendRequest error: %{public}d, uri: %{public}s", error,
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return error;
|
||||
}
|
||||
@ -91,7 +91,7 @@ int32_t DataObsManagerProxy::UnregisterObserver(const Uri &uri, sptr<IDataAbilit
|
||||
|
||||
auto error = SendTransactCmd(IDataObsMgr::UNREGISTER_OBSERVER, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, SendRequest error: %{public}d, uri: %{public}s", error,
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "sendRequest error: %{public}d, uri: %{public}s", error,
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return error;
|
||||
}
|
||||
@ -109,13 +109,13 @@ int32_t DataObsManagerProxy::NotifyChange(const Uri &uri)
|
||||
return IPC_PARCEL_ERROR;
|
||||
}
|
||||
if (!data.WriteString(uri.ToString())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, write uri error, uri: %{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write uri error, uri: %{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
auto error = SendTransactCmd(IDataObsMgr::NOTIFY_CHANGE, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, SendRequest error: %{public}d, uri: %{public}s", error,
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "sendRequest error: %{public}d, uri: %{public}s", error,
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return IPC_ERROR;
|
||||
}
|
||||
@ -140,7 +140,7 @@ Status DataObsManagerProxy::RegisterObserverExt(const Uri &uri, sptr<IDataAbilit
|
||||
}
|
||||
|
||||
if (!data.WriteBool(isDescendants)) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, write isDescendants error, uri: %{public}s, isDescendants: %{public}d",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "isDescendants error, uri: %{public}s, isDescendants: %{public}d",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str(), isDescendants);
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
@ -148,7 +148,7 @@ Status DataObsManagerProxy::RegisterObserverExt(const Uri &uri, sptr<IDataAbilit
|
||||
auto error = SendTransactCmd(IDataObsMgr::REGISTER_OBSERVER_EXT, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"failed, SendRequest error: %{public}d, uri: %{public}s, isDescendants: %{public}d", error,
|
||||
"sendRequest error: %{public}d, uri: %{public}s, isDescendants: %{public}d", error,
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str(), isDescendants);
|
||||
return IPC_ERROR;
|
||||
}
|
||||
@ -172,7 +172,7 @@ Status DataObsManagerProxy::UnregisterObserverExt(const Uri &uri, sptr<IDataAbil
|
||||
|
||||
auto error = SendTransactCmd(IDataObsMgr::UNREGISTER_OBSERVER_EXT, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, SendRequest error: %{public}d, uri: %{public}s", error,
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "sendRequest error: %{public}d, uri: %{public}s", error,
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return IPC_ERROR;
|
||||
}
|
||||
@ -191,18 +191,18 @@ Status DataObsManagerProxy::UnregisterObserverExt(sptr<IDataAbilityObserver> dat
|
||||
}
|
||||
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, dataObserver is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver");
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(dataObserver->AsObject())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, write dataObserver error");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "write dataObserver error");
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
|
||||
auto error = SendTransactCmd(IDataObsMgr::UNREGISTER_OBSERVER_ALL_EXT, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed, SendRequest error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "sendRequest error: %{public}d", error);
|
||||
return IPC_ERROR;
|
||||
}
|
||||
int32_t res = IPC_ERROR;
|
||||
@ -221,8 +221,8 @@ Status DataObsManagerProxy::NotifyChangeExt(const ChangeInfo &changeInfo)
|
||||
|
||||
if (!ChangeInfo::Marshalling(changeInfo, data)) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"failed, changeInfo marshalling error, changeType:%{public}ud, num of uris:%{public}zu, data is "
|
||||
"nullptr:%{public}d, size:%{public}ud",
|
||||
"changeInfo marshalling error, changeType:%{public}ud, num:%{public}zu,"
|
||||
"null data:%{public}d, size:%{public}ud",
|
||||
changeInfo.changeType_, changeInfo.uris_.size(), changeInfo.data_ == nullptr, changeInfo.size_);
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
@ -230,8 +230,8 @@ Status DataObsManagerProxy::NotifyChangeExt(const ChangeInfo &changeInfo)
|
||||
auto error = SendTransactCmd(IDataObsMgr::NOTIFY_CHANGE_EXT, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"failed, SendRequest error: %{public}d, changeType:%{public}ud, num of uris:%{public}zu, data is "
|
||||
"nullptr:%{public}d, size:%{public}ud",
|
||||
"sendRequest error: %{public}d, changeType:%{public}ud, num:%{public}zu,"
|
||||
"null data:%{public}d, size:%{public}ud",
|
||||
error, changeInfo.changeType_, changeInfo.uris_.size(), changeInfo.data_ == nullptr, changeInfo.size_);
|
||||
return IPC_ERROR;
|
||||
}
|
||||
@ -244,13 +244,13 @@ int32_t DataObsManagerProxy::SendTransactCmd(uint32_t code, MessageParcel &data,
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "remote object is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null remote");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
int32_t ret = remote->SendRequest(code, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "SendRequest failed. code is %{public}d, ret is %{public}d.", code, ret);
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "sendRequest failed. code:%{public}d, ret:%{public}d.", code, ret);
|
||||
return ret;
|
||||
}
|
||||
return NO_ERROR;
|
||||
|
@ -49,22 +49,22 @@ DataObsMgrService::~DataObsMgrService()
|
||||
void DataObsMgrService::OnStart()
|
||||
{
|
||||
if (state_ == DataObsServiceRunningState::STATE_RUNNING) {
|
||||
TAG_LOGI(AAFwkTag::DBOBSMGR, "Dataobs Manager Service has already started.");
|
||||
TAG_LOGI(AAFwkTag::DBOBSMGR, "dms started.");
|
||||
return;
|
||||
}
|
||||
if (!Init()) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "failed to init service.");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "init failed!");
|
||||
return;
|
||||
}
|
||||
state_ = DataObsServiceRunningState::STATE_RUNNING;
|
||||
/* Publish service maybe failed, so we need call this function at the last,
|
||||
* so it can't affect the TDD test program */
|
||||
if (!Publish(DelayedSingleton<DataObsMgrService>::GetInstance().get())) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "Init Publish failed!");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "publish init failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::DBOBSMGR, "Dataobs Manager Service start success.");
|
||||
TAG_LOGI(AAFwkTag::DBOBSMGR, "dms called");
|
||||
}
|
||||
|
||||
bool DataObsMgrService::Init()
|
||||
@ -75,7 +75,7 @@ bool DataObsMgrService::Init()
|
||||
|
||||
void DataObsMgrService::OnStop()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DBOBSMGR, "stop service");
|
||||
TAG_LOGI(AAFwkTag::DBOBSMGR, "stop");
|
||||
handler_.reset();
|
||||
state_ = DataObsServiceRunningState::STATE_NOT_START;
|
||||
}
|
||||
@ -88,13 +88,13 @@ DataObsServiceRunningState DataObsMgrService::QueryServiceState() const
|
||||
int DataObsMgrService::RegisterObserver(const Uri &uri, sptr<IDataAbilityObserver> dataObserver)
|
||||
{
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is nullptr, uri:%{public}s.",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver, uri:%{public}s.",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATA_OBSERVER_IS_NULL;
|
||||
}
|
||||
|
||||
if (dataObsMgrInner_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObsMgrInner_ is nullptr, uri:%{public}s.",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObsMgrInner, uri:%{public}s.",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATAOBS_SERVICE_INNER_IS_NULL;
|
||||
}
|
||||
@ -107,7 +107,7 @@ int DataObsMgrService::RegisterObserver(const Uri &uri, sptr<IDataAbilityObserve
|
||||
}
|
||||
|
||||
if (status != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "Observer register failed: %{public}d, uri:%{public}s", status,
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "register failed: %{public}d, uri:%{public}s", status,
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return status;
|
||||
}
|
||||
@ -117,13 +117,13 @@ int DataObsMgrService::RegisterObserver(const Uri &uri, sptr<IDataAbilityObserve
|
||||
int DataObsMgrService::UnregisterObserver(const Uri &uri, sptr<IDataAbilityObserver> dataObserver)
|
||||
{
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is nullptr, uri:%{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver, uri:%{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATA_OBSERVER_IS_NULL;
|
||||
}
|
||||
|
||||
if (dataObsMgrInner_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObsMgrInner_ is nullptr, uri:%{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObsMgrInner, uri:%{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATAOBS_SERVICE_INNER_IS_NULL;
|
||||
}
|
||||
@ -136,7 +136,7 @@ int DataObsMgrService::UnregisterObserver(const Uri &uri, sptr<IDataAbilityObser
|
||||
}
|
||||
|
||||
if (status != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "Observer unregister failed: %{public}d, uri:%{public}s", status,
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "unregister failed: %{public}d, uri:%{public}s", status,
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return status;
|
||||
}
|
||||
@ -147,12 +147,12 @@ int DataObsMgrService::NotifyChange(const Uri &uri)
|
||||
{
|
||||
if (handler_ == nullptr) {
|
||||
TAG_LOGE(
|
||||
AAFwkTag::DBOBSMGR, "handler is nullptr, uri:%{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
AAFwkTag::DBOBSMGR, "null handler, uri:%{public}s", CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATAOBS_SERVICE_HANDLER_IS_NULL;
|
||||
}
|
||||
|
||||
if (dataObsMgrInner_ == nullptr || dataObsMgrInnerExt_ == nullptr || dataObsMgrInnerPref_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObsMgr is nullptr, uri:%{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObsMgr, uri:%{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATAOBS_SERVICE_INNER_IS_NULL;
|
||||
}
|
||||
@ -160,7 +160,7 @@ int DataObsMgrService::NotifyChange(const Uri &uri)
|
||||
{
|
||||
std::lock_guard<ffrt::mutex> lck(taskCountMutex_);
|
||||
if (taskCount_ >= TASK_COUNT_MAX) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "The number of task has reached the upper limit, uri:%{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "task num reached limit, uri:%{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATAOBS_SERVICE_TASK_LIMMIT;
|
||||
}
|
||||
@ -186,13 +186,13 @@ Status DataObsMgrService::RegisterObserverExt(const Uri &uri, sptr<IDataAbilityO
|
||||
bool isDescendants)
|
||||
{
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is nullptr, uri:%{public}s, isDescendants:%{public}d",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver, uri:%{public}s, isDescendants:%{public}d",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str(), isDescendants);
|
||||
return DATA_OBSERVER_IS_NULL;
|
||||
}
|
||||
|
||||
if (dataObsMgrInnerExt_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObsMgrInner_ is nullptr, uri:%{public}s, isDescendants:%{public}d",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObsMgrInner, uri:%{public}s, isDescendants:%{public}d",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str(), isDescendants);
|
||||
return DATAOBS_SERVICE_INNER_IS_NULL;
|
||||
}
|
||||
@ -204,13 +204,13 @@ Status DataObsMgrService::RegisterObserverExt(const Uri &uri, sptr<IDataAbilityO
|
||||
Status DataObsMgrService::UnregisterObserverExt(const Uri &uri, sptr<IDataAbilityObserver> dataObserver)
|
||||
{
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is nullptr, uri:%{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver, uri:%{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATA_OBSERVER_IS_NULL;
|
||||
}
|
||||
|
||||
if (dataObsMgrInnerExt_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObsMgrInner_ is nullptr, uri:%{public}s",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObsMgrInner, uri:%{public}s",
|
||||
CommonUtils::Anonymous(uri.ToString()).c_str());
|
||||
return DATAOBS_SERVICE_INNER_IS_NULL;
|
||||
}
|
||||
@ -222,12 +222,12 @@ Status DataObsMgrService::UnregisterObserverExt(const Uri &uri, sptr<IDataAbilit
|
||||
Status DataObsMgrService::UnregisterObserverExt(sptr<IDataAbilityObserver> dataObserver)
|
||||
{
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObserver is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObserver");
|
||||
return DATA_OBSERVER_IS_NULL;
|
||||
}
|
||||
|
||||
if (dataObsMgrInnerExt_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObsMgrInner_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null dataObsMgrInner");
|
||||
return DATAOBS_SERVICE_INNER_IS_NULL;
|
||||
}
|
||||
|
||||
@ -257,12 +257,12 @@ Status DataObsMgrService::DeepCopyChangeInfo(const ChangeInfo &src, ChangeInfo &
|
||||
Status DataObsMgrService::NotifyChangeExt(const ChangeInfo &changeInfo)
|
||||
{
|
||||
if (handler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "handler is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "null handler");
|
||||
return DATAOBS_SERVICE_HANDLER_IS_NULL;
|
||||
}
|
||||
|
||||
if (dataObsMgrInner_ == nullptr || dataObsMgrInnerExt_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObsMgrInner_:%{public}d or dataObsMgrInnerExt_ is nullptr",
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dataObsMgrInner_:%{public}d or null dataObsMgrInnerExt",
|
||||
dataObsMgrInner_ == nullptr);
|
||||
return DATAOBS_SERVICE_INNER_IS_NULL;
|
||||
}
|
||||
@ -270,8 +270,8 @@ Status DataObsMgrService::NotifyChangeExt(const ChangeInfo &changeInfo)
|
||||
Status result = DeepCopyChangeInfo(changeInfo, changes);
|
||||
if (result != SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"copy data failed, changeType:%{public}ud, num of uris:%{public}zu, data is "
|
||||
"nullptr:%{public}d, size:%{public}ud",
|
||||
"copy data failed, changeType:%{public}ud,uris num:%{public}zu, "
|
||||
"null data:%{public}d, size:%{public}ud",
|
||||
changeInfo.changeType_, changeInfo.uris_.size(), changeInfo.data_ == nullptr, changeInfo.size_);
|
||||
return result;
|
||||
}
|
||||
@ -280,8 +280,8 @@ Status DataObsMgrService::NotifyChangeExt(const ChangeInfo &changeInfo)
|
||||
std::lock_guard<ffrt::mutex> lck(taskCountMutex_);
|
||||
if (taskCount_ >= TASK_COUNT_MAX) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"The number of task has reached the upper limit, changeType:%{public}ud, num of "
|
||||
"uris:%{public}zu, data is nullptr:%{public}d, size:%{public}ud",
|
||||
"task num maxed, changeType:%{public}ud,"
|
||||
"uris num:%{public}zu, null data:%{public}d, size:%{public}ud",
|
||||
changeInfo.changeType_, changeInfo.uris_.size(), changeInfo.data_ == nullptr, changeInfo.size_);
|
||||
return DATAOBS_SERVICE_TASK_LIMMIT;
|
||||
}
|
||||
@ -306,7 +306,7 @@ int DataObsMgrService::Dump(int fd, const std::vector<std::u16string>& args)
|
||||
Dump(args, result);
|
||||
int ret = dprintf(fd, "%s\n", result.c_str());
|
||||
if (ret < 0) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "%{public}s, dprintf error.", __func__);
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "dprintf error.");
|
||||
return DATAOBS_HIDUMP_ERROR;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
@ -49,14 +49,14 @@ int DataObsManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Mess
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR,
|
||||
"local descriptor is not equal to remote, descriptor: %{public}s, remoteDescriptor: %{public}s",
|
||||
"local descriptor unequals to remote, descriptor: %{public}s, remoteDescriptor: %{public}s",
|
||||
CommonUtils::Anonymous(Str16ToStr8(descriptor)).c_str(),
|
||||
CommonUtils::Anonymous(Str16ToStr8(remoteDescriptor)).c_str());
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (code < TRANS_HEAD || code >= TRANS_BUTT || HANDLES[code] == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "not support code:%{public}u, BUTT:%{public}d", code, TRANS_BUTT);
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "invalid code:%{public}u, BUTT:%{public}d", code, TRANS_BUTT);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
return (this->*HANDLES[code])(data, reply);
|
||||
@ -66,7 +66,7 @@ int DataObsManagerStub::RegisterObserverInner(MessageParcel &data, MessageParcel
|
||||
{
|
||||
Uri uri(data.ReadString());
|
||||
if (uri.ToString().empty()) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "uri is invalid");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "invalid uri");
|
||||
return IPC_STUB_INVALID_DATA_ERR;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ int DataObsManagerStub::UnregisterObserverInner(MessageParcel &data, MessageParc
|
||||
{
|
||||
Uri uri(data.ReadString());
|
||||
if (uri.ToString().empty()) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "uri is invalid");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "invalid uri");
|
||||
return IPC_STUB_INVALID_DATA_ERR;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ int DataObsManagerStub::NotifyChangeInner(MessageParcel &data, MessageParcel &re
|
||||
{
|
||||
Uri uri(data.ReadString());
|
||||
if (uri.ToString().empty()) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "uri is invalid");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "invalid uri");
|
||||
return IPC_STUB_INVALID_DATA_ERR;
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ int32_t DataObsManagerStub::RegisterObserverExtInner(MessageParcel &data, Messag
|
||||
{
|
||||
Uri uri(data.ReadString());
|
||||
if (uri.ToString().empty()) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "uri is invalid");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "invalid uri");
|
||||
return IPC_STUB_INVALID_DATA_ERR;
|
||||
}
|
||||
auto remote = data.ReadRemoteObject();
|
||||
@ -123,7 +123,7 @@ int32_t DataObsManagerStub::UnregisterObserverExtInner(MessageParcel &data, Mess
|
||||
{
|
||||
Uri uri(data.ReadString());
|
||||
if (uri.ToString().empty()) {
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "uri is invalid");
|
||||
TAG_LOGE(AAFwkTag::DBOBSMGR, "invalid uri");
|
||||
return IPC_STUB_INVALID_DATA_ERR;
|
||||
}
|
||||
auto remote = data.ReadRemoteObject();
|
||||
|
Loading…
Reference in New Issue
Block a user