• 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
16/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import UIAbility from '../@ohos.app.ability.UIAbility';
22
23/**
24 * Provide methods for matching monitored Ability objects that meet specified conditions.
25 * The most recently matched Ability objects will be saved in the AbilityMonitor object.
26 *
27 * @interface AbilityMonitor
28 * @syscap SystemCapability.Ability.AbilityRuntime.Core
29 * @since 9
30 */
31/**
32 * Provide methods for matching monitored Ability objects that meet specified conditions.
33 * The most recently matched Ability objects will be saved in the AbilityMonitor object.
34 *
35 * @interface AbilityMonitor
36 * @syscap SystemCapability.Ability.AbilityRuntime.Core
37 * @crossplatform
38 * @since 10
39 */
40/**
41 * Provide methods for matching monitored Ability objects that meet specified conditions.
42 * The most recently matched Ability objects will be saved in the AbilityMonitor object.
43 *
44 * @interface AbilityMonitor
45 * @syscap SystemCapability.Ability.AbilityRuntime.Core
46 * @crossplatform
47 * @atomicservice
48 * @since 11
49 */
50export interface AbilityMonitor {
51  /**
52   * The name of the ability to monitor.
53   *
54   * @type { string }
55   * @syscap SystemCapability.Ability.AbilityRuntime.Core
56   * @since 9
57   */
58  /**
59   * The name of the ability to monitor.
60   *
61   * @type { string }
62   * @syscap SystemCapability.Ability.AbilityRuntime.Core
63   * @crossplatform
64   * @since 10
65   */
66  /**
67   * The name of the ability to monitor.
68   *
69   * @type { string }
70   * @syscap SystemCapability.Ability.AbilityRuntime.Core
71   * @crossplatform
72   * @atomicservice
73   * @since 11
74   */
75  abilityName: string;
76
77  /**
78   * The name of the module to monitor.
79   *
80   * @type { ?string }
81   * @syscap SystemCapability.Ability.AbilityRuntime.Core
82   * @since 9
83   */
84  /**
85   * The name of the module to monitor.
86   *
87   * @type { ?string }
88   * @syscap SystemCapability.Ability.AbilityRuntime.Core
89   * @crossplatform
90   * @since 10
91   */
92  /**
93   * The name of the module to monitor.
94   *
95   * @type { ?string }
96   * @syscap SystemCapability.Ability.AbilityRuntime.Core
97   * @crossplatform
98   * @atomicservice
99   * @since 11
100   */
101  moduleName?: string;
102
103  /**
104   * Called back when the ability is created for initialization.
105   *
106   * @syscap SystemCapability.Ability.AbilityRuntime.Core
107   * @since 9
108   */
109  /**
110   * Called back when the ability is created for initialization.
111   *
112   * @syscap SystemCapability.Ability.AbilityRuntime.Core
113   * @crossplatform
114   * @since 10
115   */
116  /**
117   * Called back when the ability is created for initialization.
118   *
119   * @type { ?function }.
120   * @syscap SystemCapability.Ability.AbilityRuntime.Core
121   * @crossplatform
122   * @atomicservice
123   * @since 11
124   */
125  onAbilityCreate?: (ability: UIAbility) => void;
126
127  /**
128   * Called back when the state of the ability changes to foreground.
129   *
130   * @syscap SystemCapability.Ability.AbilityRuntime.Core
131   * @since 9
132   */
133  /**
134   * Called back when the state of the ability changes to foreground.
135   *
136   * @syscap SystemCapability.Ability.AbilityRuntime.Core
137   * @crossplatform
138   * @since 10
139   */
140  /**
141   * Called back when the state of the ability changes to foreground.
142   *
143   * @type { ?function }.
144   * @syscap SystemCapability.Ability.AbilityRuntime.Core
145   * @crossplatform
146   * @atomicservice
147   * @since 11
148   */
149  onAbilityForeground?: (ability: UIAbility) => void;
150
151  /**
152   * Called back when the state of the ability changes to background.
153   *
154   * @syscap SystemCapability.Ability.AbilityRuntime.Core
155   * @since 9
156   */
157  /**
158   * Called back when the state of the ability changes to background.
159   *
160   * @syscap SystemCapability.Ability.AbilityRuntime.Core
161   * @crossplatform
162   * @since 10
163   */
164  /**
165   * Called back when the state of the ability changes to background.
166   *
167   * @type { ?function }.
168   * @syscap SystemCapability.Ability.AbilityRuntime.Core
169   * @crossplatform
170   * @atomicservice
171   * @since 11
172   */
173  onAbilityBackground?: (ability: UIAbility) => void;
174
175  /**
176   * Called back before the ability is destroyed.
177   *
178   * @syscap SystemCapability.Ability.AbilityRuntime.Core
179   * @since 9
180   */
181  /**
182   * Called back before the ability is destroyed.
183   *
184   * @syscap SystemCapability.Ability.AbilityRuntime.Core
185   * @crossplatform
186   * @since 10
187   */
188  /**
189   * Called back before the ability is destroyed.
190   *
191   * @type { ?function }.
192   * @syscap SystemCapability.Ability.AbilityRuntime.Core
193   * @crossplatform
194   * @atomicservice
195   * @since 11
196   */
197  onAbilityDestroy?: (ability: UIAbility) => void;
198
199  /**
200   * Called back when an ability window stage is created.
201   *
202   * @syscap SystemCapability.Ability.AbilityRuntime.Core
203   * @since 9
204   */
205  /**
206   * Called back when an ability window stage is created.
207   *
208   * @syscap SystemCapability.Ability.AbilityRuntime.Core
209   * @crossplatform
210   * @since 10
211   */
212  /**
213   * Called back when an ability window stage is created.
214   *
215   * @type { ?function }.
216   * @syscap SystemCapability.Ability.AbilityRuntime.Core
217   * @crossplatform
218   * @atomicservice
219   * @since 11
220   */
221  onWindowStageCreate?: (ability: UIAbility) => void;
222
223  /**
224   * Called back when an ability window stage is restored.
225   *
226   * @syscap SystemCapability.Ability.AbilityRuntime.Core
227   * @since 9
228   */
229  /**
230   * Called back when an ability window stage is restored.
231   *
232   * @type { ?function }.
233   * @syscap SystemCapability.Ability.AbilityRuntime.Core
234   * @atomicservice
235   * @since 11
236   */
237  onWindowStageRestore?: (ability: UIAbility) => void;
238
239  /**
240   * Called back when an ability window stage is destroyed.
241   *
242   * @syscap SystemCapability.Ability.AbilityRuntime.Core
243   * @since 9
244   */
245  /**
246   * Called back when an ability window stage is destroyed.
247   *
248   * @syscap SystemCapability.Ability.AbilityRuntime.Core
249   * @crossplatform
250   * @since 10
251   */
252  /**
253   * Called back when an ability window stage is destroyed.
254   *
255   * @type { ?function }.
256   * @syscap SystemCapability.Ability.AbilityRuntime.Core
257   * @crossplatform
258   * @atomicservice
259   * @since 11
260   */
261  onWindowStageDestroy?: (ability: UIAbility) => void;
262}
263
264export default AbilityMonitor;
265