1 /* 2 * Copyright (c) 2023-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 INTERFACES_INNER_API_SECURITY_COMPONENT_KIT_H 16 #define INTERFACES_INNER_API_SECURITY_COMPONENT_KIT_H 17 18 #include <string> 19 #include "accesstoken_kit.h" 20 #include "iremote_object.h" 21 #include "sec_comp_info.h" 22 #include "sec_comp_ui_register.h" 23 24 namespace OHOS { 25 namespace Security { 26 namespace SecurityComponent { 27 class __attribute__((visibility("default"))) SecCompKit { 28 public: 29 static int32_t RegisterSecurityComponent(SecCompType type, std::string& componentInfo, int32_t& scId); 30 static int32_t UpdateSecurityComponent(int32_t scId, std::string& componentInfo); 31 static int32_t UnregisterSecurityComponent(int32_t scId); 32 static int32_t ReportSecurityComponentClickEvent(SecCompInfo& SecCompInfo, sptr<IRemoteObject> callerToken, 33 OnFirstUseDialogCloseFunc&& callback, std::string& message); 34 static bool VerifySavePermission(AccessToken::AccessTokenID tokenId); 35 static int32_t PreRegisterSecCompProcess(); 36 static bool IsServiceExist(); 37 static bool LoadService(); 38 static bool IsSystemAppCalling(); 39 static bool HasCustomPermissionForSecComp(); 40 }; 41 } // namespace SecurityComponent 42 } // namespace Security 43 } // namespace OHOS 44 #endif // INTERFACES_INNER_API_SECURITY_COMPONENT_KIT_H 45