• 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 #include "common_constant.h"
16 
17 namespace OHOS {
18 namespace DevStandbyMgr {
19 const std::string TRANSIT_NEXT_STATE_TIMED_TASK = "TransitNextStateTimedTask";
20 const std::string TRANSIT_NEXT_STATE_CONDITION_TASK = "TransitNextStateConditionTask";
21 const std::string TRANSIT_NEXT_PHASE_INSTANT_TASK = "TransitNextPhaseInstantTask";
22 const std::string REPEATED_MOTION_DETECTION_TASK = "MotionDetectionPeriodlyTask";
23 
24 const std::string DEFAULT_PLUGIN_NAME = "libstandby_plugin.z.so";
25 const int32_t REPEATED_MOTION_DETECTION_INTERVAL = 10 * 60 * 1000;
26 const std::string DARK_TIMEOUT = "dark_timeout";
27 const std::string NAP_TIMEOUT = "nap_timeout";
28 const std::string NAP_MAINTENANCE_TIMEOUT = "nap_maintenance_timeout";
29 const std::string SLEEP_MAINT_TIMEOUT = "sleep_maintenance_timeout";
30 
31 const std::string NAP_MAINT_DURATION = "nap_interval";
32 const std::string SLEEP_MAINT_DURATOIN = "sleep_interval";
33 const std::vector<std::string> STATE_NAME_LIST = {"working", "dark", "nap", "maintenance", "sleep"};
34 
35 const std::string DETECT_MOTION_CONFIG = "detect_motion";
36 const std::string MOTION_THREADSHOLD = "motion_threshold";
37 const std::string MOTION_DECTION_TASK = "motion_dection_task";
38 
39 const std::string NAP_SWITCH = "nap_switch";
40 const std::string SLEEP_SWITCH = "sleep_switch";
41 const std::string S3_SWITCH = "s3_switch";
42 
43 const int32_t MOTION_DETECTION_TIMEOUT = 1500;
44 const int32_t REST_TIMEOUT = 1000;
45 const int32_t TOTAL_TIMEOUT = 3000;
46 
47 const int32_t PERIODLY_TASK_DECTION_TIMEOUT = 410;
48 const int32_t PERIODLY_TASK_REST_TIMEOUT = 100;
49 const int32_t PERIODLY_TASK_TOTAL_TIMEOUT = 420;
50 
51 const int64_t SENSOR_SAMPLING_RATE = 200000000LL; // 200ms
52 const int64_t SENSOR_REPORTING_RATE = 0LL;
53 const int64_t HALF_HOUR = 1800 * 1000;
54 
55 const std::string PREVIOUS_STATE = "previous_state";
56 const std::string CURRENT_STATE = "current_state";
57 const std::string PREVIOUS_PHASE = "previous_phase";
58 const std::string CURRENT_PHASE = "current_phase";
59 const std::string SENSOR_DETECTION = "sensor_detection";
60 
61 const std::string RES_CTRL_CONDITION = "res_ctrl_condition";
62 const std::string SCR_OFF_HALF_HOUR_STATUS = "scr_off_half_hour_status";
63 
64 const std::string LID_CLOSE = "LID_CLOSE";
65 const std::string LID_OPEN = "LID_OPEN";
66 const std::string BG_TASK_TYPE = "type";
67 const std::string BG_TASK_STATUS = "started";
68 const std::string BG_TASK_UID = "uid";
69 const std::string BG_TASK_PID = "pid";
70 const std::string BG_TASK_BUNDLE_NAME = "name";
71 
72 const std::string SA_STATUS = "isAdded";
73 const std::string SA_ID = "systemAbilityId";
74 
75 const std::string CONTINUOUS_TASK = "continuous_task";
76 const std::string TRANSIENT_TASK = "transient_task";
77 const std::string WORK_SCHEDULER = "work_scheduler";
78 
79 const uint32_t NO_DUMP_PARAM_NUMS = 0;
80 const uint32_t DUMP_DETAILED_INFO_MAX_NUMS = 2;
81 const uint32_t DUMP_SLEEP_SWITCH_PARAM_NUMS = 3;
82 const uint32_t DUMP_SLEEP_ENTER_STATE_NUMS = 3;
83 const uint32_t DUMP_SLEEP_ALLOW_LIST_NUMS = 4;
84 const uint32_t DUMP_SLEEP_APPLY_ALLOW_LIST_NUMS = 7;
85 const uint32_t DUMP_SWITCH_PARAM_NUMS = 3;
86 const uint32_t DUMP_STATE_TIMEOUT_PARAM_NUMS = 3;
87 
88 const std::string DUMP_ON = "on";
89 const std::string DUMP_OFF = "off";
90 const std::string DUMP_SLEEP_MODE = "sleep";
91 const std::string DUMP_DAYTIME_SLEEP_MODE = "daytimesleep";
92 const std::string DUMP_NIGHTTIME_SLEEP_MODE = "nighttimesleep";
93 const std::string DUMP_DEBUG_SWITCH = "debug";
94 const std::string DUMP_RESET_STATE = "--reset_state";
95 const std::string DUMP_DETAIL_CONFIG = "--config";
96 const std::string DUMP_STRATGY_DETAIL = "--strategy";
97 const std::string DUMP_POWEROFF_STRATEGY = "--poweroff";
98 const std::string DUMP_POWERSAVE_FIREWALL = "--powersave";
99 
100 const std::string DUMP_DETAIL_INFO = "-D";
101 const std::string DUMP_ENTER_STATE = "-E";
102 const std::string DUMP_APPLY_ALLOW_RECORD = "-A";
103 const std::string DUMP_SIMULATE_SENSOR = "-S";
104 const std::string DUMP_SUBSCRIBER_OBSERVER = "-O";
105 const std::string DUMP_TURN_ON_OFF_SWITCH  = "-T";
106 const std::string DUMP_CHANGE_STATE_TIMEOUT  = "-C";
107 const std::string DUMP_PUSH_STRATEGY_CHANGE = "-P";
108 
109 const int32_t DUMP_FIRST_PARAM = 0;
110 const int32_t DUMP_SECOND_PARAM = 1;
111 const int32_t DUMP_THIRD_PARAM = 2;
112 const int32_t DUMP_FOURTH_PARAM = 3;
113 const int32_t DUMP_FIFTH_PARAM = 4;
114 const int32_t DUMP_SIXTH_PARAM = 5;
115 const int32_t DUMP_SEVENTH_PARAM = 6;
116 
117 const int32_t NIGHT_ENTRANCE_HOUR = 23;
118 const int32_t NIGHT_ENTRANCE_MIN = 45;
119 const int32_t DAY_ENTRANCE_HOUR = 6;
120 const int32_t DAY_ENTRANCE_MIN = 0;
121 const std::string AIRPLANE_MODE_PARAMETER = "persist.sys.support_air_plane_mode";
122 }  // namespace DevStandbyMgr
123 }  // namespace OHOS
124