1 /* 2 * Copyright (c) 2022 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_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_MANAGER_SERVICE_ABILITY_H 17 #define FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_MANAGER_SERVICE_ABILITY_H 18 19 #include "system_ability.h" 20 21 #include "common_event_manager_service.h" 22 #include "system_ability_definition.h" 23 24 namespace OHOS { 25 namespace EventFwk { 26 class CommonEventManagerServiceAbility final : public SystemAbility { 27 public: 28 /** 29 * @brief The constructor of the common event manager service ability. 30 * @param systemAbilityId Indicates the system ability id. 31 * @param runOnCreate Run the system ability on created. 32 */ 33 CommonEventManagerServiceAbility(const int32_t systemAbilityId, bool runOnCreate); 34 35 /** 36 * @brief The destructor. 37 */ 38 virtual ~CommonEventManagerServiceAbility() final; 39 40 private: 41 void OnStart() final; 42 void OnStop() final; 43 44 DISALLOW_COPY_AND_MOVE(CommonEventManagerServiceAbility); 45 DECLARE_SYSTEM_ABILITY(CommonEventManagerServiceAbility); 46 47 private: 48 std::shared_ptr<CommonEventManagerService> service_; 49 }; 50 } // namespace EventFwk 51 } // namespace OHOS 52 53 #endif // FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_MANAGER_SERVICE_ABILITY_H