1 /* 2 * Copyright (c) 2021-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 UPDATER_CONST_H 16 #define UPDATER_CONST_H 17 18 #include <string> 19 20 namespace Updater { 21 constexpr const char *COMMAND_FILE = "/data/updater/command"; 22 constexpr const char *TMP_LOG = "/tmp/updater.log"; 23 constexpr const char *TMP_STAGE_LOG = "/tmp/updater_stage.log"; 24 constexpr const char *TMP_ERROR_CODE_PATH = "/tmp/error_code.log"; 25 constexpr const char *ERROR_CODE_PATH = "/data/updater/log/error_code.log"; 26 constexpr const char *UPDATER_LOG_DIR = "/data/updater/log"; 27 constexpr const char *UPDATER_LOG = "/data/updater/log/updater_log"; 28 constexpr const char *UPDATER_STAGE_LOG = "/data/updater/log/updater_stage_log"; 29 constexpr const char *UPDATER_LOG_FILE = "updater_log"; 30 constexpr const char *UPDATER_STAGE_FILE = "updater_stage_log"; 31 constexpr const char *UPDATER_PATH = "/data/updater"; 32 constexpr const char *SYS_INSTALLER_PATH = "/mnt/sys_installer"; 33 constexpr const char *UPDATER_LOCALE_FILE = "locale"; 34 constexpr const char *UPDATER_RESULT_FILE = "updater_result"; 35 constexpr const char *MISC_FILE = "/dev/block/platform/soc/10100000.himci.eMMC/by-name/misc"; 36 constexpr const char *MISC_PATH = "/misc"; 37 constexpr const char *UPDATER_BINARY = "updater_binary"; 38 constexpr const char *SDCARD_PATH = "/sdcard"; 39 constexpr const char *UPDATER_HDC_LOG = "/data/updater/log/flashd_hdc.log"; 40 constexpr const char *PREFIX_UFS_NODE = "/dev/block/sd"; 41 constexpr const char *SDCARD_PACKAGE_SUFFIX = ".zip"; 42 constexpr const char *POWEROFF = "shutdown"; 43 44 // update mode 45 constexpr const char *SDCARD_MODE = "sdcard_update"; 46 constexpr const char *OTA_MODE = "update_package"; 47 48 #ifndef UPDATER_UT 49 constexpr const char *SDCARD_CARD_PATH = "/sdcard/updater"; 50 constexpr const char *SDCARD_CARD_PKG_PATH = "/sdcard/updater/updater.zip"; 51 constexpr const char *DEFAULT_LOCALE = "en-US"; 52 constexpr const char *G_WORK_PATH = "/tmp/"; 53 #else 54 constexpr const char *SDCARD_CARD_PATH = "/data/sdcard/updater"; 55 constexpr const char *SDCARD_CARD_PKG_PATH = "/data/updater/updater/updater_full.zip"; 56 constexpr const char *G_WORK_PATH = "/data/updater/src/"; 57 constexpr const char *UT_VERSION = "OpenHarmony 3.2.9.1"; 58 #endif 59 constexpr int MAX_RETRY_COUNT = 4; 60 constexpr int MINIMAL_ARGC_LIMIT = 2; 61 constexpr int MAX_LOG_BUF_SIZE = 4096; 62 constexpr int MAX_LOG_NAME_SIZE = 100; 63 constexpr long MAX_LOG_SIZE = 5 * 1024 * 1024; 64 constexpr long MAX_LOG_DIR_SIZE = 10 * 1024 * 1024; 65 constexpr int MAX_RESULT_SIZE = 20; 66 constexpr int MAX_RESULT_BUFF_SIZE = 1000; 67 constexpr int VERIFICATION_PROGRESS_TIME = 60; 68 constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25f; 69 constexpr int PREDICTED_ELAPSED_TIME = 30; 70 constexpr int PROGRESS_VALUE_MAX = 1; 71 constexpr int PROGRESS_VALUE_MIN = 0; 72 constexpr int SLEEP_TIME = 1; 73 constexpr int DECIMAL = 10; 74 constexpr int BINARY = 2; 75 constexpr int FAKE_TEMPRATURE = 40; 76 constexpr int32_t DEFAULT_PROCESS_NUM = 2; 77 constexpr int32_t MAX_BUFFER_SIZE = 512; 78 constexpr int32_t DEFAULT_PIPE_NUM = 2; 79 constexpr int32_t BINARY_MAX_ARGS = 3; 80 constexpr int32_t BINARY_SECOND_ARG = 2; 81 constexpr int32_t WRITE_SECOND_CMD = 2; 82 constexpr int REBOOT = 0; 83 constexpr int WIPE_DATA = 1; 84 constexpr int WIPE_CACHE = 2; 85 constexpr int FACTORY_RESET = 3; 86 constexpr int REBOOT_FASTBOOT = 4; 87 constexpr int UPDATE_FROM_SDCARD = 5; 88 constexpr int SHUTDOWN = 6; 89 constexpr int FULL_PERCENT_PROGRESS = 100; 90 constexpr int PROGRESS_VALUE_CONST = 2; 91 constexpr int SHOW_FULL_PROGRESS_TIME = 2000; 92 constexpr unsigned int LEAST_PARTITION_COUNT = 4; 93 constexpr unsigned int UI_SHOW_DURATION = 2000; 94 constexpr unsigned int INTERVAL_TIME = 300; 95 constexpr float EPSINON = 0.00001; 96 constexpr float FULL_EPSINON = 1; 97 } // namespace Updater 98 #endif 99