• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-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 { ApplicationInfo } from './ApplicationInfo';
22import { HapModuleInfo, RouterItem } from './HapModuleInfo';
23import bundleManager from './../@ohos.bundle.bundleManager';
24
25/**
26 * Obtains configuration information about a bundle
27 *
28 * @typedef BundleInfo
29 * @syscap SystemCapability.BundleManager.BundleFramework.Core
30 * @since 9
31 */
32/**
33 * Obtains configuration information about a bundle
34 *
35 * @typedef BundleInfo
36 * @syscap SystemCapability.BundleManager.BundleFramework.Core
37 * @atomicservice
38 * @since 11
39 */
40export interface BundleInfo {
41  /**
42   * Indicates the name of this bundle
43   *
44   * @type { string }
45   * @readonly
46   * @syscap SystemCapability.BundleManager.BundleFramework.Core
47   * @since 9
48   */
49  /**
50   * Indicates the name of this bundle
51   *
52   * @type { string }
53   * @readonly
54   * @syscap SystemCapability.BundleManager.BundleFramework.Core
55   * @atomicservice
56   * @since 11
57   */
58  readonly name: string;
59
60  /**
61   * Indicates the bundle vendor
62   *
63   * @type { string }
64   * @readonly
65   * @syscap SystemCapability.BundleManager.BundleFramework.Core
66   * @since 9
67   */
68  /**
69   * Indicates the bundle vendor
70   *
71   * @type { string }
72   * @readonly
73   * @syscap SystemCapability.BundleManager.BundleFramework.Core
74   * @atomicservice
75   * @since 11
76   */
77  readonly vendor: string;
78
79  /**
80   * Indicates the version code of the bundle
81   *
82   * @type { number }
83   * @readonly
84   * @syscap SystemCapability.BundleManager.BundleFramework.Core
85   * @since 9
86   */
87  /**
88   * Indicates the version code of the bundle
89   *
90   * @type { number }
91   * @readonly
92   * @syscap SystemCapability.BundleManager.BundleFramework.Core
93   * @atomicservice
94   * @since 11
95   */
96  readonly versionCode: number;
97
98  /**
99   * Indicates the version name of the bundle
100   *
101   * @type { string }
102   * @readonly
103   * @syscap SystemCapability.BundleManager.BundleFramework.Core
104   * @since 9
105   */
106  /**
107   * Indicates the version name of the bundle
108   *
109   * @type { string }
110   * @readonly
111   * @syscap SystemCapability.BundleManager.BundleFramework.Core
112   * @atomicservice
113   * @since 11
114   */
115  readonly versionName: string;
116
117  /**
118   * Indicates the **minimum ** version compatible with the bundle
119   *
120   * @type { number }
121   * @readonly
122   * @syscap SystemCapability.BundleManager.BundleFramework.Core
123   * @since 9
124   */
125  /**
126   * Indicates the **minimum ** version compatible with the bundle
127   *
128   * @type { number }
129   * @readonly
130   * @syscap SystemCapability.BundleManager.BundleFramework.Core
131   * @atomicservice
132   * @since 11
133   */
134  readonly minCompatibleVersionCode: number;
135
136  /**
137   * Indicates the target version number of the bundle
138   *
139   * @type { number }
140   * @readonly
141   * @syscap SystemCapability.BundleManager.BundleFramework.Core
142   * @since 9
143   */
144  /**
145   * Indicates the target version number of the bundle
146   *
147   * @type { number }
148   * @readonly
149   * @syscap SystemCapability.BundleManager.BundleFramework.Core
150   * @atomicservice
151   * @since 11
152   */
153  readonly targetVersion: number;
154
155  /**
156   * Obtains configuration information about an application
157   *
158   * @type { ApplicationInfo }
159   * @readonly
160   * @syscap SystemCapability.BundleManager.BundleFramework.Core
161   * @since 9
162   */
163  /**
164   * Obtains configuration information about an application
165   *
166   * @type { ApplicationInfo }
167   * @readonly
168   * @syscap SystemCapability.BundleManager.BundleFramework.Core
169   * @atomicservice
170   * @since 11
171   */
172  readonly appInfo: ApplicationInfo;
173
174  /**
175   * Obtains configuration information about a module
176   *
177   * @type { Array<HapModuleInfo> }
178   * @readonly
179   * @syscap SystemCapability.BundleManager.BundleFramework.Core
180   * @since 9
181   */
182  /**
183   * Obtains configuration information about a module
184   *
185   * @type { Array<HapModuleInfo> }
186   * @readonly
187   * @syscap SystemCapability.BundleManager.BundleFramework.Core
188   * @atomicservice
189   * @since 11
190   */
191  readonly hapModulesInfo: Array<HapModuleInfo>;
192
193  /**
194   * Indicates the required permissions details defined in the bundle
195   *
196   * @type { Array<ReqPermissionDetail> }
197   * @readonly
198   * @syscap SystemCapability.BundleManager.BundleFramework.Core
199   * @since 9
200   */
201  /**
202   * Indicates the required permissions details defined in the bundle
203   *
204   * @type { Array<ReqPermissionDetail> }
205   * @readonly
206   * @syscap SystemCapability.BundleManager.BundleFramework.Core
207   * @atomicservice
208   * @since 11
209   */
210  readonly reqPermissionDetails: Array<ReqPermissionDetail>;
211
212  /**
213   * Indicates the grant state of required permissions
214   *
215   * @type { Array<bundleManager.PermissionGrantState> }
216   * @readonly
217   * @syscap SystemCapability.BundleManager.BundleFramework.Core
218   * @since 9
219   */
220  /**
221   * Indicates the grant state of required permissions
222   *
223   * @type { Array<bundleManager.PermissionGrantState> }
224   * @readonly
225   * @syscap SystemCapability.BundleManager.BundleFramework.Core
226   * @atomicservice
227   * @since 11
228   */
229  readonly permissionGrantStates: Array<bundleManager.PermissionGrantState>;
230
231  /**
232   * Indicates the SignatureInfo of the bundle
233   *
234   * @type { SignatureInfo }
235   * @readonly
236   * @syscap SystemCapability.BundleManager.BundleFramework.Core
237   * @since 9
238   */
239  /**
240   * Indicates the SignatureInfo of the bundle
241   *
242   * @type { SignatureInfo }
243   * @readonly
244   * @syscap SystemCapability.BundleManager.BundleFramework.Core
245   * @atomicservice
246   * @since 11
247   */
248  readonly signatureInfo: SignatureInfo;
249
250  /**
251   * Indicates the hap install time
252   *
253   * @type { number }
254   * @readonly
255   * @syscap SystemCapability.BundleManager.BundleFramework.Core
256   * @since 9
257   */
258  /**
259   * Indicates the hap install time
260   *
261   * @type { number }
262   * @readonly
263   * @syscap SystemCapability.BundleManager.BundleFramework.Core
264   * @atomicservice
265   * @since 11
266   */
267  readonly installTime: number;
268
269  /**
270   * Indicates the hap update time
271   *
272   * @type { number }
273   * @readonly
274   * @syscap SystemCapability.BundleManager.BundleFramework.Core
275   * @since 9
276   */
277  /**
278   * Indicates the hap update time
279   *
280   * @type { number }
281   * @readonly
282   * @syscap SystemCapability.BundleManager.BundleFramework.Core
283   * @atomicservice
284   * @since 11
285   */
286  readonly updateTime: number;
287
288  /**
289   * Indicates the router information of the application
290   *
291   * @type { Array<RouterItem> }
292   * @readonly
293   * @syscap SystemCapability.BundleManager.BundleFramework.Core
294   * @atomicservice
295   * @since 12
296   */
297  readonly routerMap: Array<RouterItem>;
298
299  /**
300   * Indicates the appIndex of application, only work in appClone mode
301   *
302   * @type { number }
303   * @readonly
304   * @syscap SystemCapability.BundleManager.BundleFramework.Core
305   * @since 12
306   */
307  readonly appIndex: number;
308
309  /**
310   * Indicates the hap first install time
311   *
312   * @type { ?number }
313   * @readonly
314   * @syscap SystemCapability.BundleManager.BundleFramework.Core
315   * @atomicservice
316   * @since 18
317   */
318  readonly firstInstallTime?: number;
319}
320
321/**
322 * Indicates the required permissions details defined in configuration file
323 *
324 * @typedef ReqPermissionDetail
325 * @syscap SystemCapability.BundleManager.BundleFramework.Core
326 * @since 9
327 */
328/**
329 * Indicates the required permissions details defined in configuration file
330 *
331 * @typedef ReqPermissionDetail
332 * @syscap SystemCapability.BundleManager.BundleFramework.Core
333 * @atomicservice
334 * @since 11
335 */
336export interface ReqPermissionDetail {
337  /**
338   * Indicates the name of this required permissions
339   *
340   * @type { string }
341   * @syscap SystemCapability.BundleManager.BundleFramework.Core
342   * @since 9
343   */
344  /**
345   * Indicates the name of this required permissions
346   *
347   * @type { string }
348   * @syscap SystemCapability.BundleManager.BundleFramework.Core
349   * @atomicservice
350   * @since 11
351   */
352  name: string;
353
354  /**
355   * Indicates the module name which the request permission belongs
356   *
357   * @type { string }
358   * @syscap SystemCapability.BundleManager.BundleFramework.Core
359   * @since 10
360   */
361  /**
362   * Indicates the module name which the request permission belongs
363   *
364   * @type { string }
365   * @syscap SystemCapability.BundleManager.BundleFramework.Core
366   * @atomicservice
367   * @since 11
368   */
369  moduleName: string;
370
371  /**
372   * Indicates the reason of this required permissions
373   *
374   * @type { string }
375   * @syscap SystemCapability.BundleManager.BundleFramework.Core
376   * @since 9
377   */
378  /**
379   * Indicates the reason of this required permissions
380   *
381   * @type { string }
382   * @syscap SystemCapability.BundleManager.BundleFramework.Core
383   * @atomicservice
384   * @since 11
385   */
386  reason: string;
387
388  /**
389   * Indicates the reason id of this required permissions
390   *
391   * @type { number }
392   * @syscap SystemCapability.BundleManager.BundleFramework.Core
393   * @since 9
394   */
395  /**
396   * Indicates the reason id of this required permissions
397   *
398   * @type { number }
399   * @syscap SystemCapability.BundleManager.BundleFramework.Core
400   * @atomicservice
401   * @since 11
402   */
403  reasonId: number;
404
405  /**
406   * Indicates the used scene of this required permissions
407   *
408   * @type { UsedScene }
409   * @syscap SystemCapability.BundleManager.BundleFramework.Core
410   * @since 9
411   */
412  /**
413   * Indicates the used scene of this required permissions
414   *
415   * @type { UsedScene }
416   * @syscap SystemCapability.BundleManager.BundleFramework.Core
417   * @atomicservice
418   * @since 11
419   */
420  usedScene: UsedScene;
421}
422
423/**
424 * The scene which is used
425 *
426 * @typedef UsedScene
427 * @syscap SystemCapability.BundleManager.BundleFramework.Core
428 * @since 9
429 */
430/**
431 * The scene which is used
432 *
433 * @typedef UsedScene
434 * @syscap SystemCapability.BundleManager.BundleFramework.Core
435 * @atomicservice
436 * @since 11
437 */
438export interface UsedScene {
439  /**
440   * Indicates the abilities that need the permission
441   *
442   * @type { Array<string> }
443   * @syscap SystemCapability.BundleManager.BundleFramework.Core
444   * @since 9
445   */
446  /**
447   * Indicates the abilities that need the permission
448   *
449   * @type { Array<string> }
450   * @syscap SystemCapability.BundleManager.BundleFramework.Core
451   * @atomicservice
452   * @since 11
453   */
454  abilities: Array<string>;
455
456  /**
457   * Indicates the time when the permission is used
458   *
459   * @type { string }
460   * @syscap SystemCapability.BundleManager.BundleFramework.Core
461   * @since 9
462   */
463  /**
464   * Indicates the time when the permission is used
465   *
466   * @type { string }
467   * @syscap SystemCapability.BundleManager.BundleFramework.Core
468   * @atomicservice
469   * @since 11
470   */
471  when: string;
472}
473
474/**
475 * Indicates SignatureInfo
476 *
477 * @typedef SignatureInfo
478 * @syscap SystemCapability.BundleManager.BundleFramework.Core
479 * @since 9
480 */
481/**
482 * Indicates SignatureInfo
483 *
484 * @typedef SignatureInfo
485 * @syscap SystemCapability.BundleManager.BundleFramework.Core
486 * @atomicservice
487 * @since 11
488 */
489export interface SignatureInfo {
490  /**
491   * Indicates the ID of the application to which this bundle belongs
492   * The application ID uniquely identifies an application. It is determined by the bundle name and signature
493   *
494   * @type { string }
495   * @readonly
496   * @syscap SystemCapability.BundleManager.BundleFramework.Core
497   * @since 9
498   */
499  /**
500   * Indicates the ID of the application to which this bundle belongs
501   * The application ID uniquely identifies an application. It is determined by the bundle name and signature
502   *
503   * @type { string }
504   * @readonly
505   * @syscap SystemCapability.BundleManager.BundleFramework.Core
506   * @atomicservice
507   * @since 11
508   */
509  readonly appId: string;
510
511  /**
512   * Indicates the fingerprint of the certificate
513   *
514   * @type { string }
515   * @readonly
516   * @syscap SystemCapability.BundleManager.BundleFramework.Core
517   * @since 9
518   */
519  /**
520   * Indicates the fingerprint of the certificate
521   *
522   * @type { string }
523   * @readonly
524   * @syscap SystemCapability.BundleManager.BundleFramework.Core
525   * @atomicservice
526   * @since 11
527   */
528  readonly fingerprint: string;
529
530  /**
531   * Globally unique identifier of an application, which is allocated by the cloud.
532   * AppIdentifier does not change along the application lifecycle, including version updates, certificate changes,
533   * public and private key changes, and application transfer.
534   *
535   * @type { string }
536   * @readonly
537   * @syscap SystemCapability.BundleManager.BundleFramework.Core
538   * @atomicservice
539   * @since 11
540   */
541  readonly appIdentifier: string;
542
543  /**
544   * Indicates the certificate
545   *
546   * @type { ?string }
547   * @readonly
548   * @syscap SystemCapability.BundleManager.BundleFramework.Core
549   * @atomicservice
550   * @since 14
551   */
552  readonly certificate?: string;
553}
554
555/**
556 * AppCloneIdentity contains BundleName and appIndex
557 *
558 * @typedef AppCloneIdentity
559 * @syscap SystemCapability.BundleManager.BundleFramework.Core
560 * @since 14
561 */
562export interface AppCloneIdentity {
563  /**
564   * Indicates the application bundle name to be queried.
565   *
566   * @type { string }
567   * @readonly
568   * @syscap SystemCapability.BundleManager.BundleFramework.Core
569   * @since 14
570   */
571  readonly bundleName: string;
572  /**
573   * Indicates the index of clone app.
574   *
575   * @type { number }
576   * @readonly
577   * @syscap SystemCapability.BundleManager.BundleFramework.Core
578   * @since 14
579   */
580  readonly appIndex: number;
581}
582