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