• 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 arkts {'1.1':'11', '1.2':'20'}
49 * @arkts 1.1&1.2
50 */
51export interface AbilityMonitor {
52  /**
53   * The name of the ability to monitor.
54   *
55   * @type { string }
56   * @syscap SystemCapability.Ability.AbilityRuntime.Core
57   * @since 9
58   */
59  /**
60   * The name of the ability to monitor.
61   *
62   * @type { string }
63   * @syscap SystemCapability.Ability.AbilityRuntime.Core
64   * @crossplatform
65   * @since 10
66   */
67  /**
68   * The name of the ability to monitor.
69   *
70   * @type { string }
71   * @syscap SystemCapability.Ability.AbilityRuntime.Core
72   * @crossplatform
73   * @atomicservice
74   * @since arkts {'1.1':'11', '1.2':'20'}
75   * @arkts 1.1&1.2
76   */
77  abilityName: string;
78
79  /**
80   * The name of the module to monitor.
81   *
82   * @type { ?string }
83   * @syscap SystemCapability.Ability.AbilityRuntime.Core
84   * @since 9
85   */
86  /**
87   * The name of the module to monitor.
88   *
89   * @type { ?string }
90   * @syscap SystemCapability.Ability.AbilityRuntime.Core
91   * @crossplatform
92   * @since 10
93   */
94  /**
95   * The name of the module to monitor.
96   *
97   * @type { ?string }
98   * @syscap SystemCapability.Ability.AbilityRuntime.Core
99   * @crossplatform
100   * @atomicservice
101   * @since arkts {'1.1':'11', '1.2':'20'}
102   * @arkts 1.1&1.2
103   */
104  moduleName?: string;
105
106  /**
107   * Called back when the ability is created for initialization.
108   *
109   * @syscap SystemCapability.Ability.AbilityRuntime.Core
110   * @since 9
111   */
112  /**
113   * Called back when the ability is created for initialization.
114   *
115   * @syscap SystemCapability.Ability.AbilityRuntime.Core
116   * @crossplatform
117   * @since 10
118   */
119  /**
120   * Called back when the ability is created for initialization.
121   *
122   * @type { ?function }.
123   * @syscap SystemCapability.Ability.AbilityRuntime.Core
124   * @crossplatform
125   * @atomicservice
126   * @since arkts {'1.1':'11', '1.2':'20'}
127   * @arkts 1.1&1.2
128   */
129  onAbilityCreate?: (ability: UIAbility) => void;
130
131  /**
132   * Called back when the state of the ability changes to foreground.
133   *
134   * @syscap SystemCapability.Ability.AbilityRuntime.Core
135   * @since 9
136   */
137  /**
138   * Called back when the state of the ability changes to foreground.
139   *
140   * @syscap SystemCapability.Ability.AbilityRuntime.Core
141   * @crossplatform
142   * @since 10
143   */
144  /**
145   * Called back when the state of the ability changes to foreground.
146   *
147   * @type { ?function }.
148   * @syscap SystemCapability.Ability.AbilityRuntime.Core
149   * @crossplatform
150   * @atomicservice
151   * @since arkts {'1.1':'11', '1.2':'20'}
152   * @arkts 1.1&1.2
153   */
154  onAbilityForeground?: (ability: UIAbility) => void;
155
156  /**
157   * Called back when the state of the ability changes to background.
158   *
159   * @syscap SystemCapability.Ability.AbilityRuntime.Core
160   * @since 9
161   */
162  /**
163   * Called back when the state of the ability changes to background.
164   *
165   * @syscap SystemCapability.Ability.AbilityRuntime.Core
166   * @crossplatform
167   * @since 10
168   */
169  /**
170   * Called back when the state of the ability changes to background.
171   *
172   * @type { ?function }.
173   * @syscap SystemCapability.Ability.AbilityRuntime.Core
174   * @crossplatform
175   * @atomicservice
176   * @since arkts {'1.1':'11', '1.2':'20'}
177   * @arkts 1.1&1.2
178   */
179  onAbilityBackground?: (ability: UIAbility) => void;
180
181  /**
182   * Called back before the ability is destroyed.
183   *
184   * @syscap SystemCapability.Ability.AbilityRuntime.Core
185   * @since 9
186   */
187  /**
188   * Called back before the ability is destroyed.
189   *
190   * @syscap SystemCapability.Ability.AbilityRuntime.Core
191   * @crossplatform
192   * @since 10
193   */
194  /**
195   * Called back before the ability is destroyed.
196   *
197   * @type { ?function }.
198   * @syscap SystemCapability.Ability.AbilityRuntime.Core
199   * @crossplatform
200   * @atomicservice
201   * @since arkts {'1.1':'11', '1.2':'20'}
202   * @arkts 1.1&1.2
203   */
204  onAbilityDestroy?: (ability: UIAbility) => void;
205
206  /**
207   * Called back when an ability window stage is created.
208   *
209   * @syscap SystemCapability.Ability.AbilityRuntime.Core
210   * @since 9
211   */
212  /**
213   * Called back when an ability window stage is created.
214   *
215   * @syscap SystemCapability.Ability.AbilityRuntime.Core
216   * @crossplatform
217   * @since 10
218   */
219  /**
220   * Called back when an ability window stage is created.
221   *
222   * @type { ?function }.
223   * @syscap SystemCapability.Ability.AbilityRuntime.Core
224   * @crossplatform
225   * @atomicservice
226   * @since arkts {'1.1':'11', '1.2':'20'}
227   * @arkts 1.1&1.2
228   */
229  onWindowStageCreate?: (ability: UIAbility) => void;
230
231  /**
232   * Called back when an ability window stage is restored.
233   *
234   * @syscap SystemCapability.Ability.AbilityRuntime.Core
235   * @since 9
236   */
237  /**
238   * Called back when an ability window stage is restored.
239   *
240   * @type { ?function }.
241   * @syscap SystemCapability.Ability.AbilityRuntime.Core
242   * @atomicservice
243   * @since arkts {'1.1':'11', '1.2':'20'}
244   * @arkts 1.1&1.2
245   */
246  onWindowStageRestore?: (ability: UIAbility) => void;
247
248  /**
249   * Called back when an ability window stage is destroyed.
250   *
251   * @syscap SystemCapability.Ability.AbilityRuntime.Core
252   * @since 9
253   */
254  /**
255   * Called back when an ability window stage is destroyed.
256   *
257   * @syscap SystemCapability.Ability.AbilityRuntime.Core
258   * @crossplatform
259   * @since 10
260   */
261  /**
262   * Called back when an ability window stage is destroyed.
263   *
264   * @type { ?function }.
265   * @syscap SystemCapability.Ability.AbilityRuntime.Core
266   * @crossplatform
267   * @atomicservice
268   * @since arkts {'1.1':'11', '1.2':'20'}
269   * @arkts 1.1&1.2
270   */
271  onWindowStageDestroy?: (ability: UIAbility) => void;
272}
273
274/*** if arkts 1.1 */
275export default AbilityMonitor;
276/*** endif */
277