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