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/** 311 * Indicates the required permissions details defined in configuration file 312 * 313 * @typedef ReqPermissionDetail 314 * @syscap SystemCapability.BundleManager.BundleFramework.Core 315 * @since 9 316 */ 317/** 318 * Indicates the required permissions details defined in configuration file 319 * 320 * @typedef ReqPermissionDetail 321 * @syscap SystemCapability.BundleManager.BundleFramework.Core 322 * @atomicservice 323 * @since 11 324 */ 325export interface ReqPermissionDetail { 326 /** 327 * Indicates the name of this required permissions 328 * 329 * @type { string } 330 * @syscap SystemCapability.BundleManager.BundleFramework.Core 331 * @since 9 332 */ 333 /** 334 * Indicates the name of this required permissions 335 * 336 * @type { string } 337 * @syscap SystemCapability.BundleManager.BundleFramework.Core 338 * @atomicservice 339 * @since 11 340 */ 341 name: string; 342 343 /** 344 * Indicates the module name which the request permission belongs 345 * 346 * @type { string } 347 * @syscap SystemCapability.BundleManager.BundleFramework.Core 348 * @since 10 349 */ 350 /** 351 * Indicates the module name which the request permission belongs 352 * 353 * @type { string } 354 * @syscap SystemCapability.BundleManager.BundleFramework.Core 355 * @atomicservice 356 * @since 11 357 */ 358 moduleName: string; 359 360 /** 361 * Indicates the reason of this required permissions 362 * 363 * @type { string } 364 * @syscap SystemCapability.BundleManager.BundleFramework.Core 365 * @since 9 366 */ 367 /** 368 * Indicates the reason of this required permissions 369 * 370 * @type { string } 371 * @syscap SystemCapability.BundleManager.BundleFramework.Core 372 * @atomicservice 373 * @since 11 374 */ 375 reason: string; 376 377 /** 378 * Indicates the reason id of this required permissions 379 * 380 * @type { number } 381 * @syscap SystemCapability.BundleManager.BundleFramework.Core 382 * @since 9 383 */ 384 /** 385 * Indicates the reason id of this required permissions 386 * 387 * @type { number } 388 * @syscap SystemCapability.BundleManager.BundleFramework.Core 389 * @atomicservice 390 * @since 11 391 */ 392 reasonId: number; 393 394 /** 395 * Indicates the used scene of this required permissions 396 * 397 * @type { UsedScene } 398 * @syscap SystemCapability.BundleManager.BundleFramework.Core 399 * @since 9 400 */ 401 /** 402 * Indicates the used scene of this required permissions 403 * 404 * @type { UsedScene } 405 * @syscap SystemCapability.BundleManager.BundleFramework.Core 406 * @atomicservice 407 * @since 11 408 */ 409 usedScene: UsedScene; 410} 411 412/** 413 * The scene which is used 414 * 415 * @typedef UsedScene 416 * @syscap SystemCapability.BundleManager.BundleFramework.Core 417 * @since 9 418 */ 419/** 420 * The scene which is used 421 * 422 * @typedef UsedScene 423 * @syscap SystemCapability.BundleManager.BundleFramework.Core 424 * @atomicservice 425 * @since 11 426 */ 427export interface UsedScene { 428 /** 429 * Indicates the abilities that need the permission 430 * 431 * @type { Array<string> } 432 * @syscap SystemCapability.BundleManager.BundleFramework.Core 433 * @since 9 434 */ 435 /** 436 * Indicates the abilities that need the permission 437 * 438 * @type { Array<string> } 439 * @syscap SystemCapability.BundleManager.BundleFramework.Core 440 * @atomicservice 441 * @since 11 442 */ 443 abilities: Array<string>; 444 445 /** 446 * Indicates the time when the permission is used 447 * 448 * @type { string } 449 * @syscap SystemCapability.BundleManager.BundleFramework.Core 450 * @since 9 451 */ 452 /** 453 * Indicates the time when the permission is used 454 * 455 * @type { string } 456 * @syscap SystemCapability.BundleManager.BundleFramework.Core 457 * @atomicservice 458 * @since 11 459 */ 460 when: string; 461} 462 463/** 464 * Indicates SignatureInfo 465 * 466 * @typedef SignatureInfo 467 * @syscap SystemCapability.BundleManager.BundleFramework.Core 468 * @since 9 469 */ 470/** 471 * Indicates SignatureInfo 472 * 473 * @typedef SignatureInfo 474 * @syscap SystemCapability.BundleManager.BundleFramework.Core 475 * @atomicservice 476 * @since 11 477 */ 478export interface SignatureInfo { 479 /** 480 * Indicates the ID of the application to which this bundle belongs 481 * The application ID uniquely identifies an application. It is determined by the bundle name and signature 482 * 483 * @type { string } 484 * @readonly 485 * @syscap SystemCapability.BundleManager.BundleFramework.Core 486 * @since 9 487 */ 488 /** 489 * Indicates the ID of the application to which this bundle belongs 490 * The application ID uniquely identifies an application. It is determined by the bundle name and signature 491 * 492 * @type { string } 493 * @readonly 494 * @syscap SystemCapability.BundleManager.BundleFramework.Core 495 * @atomicservice 496 * @since 11 497 */ 498 readonly appId: string; 499 500 /** 501 * Indicates the fingerprint of the certificate 502 * 503 * @type { string } 504 * @readonly 505 * @syscap SystemCapability.BundleManager.BundleFramework.Core 506 * @since 9 507 */ 508 /** 509 * Indicates the fingerprint of the certificate 510 * 511 * @type { string } 512 * @readonly 513 * @syscap SystemCapability.BundleManager.BundleFramework.Core 514 * @atomicservice 515 * @since 11 516 */ 517 readonly fingerprint: string; 518 519 /** 520 * Globally unique identifier of an application, which is allocated by the cloud. 521 * AppIdentifier does not change along the application lifecycle, including version updates, certificate changes, 522 * public and private key changes, and application transfer. 523 * 524 * @type { string } 525 * @readonly 526 * @syscap SystemCapability.BundleManager.BundleFramework.Core 527 * @atomicservice 528 * @since 11 529 */ 530 readonly appIdentifier: string; 531 532 /** 533 * Indicates the certificate 534 * 535 * @type { ?string } 536 * @readonly 537 * @syscap SystemCapability.BundleManager.BundleFramework.Core 538 * @atomicservice 539 * @since 14 540 */ 541 readonly certificate?: string; 542} 543 544/** 545 * AppCloneIdentity contains BundleName and appIndex 546 * 547 * @typedef AppCloneIdentity 548 * @syscap SystemCapability.BundleManager.BundleFramework.Core 549 * @since 14 550 */ 551export interface AppCloneIdentity { 552 /** 553 * Indicates the application bundle name to be queried. 554 * 555 * @type { string } 556 * @readonly 557 * @syscap SystemCapability.BundleManager.BundleFramework.Core 558 * @since 14 559 */ 560 readonly bundleName: string; 561 /** 562 * Indicates the index of clone app. 563 * 564 * @type { number } 565 * @readonly 566 * @syscap SystemCapability.BundleManager.BundleFramework.Core 567 * @since 14 568 */ 569 readonly appIndex: number; 570} 571