From 8048433efdf815c1fa7e37b929b6f6068f2d3f92 Mon Sep 17 00:00:00 2001 From: baoyang Date: Thu, 13 Mar 2025 20:27:52 +0800 Subject: [PATCH] add hisysevent Signed-off-by: baoyang Change-Id: I80fd079eb0b9cc63bd11fe5a389092f0aa2cc12f --- .../test/unittest/src/test_common.cpp | 9 +++++++++ .../security_component/src/sec_comp_base.cpp | 18 ++++++++++++++++++ .../security_component/include/sec_comp_base.h | 6 ++++++ .../test/unittest/src/service_test_common.cpp | 9 +++++++++ .../security_component/common/fuzz_common.cpp | 9 +++++++++ 5 files changed, 51 insertions(+) diff --git a/frameworks/inner_api/security_component/test/unittest/src/test_common.cpp b/frameworks/inner_api/security_component/test/unittest/src/test_common.cpp index 3ba019d..f1073b8 100644 --- a/frameworks/inner_api/security_component/test/unittest/src/test_common.cpp +++ b/frameworks/inner_api/security_component/test/unittest/src/test_common.cpp @@ -84,6 +84,9 @@ void TestCommon::BuildLocationComponentInfo(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; } void TestCommon::BuildSaveComponentInfo(nlohmann::json& jsonComponent) @@ -153,6 +156,9 @@ void TestCommon::BuildSaveComponentInfo(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; } void TestCommon::BuildPasteComponentInfo(nlohmann::json& jsonComponent) @@ -222,6 +228,9 @@ void TestCommon::BuildPasteComponentInfo(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; } } // namespace SecurityComponent } // namespace Security diff --git a/frameworks/security_component/src/sec_comp_base.cpp b/frameworks/security_component/src/sec_comp_base.cpp index acd00ea..abb8142 100644 --- a/frameworks/security_component/src/sec_comp_base.cpp +++ b/frameworks/security_component/src/sec_comp_base.cpp @@ -72,6 +72,9 @@ const std::string JsonTagConstants::JSON_DISPLAY_ID = "displayId"; const std::string JsonTagConstants::JSON_CROSS_AXIS_STATE = "crossAxisState"; const std::string JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG = "hasNonCompatileChange"; const std::string JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG = "blurRadius"; +const std::string JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG = "foregroundBlurRadius"; +const std::string JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG = "isOverlayTextSet"; +const std::string JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG = "isOVerlayNodeCovered"; bool SecCompBase::ParseNonCompatibleChange(const nlohmann::json& json) { @@ -85,6 +88,18 @@ bool SecCompBase::ParseNonCompatibleChange(const nlohmann::json& json) if (!ParseDimension(json, JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG, blurRadius_)) { return false; } + + if (!ParseDimension(json, JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG, foregroundBlurRadius_)) { + return false; + } + + if (!ParseBool(json, JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG, isOverlayTextSet_)) { + return false; + } + + if (!ParseBool(json, JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG, isOverlayNodeCovered_)) { + return false; + } return true; } @@ -482,6 +497,9 @@ void SecCompBase::ToJson(nlohmann::json& jsonRes) const jsonRes[JsonTagConstants::JSON_CROSS_AXIS_STATE] = crossAxisState_; jsonRes[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = hasNonCompatileChange_; jsonRes[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = blurRadius_; + jsonRes[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = foregroundBlurRadius_; + jsonRes[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = isOverlayTextSet_; + jsonRes[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = isOverlayNodeCovered_; } std::string SecCompBase::ToJsonStr() const diff --git a/interfaces/inner_api/security_component/include/sec_comp_base.h b/interfaces/inner_api/security_component/include/sec_comp_base.h index 6ded581..e24db73 100644 --- a/interfaces/inner_api/security_component/include/sec_comp_base.h +++ b/interfaces/inner_api/security_component/include/sec_comp_base.h @@ -89,6 +89,9 @@ public: static const std::string JSON_CROSS_AXIS_STATE; static const std::string JSON_NON_COMPATIBLE_CHANGE_TAG; static const std::string JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG; + static const std::string JSON_FOREGROUND_BLUR_RADIUS_TAG; + static const std::string JSON_IS_OVERLAY_TEXT_SET_TAG; + static const std::string JSON_IS_OVERLAY_NODE_SET_TAG; }; class __attribute__((visibility("default"))) SecCompBase { @@ -144,6 +147,9 @@ public: bool hasNonCompatileChange_ = false; double blurRadius_ = 0.0; + double foregroundBlurRadius_ = 0.0; + bool isOverlayTextSet_ = false; + bool isOverlayNodeCovered_ = false; int32_t windowId_ = 0; uint64_t displayId_ = 0; int32_t nodeId_ = 0; diff --git a/services/security_component_service/sa/test/unittest/src/service_test_common.cpp b/services/security_component_service/sa/test/unittest/src/service_test_common.cpp index 6de9eca..5dcc96b 100644 --- a/services/security_component_service/sa/test/unittest/src/service_test_common.cpp +++ b/services/security_component_service/sa/test/unittest/src/service_test_common.cpp @@ -85,6 +85,9 @@ void ServiceTestCommon::BuildLocationComponentJson(nlohmann::json& jsonComponent jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; } void ServiceTestCommon::BuildSaveComponentJson(nlohmann::json& jsonComponent) @@ -154,6 +157,9 @@ void ServiceTestCommon::BuildSaveComponentJson(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; } void ServiceTestCommon::BuildPasteComponentJson(nlohmann::json& jsonComponent) @@ -223,6 +229,9 @@ void ServiceTestCommon::BuildPasteComponentJson(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; } } // namespace SecurityComponent } // namespace Security diff --git a/test/fuzztest/security_component/common/fuzz_common.cpp b/test/fuzztest/security_component/common/fuzz_common.cpp index d83d2b9..34817ac 100644 --- a/test/fuzztest/security_component/common/fuzz_common.cpp +++ b/test/fuzztest/security_component/common/fuzz_common.cpp @@ -102,6 +102,9 @@ std::string CompoRandomGenerator::ConstructLocationJson() jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; compoJson_ = jsonComponent; return compoJson_.dump(); } @@ -150,6 +153,9 @@ std::string CompoRandomGenerator::ConstructSaveJson() jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; compoJson_ = jsonComponent; return compoJson_.dump(); } @@ -198,6 +204,9 @@ std::string CompoRandomGenerator::ConstructPasteJson() jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_FOREGROUND_BLUR_RADIUS_TAG] = 0.0; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_TEXT_SET_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_OVERLAY_NODE_SET_TAG] = false; compoJson_ = jsonComponent; return compoJson_.dump(); } -- Gitee