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_MOKC_INTERFACES_INNER_API_SECURITY_COMPONENT_KIT_H 16 #define ACE_MOKC_INTERFACES_INNER_API_SECURITY_COMPONENT_KIT_H 17 18 #include <string> 19 #include "iremote_object.h" 20 #include "i_sec_comp_probe.h" 21 #include "sec_comp_base_mock.h" 22 23 namespace OHOS { 24 namespace Security { 25 namespace SecurityComponent { 26 struct ExtraInfo { 27 uint32_t dataSize; 28 uint8_t* data; 29 }; 30 31 enum class ClickEventType : int32_t { 32 UNKNOWN_EVENT_TYPE, 33 POINT_EVENT_TYPE, 34 KEY_EVENT_TYPE 35 }; 36 37 struct SecCompPointEvent { 38 double touchX; 39 double touchY; 40 uint64_t timestamp; 41 }; 42 43 struct SecCompKeyEvent { 44 uint64_t timestamp; 45 int32_t keyCode; 46 }; 47 48 struct SecCompClickEvent { 49 ClickEventType type; 50 union { 51 SecCompPointEvent point; 52 SecCompKeyEvent key; 53 }; 54 ExtraInfo extraInfo; 55 }; 56 using OnFirstUseDialogCloseFunc = std::function<void(int32_t)>; 57 58 class SecCompUiRegister { 59 public: SecCompUiRegister(std::vector<uintptr_t> & callerList,ISecCompProbe * probe)60 SecCompUiRegister(std::vector<uintptr_t>& callerList, ISecCompProbe* probe) {}; 61 virtual ~SecCompUiRegister() = default; 62 static ISecCompProbe* callbackProbe; 63 }; 64 65 class SecCompKit { 66 public: RegisterSecurityComponent(SecCompType type,std::string & componentInfo,int32_t & scId)67 static int32_t RegisterSecurityComponent(SecCompType type, std::string& componentInfo, int32_t& scId) 68 { 69 scId = 1; 70 return 0; 71 }; 72 UpdateSecurityComponent(int32_t scId,std::string & componentInfo)73 static int32_t UpdateSecurityComponent(int32_t scId, std::string& componentInfo) 74 { 75 return 0; 76 }; 77 UnregisterSecurityComponent(int32_t scId)78 static int32_t UnregisterSecurityComponent(int32_t scId) 79 { 80 return 0; 81 }; 82 PreRegisterSecCompProcess()83 static int32_t PreRegisterSecCompProcess() 84 { 85 return 0; 86 }; 87 ReportSecurityComponentClickEvent(int32_t scId,std::string & componentInfo,const SecCompClickEvent & clickInfo,sptr<IRemoteObject> callerToken,OnFirstUseDialogCloseFunc && func)88 static int32_t ReportSecurityComponentClickEvent(int32_t scId, 89 std::string& componentInfo, const SecCompClickEvent& clickInfo, 90 sptr<IRemoteObject> callerToken, OnFirstUseDialogCloseFunc&& func) 91 { 92 return 0; 93 }; 94 IsServiceExist()95 static bool IsServiceExist() 96 { 97 return false; 98 }; 99 LoadService()100 static bool LoadService() 101 { 102 return true; 103 }; 104 IsSystemAppCalling()105 static bool IsSystemAppCalling() 106 { 107 return false; 108 }; 109 }; 110 } // namespace SecurityComponent 111 } // namespace Security 112 } // namespace OHOS 113 #endif // ACE_MOKC_INTERFACES_INNER_API_SECURITY_COMPONENT_KIT_H 114