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 3ba019da00fbacfa5e86be625228bf350d9e3f22..37f4d34f50d041df10e5631efa29aacfa02022e2 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 @@ -82,6 +82,8 @@ void TestCommon::BuildLocationComponentInfo(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; } @@ -151,6 +153,8 @@ void TestCommon::BuildSaveComponentInfo(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; } @@ -220,6 +224,8 @@ void TestCommon::BuildPasteComponentInfo(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; } diff --git a/frameworks/security_component/src/sec_comp_base.cpp b/frameworks/security_component/src/sec_comp_base.cpp index acd00ea39437dad7a90604a60e58f6bef930c5e9..0afa931e293e5fbeb6d560a1d8a9aa2308002be4 100644 --- a/frameworks/security_component/src/sec_comp_base.cpp +++ b/frameworks/security_component/src/sec_comp_base.cpp @@ -70,6 +70,8 @@ const std::string JsonTagConstants::JSON_BG_TAG = "bg"; const std::string JsonTagConstants::JSON_WINDOW_ID = "windowId"; const std::string JsonTagConstants::JSON_DISPLAY_ID = "displayId"; const std::string JsonTagConstants::JSON_CROSS_AXIS_STATE = "crossAxisState"; +const std::string JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG = "isIconExceeded"; +const std::string JsonTagConstants::JSON_IS_BORDER_COVERED_TAG = "isBorderCovered"; const std::string JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG = "hasNonCompatileChange"; const std::string JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG = "blurRadius"; @@ -82,6 +84,12 @@ bool SecCompBase::ParseNonCompatibleChange(const nlohmann::json& json) } hasNonCompatileChange_ = json.at(tag).get(); + if (!ParseBool(json, JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG, isIconExceeded_)) { + return false; + } + if (!ParseBool(json, JsonTagConstants::JSON_IS_BORDER_COVERED_TAG, isBorderCovered_)) { + return false; + } if (!ParseDimension(json, JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG, blurRadius_)) { return false; } @@ -480,6 +488,8 @@ void SecCompBase::ToJson(nlohmann::json& jsonRes) const jsonRes[JsonTagConstants::JSON_WINDOW_ID] = windowId_; jsonRes[JsonTagConstants::JSON_DISPLAY_ID] = displayId_; jsonRes[JsonTagConstants::JSON_CROSS_AXIS_STATE] = crossAxisState_; + jsonRes[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = isIconExceeded_; + jsonRes[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = isBorderCovered_; jsonRes[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = hasNonCompatileChange_; jsonRes[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = blurRadius_; } 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 6ded581996ab539621a995285aaabe8de89cdfd2..1758e08ca6f77b8ed64501b91b92e6b11f11cd71 100644 --- a/interfaces/inner_api/security_component/include/sec_comp_base.h +++ b/interfaces/inner_api/security_component/include/sec_comp_base.h @@ -87,6 +87,8 @@ public: static const std::string JSON_WINDOW_ID; static const std::string JSON_DISPLAY_ID; static const std::string JSON_CROSS_AXIS_STATE; + static const std::string JSON_IS_ICON_EXCEEDED_TAG; + static const std::string JSON_IS_BORDER_COVERED_TAG; static const std::string JSON_NON_COMPATIBLE_CHANGE_TAG; static const std::string JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG; }; @@ -148,6 +150,8 @@ public: uint64_t displayId_ = 0; int32_t nodeId_ = 0; CrossAxisState crossAxisState_ = CrossAxisState::STATE_INVALID; + bool isIconExceeded_ = false; + bool isBorderCovered_ = false; bool isWearableDevice_ = false; protected: virtual bool IsTextIconTypeValid(std::string& message, bool isClicked) = 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 6de9eca66de11008f72d9930331bd051339aa9d3..dec5affe427b99d65432fb81f2fdd2ce3bd83e7c 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 @@ -83,6 +83,8 @@ void ServiceTestCommon::BuildLocationComponentJson(nlohmann::json& jsonComponent jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; } @@ -152,6 +154,8 @@ void ServiceTestCommon::BuildSaveComponentJson(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; } @@ -221,6 +225,8 @@ void ServiceTestCommon::BuildPasteComponentJson(nlohmann::json& jsonComponent) jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; } diff --git a/test/fuzztest/security_component/common/fuzz_common.cpp b/test/fuzztest/security_component/common/fuzz_common.cpp index d83d2b9e67664bb5168a4288850c9a14b583c884..5c165efeade318e5eb6db1c2e6f0648ec56788eb 100644 --- a/test/fuzztest/security_component/common/fuzz_common.cpp +++ b/test/fuzztest/security_component/common/fuzz_common.cpp @@ -100,6 +100,8 @@ std::string CompoRandomGenerator::ConstructLocationJson() jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; compoJson_ = jsonComponent; @@ -148,6 +150,8 @@ std::string CompoRandomGenerator::ConstructSaveJson() jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; compoJson_ = jsonComponent; @@ -196,6 +200,8 @@ std::string CompoRandomGenerator::ConstructPasteJson() jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0; jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0; jsonComponent[JsonTagConstants::JSON_CROSS_AXIS_STATE] = 0; + jsonComponent[JsonTagConstants::JSON_IS_ICON_EXCEEDED_TAG] = false; + jsonComponent[JsonTagConstants::JSON_IS_BORDER_COVERED_TAG] = false; jsonComponent[JsonTagConstants::JSON_NON_COMPATIBLE_CHANGE_TAG] = false; jsonComponent[JsonTagConstants::JSON_LINEAR_GRADIENT_BLUR_RADIUS_TAG] = 0.0; compoJson_ = jsonComponent;