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