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 16import AppStateData from "./AppStateData"; 17import AbilityStateData from "./AbilityStateData"; 18import * as _ProcessData from './ProcessData'; 19 20/** 21 * The application state observer. 22 * 23 * @since 8 24 * @syscap SystemCapability.Ability.AbilityRuntime.Core 25 * @systemapi hide for inner use. 26 * @permission N/A 27 */ 28export default class ApplicationStateObserver { 29 /** 30 * Will be called when foreground or background application changed. 31 * 32 * @since 8 33 * @syscap SystemCapability.Ability.AbilityRuntime.Core 34 * @param appStateData State changed Application info. 35 * @systemapi hide for inner use. 36 * @returns - 37 */ 38 onForegroundApplicationChanged(appStateData: AppStateData): void; 39 40 /** 41 * Will be called when ability state changed. 42 * 43 * @since 8 44 * @syscap SystemCapability.Ability.AbilityRuntime.Core 45 * @param abilityStateData State changed ability info. 46 * @systemapi hide for inner use. 47 * @returns - 48 */ 49 onAbilityStateChanged(abilityStateData: AbilityStateData): void; 50 51 /** 52 * Will be called when process created. 53 * 54 * @since 8 55 * @syscap SystemCapability.Ability.AbilityRuntime.Core 56 * @param processData Process info. 57 * @systemapi hide for inner use. 58 * @returns - 59 */ 60 onProcessCreated(processData: ProcessData): void; 61 62 /** 63 * Will be called when process died. 64 * 65 * @since 8 66 * @syscap SystemCapability.Ability.AbilityRuntime.Core 67 * @param processData Process info. 68 * @systemapi hide for inner use. 69 * @returns - 70 */ 71 onProcessDied(processData: ProcessData): void; 72 73 /** 74 * Called when process state changes. 75 * 76 * @since 9 77 * @syscap SystemCapability.Ability.AbilityRuntime.Core 78 * @param processData Process info. 79 * @systemapi hide for inner use. 80 * @returns - 81 */ 82 onProcessStateChanged(processData: ProcessData): void; 83} 84 85/** 86 * The process data. 87 * 88 * @since 9 89 * @syscap SystemCapability.Ability.AbilityRuntime.Core 90 * @systemapi hide for inner use. 91 */ 92export type ProcessData = _ProcessData.default