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