1 /* 2 * Copyright (c) 2021 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_ABILITY_RUNTIME_IAPP_STATE_CALLBACK_H 17 #define OHOS_ABILITY_RUNTIME_IAPP_STATE_CALLBACK_H 18 19 #include "iremote_broker.h" 20 #include "iremote_object.h" 21 22 #include "app_mgr_constants.h" 23 #include "app_process_data.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 class IAppStateCallback : public IRemoteBroker { 28 public: 29 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.AppStateCallback"); 30 31 /** 32 * Application state changed callback. 33 * 34 * @param appProcessData Process data 35 */ 36 virtual void OnAppStateChanged(const AppProcessData &appProcessData) = 0; 37 38 /** 39 * AbilityMgr's request is done. 40 * 41 * @param token Ability token. 42 * @param state Application state. 43 */ 44 virtual void OnAbilityRequestDone(const sptr<IRemoteObject> &token, const AbilityState state) = 0; 45 46 enum class Message { 47 TRANSACT_ON_APP_STATE_CHANGED = 0, 48 TRANSACT_ON_ABILITY_REQUEST_DONE, 49 }; 50 }; 51 } // namespace AppExecFwk 52 } // namespace OHOS 53 #endif // OHOS_ABILITY_RUNTIME_IAPP_STATE_CALLBACK_H 54