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 }; 44 }; 45 46 struct StandbyMessage { 47 StandbyMessage() = default; StandbyMessageStandbyMessage48 explicit StandbyMessage(uint32_t eventId): eventId_(eventId) {} StandbyMessageStandbyMessage49 StandbyMessage(uint32_t eventId, const std::string& action): eventId_(eventId), action_(action) {} 50 51 uint32_t eventId_ {0}; 52 std::string action_ {""}; 53 std::optional<AAFwk::Want> want_ {}; 54 }; 55 } // namespace DevStandbyMgr 56 } // namespace OHOS 57 #endif // FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_PLUGINS_EXT_INCLUDE_STANDBY_MESSAGE_H 58