• 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
16import { Metadata } from './Metadata';
17import { Resource } from '../global/resource';
18import bundleManager from './../@ohos.bundle.bundleManager';
19
20/**
21 * Obtains configuration information about an application
22 *
23 * @typedef ApplicationInfo
24 * @syscap SystemCapability.BundleManager.BundleFramework.Core
25 * @since 9
26 */
27/**
28 * Obtains configuration information about an application
29 *
30 * @typedef ApplicationInfo
31 * @syscap SystemCapability.BundleManager.BundleFramework.Core
32 * @crossplatform
33 * @since 10
34 */
35export interface ApplicationInfo {
36  /**
37   * Indicates the application name, which is the same as {@code bundleName}
38   *
39   * @type { string }
40   * @syscap SystemCapability.BundleManager.BundleFramework.Core
41   * @since 9
42   */
43  /**
44   * Indicates the application name, which is the same as {@code bundleName}
45   *
46   * @type { string }
47   * @syscap SystemCapability.BundleManager.BundleFramework.Core
48   * @crossplatform
49   * @since 10
50   */
51  readonly name: string;
52
53  /**
54   * Description of application
55   *
56   * @type { string }
57   * @syscap SystemCapability.BundleManager.BundleFramework.Core
58   * @since 9
59   */
60  /**
61   * Description of application
62   *
63   * @type { string }
64   * @syscap SystemCapability.BundleManager.BundleFramework.Core
65   * @crossplatform
66   * @since 10
67   */
68  readonly description: string;
69
70  /**
71   * Indicates the description id of the application
72   *
73   * @type { number }
74   * @syscap SystemCapability.BundleManager.BundleFramework.Core
75   * @since 9
76   */
77  /**
78   * Indicates the description id of the application
79   *
80   * @type { number }
81   * @syscap SystemCapability.BundleManager.BundleFramework.Core
82   * @crossplatform
83   * @since 10
84   */
85  readonly descriptionId: number;
86
87  /**
88   * Indicates whether or not this application may be instantiated
89   *
90   * @type { boolean }
91   * @syscap SystemCapability.BundleManager.BundleFramework.Core
92   * @since 9
93   */
94  readonly enabled: boolean;
95
96  /**
97   * Indicates the label of the application
98   *
99   * @type { string }
100   * @syscap SystemCapability.BundleManager.BundleFramework.Core
101   * @since 9
102   */
103  /**
104   * Indicates the label of the application
105   *
106   * @type { string }
107   * @syscap SystemCapability.BundleManager.BundleFramework.Core
108   * @crossplatform
109   * @since 10
110   */
111  readonly label: string;
112
113  /**
114   * Indicates the label id of the application
115   *
116   * @type { number }
117   * @syscap SystemCapability.BundleManager.BundleFramework.Core
118   * @since 9
119   */
120  /**
121   * Indicates the label id of the application
122   *
123   * @type { number }
124   * @syscap SystemCapability.BundleManager.BundleFramework.Core
125   * @crossplatform
126   * @since 10
127   */
128  readonly labelId: number;
129
130  /**
131   * Indicates the icon of the application
132   *
133   * @type { string }
134   * @syscap SystemCapability.BundleManager.BundleFramework.Core
135   * @since 9
136   */
137  /**
138   * Indicates the icon of the application
139   *
140   * @type { string }
141   * @syscap SystemCapability.BundleManager.BundleFramework.Core
142   * @crossplatform
143   * @since 10
144   */
145  readonly icon: string;
146
147  /**
148   * Indicates the icon id of the application
149   *
150   * @type { number }
151   * @syscap SystemCapability.BundleManager.BundleFramework.Core
152   * @since 9
153   */
154  /**
155   * Indicates the icon id of the application
156   *
157   * @type { number }
158   * @syscap SystemCapability.BundleManager.BundleFramework.Core
159   * @crossplatform
160   * @since 10
161   */
162  readonly iconId: number;
163
164  /**
165   * Process of application, if user do not set it ,the value equal bundleName
166   *
167   * @type { string }
168   * @syscap SystemCapability.BundleManager.BundleFramework.Core
169   * @since 9
170   */
171  readonly process: string;
172
173  /**
174   * Indicates the permissions required for accessing the application.
175   *
176   * @type { Array<string> }
177   * @syscap SystemCapability.BundleManager.BundleFramework.Core
178   * @since 9
179   */
180  readonly permissions: Array<string>;
181
182  /**
183   * Indicates the application source code path
184   *
185   * @type { string }
186   * @syscap SystemCapability.BundleManager.BundleFramework.Core
187   * @since 9
188   */
189  /**
190   * Indicates the application source code path
191   *
192   * @type { string }
193   * @syscap SystemCapability.BundleManager.BundleFramework.Core
194   * @crossplatform
195   * @since 10
196   */
197  readonly codePath: string;
198
199  /**
200   * Indicates the metadata of module
201   *
202   * @type { Map<string, Array<Metadata>> }
203   * @readonly
204   * @syscap SystemCapability.BundleManager.BundleFramework.Core
205   * @since 9
206   * @deprecated since 10
207   * @useinstead ApplicationInfo#metadataArray
208   */
209  readonly metadata: Map<string, Array<Metadata>>;
210
211  /**
212   * Indicates the metadata of the application
213   *
214   * @type { Array<ModuleMetadata> }
215   * @readonly
216   * @syscap SystemCapability.BundleManager.BundleFramework.Core
217   * @since 10
218   */
219  readonly metadataArray: Array<ModuleMetadata>;
220
221  /**
222   * Indicates whether or not this application may be removable
223   *
224   * @type { boolean }
225   * @syscap SystemCapability.BundleManager.BundleFramework.Core
226   * @since 9
227   */
228  readonly removable: boolean;
229
230  /**
231   * Indicates the access token of the application
232   *
233   * @type { number }
234   * @syscap SystemCapability.BundleManager.BundleFramework.Core
235   * @since 9
236   */
237  readonly accessTokenId: number;
238
239  /**
240   * Indicates the uid of the application
241   *
242   * @type { number }
243   * @syscap SystemCapability.BundleManager.BundleFramework.Core
244   * @since 9
245   */
246  readonly uid: number;
247
248  /**
249   * Indicates icon resource of the application
250   *
251   * @type { Resource }
252   * @syscap SystemCapability.BundleManager.BundleFramework.Core
253   * @since 9
254   */
255  readonly iconResource: Resource;
256
257  /**
258   * Indicates label resource of the application
259   *
260   * @type { Resource }
261   * @syscap SystemCapability.BundleManager.BundleFramework.Core
262   * @since 9
263   */
264  readonly labelResource: Resource;
265
266  /**
267   * Indicates description resource of the application
268   *
269   * @type { Resource }
270   * @syscap SystemCapability.BundleManager.BundleFramework.Core
271   * @since 9
272   */
273  readonly descriptionResource: Resource;
274
275  /**
276   * Indicates the appDistributionType of the application
277   *
278   * @type { string }
279   * @syscap SystemCapability.BundleManager.BundleFramework.Core
280   * @since 9
281   */
282  readonly appDistributionType: string;
283
284  /**
285   * Indicates the appProvisionType of the application
286   *
287   * @type { string }
288   * @syscap SystemCapability.BundleManager.BundleFramework.Core
289   * @since 9
290   */
291  readonly appProvisionType: string;
292
293  /**
294   * Indicates whether the application is a system application
295   *
296   * @type { boolean }
297   * @syscap SystemCapability.BundleManager.BundleFramework.Core
298   * @since 9
299   */
300  readonly systemApp: boolean;
301
302  /**
303   * Indicates the type of application is APP or atomicService.
304   *
305   * @type { bundleManager.BundleType }
306   * @syscap SystemCapability.BundleManager.BundleFramework.Core
307   * @since 9
308   */
309  readonly bundleType: bundleManager.BundleType;
310
311  /**
312   * Indicates whether the application is in debug mode.
313   *
314   * @type { boolean }
315   * @syscap SystemCapability.BundleManager.BundleFramework.Core
316   * @since 10
317   */
318  readonly debug: boolean;
319}
320
321/**
322 * Indicates the ModuleMetadata
323 *
324 * @typedef ModuleMetadata
325 * @syscap SystemCapability.BundleManager.BundleFramework.Core
326 * @since 10
327 */
328export interface ModuleMetadata {
329  /**
330   * Indicates the name of this hap module
331   *
332   * @type { string }
333   * @readonly
334   * @syscap SystemCapability.BundleManager.BundleFramework.Core
335   * @since 10
336   */
337  readonly moduleName: string;
338
339  /**
340   * Indicates the metadata of this hap module
341   *
342   * @type { Array<Metadata> }
343   * @readonly
344   * @syscap SystemCapability.BundleManager.BundleFramework.Core
345   * @since 10
346   */
347  readonly metadata: Array<Metadata>;
348}
349