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 OHOS_SYSTEM_ABILITY_MANAGER_SYSTEM_ABILITY_STATE_LISTENER_H 17 #define OHOS_SYSTEM_ABILITY_MANAGER_SYSTEM_ABILITY_STATE_LISTENER_H 18 19 #include <string> 20 21 #include "sam_log.h" 22 #include "string_ex.h" 23 24 namespace OHOS { 25 class SystemAbilityStateListener { 26 public: 27 virtual ~SystemAbilityStateListener() = default; OnAbilityNotLoadedLocked(int32_t systemAbilityId)28 virtual void OnAbilityNotLoadedLocked(int32_t systemAbilityId) 29 { 30 HILOGI("Scheduler SA:%{public}d not loaded", systemAbilityId); 31 }; OnAbilityLoadingLocked(int32_t systemAbilityId)32 virtual void OnAbilityLoadingLocked(int32_t systemAbilityId) 33 { 34 HILOGI("Scheduler SA:%{public}d loading", systemAbilityId); 35 }; OnAbilityLoadedLocked(int32_t systemAbilityId)36 virtual void OnAbilityLoadedLocked(int32_t systemAbilityId) 37 { 38 HILOGI("Scheduler SA:%{public}d loaded", systemAbilityId); 39 }; OnAbilityUnloadableLocked(int32_t systemAbilityId)40 virtual void OnAbilityUnloadableLocked(int32_t systemAbilityId) 41 { 42 HILOGI("Scheduler SA:%{public}d unloadable", systemAbilityId); 43 }; OnAbilityUnloadingLocked(int32_t systemAbilityId)44 virtual void OnAbilityUnloadingLocked(int32_t systemAbilityId) 45 { 46 HILOGI("Scheduler SA:%{public}d unloading", systemAbilityId); 47 }; OnProcessNotStartedLocked(const std::u16string & processName)48 virtual void OnProcessNotStartedLocked(const std::u16string& processName) 49 { 50 HILOGI("Scheduler proc:%{public}s stopped", Str16ToStr8(processName).c_str()); 51 }; OnProcessStartedLocked(const std::u16string & processName)52 virtual void OnProcessStartedLocked(const std::u16string& processName) 53 { 54 HILOGI("Scheduler proc:%{public}s started", Str16ToStr8(processName).c_str()); 55 }; OnProcessStoppingLocked(const std::u16string & processName)56 virtual void OnProcessStoppingLocked(const std::u16string& processName) 57 { 58 HILOGI("Scheduler proc:%{public}s stopping", Str16ToStr8(processName).c_str()); 59 }; 60 }; 61 } // namespace OHOS 62 63 #endif // !defined(OHOS_SYSTEM_ABILITY_MANAGER_SYSTEM_ABILITY_STATE_LISTENER_H)