1 /* 2 * Copyright (c) 2023 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 UDMF_PREPROCESS_UTILS_H 16 #define UDMF_PREPROCESS_UTILS_H 17 18 #include <bitset> 19 #include <random> 20 #include <string> 21 #include <vector> 22 23 #include "unified_data.h" 24 #include "unified_meta.h" 25 26 namespace OHOS { 27 namespace UDMF { 28 class PreProcessUtils { 29 public: 30 static int32_t RuntimeDataImputation(UnifiedData &data, CustomOption &option); 31 static std::string GenerateId(); 32 static time_t GetTimestamp(); 33 static int32_t GetHapUidByToken(uint32_t tokenId); 34 static bool GetHapBundleNameByToken(int tokenId, std::string &bundleName); 35 static bool GetNativeProcessNameByToken(int tokenId, std::string &processName); 36 static std::string GetLocalDeviceId(); 37 static void SetRemoteData(UnifiedData &data); 38 static bool IsFileType(UDType udType); 39 static int32_t SetRemoteUri(uint32_t tokenId, UnifiedData &data); 40 static bool GetInstIndex(uint32_t tokenId, int32_t &instIndex); 41 static bool IsNetworkingEnabled(); 42 private: 43 static bool CheckUriAuthorization(const std::vector<std::string>& uris, uint32_t tokenId); 44 static int32_t GetDfsUrisFromLocal(const std::vector<std::string> &uris, int32_t userId, UnifiedData &data); 45 }; 46 } // namespace UDMF 47 } // namespace OHOS 48 #endif // UDMF_PREPROCESS_UTILS_H