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 DLP_PERMISSION_PROXY_H 17 #define DLP_PERMISSION_PROXY_H 18 19 #include <string> 20 #include <vector> 21 #include "iremote_proxy.h" 22 #include "dlp_permission.h" 23 #include "i_dlp_permission_service.h" 24 25 namespace OHOS { 26 namespace Security { 27 namespace DlpPermission { 28 class DlpPermissionProxy : public IRemoteProxy<IDlpPermissionService> { 29 public: 30 explicit DlpPermissionProxy(const sptr<IRemoteObject>& impl); 31 ~DlpPermissionProxy() override; 32 33 int32_t GenerateDlpCertificate( 34 const sptr<DlpPolicyParcel>& policyParcel, const sptr<IDlpPermissionCallback>& callback) override; 35 int32_t ParseDlpCertificate(sptr<CertParcel>& certParcel, const sptr<IDlpPermissionCallback>& callback, 36 const std::string& appId, const bool& offlineAccess) override; 37 int32_t InstallDlpSandbox(const std::string& bundleName, DLPFileAccess dlpFileAccess, int32_t userId, 38 SandboxInfo& sandboxInfo, const std::string& uri) override; 39 int32_t UninstallDlpSandbox(const std::string& bundleName, int32_t appIndex, int32_t userId) override; 40 int32_t GetSandboxExternalAuthorization(int sandboxUid, const AAFwk::Want& want, 41 SandBoxExternalAuthorType& authType) override; 42 int32_t QueryDlpFileCopyableByTokenId(bool& copyable, uint32_t tokenId) override; 43 int32_t QueryDlpFileAccess(DLPPermissionInfoParcel& permInfoParcel) override; 44 int32_t IsInDlpSandbox(bool& inSandbox) override; 45 int32_t GetDlpSupportFileType(std::vector<std::string>& supportFileType) override; 46 int32_t RegisterDlpSandboxChangeCallback(const sptr<IRemoteObject>& callback) override; 47 int32_t UnRegisterDlpSandboxChangeCallback(bool& result) override; 48 int32_t RegisterOpenDlpFileCallback(const sptr<IRemoteObject>& callback) override; 49 int32_t UnRegisterOpenDlpFileCallback(const sptr<IRemoteObject>& callback) override; 50 int32_t GetDlpGatheringPolicy(bool& isGathering) override; 51 int32_t SetRetentionState(const std::vector<std::string>& docUriVec) override; 52 int32_t CancelRetentionState(const std::vector<std::string>& docUriVec) override; 53 int32_t GetRetentionSandboxList(const std::string& bundleName, 54 std::vector<RetentionSandBoxInfo>& retentionSandBoxInfoVec) override; 55 int32_t ClearUnreservedSandbox() override; 56 int32_t GetDLPFileVisitRecord(std::vector<VisitedDLPFileInfo>& infoVec) override; 57 int32_t SetMDMPolicy(const std::vector<std::string>& appIdList) override; 58 int32_t GetMDMPolicy(std::vector<std::string>& appIdList) override; 59 int32_t RemoveMDMPolicy() override; 60 int32_t SetSandboxAppConfig(const std::string& configInfo) override; 61 int32_t CleanSandboxAppConfig() override; 62 int32_t GetSandboxAppConfig(std::string& configInfo) override; 63 int32_t IsDLPFeatureProvided(bool& isProvideDLPFeature) override; 64 int32_t SetReadFlag(uint32_t uid) override; 65 66 private: 67 static inline BrokerDelegator<DlpPermissionProxy> delegator_; 68 }; 69 } // namespace DlpPermission 70 } // namespace Security 71 } // namespace OHOS 72 #endif // DLP_PERMISSION_PROXY_H 73