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 16 #ifndef I_SANDBOX_MANAGER_H 17 #define I_SANDBOX_MANAGER_H 18 #include <vector> 19 #include "errors.h" 20 #include "iremote_broker.h" 21 #include "policy_info.h" 22 #include "sandboxmanager_service_ipc_interface_code.h" 23 #include "system_ability_definition.h" 24 25 namespace OHOS { 26 namespace AccessControl { 27 namespace SandboxManager { 28 class ISandboxManager : public IRemoteBroker { 29 public: 30 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accesscontrol.sandbox_manager.ISandboxManager"); 31 32 static const int SA_ID_SANDBOX_MANAGER_SERVICE = SANDBOX_MANAGER_SERVICE_ID; 33 34 virtual int32_t CleanPersistPolicyByPath(const std::vector<std::string>& filePathList) = 0; 35 virtual int32_t PersistPolicy(const std::vector<PolicyInfo> &policy, std::vector<uint32_t> &result) = 0; 36 virtual int32_t UnPersistPolicy(const std::vector<PolicyInfo> &policy, std::vector<uint32_t> &result) = 0; 37 virtual int32_t PersistPolicyByTokenId( 38 uint32_t tokenId, const std::vector<PolicyInfo> &policy, std::vector<uint32_t> &result) = 0; 39 virtual int32_t UnPersistPolicyByTokenId( 40 uint32_t tokenId, const std::vector<PolicyInfo> &policy, std::vector<uint32_t> &result) = 0; 41 virtual int32_t SetPolicy(uint32_t tokenId, const std::vector<PolicyInfo> &policy, uint64_t policyFlag, 42 std::vector<uint32_t> &result, uint64_t timestamp) = 0; 43 virtual int32_t UnSetPolicy(uint32_t tokenId, const PolicyInfo &policy) = 0; 44 virtual int32_t SetPolicyAsync(uint32_t tokenId, const std::vector<PolicyInfo> &policy, uint64_t policyFlag, 45 uint64_t timestamp) = 0; 46 virtual int32_t UnSetPolicyAsync(uint32_t tokenId, const PolicyInfo &policy) = 0; 47 virtual int32_t CheckPolicy(uint32_t tokenId, const std::vector<PolicyInfo> &policy, std::vector<bool> &result) = 0; 48 virtual int32_t StartAccessingPolicy(const std::vector<PolicyInfo> &policy, std::vector<uint32_t> &result, 49 bool useCallerToken, uint32_t tokenId, uint64_t timestamp) = 0; 50 virtual int32_t StopAccessingPolicy(const std::vector<PolicyInfo> &policy, std::vector<uint32_t> &result) = 0; 51 virtual int32_t CheckPersistPolicy( 52 uint32_t tokenId, const std::vector<PolicyInfo> &policy, std::vector<bool> &result) = 0; 53 virtual int32_t StartAccessingByTokenId(uint32_t tokenId, uint64_t timestamp) = 0; 54 virtual int32_t UnSetAllPolicyByToken(uint32_t tokenId, uint64_t timestamp) = 0; 55 }; 56 } // namespace SandboxManager 57 } // namespace AccessControl 58 } // namespace OHOS 59 60 #endif // I_SANDBOX_MANAGER_H