• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16import { ApplicationInfo } from './ApplicationInfo';
17import { HapModuleInfo } from './HapModuleInfo';
18import bundleManager from './../@ohos.bundle.bundleManager';
19
20/**
21 * Obtains configuration information about a bundle
22 *
23 * @typedef BundleInfo
24 * @syscap SystemCapability.BundleManager.BundleFramework.Core
25 * @since 9
26 */
27export interface BundleInfo {
28  /**
29   * Indicates the name of this bundle
30   *
31   * @type { string }
32   * @syscap SystemCapability.BundleManager.BundleFramework.Core
33   * @since 9
34   */
35  readonly name: string;
36
37  /**
38   * Indicates the bundle vendor
39   *
40   * @type { string }
41   * @syscap SystemCapability.BundleManager.BundleFramework.Core
42   * @since 9
43   */
44  readonly vendor: string;
45
46  /**
47   * Indicates the version code of the bundle
48   *
49   * @type { number }
50   * @syscap SystemCapability.BundleManager.BundleFramework.Core
51   * @since 9
52   */
53  readonly versionCode: number;
54
55  /**
56   * Indicates the version name of the bundle
57   *
58   * @type { string }
59   * @syscap SystemCapability.BundleManager.BundleFramework.Core
60   * @since 9
61   */
62  readonly versionName: string;
63
64  /**
65   * Indicates the **minimum ** version compatible with the bundle
66   *
67   * @type { number }
68   * @syscap SystemCapability.BundleManager.BundleFramework.Core
69   * @since 9
70   */
71  readonly minCompatibleVersionCode: number;
72
73  /**
74   * Indicates the target version number of the bundle
75   *
76   * @type { number }
77   * @syscap SystemCapability.BundleManager.BundleFramework.Core
78   * @since 9
79   */
80  readonly targetVersion: number;
81
82  /**
83   * Obtains configuration information about an application
84   *
85   * @type { ApplicationInfo }
86   * @syscap SystemCapability.BundleManager.BundleFramework.Core
87   * @since 9
88   */
89  readonly appInfo: ApplicationInfo;
90
91  /**
92   * Obtains configuration information about a module
93   *
94   * @type { Array<HapModuleInfo> }
95   * @syscap SystemCapability.BundleManager.BundleFramework.Core
96   * @since 9
97   */
98  readonly hapModulesInfo: Array<HapModuleInfo>;
99
100  /**
101   * Indicates the required permissions details defined in the bundle
102   *
103   * @type { Array<ReqPermissionDetail> }
104   * @syscap SystemCapability.BundleManager.BundleFramework.Core
105   * @since 9
106   */
107  readonly reqPermissionDetails: Array<ReqPermissionDetail>;
108
109  /**
110   * Indicates the grant state of required permissions
111   *
112   * @type { Array<bundleManager.PermissionGrantState> }
113   * @syscap SystemCapability.BundleManager.BundleFramework.Core
114   * @since 9
115   */
116  readonly permissionGrantStates: Array<bundleManager.PermissionGrantState>;
117
118  /**
119   * Indicates the SignatureInfo of the bundle
120   *
121   * @type { SignatureInfo }
122   * @syscap SystemCapability.BundleManager.BundleFramework.Core
123   * @since 9
124   */
125  readonly signatureInfo: SignatureInfo;
126
127  /**
128   * Indicates the hap install time
129   *
130   * @type { number }
131   * @syscap SystemCapability.BundleManager.BundleFramework.Core
132   * @since 9
133   */
134  readonly installTime: number;
135
136  /**
137   * Indicates the hap update time
138   *
139   * @type { number }
140   * @syscap SystemCapability.BundleManager.BundleFramework.Core
141   * @since 9
142   */
143  readonly updateTime: number;
144}
145
146/**
147 * Indicates the required permissions details defined in configuration file
148 *
149 * @typedef ReqPermissionDetail
150 * @syscap SystemCapability.BundleManager.BundleFramework.Core
151 * @since 9
152 */
153export interface ReqPermissionDetail {
154  /**
155   * Indicates the name of this required permissions
156   *
157   * @type { string }
158   * @syscap SystemCapability.BundleManager.BundleFramework.Core
159   * @since 9
160   */
161  name: string;
162
163  /**
164   * Indicates the module name which the request permission belongs
165   *
166   * @type { string }
167   * @syscap SystemCapability.BundleManager.BundleFramework.Core
168   * @since 10
169   */
170  moduleName: string;
171
172  /**
173   * Indicates the reason of this required permissions
174   *
175   * @type { string }
176   * @syscap SystemCapability.BundleManager.BundleFramework.Core
177   * @since 9
178   */
179  reason: string;
180
181  /**
182   * Indicates the reason id of this required permissions
183   *
184   * @type { number }
185   * @syscap SystemCapability.BundleManager.BundleFramework.Core
186   * @since 9
187   */
188  reasonId: number;
189
190  /**
191   * Indicates the used scene of this required permissions
192   *
193   * @type { UsedScene }
194   * @syscap SystemCapability.BundleManager.BundleFramework.Core
195   * @since 9
196   */
197  usedScene: UsedScene;
198}
199
200/**
201 * The scene which is used
202 *
203 * @typedef UsedScene
204 * @syscap SystemCapability.BundleManager.BundleFramework.Core
205 * @since 9
206 */
207export interface UsedScene {
208  /**
209   * Indicates the abilities that need the permission
210   *
211   * @type { Array<string> }
212   * @syscap SystemCapability.BundleManager.BundleFramework.Core
213   * @since 9
214   */
215  abilities: Array<string>;
216
217  /**
218   * Indicates the time when the permission is used
219   *
220   * @type { string }
221   * @syscap SystemCapability.BundleManager.BundleFramework.Core
222   * @since 9
223   */
224  when: string;
225}
226
227/**
228 * Indicates SignatureInfo
229 *
230 * @typedef SignatureInfo
231 * @syscap SystemCapability.BundleManager.BundleFramework.Core
232 * @since 9
233 */
234export interface SignatureInfo {
235  /**
236   * Indicates the ID of the application to which this bundle belongs
237   * The application ID uniquely identifies an application. It is determined by the bundle name and signature
238   *
239   * @type { string }
240   * @syscap SystemCapability.BundleManager.BundleFramework.Core
241   * @since 9
242   */
243  readonly appId: string;
244
245  /**
246   * Indicates the fingerprint of the certificate
247   *
248   * @type { string }
249   * @syscap SystemCapability.BundleManager.BundleFramework.Core
250   * @since 9
251   */
252  readonly fingerprint: string;
253}
254