1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef ACE_MOCK_SECURITY_COMPONENT_BASE_H 16 #define ACE_MOCK_SECURITY_COMPONENT_BASE_H 17 18 #include <cstdint> 19 #include <string> 20 21 namespace OHOS { 22 namespace Security { 23 namespace SecurityComponent { 24 struct PaddingSize { 25 double top; 26 double right; 27 double bottom; 28 double left; 29 }; 30 31 struct BorderRadius { 32 double leftTop; 33 double rightTop; 34 double leftBottom; 35 double rightBottom; 36 }; 37 38 enum SecCompType { 39 UNKNOWN_SC_TYPE = 0, 40 LOCATION_COMPONENT, 41 PASTE_COMPONENT, 42 SAVE_COMPONENT, 43 MAX_SC_TYPE 44 }; 45 46 union SecCompColor { 47 struct { 48 uint8_t blue; 49 uint8_t green; 50 uint8_t red; 51 uint8_t alpha; 52 } argb; 53 uint32_t value; 54 }; 55 56 struct SecCompRect { 57 double x_; 58 double y_; 59 double width_; 60 double height_; 61 }; 62 63 enum class SecCompBackground { 64 UNKNOWN_BG = -2, 65 NO_BG_TYPE = -1, 66 CAPSULE = 0, 67 CIRCLE = 1, 68 NORMAL = 2, 69 MAX_BG_TYPE 70 }; 71 72 enum CrossAxisState { 73 STATE_INVALID = 0, 74 STATE_CROSS, 75 STATE_NO_CROSS, 76 }; 77 78 enum class TipPosition : int32_t { 79 ABOVE_BOTTOM = 0, 80 BELOW_TOP 81 }; 82 83 class SecCompBase { 84 public: 85 SecCompBase() = default; 86 virtual ~SecCompBase() = default; ToJsonStr(void)87 std::string ToJsonStr(void) const 88 { 89 return ""; 90 }; 91 92 // size 93 double fontSize_; 94 double iconSize_; 95 PaddingSize padding_; 96 BorderRadius borderRadius_; 97 double textIconSpace_; 98 99 // color 100 SecCompColor fontColor_; 101 SecCompColor iconColor_; 102 SecCompColor bgColor_; 103 104 // border 105 double borderWidth_; 106 107 // parent effect 108 bool parentEffect_ = false; 109 bool isClipped_ = false; 110 double topClip_; 111 double bottomClip_; 112 double leftClip_; 113 double rightClip_; 114 std::string parentTag_; 115 116 SecCompType type_ = UNKNOWN_SC_TYPE; 117 SecCompRect rect_; 118 SecCompRect windowRect_; 119 bool isValid_ = false; 120 121 int32_t text_; 122 int32_t icon_; 123 SecCompBackground bg_; 124 125 bool hasNonCompatibleChange_ = false; 126 double blurRadius_ = 0.0; 127 double foregroundBlurRadius_ = 0.0; 128 bool isOverlayTextSet_ = false; 129 bool isOverlayNodeCovered_ = false; 130 int32_t windowId_; 131 uint64_t displayId_ = 0; 132 int32_t nodeId_; 133 CrossAxisState crossAxisState_ = CrossAxisState::STATE_INVALID; 134 bool isIconExceeded_ = false; 135 bool isBorderCovered_ = false; 136 bool isWearableDevice_ = false; 137 bool isCustomizable_ = false; 138 TipPosition tipPosition_ = TipPosition::ABOVE_BOTTOM; 139 }; 140 } // namespace SecurityComponent 141 } // namespace Security 142 } // namespace OHOS 143 #endif // ACE_MOCK_SECURITY_COMPONENT_BASE_H 144