• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 
16 #ifndef FIRMWARE_CONSTANT_H
17 #define FIRMWARE_CONSTANT_H
18 
19 #include <vector>
20 
21 #include "constant.h"
22 #include "update_helper.h"
23 
24 namespace OHOS {
25 namespace UpdateEngine {
26 namespace Firmware {
27 constexpr double HALF_PROGRESS = 0.5;
28 constexpr int32_t NIGHT_UPGRADE_START_HOUR = 2;
29 constexpr int32_t NIGHT_UPGRADE_END_HOUR = 4;
30 constexpr int32_t VER_CARRY_DEVICE_ID = 2;
31 
32 static const std::string HOTA_CURRENT_COMPONENT_ID = "hota_current_component_id";
33 
34 static const std::string UPDATE_ACTION = "update_action"; // recovery upgrade
35 
36 static const std::string PACKAGE_ROOT_PATH = Constant::DUPDATE_ENGINE_PACKAGE_ROOT_PATH + "/firmware";
37 static const std::string PACKAGE_PATH = PACKAGE_ROOT_PATH + "/versions";
38 
39 static const std::string ENCRYPTED_ROOT_PATH = Constant::FILES_ROOT_PATH + "/firmware";
40 static const std::string CHANGELOG_PATH = ENCRYPTED_ROOT_PATH + "/changelogs";
41 
42 static const std::string AUTO_DOWNLOAD_SWITCH = "auto_download_switch"; // 自动下载开关
43 
44 constexpr float COMPRESSION_RATIO = 0.2;
45 
46 constexpr int32_t ONE_HUNDRED = 100;
47 
48 const std::string BOOTSLOTS_DEFAULT_VALUE = "0";
49 const std::string BOOTSLOTS_AB_UPDATE_VALUE = "2";
50 constexpr int32_t SLEEP_TIME_BEFORE_REBOOT = 2;
51 
52 } // namespace Firmware
53 
54 static const std::vector<DirInfo> FIRMWARE_DIR_INFOS {
55     {Firmware::ENCRYPTED_ROOT_PATH, 0700, true},
56     {Firmware::CHANGELOG_PATH, 0700, true},
57     {Firmware::PACKAGE_ROOT_PATH, 0770, true},
58     {Firmware::PACKAGE_PATH, 0770, true}
59 };
60 } // namespace UpdateEngine
61 } // namespace OHOS
62 #endif // FIRMWARE_CONSTANT_H
63