1 /* 2 * Copyright (c) 2021 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 POWERMGR_POWER_STATE_MACHINE_INFO_H 17 #define POWERMGR_POWER_STATE_MACHINE_INFO_H 18 19 #include <string> 20 21 #include <parcel.h> 22 23 namespace OHOS { 24 namespace PowerMgr { 25 /* 26 * If already dimmed, extend the dim timeout but do not brighten. This flag is useful for keeping 27 * the screen on little longer without causing a visible change such as when the power key is pressed. 28 */ 29 constexpr uint32_t REFRESH_ACTIVITY_NO_CHANGE_LIGHTS = 1 << 0; 30 constexpr uint32_t REFRESH_ACTIVITY_NEED_CHANGE_LIGHTS = 0; 31 32 /* 33 * Indicate whether device enter suspend immediately 34 */ 35 constexpr uint32_t SUSPEND_DEVICE_NEED_DOZE = 0; 36 constexpr uint32_t SUSPEND_DEVICE_IMMEDIATELY = 1 << 0; 37 38 // This is use for judge whether the time is valid. 39 constexpr int DEFAULT_SYSTEM_START_TIME = 0; 40 41 // Max datails string length 42 constexpr int MAX_STRING_LENGTH = 128; 43 44 // Throttling interval for user activity calls. 45 constexpr int64_t MIN_TIME_MS_BETWEEN_USERACTIVITIES = 100; // 100ms 46 47 /** 48 * PowerState of Device. 49 */ 50 enum class PowerState : uint32_t { 51 /** 52 * Power State: screen on and cpu on. 53 */ 54 AWAKE = 0, 55 56 /** 57 * Power State: screen off and cpu on. 58 */ 59 INACTIVE, 60 61 /** 62 * Power State: screen off and cpu off. 63 */ 64 SLEEP, 65 66 /** 67 * Power State: unknown. 68 */ 69 UNKNOWN, 70 }; 71 72 /** 73 * Display State of Device. 74 */ 75 enum class DisplayState : uint32_t { 76 DISPLAY_OFF = 0, 77 DISPLAY_DIM = 1, 78 DISPLAY_ON = 2, 79 DISPLAY_SUSPEND = 3, 80 DISPLAY_UNKNOWN = 4, 81 }; 82 83 // UserActivityType list, must sync with A_PMS 84 enum class UserActivityType : uint32_t { 85 USER_ACTIVITY_TYPE_OTHER = 0, 86 USER_ACTIVITY_TYPE_BUTTON = 1, 87 USER_ACTIVITY_TYPE_TOUCH = 2, 88 USER_ACTIVITY_TYPE_ACCESSIBILITY = 3, 89 USER_ACTIVITY_TYPE_ATTENTION = 4, 90 USER_ACTIVITY_TYPE_SOFTWARE = 5, 91 USER_ACTIVITY_TYPE_MAX = USER_ACTIVITY_TYPE_SOFTWARE, 92 }; 93 94 // WakeupReasonType list 95 enum class WakeupDeviceType : uint32_t { 96 WAKEUP_DEVICE_UNKNOWN = 0, 97 WAKEUP_DEVICE_POWER_BUTTON = 1, 98 WAKEUP_DEVICE_APPLICATION = 2, 99 WAKEUP_DEVICE_PLUGGED_IN = 3, 100 WAKEUP_DEVICE_GESTURE = 4, 101 WAKEUP_DEVICE_CAMERA_LAUNCH = 5, 102 WAKEUP_DEVICE_WAKE_KEY = 6, 103 WAKEUP_DEVICE_WAKE_MOTION = 7, 104 WAKEUP_DEVICE_HDMI = 8, 105 WAKEUP_DEVICE_LID = 9, 106 WAKEUP_DEVICE_DOUBLE_CLICK = 10, 107 WAKEUP_DEVICE_KEYBOARD = 11, 108 WAKEUP_DEVICE_MOUSE = 12, 109 WAKEUP_DEVICE_MAX = WAKEUP_DEVICE_MOUSE, 110 }; 111 112 // SuspendDeviceType list 113 enum class SuspendDeviceType : uint32_t { 114 SUSPEND_DEVICE_REASON_MIN = 0, 115 SUSPEND_DEVICE_REASON_APPLICATION = SUSPEND_DEVICE_REASON_MIN, 116 SUSPEND_DEVICE_REASON_DEVICE_ADMIN = 1, 117 SUSPEND_DEVICE_REASON_TIMEOUT = 2, 118 SUSPEND_DEVICE_REASON_LID_SWITCH = 3, 119 SUSPEND_DEVICE_REASON_POWER_BUTTON = 4, 120 SUSPEND_DEVICE_REASON_HDMI = 5, 121 SUSPEND_DEVICE_REASON_SLEEP_BUTTON = 6, 122 SUSPEND_DEVICE_REASON_ACCESSIBILITY = 7, 123 SUSPEND_DEVICE_REASON_FORCE_SUSPEND = 8, 124 SUSPEND_DEVICE_REASON_MAX = SUSPEND_DEVICE_REASON_FORCE_SUSPEND, 125 }; 126 127 enum class StateChangeReason : uint32_t { 128 STATE_CHANGE_REASON_INIT = 0, 129 STATE_CHANGE_REASON_TIMEOUT = 1, 130 STATE_CHANGE_REASON_RUNNING_LOCK = 2, 131 STATE_CHANGE_REASON_BATTERY = 3, 132 STATE_CHANGE_REASON_THERMAL = 4, 133 STATE_CHANGE_REASON_WORK = 5, 134 STATE_CHANGE_REASON_SYSTEM = 6, 135 STATE_CHANGE_REASON_APPLICATION = 10, 136 STATE_CHANGE_REASON_SETTINGS = 11, 137 STATE_CHANGE_REASON_HARD_KEY = 12, 138 STATE_CHANGE_REASON_TOUCH = 13, 139 STATE_CHANGE_REASON_CABLE = 14, 140 STATE_CHANGE_REASON_SENSOR = 15, 141 STATE_CHANGE_REASON_LID = 16, 142 STATE_CHANGE_REASON_CAMERA = 17, 143 STATE_CHANGE_REASON_ACCESSIBILITY = 18, 144 STATE_CHANGE_REASON_RESET = 19, 145 STATE_CHANGE_REASON_POWER_KEY = 20, 146 STATE_CHANGE_REASON_KEYBOARD = 21, 147 STATE_CHANGE_REASON_MOUSE = 22, 148 STATE_CHANGE_REASON_DOUBLE_CLICK = 23, 149 STATE_CHANGE_REASON_REMOTE = 100, 150 STATE_CHANGE_REASON_UNKNOWN = 1000, 151 }; 152 } // namespace PowerMgr 153 } // namespace OHOS 154 #endif // POWERMGR_POWER_STATE_MACHINE_INFO_H 155