1/* 2 * Copyright (c) 2022-2024 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 { Metadata } from './Metadata'; 22import { Resource } from '../global/resource'; 23import bundleManager from './../@ohos.bundle.bundleManager'; 24 25/** 26 * Obtains configuration information about an application 27 * 28 * @typedef ApplicationInfo 29 * @syscap SystemCapability.BundleManager.BundleFramework.Core 30 * @since 9 31 */ 32/** 33 * Obtains configuration information about an application 34 * 35 * @typedef ApplicationInfo 36 * @syscap SystemCapability.BundleManager.BundleFramework.Core 37 * @crossplatform 38 * @since 10 39 */ 40/** 41 * Obtains configuration information about an application 42 * 43 * @typedef ApplicationInfo 44 * @syscap SystemCapability.BundleManager.BundleFramework.Core 45 * @crossplatform 46 * @atomicservice 47 * @since 11 48 */ 49export interface ApplicationInfo { 50 /** 51 * Indicates the application name, which is the same as {@code bundleName} 52 * 53 * @type { string } 54 * @readonly 55 * @syscap SystemCapability.BundleManager.BundleFramework.Core 56 * @since 9 57 */ 58 /** 59 * Indicates the application name, which is the same as {@code bundleName} 60 * 61 * @type { string } 62 * @readonly 63 * @syscap SystemCapability.BundleManager.BundleFramework.Core 64 * @crossplatform 65 * @since 10 66 */ 67 /** 68 * Indicates the application name, which is the same as {@code bundleName} 69 * 70 * @type { string } 71 * @readonly 72 * @syscap SystemCapability.BundleManager.BundleFramework.Core 73 * @crossplatform 74 * @atomicservice 75 * @since 11 76 */ 77 readonly name: string; 78 79 /** 80 * Description of application 81 * 82 * @type { string } 83 * @readonly 84 * @syscap SystemCapability.BundleManager.BundleFramework.Core 85 * @since 9 86 */ 87 /** 88 * Description of application 89 * 90 * @type { string } 91 * @readonly 92 * @syscap SystemCapability.BundleManager.BundleFramework.Core 93 * @crossplatform 94 * @since 10 95 */ 96 /** 97 * Description of application 98 * 99 * @type { string } 100 * @readonly 101 * @syscap SystemCapability.BundleManager.BundleFramework.Core 102 * @crossplatform 103 * @atomicservice 104 * @since 11 105 */ 106 readonly description: string; 107 108 /** 109 * Indicates the description id of the application 110 * 111 * @type { number } 112 * @readonly 113 * @syscap SystemCapability.BundleManager.BundleFramework.Core 114 * @since 9 115 */ 116 /** 117 * Indicates the description id of the application 118 * 119 * @type { number } 120 * @readonly 121 * @syscap SystemCapability.BundleManager.BundleFramework.Core 122 * @crossplatform 123 * @since 10 124 */ 125 /** 126 * Indicates the description id of the application 127 * 128 * @type { number } 129 * @readonly 130 * @syscap SystemCapability.BundleManager.BundleFramework.Core 131 * @crossplatform 132 * @atomicservice 133 * @since 11 134 */ 135 readonly descriptionId: number; 136 137 /** 138 * Indicates whether or not this application may be instantiated 139 * 140 * @type { boolean } 141 * @readonly 142 * @syscap SystemCapability.BundleManager.BundleFramework.Core 143 * @since 9 144 */ 145 /** 146 * Indicates whether or not this application may be instantiated 147 * 148 * @type { boolean } 149 * @readonly 150 * @syscap SystemCapability.BundleManager.BundleFramework.Core 151 * @atomicservice 152 * @since 11 153 */ 154 readonly enabled: boolean; 155 156 /** 157 * Indicates the label of the application 158 * 159 * @type { string } 160 * @readonly 161 * @syscap SystemCapability.BundleManager.BundleFramework.Core 162 * @since 9 163 */ 164 /** 165 * Indicates the label of the application 166 * 167 * @type { string } 168 * @readonly 169 * @syscap SystemCapability.BundleManager.BundleFramework.Core 170 * @crossplatform 171 * @since 10 172 */ 173 /** 174 * Indicates the label of the application 175 * 176 * @type { string } 177 * @readonly 178 * @syscap SystemCapability.BundleManager.BundleFramework.Core 179 * @crossplatform 180 * @atomicservice 181 * @since 11 182 */ 183 readonly label: string; 184 185 /** 186 * Indicates the label id of the application 187 * 188 * @type { number } 189 * @readonly 190 * @syscap SystemCapability.BundleManager.BundleFramework.Core 191 * @since 9 192 */ 193 /** 194 * Indicates the label id of the application 195 * 196 * @type { number } 197 * @readonly 198 * @syscap SystemCapability.BundleManager.BundleFramework.Core 199 * @crossplatform 200 * @since 10 201 */ 202 /** 203 * Indicates the label id of the application 204 * 205 * @type { number } 206 * @readonly 207 * @syscap SystemCapability.BundleManager.BundleFramework.Core 208 * @crossplatform 209 * @atomicservice 210 * @since 11 211 */ 212 readonly labelId: number; 213 214 /** 215 * Indicates the icon of the application 216 * 217 * @type { string } 218 * @readonly 219 * @syscap SystemCapability.BundleManager.BundleFramework.Core 220 * @since 9 221 */ 222 /** 223 * Indicates the icon of the application 224 * 225 * @type { string } 226 * @readonly 227 * @syscap SystemCapability.BundleManager.BundleFramework.Core 228 * @crossplatform 229 * @since 10 230 */ 231 /** 232 * Indicates the icon of the application 233 * 234 * @type { string } 235 * @readonly 236 * @syscap SystemCapability.BundleManager.BundleFramework.Core 237 * @crossplatform 238 * @atomicservice 239 * @since 11 240 */ 241 readonly icon: string; 242 243 /** 244 * Indicates the icon id of the application 245 * 246 * @type { number } 247 * @readonly 248 * @syscap SystemCapability.BundleManager.BundleFramework.Core 249 * @since 9 250 */ 251 /** 252 * Indicates the icon id of the application 253 * 254 * @type { number } 255 * @readonly 256 * @syscap SystemCapability.BundleManager.BundleFramework.Core 257 * @crossplatform 258 * @since 10 259 */ 260 /** 261 * Indicates the icon id of the application 262 * 263 * @type { number } 264 * @readonly 265 * @syscap SystemCapability.BundleManager.BundleFramework.Core 266 * @crossplatform 267 * @atomicservice 268 * @since 11 269 */ 270 readonly iconId: number; 271 272 /** 273 * Process of application, if user do not set it ,the value equal bundleName 274 * 275 * @type { string } 276 * @readonly 277 * @syscap SystemCapability.BundleManager.BundleFramework.Core 278 * @since 9 279 */ 280 /** 281 * Process of application, if user do not set it ,the value equal bundleName 282 * 283 * @type { string } 284 * @readonly 285 * @syscap SystemCapability.BundleManager.BundleFramework.Core 286 * @atomicservice 287 * @since 11 288 */ 289 readonly process: string; 290 291 /** 292 * Indicates the permissions required for accessing the application. 293 * 294 * @type { Array<string> } 295 * @readonly 296 * @syscap SystemCapability.BundleManager.BundleFramework.Core 297 * @since 9 298 */ 299 /** 300 * Indicates the permissions required for accessing the application. 301 * 302 * @type { Array<string> } 303 * @readonly 304 * @syscap SystemCapability.BundleManager.BundleFramework.Core 305 * @atomicservice 306 * @since 11 307 */ 308 readonly permissions: Array<string>; 309 310 /** 311 * Indicates the application source code path 312 * 313 * @type { string } 314 * @readonly 315 * @syscap SystemCapability.BundleManager.BundleFramework.Core 316 * @since 9 317 */ 318 /** 319 * Indicates the application source code path 320 * 321 * @type { string } 322 * @readonly 323 * @syscap SystemCapability.BundleManager.BundleFramework.Core 324 * @crossplatform 325 * @since 10 326 */ 327 /** 328 * Indicates the application source code path 329 * 330 * @type { string } 331 * @readonly 332 * @syscap SystemCapability.BundleManager.BundleFramework.Core 333 * @crossplatform 334 * @atomicservice 335 * @since 11 336 */ 337 readonly codePath: string; 338 339 /** 340 * Indicates the metadata of module 341 * 342 * @type { Map<string, Array<Metadata>> } 343 * @readonly 344 * @syscap SystemCapability.BundleManager.BundleFramework.Core 345 * @since 9 346 * @deprecated since 10 347 * @useinstead ApplicationInfo#metadataArray 348 */ 349 readonly metadata: Map<string, Array<Metadata>>; 350 351 /** 352 * Indicates the metadata of the application 353 * 354 * @type { Array<ModuleMetadata> } 355 * @readonly 356 * @syscap SystemCapability.BundleManager.BundleFramework.Core 357 * @since 10 358 */ 359 /** 360 * Indicates the metadata of the application 361 * 362 * @type { Array<ModuleMetadata> } 363 * @readonly 364 * @syscap SystemCapability.BundleManager.BundleFramework.Core 365 * @atomicservice 366 * @since 11 367 */ 368 readonly metadataArray: Array<ModuleMetadata>; 369 370 /** 371 * Indicates whether or not this application may be removable 372 * 373 * @type { boolean } 374 * @readonly 375 * @syscap SystemCapability.BundleManager.BundleFramework.Core 376 * @since 9 377 */ 378 /** 379 * Indicates whether or not this application may be removable 380 * 381 * @type { boolean } 382 * @readonly 383 * @syscap SystemCapability.BundleManager.BundleFramework.Core 384 * @atomicservice 385 * @since 11 386 */ 387 readonly removable: boolean; 388 389 /** 390 * Indicates the access token of the application 391 * 392 * @type { number } 393 * @readonly 394 * @syscap SystemCapability.BundleManager.BundleFramework.Core 395 * @since 9 396 */ 397 /** 398 * Indicates the access token of the application 399 * 400 * @type { number } 401 * @readonly 402 * @syscap SystemCapability.BundleManager.BundleFramework.Core 403 * @atomicservice 404 * @since 11 405 */ 406 readonly accessTokenId: number; 407 408 /** 409 * Indicates the uid of the application 410 * 411 * @type { number } 412 * @readonly 413 * @syscap SystemCapability.BundleManager.BundleFramework.Core 414 * @since 9 415 */ 416 /** 417 * Indicates the uid of the application 418 * 419 * @type { number } 420 * @readonly 421 * @syscap SystemCapability.BundleManager.BundleFramework.Core 422 * @atomicservice 423 * @since 11 424 */ 425 readonly uid: number; 426 427 /** 428 * Indicates icon resource of the application 429 * 430 * @type { Resource } 431 * @readonly 432 * @syscap SystemCapability.BundleManager.BundleFramework.Core 433 * @since 9 434 */ 435 /** 436 * Indicates icon resource of the application 437 * 438 * @type { Resource } 439 * @readonly 440 * @syscap SystemCapability.BundleManager.BundleFramework.Core 441 * @atomicservice 442 * @since 11 443 */ 444 readonly iconResource: Resource; 445 446 /** 447 * Indicates label resource of the application 448 * 449 * @type { Resource } 450 * @readonly 451 * @syscap SystemCapability.BundleManager.BundleFramework.Core 452 * @since 9 453 */ 454 /** 455 * Indicates label resource of the application 456 * 457 * @type { Resource } 458 * @readonly 459 * @syscap SystemCapability.BundleManager.BundleFramework.Core 460 * @atomicservice 461 * @since 11 462 */ 463 readonly labelResource: Resource; 464 465 /** 466 * Indicates description resource of the application 467 * 468 * @type { Resource } 469 * @readonly 470 * @syscap SystemCapability.BundleManager.BundleFramework.Core 471 * @since 9 472 */ 473 /** 474 * Indicates description resource of the application 475 * 476 * @type { Resource } 477 * @readonly 478 * @syscap SystemCapability.BundleManager.BundleFramework.Core 479 * @atomicservice 480 * @since 11 481 */ 482 readonly descriptionResource: Resource; 483 484 /** 485 * Indicates the appDistributionType of the application 486 * 487 * @type { string } 488 * @readonly 489 * @syscap SystemCapability.BundleManager.BundleFramework.Core 490 * @since 9 491 */ 492 /** 493 * Indicates the appDistributionType of the application 494 * 495 * @type { string } 496 * @readonly 497 * @syscap SystemCapability.BundleManager.BundleFramework.Core 498 * @atomicservice 499 * @since 11 500 */ 501 readonly appDistributionType: string; 502 503 /** 504 * Indicates the appProvisionType of the application 505 * 506 * @type { string } 507 * @readonly 508 * @syscap SystemCapability.BundleManager.BundleFramework.Core 509 * @since 9 510 */ 511 /** 512 * Indicates the appProvisionType of the application 513 * 514 * @type { string } 515 * @readonly 516 * @syscap SystemCapability.BundleManager.BundleFramework.Core 517 * @atomicservice 518 * @since 11 519 */ 520 readonly appProvisionType: string; 521 522 /** 523 * Indicates whether the application is a system application 524 * 525 * @type { boolean } 526 * @readonly 527 * @syscap SystemCapability.BundleManager.BundleFramework.Core 528 * @since 9 529 */ 530 /** 531 * Indicates whether the application is a system application 532 * 533 * @type { boolean } 534 * @readonly 535 * @syscap SystemCapability.BundleManager.BundleFramework.Core 536 * @atomicservice 537 * @since 11 538 */ 539 readonly systemApp: boolean; 540 541 /** 542 * Indicates the type of application is APP or atomicService. 543 * 544 * @type { bundleManager.BundleType } 545 * @readonly 546 * @syscap SystemCapability.BundleManager.BundleFramework.Core 547 * @since 9 548 */ 549 /** 550 * Indicates the type of application is APP or atomicService. 551 * 552 * @type { bundleManager.BundleType } 553 * @readonly 554 * @syscap SystemCapability.BundleManager.BundleFramework.Core 555 * @atomicservice 556 * @since 11 557 */ 558 readonly bundleType: bundleManager.BundleType; 559 560 /** 561 * Indicates whether the application is in debug mode. 562 * 563 * @type { boolean } 564 * @readonly 565 * @syscap SystemCapability.BundleManager.BundleFramework.Core 566 * @since 10 567 */ 568 /** 569 * Indicates whether the application is in debug mode. 570 * 571 * @type { boolean } 572 * @readonly 573 * @syscap SystemCapability.BundleManager.BundleFramework.Core 574 * @atomicservice 575 * @since 11 576 */ 577 readonly debug: boolean; 578 579 /** 580 * Indicates whether the application data is unclearable, that is, whether the application data cannot be cleared. 581 * 582 * @type { boolean } 583 * @readonly 584 * @syscap SystemCapability.BundleManager.BundleFramework.Core 585 * @atomicservice 586 * @since 11 587 */ 588 readonly dataUnclearable: boolean; 589 590 /** 591 * Indicates native library path. 592 * 593 * @type { string } 594 * @readonly 595 * @syscap SystemCapability.BundleManager.BundleFramework.Core 596 * @since 12 597 */ 598 readonly nativeLibraryPath: string; 599 600 /** 601 * Indicates the MultiAppMode object of the bundle 602 * 603 * @type { MultiAppMode } 604 * @readonly 605 * @syscap SystemCapability.BundleManager.BundleFramework.Core 606 * @since 12 607 */ 608 readonly multiAppMode: MultiAppMode; 609 610 /** 611 * Indicates the index of the bundle 612 * 613 * @type { number } 614 * @readonly 615 * @syscap SystemCapability.BundleManager.BundleFramework.Core 616 * @since 12 617 */ 618 readonly appIndex: number; 619 620 /** 621 * Indicates sources to install the app 622 * 623 * @type { string } 624 * @readonly 625 * @syscap SystemCapability.BundleManager.BundleFramework.Core 626 * @atomicservice 627 * @since 12 628 */ 629 readonly installSource: string; 630 631 /** 632 * Indicates the release type of the app 633 * 634 * @type { string } 635 * @readonly 636 * @syscap SystemCapability.BundleManager.BundleFramework.Core 637 * @atomicservice 638 * @since 12 639 */ 640 readonly releaseType: string; 641 642 /** 643 * Indicates whether the application enables cloud file sync. 644 * 645 * @type { boolean } 646 * @readonly 647 * @syscap SystemCapability.BundleManager.BundleFramework.Core 648 * @atomicservice 649 * @since 12 650 */ 651 readonly cloudFileSyncEnabled: boolean; 652 653 /** 654 * Indicates the flags of the application. 655 * 656 * @type { ?number } 657 * @readonly 658 * @syscap SystemCapability.BundleManager.BundleFramework.Core 659 * @systemapi 660 * @since 12 661 */ 662 readonly flags?: number; 663} 664 665/** 666 * Indicates the ModuleMetadata 667 * 668 * @typedef ModuleMetadata 669 * @syscap SystemCapability.BundleManager.BundleFramework.Core 670 * @since 10 671 */ 672/** 673 * Indicates the ModuleMetadata 674 * 675 * @typedef ModuleMetadata 676 * @syscap SystemCapability.BundleManager.BundleFramework.Core 677 * @atomicservice 678 * @since 11 679 */ 680export interface ModuleMetadata { 681 /** 682 * Indicates the name of this hap module 683 * 684 * @type { string } 685 * @readonly 686 * @syscap SystemCapability.BundleManager.BundleFramework.Core 687 * @since 10 688 */ 689 /** 690 * Indicates the name of this hap module 691 * 692 * @type { string } 693 * @readonly 694 * @syscap SystemCapability.BundleManager.BundleFramework.Core 695 * @atomicservice 696 * @since 11 697 */ 698 readonly moduleName: string; 699 700 /** 701 * Indicates the metadata of this hap module 702 * 703 * @type { Array<Metadata> } 704 * @readonly 705 * @syscap SystemCapability.BundleManager.BundleFramework.Core 706 * @since 10 707 */ 708 /** 709 * Indicates the metadata of this hap module 710 * 711 * @type { Array<Metadata> } 712 * @readonly 713 * @syscap SystemCapability.BundleManager.BundleFramework.Core 714 * @atomicservice 715 * @since 11 716 */ 717 readonly metadata: Array<Metadata>; 718} 719 720/** 721 * Indicates MultiAppMode 722 * 723 * @typedef MultiAppMode 724 * @syscap SystemCapability.BundleManager.BundleFramework.Core 725 * @since 12 726 */ 727export interface MultiAppMode { 728 /** 729 * Indicates the multiAppModeType of the bundle 730 * 731 * @type { bundleManager.MultiAppModeType } 732 * @readonly 733 * @syscap SystemCapability.BundleManager.BundleFramework.Core 734 * @since 12 735 */ 736 readonly multiAppModeType: bundleManager.MultiAppModeType; 737 738 /** 739 * Indicates the max count of the bundle 740 * 741 * @type { number } 742 * @readonly 743 * @syscap SystemCapability.BundleManager.BundleFramework.Core 744 * @since 12 745 */ 746 readonly maxCount: number; 747} 748 749/** 750 * Indicates the information of preinstalled application 751 * 752 * @typedef PreinstalledApplicationInfo 753 * @syscap SystemCapability.BundleManager.BundleFramework.Core 754 * @systemapi 755 * @since 12 756 */ 757export interface PreinstalledApplicationInfo { 758 759 /** 760 * Indicates the name of this bundle 761 * 762 * @type { string } 763 * @readonly 764 * @syscap SystemCapability.BundleManager.BundleFramework.Core 765 * @systemapi 766 * @since 12 767 */ 768 readonly bundleName: string; 769 770 /** 771 * Indicates the name of module 772 * 773 * @type { string } 774 * @readonly 775 * @syscap SystemCapability.BundleManager.BundleFramework.Core 776 * @systemapi 777 * @since 12 778 */ 779 readonly moduleName: string; 780 781 /** 782 * Indicates the icon id of the application 783 * 784 * @type { number } 785 * @readonly 786 * @syscap SystemCapability.BundleManager.BundleFramework.Core 787 * @systemapi 788 * @since 12 789 */ 790 readonly iconId: number; 791 792 /** 793 * Indicates the label id of the application 794 * 795 * @type { number } 796 * @readonly 797 * @syscap SystemCapability.BundleManager.BundleFramework.Core 798 * @systemapi 799 * @since 12 800 */ 801 readonly labelId: number; 802}