• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 *INSTALL_TIME_FILE = "install_time";
22 constexpr const char *ROLLBACK_FILE = "rollback";
23 constexpr const char *COMMAND_FILE = "/data/updater/command";
24 constexpr const char *TMP_LOG = "/tmp/updater.log";
25 constexpr const char *TMP_STAGE_LOG = "/tmp/updater_stage.log";
26 constexpr const char *TMP_ERROR_CODE_PATH = "/tmp/error_code.log";
27 constexpr const char *ERROR_CODE_PATH = "/data/updater/log/error_code.log";
28 constexpr const char *UPDATER_LOG_DIR = "/data/updater/log";
29 constexpr const char *UPDATER_LOG = "/data/updater/log/updater_log";
30 constexpr const char *SYS_INSTALLER_LOG = "/data/updater/log/sys_installer.log";
31 constexpr const char *UPDATER_STAGE_LOG = "/data/updater/log/updater_stage_log";
32 constexpr const char *UPDATER_LOG_FILE = "updater_log";
33 constexpr const char *UPDATER_STAGE_FILE = "updater_stage_log";
34 constexpr const char *SYS_INSTALLER_PATH = "/mnt/sys_installer";
35 constexpr const char *UPDATER_PATH = "/data/updater";
36 constexpr const char *UPDATER_LOCALE_FILE = "locale";
37 constexpr const char *UPDATER_RESULT_FILE = "updater_result";
38 constexpr const char *MODULE_UPDATE_RESULT_FILE = "module_update_result";
39 constexpr const char *MISC_FILE = "/dev/block/platform/soc/10100000.himci.eMMC/by-name/misc";
40 constexpr const char *MISC_PATH = "/misc";
41 constexpr const char *UPDATER_BINARY = "updater_binary";
42 constexpr const char *STREAM_ZIP_PATH = "/data/updater/update_stream.zip";
43 constexpr const char *SDCARD_PATH = "/sdcard";
44 constexpr const char *INTERNAL_DATA_PATH = "/internaldata";
45 constexpr const char *UPDATER_HDC_LOG = "/data/updater/log/flashd_hdc.log";
46 constexpr const char *PREFIX_UFS_NODE = "/dev/block/sd";
47 constexpr const char *SDCARD_PACKAGE_SUFFIX = ".zip";
48 constexpr const char *POWEROFF = "shutdown";
49 constexpr const char *BOOTDEV_TYPE = "/proc/bootdevice/type";
50 constexpr const char *UPLOAD_LOG_TIME_FILE = "upload_time";
51 constexpr const char *ERASE_LOG_OEMINFO = "not_erase_log_switch";
52 
53 // update mode
54 constexpr const char *SDCARD_MODE = "sdcard_update";
55 constexpr const char *OTA_MODE = "update_package";
56 constexpr const char *USB_MODE = "usb_update";
57 constexpr const char *OTA_INTRAL_MODE = "ota_intral_update";
58 constexpr const char *SDCARD_INTRAL_MODE = "sdcard_intral_update";
59 constexpr const char *UPDATRE_SCRIPT_ZIP = "/etc/updater_script.zip";
60 constexpr const char *FACTORY_INTERNAL_MODE = "factory_internal_update";
61 constexpr const char *USB_UPDATE_FAIL = "usb_update_fail";
62 
63 // sd update ext mode
64 constexpr const char *SDCARD_NORMAL_UPDATE = "sdUpdate";
65 constexpr const char *SDCARD_UPDATE_FROM_DEV = "sdUpdateFromDev";
66 constexpr const char *SDCARD_MAINIMG = "mainUpdate";
67 constexpr const char *SDCARD_UPDATE_FROM_DATA = "sdUpdateFromData";
68 
69 #ifndef UPDATER_UT
70 constexpr const char *SDCARD_CARD_PATH = "/sdcard/updater";
71 constexpr const char *SDCARD_CARD_PKG_PATH = "/sdcard/updater/updater.zip";
72 constexpr const char *DEFAULT_LOCALE = "en-US";
73 constexpr const char *G_WORK_PATH = "/tmp/";
74 constexpr const char *MMC_BLOCK_DEV_NAME = "/dev/block/mmcblk0";
75 constexpr const char *MMC_SIZE_FILE = "/sys/class/block/mmcblk0/size";
76 #else
77 constexpr const char *SDCARD_CARD_PATH = "/data/sdcard/updater";
78 constexpr const char *SDCARD_CARD_PKG_PATH = "/data/updater/updater/updater_full.zip";
79 constexpr const char *G_WORK_PATH = "/data/updater/src/";
80 constexpr const char *UT_VERSION = "OpenHarmony 3.2.9.1";
81 constexpr const char *MMC_BLOCK_DEV_NAME = "/data/block/mmcblk0";
82 constexpr const char *MMC_SIZE_FILE = "/data/class/block/mmcblk0/size";
83 #endif
84 
85 // update retry
86 constexpr const char *UPDATER_RETRY_TAG = "retry_update";
87 constexpr const char *VERIFY_FAILED_REBOOT = "reboot_verify_failed";
88 constexpr const char *IO_FAILED_REBOOT = "reboot_IO_failed";
89 constexpr const char *BLOCK_UPDATE_FAILED_REBOOT = "reboot_block_update_failed";
90 constexpr const char *PROCESS_BIN_FAIL_RETRY = "process_bin_failed";
91 
92 constexpr int MAX_RETRY_COUNT = 3;
93 constexpr int MINIMAL_ARGC_LIMIT = 2;
94 constexpr int MAXIMAL_ARGC_LIMIT = 4;
95 constexpr int MAX_LOG_BUF_SIZE = 4096;
96 constexpr int MAX_LOG_NAME_SIZE = 100;
97 constexpr long MAX_LOG_SIZE = 10 * 1024 * 1024;
98 constexpr long MAX_LOG_DIR_SIZE = 10 * 1024 * 1024;
99 constexpr int MAX_RESULT_SIZE = 20;
100 constexpr int MAX_RESULT_BUFF_SIZE = 1000;
101 constexpr int VERIFICATION_PROGRESS_TIME = 60;
102 constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25f;
103 constexpr int PREDICTED_ELAPSED_TIME = 30;
104 constexpr int PROGRESS_VALUE_MAX = 1;
105 constexpr int PROGRESS_VALUE_MIN = 0;
106 constexpr int SLEEP_TIME = 1;
107 constexpr int DECIMAL = 10;
108 constexpr int BINARY = 2;
109 constexpr int FAKE_TEMPRATURE = 40;
110 constexpr int32_t DEFAULT_PROCESS_NUM = 2;
111 constexpr int32_t MAX_BUFFER_SIZE = 512;
112 constexpr int32_t DEFAULT_PIPE_NUM = 2;
113 constexpr int32_t BINARY_MAX_ARGS = 3;
114 constexpr int32_t BINARY_SECOND_ARG = 2;
115 constexpr int32_t WRITE_SECOND_CMD = 2;
116 constexpr uint32_t LITTLE_CPU_CORES = 4;
117 constexpr int REBOOT = 0;
118 constexpr int WIPE_DATA = 1;
119 constexpr int WIPE_CACHE = 2;
120 constexpr int FACTORY_RESET = 3;
121 constexpr int REBOOT_FASTBOOT = 4;
122 constexpr int UPDATE_FROM_SDCARD = 5;
123 constexpr int SHUTDOWN = 6;
124 constexpr int FULL_PERCENT_PROGRESS = 100;
125 constexpr int PROGRESS_VALUE_CONST = 2;
126 constexpr int SHOW_FULL_PROGRESS_TIME = 2000;
127 constexpr unsigned int LEAST_PARTITION_COUNT = 4;
128 constexpr unsigned int UI_SHOW_DURATION = 2000;
129 constexpr unsigned int INTERVAL_TIME = 300;
130 constexpr float EPSINON = 0.00001;
131 constexpr float FULL_EPSINON = 1;
132 } // namespace Updater
133 #endif
134