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