1 /* 2 * Copyright (c) 2023-2025 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 FAULTLOG_BUNDLE_UTIL_H 17 #define FAULTLOG_BUNDLE_UTIL_H 18 #include <algorithm> 19 #include <string> 20 #include <vector> 21 #include <sys/types.h> 22 namespace OHOS { 23 namespace HiviewDFX { 24 constexpr unsigned BUF_SIZE = 1024; 25 constexpr int MIN_APP_USERID = 10000; 26 constexpr uint32_t MAX_NAME_LENGTH = 4096; 27 constexpr int AID_SYSTEM = 1000; 28 constexpr mode_t DEFAULT_LOG_FILE_MODE = 0644; 29 constexpr mode_t DEFAULT_LOG_DIR_MODE = 0775; 30 31 struct DfxBundleInfo { 32 bool isPreInstalled; 33 uint32_t versionCode; 34 std::string versionName; 35 }; 36 37 bool IsModuleNameValid(const std::string& name); 38 std::string GetApplicationNameById(int32_t uid); 39 bool GetDfxBundleInfo(const std::string& bundleName, DfxBundleInfo& bundleInfo); 40 bool IsNameValid(const std::string& name, const std::string& sep, bool canEmpty); 41 } // namespace HiviewDFX 42 } // namespace OHOS 43 #endif 44