/* * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_ABILITY_RUNTIME_BATCH_URI_H #define OHOS_ABILITY_RUNTIME_BATCH_URI_H #include #include #ifdef ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER #include "policy_info.h" #else #include "upms_policy_info.h" #endif #include "uri.h" namespace OHOS { namespace AAFwk { namespace { #ifdef ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER using PolicyInfo = AccessControl::SandboxManager::PolicyInfo; #endif } class BatchUri { public: BatchUri() {} int32_t Init(const std::vector &uriVec, uint32_t mode = 0, const std::string &callerBundleName = "", const std::string &targetBundleName = ""); void InitFileUriInfo(Uri &uriInner, uint32_t index, const uint32_t mode = 0, const std::string &callerBundleName = "", const std::string &targetBundleName = ""); void SetContentUriCheckResult(const std::vector &contentUriResult); void SetMediaUriCheckResult(const std::vector &mediaUriResult); void SetOtherUriCheckResult(const std::vector &otherUriResult); void GetNeedCheckProxyPermissionURI(std::vector &proxyUrisByPolicy, std::vector &proxyUrisByMap); void SetCheckProxyByMapResult(std::vector &proxyResultByMap); void SetCheckProxyByPolicyResult(std::vector &proxyResultByPolicy); int32_t GetUriToGrantByMap(std::vector &uriVec); void SelectPermissionedUri(std::vector &uris, std::vector &indexs, std::vector &uriVec); int32_t GetUriToGrantByPolicy(std::vector &docsPolicyInfoVec, std::vector &bundlePolicyInfoVec); int32_t GetPermissionedUriCount(); std::string targetAppName; // media uri std::vector mediaUris; std::vector mediaIndexs; // content uri std::vector contentUris; std::vector contentIndexs; // docs and bundle uri std::vector otherUris; std::vector otherIndexs; std::vector otherPolicyInfos; // caller's uri std::vector selfBundlePolicyInfos; // for check proxy uri permission std::vector proxyIndexsByMap; std::vector proxyIndexsByPolicy; // result of CheckUriPermission std::vector result; std::vector isDocsUriVec; // target's uri int32_t targetBundleUriCount = 0; std::vector isTargetBundleUri; int32_t validUriCount = 0; int32_t totalUriCount = 0; }; } // OHOS } // AAFwk #endif // OHOS_ABILITY_RUNTIME_BATCH_URI_H