1 /* 2 * Copyright (c) 2021 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 const std::string COMMAND_FILE = "/data/updater/command"; 22 const std::string TMP_LOG = "/tmp/updater.log"; 23 const std::string TMP_STAGE_LOG = "/tmp/updater_stage.log"; 24 const std::string TMP_ERROR_CODE_PATH = "/tmp/error_code.log"; 25 const std::string UPDATER_LOG_DIR = "/data/updater/log"; 26 const std::string UPDATER_PATH = "/data/updater"; 27 const std::string MISC_FILE = "/dev/block/platform/soc/10100000.himci.eMMC/by-name/misc"; 28 const std::string UPDATER_BINARY = "updater_binary"; 29 const std::string SDCARD_PATH = "/sdcard"; 30 const std::string UPDATER_HDC_LOG = "/data/updater/log/flashd_hdc.log"; 31 32 #ifndef UPDATER_UT 33 const std::string SDCARD_CARD_PATH = "/sdcard/updater"; 34 const std::string SDCARD_CARD_PKG_PATH = "/sdcard/updater/updater.zip"; 35 const std::string DEFAULT_LOCALE = "en-US"; 36 const std::string G_WORK_PATH = "/tmp/"; 37 #else 38 const std::string SDCARD_CARD_PATH = "/data/sdcard/updater"; 39 const std::string SDCARD_CARD_PKG_PATH = "/data/updater/updater/updater.zip"; 40 const std::string G_WORK_PATH = "/data/updater/src/"; 41 #endif 42 constexpr int MAX_RETRY_COUNT = 4; 43 constexpr int MINIMAL_ARGC_LIMIT = 2; 44 constexpr int MAX_LOG_BUF_SIZE = 4096; 45 constexpr int MAX_LOG_NAME_SIZE = 100; 46 constexpr long MAX_LOG_SIZE = 5 * 1024 * 1024; 47 constexpr int MAX_TIME_SIZE = 20; 48 constexpr int VERIFICATION_PROGRESS_TIME = 60; 49 constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25f; 50 constexpr int PREDICTED_ELAPSED_TIME = 30; 51 constexpr int PROGRESS_VALUE_MAX = 1; 52 constexpr int PROGRESS_VALUE_MIN = 0; 53 constexpr int SLEEP_TIME = 1; 54 constexpr int DECIMAL = 10; 55 constexpr int BINARY = 2; 56 constexpr int LEAST_PARTITION_COUNT = 4; 57 constexpr int FAKE_TEMPRATURE = 40; 58 constexpr int32_t DEFAULT_PROCESS_NUM = 2; 59 constexpr int32_t MAX_BUFFER_SIZE = 512; 60 constexpr int32_t DEFAULT_PIPE_NUM = 2; 61 constexpr int32_t BINARY_MAX_ARGS = 3; 62 constexpr int32_t BINARY_SECOND_ARG = 2; 63 constexpr int32_t WRITE_SECOND_CMD = 2; 64 constexpr int REBOOT = 0; 65 constexpr int WIPE_DATA = 1; 66 constexpr int WIPE_CACHE = 2; 67 constexpr int FACTORY_RESET = 3; 68 constexpr int REBOOT_FASTBOOT = 4; 69 constexpr int UPDATE_FROM_SDCARD = 5; 70 constexpr int SHUTDOWN = 6; 71 constexpr int FULL_PERCENT_PROGRESS = 100; 72 constexpr int PROGRESS_VALUE_CONST = 2; 73 constexpr int SHOW_FULL_PROGRESS_TIME = 2000; 74 constexpr unsigned int UI_SHOW_DURATION = 2000; 75 constexpr unsigned int INTERVAL_TIME = 300; 76 constexpr float EPSINON = 0.00001; 77 constexpr float FULL_EPSINON = 1; 78 constexpr int BOOT_FLASHD = 1; 79 constexpr int BOOT_UPDATER = 2; 80 } // namespace updater 81 #endif 82