1 /* 2 * Copyright (c) 2023-2024 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 const std::string DEVICE_STANGDY_MODE = "device_standby_mode"; 43 44 const int32_t MOTION_DETECTION_TIMEOUT = 1500; 45 const int32_t REST_TIMEOUT = 1000; 46 const int32_t TOTAL_TIMEOUT = 3000; 47 48 const int32_t PERIODLY_TASK_DECTION_TIMEOUT = 410; 49 const int32_t PERIODLY_TASK_REST_TIMEOUT = 100; 50 const int32_t PERIODLY_TASK_TOTAL_TIMEOUT = 420; 51 52 const int64_t SENSOR_SAMPLING_RATE = 200000000LL; // 200ms 53 const int64_t SENSOR_REPORTING_RATE = 0LL; 54 const int64_t HALF_HOUR = 1800 * 1000; 55 56 const std::string PREVIOUS_STATE = "previous_state"; 57 const std::string CURRENT_STATE = "current_state"; 58 const std::string PREVIOUS_PHASE = "previous_phase"; 59 const std::string CURRENT_PHASE = "current_phase"; 60 const std::string SENSOR_DETECTION = "sensor_detection"; 61 62 const std::string RES_CTRL_CONDITION = "res_ctrl_condition"; 63 const std::string SCR_OFF_HALF_HOUR_STATUS = "scr_off_half_hour_status"; 64 const std::string NET_IDLE_POLICY_STATUS = "net_idle_policy_status"; 65 66 const std::string LID_CLOSE = "LID_CLOSE"; 67 const std::string LID_OPEN = "LID_OPEN"; 68 const std::string BG_TASK_TYPE = "type"; 69 const std::string BG_TASK_STATUS = "started"; 70 const std::string BG_TASK_UID = "uid"; 71 const std::string BG_TASK_PID = "pid"; 72 const std::string BG_TASK_BUNDLE_NAME = "name"; 73 const std::string BG_TASK_RESOURCE_STATUS = "applyed"; 74 75 const std::string SA_STATUS = "isAdded"; 76 const std::string SA_ID = "systemAbilityId"; 77 78 const std::string MESSAGE_TYPE = "type"; 79 const std::string MESSAGE_ENABLE = "enable"; 80 const std::string MESSAGE_INTERVAL = "interval"; 81 82 const std::string CONTINUOUS_TASK = "continuous_task"; 83 const std::string TRANSIENT_TASK = "transient_task"; 84 const std::string WORK_SCHEDULER = "work_scheduler"; 85 86 const uint32_t NO_DUMP_PARAM_NUMS = 0; 87 const uint32_t DUMP_DETAILED_INFO_MAX_NUMS = 2; 88 const uint32_t DUMP_SLEEP_SWITCH_PARAM_NUMS = 3; 89 const uint32_t DUMP_SLEEP_ENTER_STATE_NUMS = 3; 90 const uint32_t DUMP_SLEEP_ALLOW_LIST_NUMS = 4; 91 const uint32_t DUMP_SLEEP_APPLY_ALLOW_LIST_NUMS = 7; 92 const uint32_t DUMP_SWITCH_PARAM_NUMS = 3; 93 const uint32_t DUMP_STATE_TIMEOUT_PARAM_NUMS = 3; 94 95 const std::string DUMP_ON = "on"; 96 const std::string DUMP_OFF = "off"; 97 const std::string DUMP_SLEEP_MODE = "sleep"; 98 const std::string DUMP_DAYTIME_SLEEP_MODE = "daytimesleep"; 99 const std::string DUMP_NIGHTTIME_SLEEP_MODE = "nighttimesleep"; 100 const std::string DUMP_DEBUG_SWITCH = "debug"; 101 const std::string DUMP_RESET_STATE = "--reset_state"; 102 const std::string DUMP_DETAIL_CONFIG = "--config"; 103 const std::string DUMP_STRATGY_DETAIL = "--strategy"; 104 const std::string DUMP_POWEROFF_STRATEGY = "--poweroff"; 105 const std::string DUMP_POWERSAVE_FIREWALL = "--powersave"; 106 107 const std::string DUMP_DETAIL_INFO = "-D"; 108 const std::string DUMP_ENTER_STATE = "-E"; 109 const std::string DUMP_APPLY_ALLOW_RECORD = "-A"; 110 const std::string DUMP_SIMULATE_SENSOR = "-S"; 111 const std::string DUMP_SUBSCRIBER_OBSERVER = "-O"; 112 const std::string DUMP_TURN_ON_OFF_SWITCH = "-T"; 113 const std::string DUMP_CHANGE_STATE_TIMEOUT = "-C"; 114 const std::string DUMP_PUSH_STRATEGY_CHANGE = "-P"; 115 116 const int32_t DUMP_FIRST_PARAM = 0; 117 const int32_t DUMP_SECOND_PARAM = 1; 118 const int32_t DUMP_THIRD_PARAM = 2; 119 const int32_t DUMP_FOURTH_PARAM = 3; 120 const int32_t DUMP_FIFTH_PARAM = 4; 121 const int32_t DUMP_SIXTH_PARAM = 5; 122 const int32_t DUMP_SEVENTH_PARAM = 6; 123 124 const int32_t NIGHT_ENTRANCE_HOUR = 23; 125 const int32_t NIGHT_ENTRANCE_MIN = 45; 126 const int32_t DAY_ENTRANCE_HOUR = 6; 127 const int32_t DAY_ENTRANCE_MIN = 0; 128 const std::string AIRPLANE_MODE_PARAMETER = "persist.sys.support_air_plane_mode"; 129 } // namespace DevStandbyMgr 130 } // namespace OHOS 131