1 /* 2 * Copyright (c) 2024 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 HIVIEW_PLUGINS_UNIFIED_COLLECTOR_OBSERVER_INCLUDE_UC_OBSERVER_MANAGER_H 17 #define HIVIEW_PLUGINS_UNIFIED_COLLECTOR_OBSERVER_INCLUDE_UC_OBSERVER_MANAGER_H 18 19 #include "singleton.h" 20 #include "uc_app_state_observer.h" 21 #include "uc_render_state_observer.h" 22 #include "uc_system_ability_listener.h" 23 24 namespace OHOS { 25 namespace HiviewDFX { 26 class UcObserverManager : public DelayedRefSingleton<UcObserverManager> { 27 public: 28 void RegisterObservers(); 29 void UnregisterObservers(); 30 31 private: 32 void RegisterSysAbilityListener(); 33 void UnregisterSysAbilityListener(); 34 void RegisterAppObserver(); 35 void UnregisterAppObserver(); 36 void RegisterRenderObserver(); 37 void UnregisterRenderObserver(); 38 39 friend class UcSystemAbilityListener; 40 41 private: 42 sptr<ISystemAbilityStatusChange> sysAbilityListener_ = nullptr; 43 sptr<UcAppStateObserver> appStateObserver_ = nullptr; 44 sptr<UcRenderStateObserver> renderStateObserver_ = nullptr; 45 }; // UcObserverManager 46 } // namespace HiviewDFX 47 } // namespace OHOS 48 #endif // HIVIEW_PLUGINS_UNIFIED_COLLECTOR_OBSERVER_INCLUDE_UC_OBSERVER_MANAGER_H 49