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 #ifndef HIAPPEVENT_INTERFACES_NATIVE_INNER_API_INCLUDE_APP_STATE_CALLBACK_H 16 #define HIAPPEVENT_INTERFACES_NATIVE_INNER_API_INCLUDE_APP_STATE_CALLBACK_H 17 18 #include <memory> 19 #include <string> 20 21 #include "application_context.h" 22 23 namespace OHOS { 24 namespace HiviewDFX { 25 namespace HiAppEvent { 26 class AppStateCallback : public OHOS::AbilityRuntime::AbilityLifecycleCallback { 27 public: OnAbilityCreate(const std::shared_ptr<NativeReference> & ability)28 void OnAbilityCreate(const std::shared_ptr<NativeReference>& ability) override {} 29 OnWindowStageCreate(const std::shared_ptr<NativeReference> & ability,const std::shared_ptr<NativeReference> & windowStage)30 void OnWindowStageCreate(const std::shared_ptr<NativeReference>& ability, 31 const std::shared_ptr<NativeReference>& windowStage) override {} 32 OnWindowStageDestroy(const std::shared_ptr<NativeReference> & ability,const std::shared_ptr<NativeReference> & windowStage)33 void OnWindowStageDestroy(const std::shared_ptr<NativeReference>& ability, 34 const std::shared_ptr<NativeReference>& windowStage) override {} 35 OnWindowStageActive(const std::shared_ptr<NativeReference> & ability,const std::shared_ptr<NativeReference> & windowStage)36 void OnWindowStageActive(const std::shared_ptr<NativeReference>& ability, 37 const std::shared_ptr<NativeReference>& windowStage) override {} 38 OnWindowStageInactive(const std::shared_ptr<NativeReference> & ability,const std::shared_ptr<NativeReference> & windowStage)39 void OnWindowStageInactive(const std::shared_ptr<NativeReference>& ability, 40 const std::shared_ptr<NativeReference>& windowStage) override {} 41 OnAbilityDestroy(const std::shared_ptr<NativeReference> & ability)42 void OnAbilityDestroy(const std::shared_ptr<NativeReference>& ability) override {} 43 OnAbilityForeground(const std::shared_ptr<NativeReference> & ability)44 void OnAbilityForeground(const std::shared_ptr<NativeReference>& ability) override {} 45 46 void OnAbilityBackground(const std::shared_ptr<NativeReference>& ability) override; 47 OnAbilityContinue(const std::shared_ptr<NativeReference> & ability)48 void OnAbilityContinue(const std::shared_ptr<NativeReference>& ability) override {} 49 }; 50 } // namespace HiAppEvent 51 } // namespace HiviewDFX 52 } // namespace OHOS 53 #endif // HIAPPEVENT_INTERFACES_NATIVE_INNER_API_INCLUDE_APP_STATE_CALLBACK_H 54