• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_UTILS_CONSTANTS_H
17 #define FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_UTILS_CONSTANTS_H
18 
19 namespace OHOS {
20 namespace WorkScheduler {
21 // services\native\src\work_policy_manager.cpp
22 inline constexpr int32_t MAX_RUNNING_COUNT = 3;
23 inline constexpr int32_t STANDBY_MAX_RUNNING_COUNT = 2 * MAX_RUNNING_COUNT;
24 inline constexpr uint32_t MAX_WORK_COUNT_PER_UID = 10;
25 inline constexpr int32_t DELAY_TIME_LONG = 30000;
26 inline constexpr int32_t DELAY_TIME_SHORT = 5000;
27 inline constexpr uint32_t MAX_WATCHDOG_ID = 1000;
28 inline constexpr uint32_t INIT_WATCHDOG_ID = 1;
29 inline constexpr int32_t INIT_DUMP_SET_MEMORY = -1;
30 inline constexpr int32_t WATCHDOG_TIME = 2 * 60 * 1000;
31 inline constexpr int32_t MEDIUM_WATCHDOG_TIME = 10 * 60 * 1000;
32 inline constexpr int32_t LONG_WATCHDOG_TIME = 20 * 60 * 1000;
33 inline constexpr int32_t INIT_DUMP_SET_CPU = 0;
34 inline constexpr int32_t INVALID_VALUE = -1;
35 inline constexpr int32_t DUMP_SET_MAX_COUNT_LIMIT = 100;
36 inline static int32_t g_lastWatchdogTime = WATCHDOG_TIME;
37 
38 // services\native\src\work_status.cpp
39 inline const std::string OK = "1";
40 inline const std::string NOT_OK = "0";
41 // watchdog timeout threshold
42 inline constexpr int32_t WATCHDOG_TIMEOUT_THRESHOLD_MS = 500;
43 
44 // services\native\src\conditions\screen_listener.cpp
45 inline constexpr int MIN_DEEP_IDLE_SCREEN_OFF_TIME_MIN = 31 * 60 * 1000;
46 
47 enum EventErrorCode {
48     CONNECT_ABILITY = 1,
49     DISCONNECT_ABILITY,
50     WATCHDOG_TIMEOUT,
51     LOAD_WORK,
52     SERVICE_INIT,
53     LOAD_SA,
54     TOKEN_CHECK,
55     WORK_CHECK,
56     SERVICE_STOP
57 };
58 inline constexpr int JSON_INDENT_WIDTH = 4;
59 } // namespace WorkScheduler
60 } // namespace OHOS
61 #endif // FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_UTILS_CONSTANTS_H