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 FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_PLUGINS_EXT_INCLUDE_STANDBY_MESSAGE_H 17 #define FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_PLUGINS_EXT_INCLUDE_STANDBY_MESSAGE_H 18 19 #include <cstdint> 20 #include <string> 21 #include <memory> 22 #include <unordered_map> 23 #include <optional> 24 25 #include "want.h" 26 27 #include "common_constant.h" 28 29 namespace OHOS { 30 namespace DevStandbyMgr { 31 struct StandbyMessageType { 32 enum : uint32_t { 33 COMMON_EVENT = 1, 34 STATE_TRANSIT, 35 PHASE_TRANSIT, 36 RES_CTRL_CONDITION_CHANGED, // day and night switch 37 ALLOW_LIST_CHANGED, 38 SCREEN_OFF_HALF_HOUR, 39 BG_TASK_STATUS_CHANGE, // application apply or unapply background task, start or stop work scheduler 40 SYS_ABILITY_STATUS_CHANGED, // system ability is added or removed 41 PROCESS_STATE_CHANGED, // process is created or died 42 DEVICE_STATE_CHANGED, // process is created or died 43 USER_SLEEP_STATE_CHANGED, // user is sleep or not 44 DEVICE_NET_IDLE_POLICY_TRANSIT, // netlimit or not 45 BG_EFFICIENCY_RESOURCE_APPLY, // application apply or unapply efficiency resources 46 NAT_DETECT_INTERVAL_CHANGED, // push report nat timeout interval 47 FG_APPLICATION_CHANGED, 48 }; 49 }; 50 51 struct StandbyMessage { 52 StandbyMessage() = default; StandbyMessageStandbyMessage53 explicit StandbyMessage(uint32_t eventId): eventId_(eventId) {} StandbyMessageStandbyMessage54 StandbyMessage(uint32_t eventId, const std::string& action): eventId_(eventId), action_(action) {} 55 56 uint32_t eventId_ {0}; 57 std::string action_ {""}; 58 std::optional<AAFwk::Want> want_ {}; 59 }; 60 } // namespace DevStandbyMgr 61 } // namespace OHOS 62 #endif // FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_PLUGINS_EXT_INCLUDE_STANDBY_MESSAGE_H 63