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