• 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 *UPDATER_HDC_LOG = "/data/updater/log/flashd_hdc.log";
43 constexpr const char *PREFIX_UFS_NODE = "/dev/block/sd";
44 constexpr const char *SDCARD_PACKAGE_SUFFIX = ".zip";
45 constexpr const char *POWEROFF = "shutdown";
46 constexpr const char *BOOTDEV_TYPE = "/proc/bootdevice/type";
47 
48 // update mode
49 constexpr const char *SDCARD_MODE = "sdcard_update";
50 constexpr const char *OTA_MODE = "update_package";
51 constexpr const char *USB_MODE = "usb_update";
52 constexpr const char *UPDATRE_SCRIPT_ZIP = "/etc/updater_script.zip";
53 
54 #ifndef UPDATER_UT
55 constexpr const char *SDCARD_CARD_PATH = "/sdcard/updater";
56 constexpr const char *SDCARD_CARD_PKG_PATH = "/sdcard/updater/updater.zip";
57 constexpr const char *DEFAULT_LOCALE = "en-US";
58 constexpr const char *G_WORK_PATH = "/tmp/";
59 constexpr const char *MMC_BLOCK_DEV_NAME = "/dev/block/mmcblk0";
60 constexpr const char *MMC_SIZE_FILE = "/sys/class/block/mmcblk0/size";
61 #else
62 constexpr const char *SDCARD_CARD_PATH = "/data/sdcard/updater";
63 constexpr const char *SDCARD_CARD_PKG_PATH = "/data/updater/updater/updater_full.zip";
64 constexpr const char *G_WORK_PATH = "/data/updater/src/";
65 constexpr const char *UT_VERSION = "OpenHarmony 3.2.9.1";
66 constexpr const char *MMC_BLOCK_DEV_NAME = "/data/block/mmcblk0";
67 constexpr const char *MMC_SIZE_FILE = "/data/class/block/mmcblk0/size";
68 #endif
69 
70 // update retry
71 constexpr const char *UPDATER_RETRY_TAG = "retry_update";
72 constexpr const char *VERIFY_FAILED_REBOOT = "reboot_verify_failed";
73 constexpr const char *IO_FAILED_REBOOT = "reboot_IO_failed";
74 
75 constexpr int MAX_RETRY_COUNT = 3;
76 constexpr int MINIMAL_ARGC_LIMIT = 2;
77 constexpr int MAX_LOG_BUF_SIZE = 4096;
78 constexpr int MAX_LOG_NAME_SIZE = 100;
79 constexpr long MAX_LOG_SIZE = 5 * 1024 * 1024;
80 constexpr long MAX_LOG_DIR_SIZE = 10 * 1024 * 1024;
81 constexpr int MAX_RESULT_SIZE = 20;
82 constexpr int MAX_RESULT_BUFF_SIZE = 1000;
83 constexpr int VERIFICATION_PROGRESS_TIME = 60;
84 constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25f;
85 constexpr int PREDICTED_ELAPSED_TIME = 30;
86 constexpr int PROGRESS_VALUE_MAX = 1;
87 constexpr int PROGRESS_VALUE_MIN = 0;
88 constexpr int SLEEP_TIME = 1;
89 constexpr int DECIMAL = 10;
90 constexpr int BINARY = 2;
91 constexpr int FAKE_TEMPRATURE = 40;
92 constexpr int32_t DEFAULT_PROCESS_NUM = 2;
93 constexpr int32_t MAX_BUFFER_SIZE = 512;
94 constexpr int32_t DEFAULT_PIPE_NUM = 2;
95 constexpr int32_t BINARY_MAX_ARGS = 3;
96 constexpr int32_t BINARY_SECOND_ARG = 2;
97 constexpr int32_t WRITE_SECOND_CMD = 2;
98 constexpr int REBOOT = 0;
99 constexpr int WIPE_DATA = 1;
100 constexpr int WIPE_CACHE = 2;
101 constexpr int FACTORY_RESET = 3;
102 constexpr int REBOOT_FASTBOOT = 4;
103 constexpr int UPDATE_FROM_SDCARD = 5;
104 constexpr int SHUTDOWN = 6;
105 constexpr int FULL_PERCENT_PROGRESS = 100;
106 constexpr int PROGRESS_VALUE_CONST = 2;
107 constexpr int SHOW_FULL_PROGRESS_TIME = 2000;
108 constexpr unsigned int LEAST_PARTITION_COUNT = 4;
109 constexpr unsigned int UI_SHOW_DURATION = 2000;
110 constexpr unsigned int INTERVAL_TIME = 300;
111 constexpr float EPSINON = 0.00001;
112 constexpr float FULL_EPSINON = 1;
113 } // namespace Updater
114 #endif
115