check parentNode when parentNode is UiNode

Signed-off-by: baoyang <baoyang9@huawei.com>
Change-Id: Ia07961c052f7a07a6c7d0a38269a3df42ef8d093
This commit is contained in:
baoyang
2024-10-21 09:11:48 +00:00
parent 3805c5ea21
commit 2fedb1f22b
7 changed files with 1 additions and 18 deletions
@@ -58,7 +58,6 @@ void TestCommon::BuildLocationComponentInfo(nlohmann::json& jsonComponent)
}; };
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 },
@@ -115,7 +114,6 @@ void TestCommon::BuildSaveComponentInfo(nlohmann::json& jsonComponent)
}; };
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 },
@@ -172,7 +170,6 @@ void TestCommon::BuildPasteComponentInfo(nlohmann::json& jsonComponent)
}; };
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 },
@@ -51,7 +51,6 @@ const std::string JsonTagConstants::JSON_BORDER_TAG = "border";
const std::string JsonTagConstants::JSON_BORDER_WIDTH_TAG = "borderWidth"; const std::string JsonTagConstants::JSON_BORDER_WIDTH_TAG = "borderWidth";
const std::string JsonTagConstants::JSON_PARENT_TAG = "parent"; const std::string JsonTagConstants::JSON_PARENT_TAG = "parent";
const std::string JsonTagConstants::JSON_PARENT_EFFECT_TAG = "parentEffect"; const std::string JsonTagConstants::JSON_PARENT_EFFECT_TAG = "parentEffect";
const std::string JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG = "isParentCheckFailed";
const std::string JsonTagConstants::JSON_IS_CLIPPED_TAG = "isClipped"; const std::string JsonTagConstants::JSON_IS_CLIPPED_TAG = "isClipped";
const std::string JsonTagConstants::JSON_TOP_CLIP_TAG = "topClip"; const std::string JsonTagConstants::JSON_TOP_CLIP_TAG = "topClip";
const std::string JsonTagConstants::JSON_BOTTOM_CLIP_TAG = "bottomClip"; const std::string JsonTagConstants::JSON_BOTTOM_CLIP_TAG = "bottomClip";
@@ -197,9 +196,6 @@ bool SecCompBase::ParseParent(const nlohmann::json& json, const std::string& tag
if (!ParseBool(jsonParent, JsonTagConstants::JSON_PARENT_EFFECT_TAG, parentEffect_)) { if (!ParseBool(jsonParent, JsonTagConstants::JSON_PARENT_EFFECT_TAG, parentEffect_)) {
return false; return false;
} }
if (!ParseBool(jsonParent, JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, isParentCheckFailed_)) {
return false;
}
if (!ParseBool(jsonParent, JsonTagConstants::JSON_IS_CLIPPED_TAG, isClipped_)) { if (!ParseBool(jsonParent, JsonTagConstants::JSON_IS_CLIPPED_TAG, isClipped_)) {
return false; return false;
} }
@@ -343,7 +339,6 @@ void SecCompBase::ToJson(nlohmann::json& jsonRes) const
}; };
jsonRes[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonRes[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, parentEffect_ }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, parentEffect_ },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, isParentCheckFailed_},
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, isClipped_ }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, isClipped_ },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, topClip_ }, { JsonTagConstants::JSON_TOP_CLIP_TAG, topClip_ },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, bottomClip_ }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, bottomClip_ },
@@ -66,7 +66,6 @@ public:
static const std::string JSON_BORDER_WIDTH_TAG; static const std::string JSON_BORDER_WIDTH_TAG;
static const std::string JSON_PARENT_TAG; static const std::string JSON_PARENT_TAG;
static const std::string JSON_PARENT_EFFECT_TAG; static const std::string JSON_PARENT_EFFECT_TAG;
static const std::string JSON_PARENT_CHECK_FAILED_TAG;
static const std::string JSON_IS_CLIPPED_TAG; static const std::string JSON_IS_CLIPPED_TAG;
static const std::string JSON_TOP_CLIP_TAG; static const std::string JSON_TOP_CLIP_TAG;
static const std::string JSON_BOTTOM_CLIP_TAG; static const std::string JSON_BOTTOM_CLIP_TAG;
@@ -115,7 +114,6 @@ public:
// parent effect // parent effect
bool parentEffect_ = false; bool parentEffect_ = false;
bool isParentCheckFailed_ = false;
bool isClipped_ = false; bool isClipped_ = false;
DimensionT topClip_; DimensionT topClip_;
DimensionT bottomClip_; DimensionT bottomClip_;
@@ -461,7 +461,7 @@ int32_t SecCompManager::CheckClickSecurityComponentInfo(std::shared_ptr<SecCompE
sc->GetType()); sc->GetType());
return SC_SERVICE_ERROR_COMPONENT_INFO_INVALID; return SC_SERVICE_ERROR_COMPONENT_INFO_INVALID;
} }
if (report && (report->isClipped_ || report->isParentCheckFailed_)) { if (report && (report->isClipped_)) {
HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SEC_COMPONENT, "CLIP_CHECK_FAILED", HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SEC_COMPONENT, "CLIP_CHECK_FAILED",
HiviewDFX::HiSysEvent::EventType::SECURITY, HiviewDFX::HiSysEvent::EventType::SECURITY,
"CALLER_BUNDLE_NAME", bundleName, "COMPONENT_INFO", jsonComponent.dump().c_str()); "CALLER_BUNDLE_NAME", bundleName, "COMPONENT_INFO", jsonComponent.dump().c_str());
@@ -235,7 +235,6 @@ HWTEST_F(SecCompInfoHelperTest, ParseComponent006, TestSize.Level1)
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, true }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, true },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 },
@@ -58,7 +58,6 @@ void ServiceTestCommon::BuildLocationComponentJson(nlohmann::json& jsonComponent
}; };
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 },
@@ -115,7 +114,6 @@ void ServiceTestCommon::BuildSaveComponentJson(nlohmann::json& jsonComponent)
}; };
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 },
@@ -172,7 +170,6 @@ void ServiceTestCommon::BuildPasteComponentJson(nlohmann::json& jsonComponent)
}; };
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 },
@@ -80,7 +80,6 @@ std::string CompoRandomGenerator::ConstructLocationJson()
// set default val // set default val
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() }, { JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() },
@@ -123,7 +122,6 @@ std::string CompoRandomGenerator::ConstructSaveJson()
// set default val // set default val
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() }, { JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() },
@@ -166,7 +164,6 @@ std::string CompoRandomGenerator::ConstructPasteJson()
// set default val // set default val
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() }, { JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() },
{ JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() }, { JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() },
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() },