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 16import { Metadata } from './Metadata'; 17import { Resource } from '../global/resource'; 18import bundleManager from './../@ohos.bundle.bundleManager'; 19 20/** 21 * Obtains configuration information about an application 22 * 23 * @typedef ApplicationInfo 24 * @syscap SystemCapability.BundleManager.BundleFramework.Core 25 * @since 9 26 */ 27/** 28 * Obtains configuration information about an application 29 * 30 * @typedef ApplicationInfo 31 * @syscap SystemCapability.BundleManager.BundleFramework.Core 32 * @crossplatform 33 * @since 10 34 */ 35/** 36 * Obtains configuration information about an application 37 * 38 * @typedef ApplicationInfo 39 * @syscap SystemCapability.BundleManager.BundleFramework.Core 40 * @crossplatform 41 * @atomicservice 42 * @since 11 43 */ 44export interface ApplicationInfo { 45 /** 46 * Indicates the application name, which is the same as {@code bundleName} 47 * 48 * @type { string } 49 * @syscap SystemCapability.BundleManager.BundleFramework.Core 50 * @since 9 51 */ 52 /** 53 * Indicates the application name, which is the same as {@code bundleName} 54 * 55 * @type { string } 56 * @syscap SystemCapability.BundleManager.BundleFramework.Core 57 * @crossplatform 58 * @since 10 59 */ 60 /** 61 * Indicates the application name, which is the same as {@code bundleName} 62 * 63 * @type { string } 64 * @syscap SystemCapability.BundleManager.BundleFramework.Core 65 * @crossplatform 66 * @atomicservice 67 * @since 11 68 */ 69 readonly name: string; 70 71 /** 72 * Description of application 73 * 74 * @type { string } 75 * @syscap SystemCapability.BundleManager.BundleFramework.Core 76 * @since 9 77 */ 78 /** 79 * Description of application 80 * 81 * @type { string } 82 * @syscap SystemCapability.BundleManager.BundleFramework.Core 83 * @crossplatform 84 * @since 10 85 */ 86 /** 87 * Description of application 88 * 89 * @type { string } 90 * @syscap SystemCapability.BundleManager.BundleFramework.Core 91 * @crossplatform 92 * @atomicservice 93 * @since 11 94 */ 95 readonly description: string; 96 97 /** 98 * Indicates the description id of the application 99 * 100 * @type { number } 101 * @syscap SystemCapability.BundleManager.BundleFramework.Core 102 * @since 9 103 */ 104 /** 105 * Indicates the description id of the application 106 * 107 * @type { number } 108 * @syscap SystemCapability.BundleManager.BundleFramework.Core 109 * @crossplatform 110 * @since 10 111 */ 112 /** 113 * Indicates the description id of the application 114 * 115 * @type { number } 116 * @syscap SystemCapability.BundleManager.BundleFramework.Core 117 * @crossplatform 118 * @atomicservice 119 * @since 11 120 */ 121 readonly descriptionId: number; 122 123 /** 124 * Indicates whether or not this application may be instantiated 125 * 126 * @type { boolean } 127 * @syscap SystemCapability.BundleManager.BundleFramework.Core 128 * @since 9 129 */ 130 /** 131 * Indicates whether or not this application may be instantiated 132 * 133 * @type { boolean } 134 * @syscap SystemCapability.BundleManager.BundleFramework.Core 135 * @atomicservice 136 * @since 11 137 */ 138 readonly enabled: boolean; 139 140 /** 141 * Indicates the label of the application 142 * 143 * @type { string } 144 * @syscap SystemCapability.BundleManager.BundleFramework.Core 145 * @since 9 146 */ 147 /** 148 * Indicates the label of the application 149 * 150 * @type { string } 151 * @syscap SystemCapability.BundleManager.BundleFramework.Core 152 * @crossplatform 153 * @since 10 154 */ 155 /** 156 * Indicates the label of the application 157 * 158 * @type { string } 159 * @syscap SystemCapability.BundleManager.BundleFramework.Core 160 * @crossplatform 161 * @atomicservice 162 * @since 11 163 */ 164 readonly label: string; 165 166 /** 167 * Indicates the label id of the application 168 * 169 * @type { number } 170 * @syscap SystemCapability.BundleManager.BundleFramework.Core 171 * @since 9 172 */ 173 /** 174 * Indicates the label id of the application 175 * 176 * @type { number } 177 * @syscap SystemCapability.BundleManager.BundleFramework.Core 178 * @crossplatform 179 * @since 10 180 */ 181 /** 182 * Indicates the label id of the application 183 * 184 * @type { number } 185 * @syscap SystemCapability.BundleManager.BundleFramework.Core 186 * @crossplatform 187 * @atomicservice 188 * @since 11 189 */ 190 readonly labelId: number; 191 192 /** 193 * Indicates the icon of the application 194 * 195 * @type { string } 196 * @syscap SystemCapability.BundleManager.BundleFramework.Core 197 * @since 9 198 */ 199 /** 200 * Indicates the icon of the application 201 * 202 * @type { string } 203 * @syscap SystemCapability.BundleManager.BundleFramework.Core 204 * @crossplatform 205 * @since 10 206 */ 207 /** 208 * Indicates the icon of the application 209 * 210 * @type { string } 211 * @syscap SystemCapability.BundleManager.BundleFramework.Core 212 * @crossplatform 213 * @atomicservice 214 * @since 11 215 */ 216 readonly icon: string; 217 218 /** 219 * Indicates the icon id of the application 220 * 221 * @type { number } 222 * @syscap SystemCapability.BundleManager.BundleFramework.Core 223 * @since 9 224 */ 225 /** 226 * Indicates the icon id of the application 227 * 228 * @type { number } 229 * @syscap SystemCapability.BundleManager.BundleFramework.Core 230 * @crossplatform 231 * @since 10 232 */ 233 /** 234 * Indicates the icon id of the application 235 * 236 * @type { number } 237 * @syscap SystemCapability.BundleManager.BundleFramework.Core 238 * @crossplatform 239 * @atomicservice 240 * @since 11 241 */ 242 readonly iconId: number; 243 244 /** 245 * Process of application, if user do not set it ,the value equal bundleName 246 * 247 * @type { string } 248 * @syscap SystemCapability.BundleManager.BundleFramework.Core 249 * @since 9 250 */ 251 /** 252 * Process of application, if user do not set it ,the value equal bundleName 253 * 254 * @type { string } 255 * @syscap SystemCapability.BundleManager.BundleFramework.Core 256 * @atomicservice 257 * @since 11 258 */ 259 readonly process: string; 260 261 /** 262 * Indicates the permissions required for accessing the application. 263 * 264 * @type { Array<string> } 265 * @syscap SystemCapability.BundleManager.BundleFramework.Core 266 * @since 9 267 */ 268 /** 269 * Indicates the permissions required for accessing the application. 270 * 271 * @type { Array<string> } 272 * @syscap SystemCapability.BundleManager.BundleFramework.Core 273 * @atomicservice 274 * @since 11 275 */ 276 readonly permissions: Array<string>; 277 278 /** 279 * Indicates the application source code path 280 * 281 * @type { string } 282 * @syscap SystemCapability.BundleManager.BundleFramework.Core 283 * @since 9 284 */ 285 /** 286 * Indicates the application source code path 287 * 288 * @type { string } 289 * @syscap SystemCapability.BundleManager.BundleFramework.Core 290 * @crossplatform 291 * @since 10 292 */ 293 /** 294 * Indicates the application source code path 295 * 296 * @type { string } 297 * @syscap SystemCapability.BundleManager.BundleFramework.Core 298 * @crossplatform 299 * @atomicservice 300 * @since 11 301 */ 302 readonly codePath: string; 303 304 /** 305 * Indicates the metadata of module 306 * 307 * @type { Map<string, Array<Metadata>> } 308 * @readonly 309 * @syscap SystemCapability.BundleManager.BundleFramework.Core 310 * @since 9 311 * @deprecated since 10 312 * @useinstead ApplicationInfo#metadataArray 313 */ 314 readonly metadata: Map<string, Array<Metadata>>; 315 316 /** 317 * Indicates the metadata of the application 318 * 319 * @type { Array<ModuleMetadata> } 320 * @readonly 321 * @syscap SystemCapability.BundleManager.BundleFramework.Core 322 * @since 10 323 */ 324 /** 325 * Indicates the metadata of the application 326 * 327 * @type { Array<ModuleMetadata> } 328 * @readonly 329 * @syscap SystemCapability.BundleManager.BundleFramework.Core 330 * @atomicservice 331 * @since 11 332 */ 333 readonly metadataArray: Array<ModuleMetadata>; 334 335 /** 336 * Indicates whether or not this application may be removable 337 * 338 * @type { boolean } 339 * @syscap SystemCapability.BundleManager.BundleFramework.Core 340 * @since 9 341 */ 342 /** 343 * Indicates whether or not this application may be removable 344 * 345 * @type { boolean } 346 * @syscap SystemCapability.BundleManager.BundleFramework.Core 347 * @atomicservice 348 * @since 11 349 */ 350 readonly removable: boolean; 351 352 /** 353 * Indicates the access token of the application 354 * 355 * @type { number } 356 * @syscap SystemCapability.BundleManager.BundleFramework.Core 357 * @since 9 358 */ 359 /** 360 * Indicates the access token of the application 361 * 362 * @type { number } 363 * @syscap SystemCapability.BundleManager.BundleFramework.Core 364 * @atomicservice 365 * @since 11 366 */ 367 readonly accessTokenId: number; 368 369 /** 370 * Indicates the uid of the application 371 * 372 * @type { number } 373 * @syscap SystemCapability.BundleManager.BundleFramework.Core 374 * @since 9 375 */ 376 /** 377 * Indicates the uid of the application 378 * 379 * @type { number } 380 * @syscap SystemCapability.BundleManager.BundleFramework.Core 381 * @atomicservice 382 * @since 11 383 */ 384 readonly uid: number; 385 386 /** 387 * Indicates icon resource of the application 388 * 389 * @type { Resource } 390 * @syscap SystemCapability.BundleManager.BundleFramework.Core 391 * @since 9 392 */ 393 /** 394 * Indicates icon resource of the application 395 * 396 * @type { Resource } 397 * @syscap SystemCapability.BundleManager.BundleFramework.Core 398 * @atomicservice 399 * @since 11 400 */ 401 readonly iconResource: Resource; 402 403 /** 404 * Indicates label resource of the application 405 * 406 * @type { Resource } 407 * @syscap SystemCapability.BundleManager.BundleFramework.Core 408 * @since 9 409 */ 410 /** 411 * Indicates label resource of the application 412 * 413 * @type { Resource } 414 * @syscap SystemCapability.BundleManager.BundleFramework.Core 415 * @atomicservice 416 * @since 11 417 */ 418 readonly labelResource: Resource; 419 420 /** 421 * Indicates description resource of the application 422 * 423 * @type { Resource } 424 * @syscap SystemCapability.BundleManager.BundleFramework.Core 425 * @since 9 426 */ 427 /** 428 * Indicates description resource of the application 429 * 430 * @type { Resource } 431 * @syscap SystemCapability.BundleManager.BundleFramework.Core 432 * @atomicservice 433 * @since 11 434 */ 435 readonly descriptionResource: Resource; 436 437 /** 438 * Indicates the appDistributionType of the application 439 * 440 * @type { string } 441 * @syscap SystemCapability.BundleManager.BundleFramework.Core 442 * @since 9 443 */ 444 /** 445 * Indicates the appDistributionType of the application 446 * 447 * @type { string } 448 * @syscap SystemCapability.BundleManager.BundleFramework.Core 449 * @atomicservice 450 * @since 11 451 */ 452 readonly appDistributionType: string; 453 454 /** 455 * Indicates the appProvisionType of the application 456 * 457 * @type { string } 458 * @syscap SystemCapability.BundleManager.BundleFramework.Core 459 * @since 9 460 */ 461 /** 462 * Indicates the appProvisionType of the application 463 * 464 * @type { string } 465 * @syscap SystemCapability.BundleManager.BundleFramework.Core 466 * @atomicservice 467 * @since 11 468 */ 469 readonly appProvisionType: string; 470 471 /** 472 * Indicates whether the application is a system application 473 * 474 * @type { boolean } 475 * @syscap SystemCapability.BundleManager.BundleFramework.Core 476 * @since 9 477 */ 478 /** 479 * Indicates whether the application is a system application 480 * 481 * @type { boolean } 482 * @syscap SystemCapability.BundleManager.BundleFramework.Core 483 * @atomicservice 484 * @since 11 485 */ 486 readonly systemApp: boolean; 487 488 /** 489 * Indicates the type of application is APP or atomicService. 490 * 491 * @type { bundleManager.BundleType } 492 * @syscap SystemCapability.BundleManager.BundleFramework.Core 493 * @since 9 494 */ 495 /** 496 * Indicates the type of application is APP or atomicService. 497 * 498 * @type { bundleManager.BundleType } 499 * @syscap SystemCapability.BundleManager.BundleFramework.Core 500 * @atomicservice 501 * @since 11 502 */ 503 readonly bundleType: bundleManager.BundleType; 504 505 /** 506 * Indicates whether the application is in debug mode. 507 * 508 * @type { boolean } 509 * @syscap SystemCapability.BundleManager.BundleFramework.Core 510 * @since 10 511 */ 512 /** 513 * Indicates whether the application is in debug mode. 514 * 515 * @type { boolean } 516 * @syscap SystemCapability.BundleManager.BundleFramework.Core 517 * @atomicservice 518 * @since 11 519 */ 520 readonly debug: boolean; 521 522 /** 523 * Indicates whether the application data is unclearable, that is, whether the application data cannot be cleared. 524 * 525 * @type { boolean } 526 * @readonly 527 * @syscap SystemCapability.BundleManager.BundleFramework.Core 528 * @atomicservice 529 * @since 11 530 */ 531 readonly dataUnclearable: boolean; 532} 533 534/** 535 * Indicates the ModuleMetadata 536 * 537 * @typedef ModuleMetadata 538 * @syscap SystemCapability.BundleManager.BundleFramework.Core 539 * @since 10 540 */ 541/** 542 * Indicates the ModuleMetadata 543 * 544 * @typedef ModuleMetadata 545 * @syscap SystemCapability.BundleManager.BundleFramework.Core 546 * @atomicservice 547 * @since 11 548 */ 549export interface ModuleMetadata { 550 /** 551 * Indicates the name of this hap module 552 * 553 * @type { string } 554 * @readonly 555 * @syscap SystemCapability.BundleManager.BundleFramework.Core 556 * @since 10 557 */ 558 /** 559 * Indicates the name of this hap module 560 * 561 * @type { string } 562 * @readonly 563 * @syscap SystemCapability.BundleManager.BundleFramework.Core 564 * @atomicservice 565 * @since 11 566 */ 567 readonly moduleName: string; 568 569 /** 570 * Indicates the metadata of this hap module 571 * 572 * @type { Array<Metadata> } 573 * @readonly 574 * @syscap SystemCapability.BundleManager.BundleFramework.Core 575 * @since 10 576 */ 577 /** 578 * Indicates the metadata of this hap module 579 * 580 * @type { Array<Metadata> } 581 * @readonly 582 * @syscap SystemCapability.BundleManager.BundleFramework.Core 583 * @atomicservice 584 * @since 11 585 */ 586 readonly metadata: Array<Metadata>; 587} 588