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 INTERFACES_INNER_API_DLP_FILE_KITS_H 17 #define INTERFACES_INNER_API_DLP_FILE_KITS_H 18 #include <cstdint> 19 #include <string> 20 #include "want.h" 21 #include "ability_info.h" 22 23 namespace OHOS { 24 namespace Security { 25 namespace DlpPermission { 26 static const std::string TAG_ACTION_VIEW = "ohos.want.action.viewData"; 27 static const std::string TAG_ACTION_EDIT = "ohos.want.action.editData"; 28 29 static const std::string TAG_KEY_FD = "keyFd"; 30 static const std::string TAG_KEY_FD_TYPE = "type"; 31 static const std::string TAG_KEY_FD_VALUE = "value"; 32 static const std::string VALUE_KEY_FD_TYPE = "FD"; 33 static const int INVALID_FD = -1; 34 35 static const std::string TAG_FILE_NAME = "fileName"; 36 static const std::string TAG_FILE_NAME_VALUE = "name"; 37 static const std::string DLP_FILE_SUFFIX = ".dlp"; 38 static const std::string DEFAULT_STRING = ""; 39 40 class DlpFileKits { 41 public: 42 static bool GetSandboxFlag(AAFwk::Want &want); 43 static bool IsDlpFile(int32_t dlpFd); 44 static bool IsDlpFileBySuffix(const std::string &fileSuffix); 45 static void ConvertAbilityInfoWithSupportDlp(const AAFwk::Want& want, 46 std::vector<AppExecFwk::AbilityInfo> &abilityInfos); 47 }; 48 } // namespace DlpPermission 49 } // namespace Security 50 } // namespace OHOS 51 #endif /* INTERFACES_INNER_API_DLP_FILE_KITS_H */ 52