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 #include "uc_system_ability_listener.h" 16 17 #include "hiview_logger.h" 18 #include "system_ability_definition.h" 19 #include "uc_observer_mgr.h" 20 21 namespace OHOS { 22 namespace HiviewDFX { 23 DEFINE_LOG_TAG("HiView-UnifiedCollector"); 24 OnAddSystemAbility(int32_t systemAbilityId,const std::string & deviceId)25void UcSystemAbilityListener::OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) 26 { 27 if (systemAbilityId != APP_MGR_SERVICE_ID) { 28 return; 29 } 30 HIVIEW_LOGI("APP_MGR_SERVICE has added"); 31 UcObserverManager::GetInstance().RegisterAppObserver(); 32 UcObserverManager::GetInstance().RegisterRenderObserver(); 33 } 34 OnRemoveSystemAbility(int32_t systemAbilityId,const std::string & deviceId)35void UcSystemAbilityListener::OnRemoveSystemAbility(int32_t systemAbilityId, const std::string &deviceId) 36 { 37 if (systemAbilityId != APP_MGR_SERVICE_ID) { 38 return; 39 } 40 // app mgr service has been removed and does not need to unregister. 41 HIVIEW_LOGI("APP_MGR_SERVICE has removed"); 42 } 43 } // namespace HiviewDFX 44 } // namespace OHOS 45