1/*
2 * Copyright (c) 2022 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 { ApplicationInfo } from './ApplicationInfo';
22import { Metadata } from './Metadata';
23import bundleManager from './../@ohos.bundle.bundleManager';
24import { Skill } from './Skill';
25
26/**
27 * Obtains configuration information about an ability
28 *
29 * @typedef AbilityInfo
30 * @syscap SystemCapability.BundleManager.BundleFramework.Core
31 * @since 9
32 */
33/**
34 * Obtains configuration information about an ability
35 *
36 * @typedef AbilityInfo
37 * @syscap SystemCapability.BundleManager.BundleFramework.Core
38 * @crossplatform
39 * @since 10
40 */
41/**
42 * Obtains configuration information about an ability
43 *
44 * @typedef AbilityInfo
45 * @syscap SystemCapability.BundleManager.BundleFramework.Core
46 * @crossplatform
47 * @atomicservice
48 * @since 11
49 */
50export interface AbilityInfo {
51  /**
52   * Indicates the name of the bundle containing the ability
53   *
54   * @type { string }
55   * @syscap SystemCapability.BundleManager.BundleFramework.Core
56   * @since 9
57   */
58  /**
59   * Indicates the name of the bundle containing the ability
60   *
61   * @type { string }
62   * @syscap SystemCapability.BundleManager.BundleFramework.Core
63   * @crossplatform
64   * @since 10
65   */
66  /**
67   * Indicates the name of the bundle containing the ability
68   *
69   * @type { string }
70   * @syscap SystemCapability.BundleManager.BundleFramework.Core
71   * @crossplatform
72   * @atomicservice
73   * @since 11
74   */
75  readonly bundleName: string;
76
77  /**
78   * Indicates the name of the .hap package to which the capability belongs
79   *
80   * @type { string }
81   * @syscap SystemCapability.BundleManager.BundleFramework.Core
82   * @since 9
83   */
84  /**
85   * Indicates the name of the .hap package to which the capability belongs
86   *
87   * @type { string }
88   * @syscap SystemCapability.BundleManager.BundleFramework.Core
89   * @crossplatform
90   * @since 10
91   */
92  /**
93   * Indicates the name of the .hap package to which the capability belongs
94   *
95   * @type { string }
96   * @syscap SystemCapability.BundleManager.BundleFramework.Core
97   * @crossplatform
98   * @atomicservice
99   * @since 11
100   */
101  readonly moduleName: string;
102
103  /**
104   * Ability simplified class name
105   *
106   * @type { string }
107   * @syscap SystemCapability.BundleManager.BundleFramework.Core
108   * @since 9
109   */
110  /**
111   * Ability simplified class name
112   *
113   * @type { string }
114   * @syscap SystemCapability.BundleManager.BundleFramework.Core
115   * @crossplatform
116   * @since 10
117   */
118  /**
119   * Ability simplified class name
120   *
121   * @type { string }
122   * @syscap SystemCapability.BundleManager.BundleFramework.Core
123   * @crossplatform
124   * @atomicservice
125   * @since 11
126   */
127  readonly name: string;
128
129  /**
130   * Indicates the label of the ability
131   *
132   * @type { string }
133   * @syscap SystemCapability.BundleManager.BundleFramework.Core
134   * @since 9
135   */
136  /**
137   * Indicates the label of the ability
138   *
139   * @type { string }
140   * @syscap SystemCapability.BundleManager.BundleFramework.Core
141   * @crossplatform
142   * @since 10
143   */
144  /**
145   * Indicates the label of the ability
146   *
147   * @type { string }
148   * @syscap SystemCapability.BundleManager.BundleFramework.Core
149   * @crossplatform
150   * @atomicservice
151   * @since 11
152   */
153  readonly label: string;
154
155  /**
156   * Indicates the label id of the ability
157   *
158   * @type { number }
159   * @syscap SystemCapability.BundleManager.BundleFramework.Core
160   * @since 9
161   */
162  /**
163   * Indicates the label id of the ability
164   *
165   * @type { number }
166   * @syscap SystemCapability.BundleManager.BundleFramework.Core
167   * @crossplatform
168   * @since 10
169   */
170  /**
171   * Indicates the label id of the ability
172   *
173   * @type { number }
174   * @syscap SystemCapability.BundleManager.BundleFramework.Core
175   * @crossplatform
176   * @atomicservice
177   * @since 11
178   */
179  readonly labelId: number;
180
181  /**
182   * Indicates the ability
183   *
184   * @type { string }
185   * @syscap SystemCapability.BundleManager.BundleFramework.Core
186   * @since 9
187   */
188  /**
189   * Indicates the ability
190   *
191   * @type { string }
192   * @syscap SystemCapability.BundleManager.BundleFramework.Core
193   * @crossplatform
194   * @since 10
195   */
196  /**
197   * Indicates the ability
198   *
199   * @type { string }
200   * @syscap SystemCapability.BundleManager.BundleFramework.Core
201   * @crossplatform
202   * @atomicservice
203   * @since 11
204   */
205  readonly description: string;
206
207  /**
208   * Indicates the description id of the ability
209   *
210   * @type { number }
211   * @syscap SystemCapability.BundleManager.BundleFramework.Core
212   * @since 9
213   */
214  /**
215   * Indicates the description id of the ability
216   *
217   * @type { number }
218   * @syscap SystemCapability.BundleManager.BundleFramework.Core
219   * @crossplatform
220   * @since 10
221   */
222  /**
223   * Indicates the description id of the ability
224   *
225   * @type { number }
226   * @syscap SystemCapability.BundleManager.BundleFramework.Core
227   * @crossplatform
228   * @atomicservice
229   * @since 11
230   */
231  readonly descriptionId: number;
232
233  /**
234   * Indicates the icon of the ability
235   *
236   * @type { string }
237   * @syscap SystemCapability.BundleManager.BundleFramework.Core
238   * @since 9
239   */
240  /**
241   * Indicates the icon of the ability
242   *
243   * @type { string }
244   * @syscap SystemCapability.BundleManager.BundleFramework.Core
245   * @crossplatform
246   * @since 10
247   */
248  /**
249   * Indicates the icon of the ability
250   *
251   * @type { string }
252   * @syscap SystemCapability.BundleManager.BundleFramework.Core
253   * @crossplatform
254   * @atomicservice
255   * @since 11
256   */
257  readonly icon: string;
258
259  /**
260   * Indicates the icon id of the ability
261   *
262   * @type { number }
263   * @syscap SystemCapability.BundleManager.BundleFramework.Core
264   * @since 9
265   */
266  /**
267   * Indicates the icon id of the ability
268   *
269   * @type { number }
270   * @syscap SystemCapability.BundleManager.BundleFramework.Core
271   * @crossplatform
272   * @since 10
273   */
274  /**
275   * Indicates the icon id of the ability
276   *
277   * @type { number }
278   * @syscap SystemCapability.BundleManager.BundleFramework.Core
279   * @crossplatform
280   * @atomicservice
281   * @since 11
282   */
283  readonly iconId: number;
284
285  /**
286   * Process of ability, if user do not set it, the value equal application process
287   *
288   * @type { string }
289   * @syscap SystemCapability.BundleManager.BundleFramework.Core
290   * @since 9
291   */
292  /**
293   * Process of ability, if user do not set it, the value equal application process
294   *
295   * @type { string }
296   * @syscap SystemCapability.BundleManager.BundleFramework.Core
297   * @atomicservice
298   * @since 11
299   */
300  readonly process: string;
301
302  /**
303   * Indicates whether this ability can be called by other abilities
304   *
305   * @type { boolean }
306   * @syscap SystemCapability.BundleManager.BundleFramework.Core
307   * @since 9
308   */
309  /**
310   * Indicates whether this ability can be called by other abilities
311   *
312   * @type { boolean }
313   * @syscap SystemCapability.BundleManager.BundleFramework.Core
314   * @atomicservice
315   * @since 11
316   */
317  readonly exported: boolean;
318
319  /**
320   * Enumerates types of templates that can be used by an ability
321   *
322   * @type { bundleManager.AbilityType }
323   * @syscap SystemCapability.BundleManager.BundleFramework.Core
324   * @FAModelOnly
325   * @since 9
326   */
327  readonly type: bundleManager.AbilityType;
328
329  /**
330   * Enumerates ability display orientations
331   *
332   * @type { bundleManager.DisplayOrientation }
333   * @syscap SystemCapability.BundleManager.BundleFramework.Core
334   * @since 9
335   */
336  /**
337   * Enumerates ability display orientations
338   *
339   * @type { bundleManager.DisplayOrientation }
340   * @syscap SystemCapability.BundleManager.BundleFramework.Core
341   * @atomicservice
342   * @since 11
343   */
344  readonly orientation: bundleManager.DisplayOrientation;
345
346  /**
347   * Enumerates ability launch type
348   *
349   * @type { bundleManager.LaunchType }
350   * @syscap SystemCapability.BundleManager.BundleFramework.Core
351   * @since 9
352   */
353  /**
354   * Enumerates ability launch type
355   *
356   * @type { bundleManager.LaunchType }
357   * @syscap SystemCapability.BundleManager.BundleFramework.Core
358   * @crossplatform
359   * @since 10
360   */
361  /**
362   * Enumerates ability launch type
363   *
364   * @type { bundleManager.LaunchType }
365   * @syscap SystemCapability.BundleManager.BundleFramework.Core
366   * @crossplatform
367   * @atomicservice
368   * @since 11
369   */
370  readonly launchType: bundleManager.LaunchType;
371
372  /**
373   * The permissions that others need to launch this ability
374   *
375   * @type { Array<string> }
376   * @syscap SystemCapability.BundleManager.BundleFramework.Core
377   * @since 9
378   */
379  /**
380   * The permissions that others need to launch this ability
381   *
382   * @type { Array<string> }
383   * @syscap SystemCapability.BundleManager.BundleFramework.Core
384   * @atomicservice
385   * @since 11
386   */
387  readonly permissions: Array<string>;
388
389  /**
390   * Indicates the permission required for reading ability data
391   *
392   * @type { string }
393   * @syscap SystemCapability.BundleManager.BundleFramework.Core
394   * @FAModelOnly
395   * @since 9
396   */
397  readonly readPermission: string;
398
399  /**
400   * Indicates the permission required for writing data to the ability
401   *
402   * @type { string }
403   * @syscap SystemCapability.BundleManager.BundleFramework.Core
404   * @FAModelOnly
405   * @since 9
406   */
407  readonly writePermission: string;
408
409  /**
410   * Uri of ability
411   *
412   * @type { string }
413   * @syscap SystemCapability.BundleManager.BundleFramework.Core
414   * @FAModelOnly
415   * @since 9
416   */
417  readonly uri: string;
418
419  /**
420   * The device types that this ability can run on
421   *
422   * @type { Array<string> }
423   * @syscap SystemCapability.BundleManager.BundleFramework.Core
424   * @since 9
425   */
426  /**
427   * The device types that this ability can run on
428   *
429   * @type { Array<string> }
430   * @syscap SystemCapability.BundleManager.BundleFramework.Core
431   * @atomicservice
432   * @since 11
433   */
434  readonly deviceTypes: Array<string>;
435
436  /**
437   * Obtains configuration information about an application
438   *
439   * @type { ApplicationInfo }
440   * @syscap SystemCapability.BundleManager.BundleFramework.Core
441   * @since 9
442   */
443  /**
444   * Obtains configuration information about an application
445   *
446   * @type { ApplicationInfo }
447   * @syscap SystemCapability.BundleManager.BundleFramework.Core
448   * @crossplatform
449   * @since 10
450   */
451  /**
452   * Obtains configuration information about an application
453   *
454   * @type { ApplicationInfo }
455   * @syscap SystemCapability.BundleManager.BundleFramework.Core
456   * @crossplatform
457   * @atomicservice
458   * @since 11
459   */
460  readonly applicationInfo: ApplicationInfo;
461
462  /**
463   * Indicates the metadata of ability
464   *
465   * @type { Array<Metadata> }
466   * @syscap SystemCapability.BundleManager.BundleFramework.Core
467   * @since 9
468   */
469  /**
470   * Indicates the metadata of ability
471   *
472   * @type { Array<Metadata> }
473   * @syscap SystemCapability.BundleManager.BundleFramework.Core
474   * @crossplatform
475   * @since 10
476   */
477  /**
478   * Indicates the metadata of ability
479   *
480   * @type { Array<Metadata> }
481   * @syscap SystemCapability.BundleManager.BundleFramework.Core
482   * @crossplatform
483   * @atomicservice
484   * @since 11
485   */
486  readonly metadata: Array<Metadata>;
487
488  /**
489   * Indicates whether the ability is enabled
490   *
491   * @type { boolean }
492   * @syscap SystemCapability.BundleManager.BundleFramework.Core
493   * @since 9
494   */
495  /**
496   * Indicates whether the ability is enabled
497   *
498   * @type { boolean }
499   * @syscap SystemCapability.BundleManager.BundleFramework.Core
500   * @atomicservice
501   * @since 11
502   */
503  readonly enabled: boolean;
504
505  /**
506   * Indicates which window mode is supported
507   *
508   * @type { Array<bundleManager.SupportWindowMode> }
509   * @syscap SystemCapability.BundleManager.BundleFramework.Core
510   * @since 9
511   */
512  /**
513   * Indicates which window mode is supported
514   *
515   * @type { Array<bundleManager.SupportWindowMode> }
516   * @syscap SystemCapability.BundleManager.BundleFramework.Core
517   * @atomicservice
518   * @since 11
519   */
520  readonly supportWindowModes: Array<bundleManager.SupportWindowMode>;
521
522  /**
523   * Indicates window size
524   *
525   * @type { WindowSize }
526   * @syscap SystemCapability.BundleManager.BundleFramework.Core
527   * @since 9
528   */
529  /**
530   * Indicates window size
531   *
532   * @type { WindowSize }
533   * @syscap SystemCapability.BundleManager.BundleFramework.Core
534   * @atomicservice
535   * @since 11
536   */
537  readonly windowSize: WindowSize;
538
539  /**
540   * Indicates whether to hide the application icon from the dock area
541   *
542   * @type { boolean }
543   * @readonly
544   * @syscap SystemCapability.BundleManager.BundleFramework.Core
545   * @atomicservice
546   * @since 12
547   */
548  readonly excludeFromDock: boolean;
549
550  /**
551   * Indicates skills of the ability
552   *
553   * @type { Array<Skill> }
554   * @readonly
555   * @syscap SystemCapability.BundleManager.BundleFramework.Core
556   * @atomicservice
557   * @since 12
558   */
559  readonly skills: Array<Skill>;
560
561  /**
562   * Indicates the appIndex of application, only work in clone app mode
563   *
564   * @type { number }
565   * @readonly
566   * @syscap SystemCapability.BundleManager.BundleFramework.Core
567   * @since 12
568   */
569  readonly appIndex: number;
570
571  /**
572   * Indicates the orientation id of the ability
573   *
574   * @type { number }
575   * @readonly
576   * @syscap SystemCapability.BundleManager.BundleFramework.Core
577   * @atomicservice
578   * @since 13
579   */
580  readonly orientationId: number;
581}
582
583/**
584 * Indicates the window size.
585 *
586 * @typedef WindowSize
587 * @syscap SystemCapability.BundleManager.BundleFramework.Core
588 * @since 9
589 */
590/**
591 * Indicates the window size.
592 *
593 * @typedef WindowSize
594 * @syscap SystemCapability.BundleManager.BundleFramework.Core
595 * @atomicservice
596 * @since 11
597 */
598export interface WindowSize {
599  /**
600   * Indicates maximum ratio of width over height of window under free window status.
601   *
602   * @type { number }
603   * @syscap SystemCapability.BundleManager.BundleFramework.Core
604   * @since 9
605   */
606  /**
607   * Indicates maximum ratio of width over height of window under free window status.
608   *
609   * @type { number }
610   * @syscap SystemCapability.BundleManager.BundleFramework.Core
611   * @atomicservice
612   * @since 11
613   */
614  readonly maxWindowRatio: number;
615
616  /**
617   * Indicates minimum ratio of width over height of window under free window status.
618   *
619   * @type { number }
620   * @syscap SystemCapability.BundleManager.BundleFramework.Core
621   * @since 9
622   */
623  /**
624   * Indicates minimum ratio of width over height of window under free window status.
625   *
626   * @type { number }
627   * @syscap SystemCapability.BundleManager.BundleFramework.Core
628   * @atomicservice
629   * @since 11
630   */
631  readonly minWindowRatio: number;
632
633  /**
634   * Indicates maximum width of window under free window status.
635   *
636   * @type { number }
637   * @syscap SystemCapability.BundleManager.BundleFramework.Core
638   * @since 9
639   */
640  /**
641   * Indicates maximum width of window under free window status.
642   *
643   * @type { number }
644   * @syscap SystemCapability.BundleManager.BundleFramework.Core
645   * @atomicservice
646   * @since 11
647   */
648  readonly maxWindowWidth: number;
649
650  /**
651   * Indicates minimum width of window under free window status.
652   *
653   * @type { number }
654   * @syscap SystemCapability.BundleManager.BundleFramework.Core
655   * @since 9
656   */
657  /**
658   * Indicates minimum width of window under free window status.
659   *
660   * @type { number }
661   * @syscap SystemCapability.BundleManager.BundleFramework.Core
662   * @atomicservice
663   * @since 11
664   */
665  readonly minWindowWidth: number;
666
667  /**
668   * Indicates maximum height of window under free window status.
669   *
670   * @type { number }
671   * @syscap SystemCapability.BundleManager.BundleFramework.Core
672   * @since 9
673   */
674  /**
675   * Indicates maximum height of window under free window status.
676   *
677   * @type { number }
678   * @syscap SystemCapability.BundleManager.BundleFramework.Core
679   * @atomicservice
680   * @since 11
681   */
682  readonly maxWindowHeight: number;
683
684  /**
685   * Indicates minimum height of window under free window status.
686   *
687   * @type { number }
688   * @syscap SystemCapability.BundleManager.BundleFramework.Core
689   * @since 9
690   */
691  /**
692   * Indicates minimum height of window under free window status.
693   *
694   * @type { number }
695   * @syscap SystemCapability.BundleManager.BundleFramework.Core
696   * @atomicservice
697   * @since 11
698   */
699  readonly minWindowHeight: number;
700}
701