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 FormKit 19 */ 20 21import { AsyncCallback } from './@ohos.base'; 22import { Callback } from './@ohos.base'; 23import Want from './@ohos.app.ability.Want'; 24import formInfo from './@ohos.app.form.formInfo'; 25 26/** 27 * Interface of formHost. 28 * 29 * @namespace formHost 30 * @syscap SystemCapability.Ability.Form 31 * @systemapi 32 * @since 9 33 */ 34declare namespace formHost { 35 /** 36 * Add a form. 37 * <p>You can use this method to create a theme form.</p> 38 * 39 * @permission ohos.permission.REQUIRE_FORM 40 * @param { Want } want - Indicates want of the form. 41 * @returns { Promise<formInfo.RunningFormInfo> } Return the form info. 42 * @throws { BusinessError } 201 - Permissions denied. 43 * @throws { BusinessError } 202 - The application is not a system application. 44 * @throws { BusinessError } 401 - Parameter error. Possible causes: 45 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 46 * @throws { BusinessError } 16500050 - IPC connection error. 47 * @throws { BusinessError } 16500060 - Service connection error. 48 * @throws { BusinessError } 16501000 - An internal functional error occurred. 49 * @syscap SystemCapability.Ability.Form 50 * @systemapi 51 * @stagemodelonly 52 * @since 12 53 */ 54 function addForm(want: Want): Promise<formInfo.RunningFormInfo>; 55 56 /** 57 * Deletes an obtained form by its ID. 58 * <p>After this method is called, the form won't be available for use by the application and the Form Manager 59 * Service no longer keeps the cache information about the form.</p> 60 * 61 * @permission ohos.permission.REQUIRE_FORM 62 * @param { string } formId - Indicates the form ID. 63 * @param { AsyncCallback<void> } callback - The callback of deleteForm. 64 * @throws { BusinessError } 201 - Permissions denied. 65 * @throws { BusinessError } 202 - The application is not a system application. 66 * @throws { BusinessError } 401 - Parameter error. Possible causes: 67 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 68 * @throws { BusinessError } 16500050 - IPC connection error. 69 * @throws { BusinessError } 16500060 - Service connection error. 70 * @throws { BusinessError } 16501000 - An internal functional error occurred. 71 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 72 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 73 * @syscap SystemCapability.Ability.Form 74 * @systemapi 75 * @since 9 76 */ 77 function deleteForm(formId: string, callback: AsyncCallback<void>): void; 78 79 /** 80 * Deletes an obtained form by its ID. 81 * <p>After this method is called, the form won't be available for use by the application and the Form Manager 82 * Service no longer keeps the cache information about the form.</p> 83 * 84 * @permission ohos.permission.REQUIRE_FORM 85 * @param { string } formId - Indicates the form ID. 86 * @returns { Promise<void> } The promise returned by the function. 87 * @throws { BusinessError } 201 - Permissions denied. 88 * @throws { BusinessError } 202 - The application is not a system application. 89 * @throws { BusinessError } 401 - Parameter error. Possible causes: 90 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 91 * @throws { BusinessError } 16500050 - IPC connection error. 92 * @throws { BusinessError } 16500060 - Service connection error. 93 * @throws { BusinessError } 16501000 - An internal functional error occurred. 94 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 95 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 96 * @syscap SystemCapability.Ability.Form 97 * @systemapi 98 * @since 9 99 */ 100 function deleteForm(formId: string): Promise<void>; 101 102 /** 103 * Releases an obtained form by its ID. 104 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 105 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 106 * the {@code formId}.</p> 107 * 108 * @permission ohos.permission.REQUIRE_FORM 109 * @param { string } formId - Indicates the form ID 110 * @param { AsyncCallback<void> } callback - The callback of releaseForm. 111 * @throws { BusinessError } 201 - Permissions denied. 112 * @throws { BusinessError } 202 - The application is not a system application. 113 * @throws { BusinessError } 401 - Parameter error. Possible causes: 114 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 115 * @throws { BusinessError } 16500050 - IPC connection error. 116 * @throws { BusinessError } 16500060 - Service connection error. 117 * @throws { BusinessError } 16501000 - An internal functional error occurred. 118 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 119 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 120 * @syscap SystemCapability.Ability.Form 121 * @systemapi 122 * @since 9 123 */ 124 function releaseForm(formId: string, callback: AsyncCallback<void>): void; 125 126 /** 127 * Releases an obtained form by its ID. 128 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 129 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 130 * the {@code formId}.</p> 131 * 132 * @permission ohos.permission.REQUIRE_FORM 133 * @param { string } formId - Indicates the form ID 134 * @param { boolean } isReleaseCache - Indicates whether release cache or not. 135 * @param { AsyncCallback<void> } callback - The callback of releaseForm. 136 * @throws { BusinessError } 201 - Permissions denied. 137 * @throws { BusinessError } 202 - The application is not a system application. 138 * @throws { BusinessError } 401 - Parameter error. Possible causes: 139 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 140 * @throws { BusinessError } 16500050 - IPC connection error. 141 * @throws { BusinessError } 16500060 - Service connection error. 142 * @throws { BusinessError } 16501000 - An internal functional error occurred. 143 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 144 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 145 * @syscap SystemCapability.Ability.Form 146 * @systemapi 147 * @since 9 148 */ 149 function releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback<void>): void; 150 151 /** 152 * Releases an obtained form by its ID. 153 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 154 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 155 * the {@code formId}.</p> 156 * 157 * @permission ohos.permission.REQUIRE_FORM 158 * @param { string } formId - Indicates the form ID 159 * @param { boolean } [isReleaseCache] - Indicates whether release cache or not. 160 * @returns { Promise<void> } The promise returned by the function. 161 * @throws { BusinessError } 201 - Permissions denied. 162 * @throws { BusinessError } 202 - The application is not a system application. 163 * @throws { BusinessError } 401 - Parameter error. Possible causes: 164 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 165 * @throws { BusinessError } 16500050 - IPC connection error. 166 * @throws { BusinessError } 16500060 - Service connection error. 167 * @throws { BusinessError } 16501000 - An internal functional error occurred. 168 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 169 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 170 * @syscap SystemCapability.Ability.Form 171 * @systemapi 172 * @since 9 173 */ 174 function releaseForm(formId: string, isReleaseCache?: boolean): Promise<void>; 175 176 /** 177 * Requests for form update. 178 * <p>This method must be called when the application has detected that a system setting item (such as the language, 179 * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form 180 * provider automatically updates the form data (if there is any update) through the form framework, with the update 181 * process being unperceivable by the application.</p> 182 * 183 * @permission ohos.permission.REQUIRE_FORM 184 * @param { string } formId - Indicates the ID of the form to update. 185 * @param { AsyncCallback<void> } callback - The callback of requestForm. 186 * @throws { BusinessError } 201 - Permissions denied. 187 * @throws { BusinessError } 202 - The application is not a system application. 188 * @throws { BusinessError } 401 - Parameter error. Possible causes: 189 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 190 * @throws { BusinessError } 16500050 - IPC connection error. 191 * @throws { BusinessError } 16500060 - Service connection error. 192 * @throws { BusinessError } 16501000 - An internal functional error occurred. 193 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 194 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 195 * @syscap SystemCapability.Ability.Form 196 * @systemapi 197 * @since 9 198 */ 199 function requestForm(formId: string, callback: AsyncCallback<void>): void; 200 201 /** 202 * Requests for form update. 203 * <p>This method must be called when the application has detected that a system setting item (such as the language, 204 * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form 205 * provider automatically updates the form data (if there is any update) through the form framework, with the update 206 * process being unperceivable by the application.</p> 207 * 208 * @permission ohos.permission.REQUIRE_FORM 209 * @param { string } formId - Indicates the ID of the form to update. 210 * @returns { Promise<void> } The promise returned by the function. 211 * @throws { BusinessError } 201 - Permissions denied. 212 * @throws { BusinessError } 202 - The application is not a system application. 213 * @throws { BusinessError } 401 - Parameter error. Possible causes: 214 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 215 * @throws { BusinessError } 16500050 - IPC connection error. 216 * @throws { BusinessError } 16500060 - Service connection error. 217 * @throws { BusinessError } 16501000 - An internal functional error occurred. 218 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 219 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 220 * @syscap SystemCapability.Ability.Form 221 * @systemapi 222 * @since 9 223 */ 224 function requestForm(formId: string): Promise<void>; 225 226 /** 227 * Requests for form update. 228 * <p>This method must be called when the application has detected that a system setting item (such as the language, 229 * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form 230 * provider automatically updates the form data (if there is any update) through the form framework, with the update 231 * process being unperceivable by the application.</p> 232 * 233 * @permission ohos.permission.REQUIRE_FORM 234 * @param { string } formId - Indicates the ID of the form to update. 235 * @param { Record<string, Object> } [wantParams] - Indicates want params of the form to update. 236 * @returns { Promise<void> } The promise returned by the function. 237 * @throws { BusinessError } 201 - Permissions denied. 238 * @throws { BusinessError } 202 - The application is not a system application. 239 * @throws { BusinessError } 401 - Parameter error. Possible causes: 240 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 241 * @throws { BusinessError } 16500050 - IPC connection error. 242 * @throws { BusinessError } 16500060 - Service connection error. 243 * @throws { BusinessError } 16501000 - An internal functional error occurred. 244 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 245 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 246 * @syscap SystemCapability.Ability.Form 247 * @systemapi 248 * @since 12 249 */ 250 function requestFormWithParams(formId: string, wantParams?: Record<string, Object>): Promise<void>; 251 252 /** 253 * Converts a specified temporary form that has been obtained by the application into a normal form. 254 * 255 * @permission ohos.permission.REQUIRE_FORM 256 * @param { string } formId - Indicates the ID of the temporary form to convert. 257 * @param { AsyncCallback<void> } callback - The callback of castToNormalForm. 258 * @throws { BusinessError } 201 - Permissions denied. 259 * @throws { BusinessError } 202 - The application is not a system application. 260 * @throws { BusinessError } 401 - Parameter error. Possible causes: 261 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 262 * @throws { BusinessError } 16500050 - IPC connection error. 263 * @throws { BusinessError } 16501000 - An internal functional error occurred. 264 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 265 * @throws { BusinessError } 16501002 - The number of forms exceeds the maximum allowed. 266 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 267 * @syscap SystemCapability.Ability.Form 268 * @systemapi 269 * @since 9 270 */ 271 function castToNormalForm(formId: string, callback: AsyncCallback<void>): void; 272 273 /** 274 * Converts a specified temporary form that has been obtained by the application into a normal form. 275 * 276 * @permission ohos.permission.REQUIRE_FORM 277 * @param { string } formId - Indicates the ID of the temporary form to convert. 278 * @returns { Promise<void> } The promise returned by the function. 279 * @throws { BusinessError } 201 - Permissions denied. 280 * @throws { BusinessError } 202 - The application is not a system application. 281 * @throws { BusinessError } 401 - Parameter error. Possible causes: 282 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 283 * @throws { BusinessError } 16500050 - IPC connection error. 284 * @throws { BusinessError } 16501000 - An internal functional error occurred. 285 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 286 * @throws { BusinessError } 16501002 - The number of forms exceeds the maximum allowed. 287 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 288 * @syscap SystemCapability.Ability.Form 289 * @systemapi 290 * @since 9 291 */ 292 function castToNormalForm(formId: string): Promise<void>; 293 294 /** 295 * Sends a notification to the form framework to make the specified forms visible. 296 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 297 * the form visibility change event.</p> 298 * 299 * @permission ohos.permission.REQUIRE_FORM 300 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made visible. 301 * @param { AsyncCallback<void> } callback - The callback of notifyVisibleForms. 302 * @throws { BusinessError } 201 - Permissions denied. 303 * @throws { BusinessError } 202 - The application is not a system application. 304 * @throws { BusinessError } 401 - Parameter error. Possible causes: 305 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 306 * @throws { BusinessError } 16500050 - IPC connection error. 307 * @throws { BusinessError } 16500060 - Service connection error. 308 * @throws { BusinessError } 16501000 - An internal functional error occurred. 309 * @syscap SystemCapability.Ability.Form 310 * @systemapi 311 * @since 9 312 */ 313 function notifyVisibleForms(formIds: Array<string>, callback: AsyncCallback<void>): void; 314 315 /** 316 * Sends a notification to the form framework to make the specified forms visible. 317 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 318 * the form visibility change event.</p> 319 * 320 * @permission ohos.permission.REQUIRE_FORM 321 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made visible. 322 * @returns { Promise<void> } The promise returned by the function. 323 * @throws { BusinessError } 201 - Permissions denied. 324 * @throws { BusinessError } 202 - The application is not a system application. 325 * @throws { BusinessError } 401 - Parameter error. Possible causes: 326 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 327 * @throws { BusinessError } 16500050 - IPC connection error. 328 * @throws { BusinessError } 16500060 - Service connection error. 329 * @throws { BusinessError } 16501000 - An internal functional error occurred. 330 * @syscap SystemCapability.Ability.Form 331 * @systemapi 332 * @since 9 333 */ 334 function notifyVisibleForms(formIds: Array<string>): Promise<void>; 335 336 /** 337 * Sends a notification to the form framework to make the specified forms invisible. 338 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 339 * the form visibility change event.</p> 340 * 341 * @permission ohos.permission.REQUIRE_FORM 342 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 343 * @param { AsyncCallback<void> } callback - The callback of notifyInvisibleForms. 344 * @throws { BusinessError } 201 - Permissions denied. 345 * @throws { BusinessError } 202 - The application is not a system application. 346 * @throws { BusinessError } 401 - Parameter error. Possible causes: 347 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 348 * @throws { BusinessError } 16500050 - IPC connection error. 349 * @throws { BusinessError } 16500060 - Service connection error. 350 * @throws { BusinessError } 16501000 - An internal functional error occurred. 351 * @syscap SystemCapability.Ability.Form 352 * @systemapi 353 * @since 9 354 */ 355 function notifyInvisibleForms(formIds: Array<string>, callback: AsyncCallback<void>): void; 356 357 /** 358 * Sends a notification to the form framework to make the specified forms invisible. 359 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 360 * the form visibility change event.</p> 361 * 362 * @permission ohos.permission.REQUIRE_FORM 363 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 364 * @returns { Promise<void> } The promise returned by the function. 365 * @throws { BusinessError } 201 - Permissions denied. 366 * @throws { BusinessError } 202 - The application is not a system application. 367 * @throws { BusinessError } 401 - Parameter error. Possible causes: 368 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 369 * @throws { BusinessError } 16500050 - IPC connection error. 370 * @throws { BusinessError } 16500060 - Service connection error. 371 * @throws { BusinessError } 16501000 - An internal functional error occurred. 372 * @syscap SystemCapability.Ability.Form 373 * @systemapi 374 * @since 9 375 */ 376 function notifyInvisibleForms(formIds: Array<string>): Promise<void>; 377 378 /** 379 * Notify the form framework to make the specified forms updatable. 380 * <p>You can use this method to set form refresh state to true, the form can receive new 381 * update from service.</p> 382 * 383 * @permission ohos.permission.REQUIRE_FORM 384 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 385 * @param { AsyncCallback<void> } callback - The callback of enableFormsUpdate. 386 * @throws { BusinessError } 201 - Permissions denied. 387 * @throws { BusinessError } 202 - The application is not a system application. 388 * @throws { BusinessError } 401 - Parameter error. Possible causes: 389 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 390 * @throws { BusinessError } 16500050 - IPC connection error. 391 * @throws { BusinessError } 16500060 - Service connection error. 392 * @throws { BusinessError } 16501000 - An internal functional error occurred. 393 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 394 * @syscap SystemCapability.Ability.Form 395 * @systemapi 396 * @since 9 397 */ 398 function enableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void>): void; 399 400 /** 401 * Notify the form framework to make the specified forms updatable. 402 * <p>You can use this method to set form refresh state to true, the form can receive new 403 * update from service.</p> 404 * 405 * @permission ohos.permission.REQUIRE_FORM 406 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 407 * @returns { Promise<void> } The promise returned by the function. 408 * @throws { BusinessError } 201 - Permissions denied. 409 * @throws { BusinessError } 202 - The application is not a system application. 410 * @throws { BusinessError } 401 - Parameter error. Possible causes: 411 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 412 * @throws { BusinessError } 16500050 - IPC connection error. 413 * @throws { BusinessError } 16500060 - Service connection error. 414 * @throws { BusinessError } 16501000 - An internal functional error occurred. 415 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 416 * @syscap SystemCapability.Ability.Form 417 * @systemapi 418 * @since 9 419 */ 420 function enableFormsUpdate(formIds: Array<string>): Promise<void>; 421 422 /** 423 * Notify the form framework to make the specified forms non-updatable. 424 * <p>You can use this method to set form refresh state to false, the form do not receive 425 * new update from service.</p> 426 * 427 * @permission ohos.permission.REQUIRE_FORM 428 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 429 * @param { AsyncCallback<void> } callback - The callback of disableFormsUpdate. 430 * @throws { BusinessError } 201 - Permissions denied. 431 * @throws { BusinessError } 202 - The application is not a system application. 432 * @throws { BusinessError } 401 - Parameter error. Possible causes: 433 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 434 * @throws { BusinessError } 16500050 - IPC connection error. 435 * @throws { BusinessError } 16500060 - Service connection error. 436 * @throws { BusinessError } 16501000 - An internal functional error occurred. 437 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 438 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 439 * @syscap SystemCapability.Ability.Form 440 * @systemapi 441 * @since 9 442 */ 443 function disableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void>): void; 444 445 /** 446 * Notify the form framework to make the specified forms non updatable. 447 * <p>You can use this method to set form refresh state to false, the form do not receive 448 * new update from service.</p> 449 * 450 * @permission ohos.permission.REQUIRE_FORM 451 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 452 * @returns { Promise<void> } The promise returned by the function. 453 * @throws { BusinessError } 201 - Permissions denied. 454 * @throws { BusinessError } 202 - The application is not a system application. 455 * @throws { BusinessError } 401 - Parameter error. Possible causes: 456 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 457 * @throws { BusinessError } 16500050 - IPC connection error. 458 * @throws { BusinessError } 16500060 - Service connection error. 459 * @throws { BusinessError } 16501000 - An internal functional error occurred. 460 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 461 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 462 * @syscap SystemCapability.Ability.Form 463 * @systemapi 464 * @since 9 465 */ 466 function disableFormsUpdate(formIds: Array<string>): Promise<void>; 467 468 /** 469 * Checks whether the system is ready. 470 * <p>You can use this method to obtain the system is ready.</p> 471 * 472 * @param { AsyncCallback<void> } callback - The callback of isSystemReady. 473 * @throws { BusinessError } 202 - The application is not a system application. 474 * @throws { BusinessError } 401 - Parameter error. Possible causes: 475 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 476 * @syscap SystemCapability.Ability.Form 477 * @systemapi 478 * @since 9 479 */ 480 function isSystemReady(callback: AsyncCallback<void>): void; 481 482 /** 483 * Checks whether the system is ready. 484 * <p>You can use this method to obtain the system is ready.</p> 485 * 486 * @returns { Promise<void> } The promise returned by the function. 487 * @throws { BusinessError } 202 - The application is not a system application. 488 * @syscap SystemCapability.Ability.Form 489 * @systemapi 490 * @since 9 491 */ 492 function isSystemReady(): Promise<void>; 493 494 /** 495 * Obtains the FormInfo objects provided by all applications on the device. 496 * 497 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 498 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 499 * @throws { BusinessError } 201 - Permissions denied. 500 * @throws { BusinessError } 202 - The application is not a system application. 501 * @throws { BusinessError } 401 - Parameter error. Possible causes: 502 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 503 * @throws { BusinessError } 16500050 - IPC connection error. 504 * @throws { BusinessError } 16500060 - Service connection error. 505 * @throws { BusinessError } 16501000 - An internal functional error occurred. 506 * @syscap SystemCapability.Ability.Form 507 * @systemapi 508 * @since 9 509 */ 510 function getAllFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): void; 511 512 /** 513 * Obtains the FormInfo objects provided by all applications on the device. 514 * 515 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 516 * @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo. 517 * @throws { BusinessError } 201 - Permissions denied. 518 * @throws { BusinessError } 202 - The application is not a system application. 519 * @throws { BusinessError } 16500050 - IPC connection error. 520 * @throws { BusinessError } 16500060 - Service connection error. 521 * @throws { BusinessError } 16501000 - An internal functional error occurred. 522 * @syscap SystemCapability.Ability.Form 523 * @systemapi 524 * @since 9 525 */ 526 function getAllFormsInfo(): Promise<Array<formInfo.FormInfo>>; 527 528 /** 529 * Obtains the FormInfo objects provided by a specified application on the device. 530 * 531 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 532 * @param { string } bundleName - Indicates the bundle name of the application. 533 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 534 * @throws { BusinessError } 201 - Permissions denied. 535 * @throws { BusinessError } 202 - The application is not a system application. 536 * @throws { BusinessError } 401 - Parameter error. Possible causes: 537 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 538 * @throws { BusinessError } 16500050 - IPC connection error. 539 * @throws { BusinessError } 16500060 - Service connection error. 540 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 541 * @throws { BusinessError } 16501000 - An internal functional error occurred. 542 * @syscap SystemCapability.Ability.Form 543 * @systemapi 544 * @since 9 545 */ 546 function getFormsInfo(bundleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void; 547 548 /** 549 * Obtains the FormInfo objects provided by a specified application on the device. 550 * 551 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 552 * @param { string } bundleName - Indicates the bundle name of the application. 553 * @param { string } moduleName - Indicates the module name of the application. 554 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 555 * @throws { BusinessError } 201 - Permissions denied. 556 * @throws { BusinessError } 202 - The application is not a system application. 557 * @throws { BusinessError } 401 - Parameter error. Possible causes: 558 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 559 * @throws { BusinessError } 16500050 - IPC connection error. 560 * @throws { BusinessError } 16500060 - Service connection error. 561 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 562 * @throws { BusinessError } 16501000 - An internal functional error occurred. 563 * @syscap SystemCapability.Ability.Form 564 * @systemapi 565 * @since 9 566 */ 567 function getFormsInfo( 568 bundleName: string, 569 moduleName: string, 570 callback: AsyncCallback<Array<formInfo.FormInfo>> 571 ): void; 572 573 /** 574 * Obtains the FormInfo objects provided by a specified application on the device. 575 * 576 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 577 * @param { string } bundleName - Indicates the bundle name of the application. 578 * @param { string } [moduleName] - Indicates the module name of the application. 579 * @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo. 580 * @throws { BusinessError } 201 - Permissions denied. 581 * @throws { BusinessError } 202 - The application is not a system application. 582 * @throws { BusinessError } 401 - Parameter error. Possible causes: 583 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 584 * @throws { BusinessError } 16500050 - IPC connection error. 585 * @throws { BusinessError } 16500060 - Service connection error. 586 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 587 * @throws { BusinessError } 16501000 - An internal functional error occurred. 588 * @syscap SystemCapability.Ability.Form 589 * @systemapi 590 * @since 9 591 */ 592 function getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<formInfo.FormInfo>>; 593 594 /** 595 * Obtains the FormInfo objects provided by all application with filter on the device. 596 * 597 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 598 * @param { formInfo.FormInfoFilter } filter - Indicates the requirements the forms that the formInfos belong to have to meet. 599 * @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo. 600 * @throws { BusinessError } 201 - Permissions denied. 601 * @throws { BusinessError } 202 - The application is not a system application. 602 * @throws { BusinessError } 401 - Parameter error. Possible causes: 603 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 604 * @throws { BusinessError } 16500050 - IPC connection error. 605 * @throws { BusinessError } 16500060 - Service connection error. 606 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 607 * @throws { BusinessError } 16501000 - An internal functional error occurred. 608 * @syscap SystemCapability.Ability.Form 609 * @systemapi 610 * @since 12 611 */ 612 function getFormsInfo(filter: formInfo.FormInfoFilter): Promise<Array<formInfo.FormInfo>>; 613 614 /** 615 * Deletes invalid forms of the application in the Form Manager Service based on the list of. 616 * <p>You can use this method to delete invalid forms of the application.</p> 617 * 618 * @permission ohos.permission.REQUIRE_FORM 619 * @param { Array<string> } formIds - Indicates the specified form id. 620 * @param { AsyncCallback<number> } callback - The callback is used to return the number of invalid forms deleted 621 * by the Form Manager Service. 622 * @throws { BusinessError } 201 - Permissions denied. 623 * @throws { BusinessError } 202 - The application is not a system application. 624 * @throws { BusinessError } 401 - Parameter error. Possible causes: 625 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 626 * @throws { BusinessError } 16500050 - IPC connection error. 627 * @throws { BusinessError } 16500060 - Service connection error. 628 * @throws { BusinessError } 16501000 - An internal functional error occurred. 629 * @syscap SystemCapability.Ability.Form 630 * @systemapi 631 * @since 9 632 */ 633 function deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<number>): void; 634 635 /** 636 * Deletes invalid forms of the application in the Form Manager Service based on the list of. 637 * <p>You can use this method to delete invalid forms of the application.</p> 638 * 639 * @permission ohos.permission.REQUIRE_FORM 640 * @param { Array<string> } formIds - Indicates the specified form id. 641 * @returns { Promise<number> } Returns the number of invalid forms deleted by the Form Manager Service. 642 * @throws { BusinessError } 201 - Permissions denied. 643 * @throws { BusinessError } 202 - The application is not a system application. 644 * @throws { BusinessError } 401 - Parameter error. Possible causes: 645 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 646 * @throws { BusinessError } 16500050 - IPC connection error. 647 * @throws { BusinessError } 16500060 - Service connection error. 648 * @throws { BusinessError } 16501000 - An internal functional error occurred. 649 * @syscap SystemCapability.Ability.Form 650 * @systemapi 651 * @since 9 652 */ 653 function deleteInvalidForms(formIds: Array<string>): Promise<number>; 654 655 /** 656 * Obtains the Form state. 657 * <p>You can use this method to obtains the form state.</p> 658 * 659 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 660 * @param { Want } want - Indicates want of the form. 661 * @param { AsyncCallback<formInfo.FormStateInfo> } callback - The callback is used to return the form state. 662 * @throws { BusinessError } 201 - Permissions denied. 663 * @throws { BusinessError } 202 - The application is not a system application. 664 * @throws { BusinessError } 401 - Parameter error. Possible causes: 665 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 666 * @throws { BusinessError } 16500050 - IPC connection error. 667 * @throws { BusinessError } 16500060 - Service connection error. 668 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 669 * @throws { BusinessError } 16501000 - An internal functional error occurred. 670 * @syscap SystemCapability.Ability.Form 671 * @systemapi 672 * @since 9 673 */ 674 function acquireFormState(want: Want, callback: AsyncCallback<formInfo.FormStateInfo>): void; 675 676 /** 677 * Obtains the Form state. 678 * <p>You can use this method to obtains the form state.</p> 679 * 680 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 681 * @param { Want } want - Indicates want of the form. 682 * @returns { Promise<formInfo.FormStateInfo> } Returns the form state. 683 * @throws { BusinessError } 201 - Permissions denied. 684 * @throws { BusinessError } 202 - The application is not a system application. 685 * @throws { BusinessError } 401 - Parameter error. Possible causes: 686 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 687 * @throws { BusinessError } 16500050 - IPC connection error. 688 * @throws { BusinessError } 16500060 - Service connection error. 689 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 690 * @throws { BusinessError } 16501000 - An internal functional error occurred. 691 * @syscap SystemCapability.Ability.Form 692 * @systemapi 693 * @since 9 694 */ 695 function acquireFormState(want: Want): Promise<formInfo.FormStateInfo>; 696 697 /** 698 * Listens to the event of uninstall form. 699 * <p>You can use this method to listen to the event of uninstall form.</p> 700 * 701 * @param { 'formUninstall' } type - Indicates event type. 702 * @param { Callback<string> } callback - The callback of formUninstall. 703 * @throws { BusinessError } 202 - The application is not a system application. 704 * @throws { BusinessError } 401 - Parameter error. Possible causes: 705 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 706 * @syscap SystemCapability.Ability.Form 707 * @systemapi 708 * @since 9 709 */ 710 function on(type: 'formUninstall', callback: Callback<string>): void; 711 712 /** 713 * Cancels listening to the event of uninstall form. 714 * <p>You can use this method to cancel listening to the event of uninstall form.</p> 715 * 716 * @param { 'formUninstall' } type - Indicates event type. 717 * @param { Callback<string> } [callback] - The callback of formUninstall. 718 * @throws { BusinessError } 202 - The application is not a system application. 719 * @throws { BusinessError } 401 - Parameter error. Possible causes: 720 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 721 * @syscap SystemCapability.Ability.Form 722 * @systemapi 723 * @since 9 724 */ 725 function off(type: 'formUninstall', callback?: Callback<string>): void; 726 727 /** 728 * Listens to the event of form's overflow. 729 * <p>You can use this method to listen to the event of form's overflow.</p> 730 * 731 * @param { 'formOverflow' } type - Indicates event type. 732 * @param { Callback<formInfo.OverflowRequest> } callback - The callback of formOverflow. 733 * @throws { BusinessError } 202 - The application is not a system application. 734 * @syscap SystemCapability.Ability.Form 735 * @systemapi 736 * @since 20 737 */ 738 function on(type: 'formOverflow', callback: Callback<formInfo.OverflowRequest>): void; 739 740 /** 741 * Cancels listening to the event of form's overflow. 742 * <p>You can use this method to cancel listening to the event of form's overflow.</p> 743 * 744 * @param { 'formOverflow' } type - Indicates event type. 745 * @param { Callback<formInfo.OverflowRequest> } callback - The callback of formOverflow. 746 * @throws { BusinessError } 202 - The application is not a system application. 747 * @syscap SystemCapability.Ability.Form 748 * @systemapi 749 * @since 20 750 */ 751 function off(type: 'formOverflow', callback?: Callback<formInfo.OverflowRequest>): void; 752 753 /** 754 * Listens to the event of change scene animation state. 755 * <p>You can use this method to listen to the event of change scene animation state.</p> 756 * 757 * @param { 'changeSceneAnimationState' } type - Indicates event type. 758 * @param { Callback<formInfo.ChangeSceneAnimationStateRequest> } callback - The callback of 759 * change scene animation state. 760 * @throws { BusinessError } 202 - The application is not a system application. 761 * @syscap SystemCapability.Ability.Form 762 * @systemapi 763 * @since 20 764 */ 765 function on(type: 'changeSceneAnimationState', 766 callback: Callback<formInfo.ChangeSceneAnimationStateRequest>): void; 767 768 /** 769 * Cancels listening to the event of change scene animation state. 770 * <p>You can use this method to cancel listening to the event of change scene animation state.</p> 771 * 772 * @param { 'changeSceneAnimationState' } type - Indicates event type. 773 * @param { Callback<formInfo.ChangeSceneAnimationStateRequest> } callback - The callback of 774 * change scene animation state. 775 * @throws { BusinessError } 202 - The application is not a system application. 776 * @syscap SystemCapability.Ability.Form 777 * @systemapi 778 * @since 20 779 */ 780 function off(type: 'changeSceneAnimationState', 781 callback?: Callback<formInfo.ChangeSceneAnimationStateRequest>): void; 782 783 /** 784 * Listens to the event of get form rect. 785 * <p>You can use this method to listen to the event of get form rect.</p> 786 * 787 * @param { 'getFormRect' } type - Indicates event type. 788 * @param { formInfo.GetFormRectInfoCallback } callback - The callback of get form rect. 789 * @throws { BusinessError } 202 - The application is not a system application. 790 * @syscap SystemCapability.Ability.Form 791 * @systemapi 792 * @since 20 793 */ 794 function on(type: 'getFormRect', callback: formInfo.GetFormRectInfoCallback): void; 795 796 /** 797 * Cancels listening to the event of get form rect. 798 * <p>You can use this method to cancel listening to the event of get form rect.</p> 799 * 800 * @param { 'getFormRect' } type - Indicates event type. 801 * @param { formInfo.GetFormRectInfoCallback } [callback] - The callback of get form rect. 802 * @throws { BusinessError } 202 - The application is not a system application. 803 * @syscap SystemCapability.Ability.Form 804 * @systemapi 805 * @since 20 806 */ 807 function off(type: 'getFormRect', callback?: formInfo.GetFormRectInfoCallback): void; 808 809 /** 810 * Notify form is Visible 811 * <p>You can use this method to notify form visible state.</p> 812 * 813 * @permission ohos.permission.REQUIRE_FORM 814 * @param { Array<string> } formIds - Indicates the specified form id. 815 * @param { boolean } isVisible - Indicates whether visible. 816 * @param { AsyncCallback<void> } callback - The callback of notifyFormsVisible. 817 * @throws { BusinessError } 201 - Permissions denied. 818 * @throws { BusinessError } 202 - The application is not a system application. 819 * @throws { BusinessError } 401 - Parameter error. Possible causes: 820 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 821 * @throws { BusinessError } 16500050 - IPC connection error. 822 * @throws { BusinessError } 16500060 - Service connection error. 823 * @throws { BusinessError } 16501000 - An internal functional error occurred. 824 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 825 * @syscap SystemCapability.Ability.Form 826 * @systemapi 827 * @since 9 828 */ 829 function notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: AsyncCallback<void>): void; 830 831 /** 832 * Notify form is Visible 833 * <p>You can use this method to notify form visible state.</p> 834 * 835 * @permission ohos.permission.REQUIRE_FORM 836 * @param { Array<string> } formIds - Indicates the specified form id. 837 * @param { boolean } isVisible - Indicates whether visible. 838 * @returns { Promise<void> } The promise returned by the function. 839 * @throws { BusinessError } 201 - Permissions denied. 840 * @throws { BusinessError } 202 - The application is not a system application. 841 * @throws { BusinessError } 401 - Parameter error. Possible causes: 842 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 843 * @throws { BusinessError } 16500050 - IPC connection error. 844 * @throws { BusinessError } 16500060 - Service connection error. 845 * @throws { BusinessError } 16501000 - An internal functional error occurred. 846 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 847 * @syscap SystemCapability.Ability.Form 848 * @systemapi 849 * @since 9 850 */ 851 function notifyFormsVisible(formIds: Array<string>, isVisible: boolean): Promise<void>; 852 853 /** 854 * Notify form enable update state. 855 * <p>You can use this method to notify form enable update state.</p> 856 * 857 * @permission ohos.permission.REQUIRE_FORM 858 * @param { Array<string> } formIds - Indicates the specified form id. 859 * @param { boolean } isEnableUpdate - Indicates whether enable update. 860 * @param { AsyncCallback<void> } callback - The callback of notifyFormsEnableUpdate. 861 * @throws { BusinessError } 201 - Permissions denied. 862 * @throws { BusinessError } 202 - The application is not a system application. 863 * @throws { BusinessError } 401 - Parameter error. Possible causes: 864 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 865 * @throws { BusinessError } 16500050 - IPC connection error. 866 * @throws { BusinessError } 16500060 - Service connection error. 867 * @throws { BusinessError } 16501000 - An internal functional error occurred. 868 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 869 * @syscap SystemCapability.Ability.Form 870 * @systemapi 871 * @since 9 872 */ 873 function notifyFormsEnableUpdate( 874 formIds: Array<string>, 875 isEnableUpdate: boolean, 876 callback: AsyncCallback<void> 877 ): void; 878 879 /** 880 * Notify form enable update state. 881 * <p>You can use this method to notify form enable update state.</p> 882 * 883 * @permission ohos.permission.REQUIRE_FORM 884 * @param { Array<string> } formIds - Indicates the specified form id. 885 * @param { boolean } isEnableUpdate - Indicates whether enable update. 886 * @returns { Promise<void> } The promise returned by the function. 887 * @throws { BusinessError } 201 - Permissions denied. 888 * @throws { BusinessError } 202 - The application is not a system application. 889 * @throws { BusinessError } 401 - Parameter error. Possible causes: 890 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 891 * @throws { BusinessError } 16500050 - IPC connection error. 892 * @throws { BusinessError } 16500060 - Service connection error. 893 * @throws { BusinessError } 16501000 - An internal functional error occurred. 894 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 895 * @syscap SystemCapability.Ability.Form 896 * @systemapi 897 * @since 9 898 */ 899 function notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean): Promise<void>; 900 901 /** 902 * Share form by formId and deviceId. 903 * 904 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC 905 * @param { string } formId - Indicates the form ID. 906 * @param { string } deviceId - Indicates the remote device ID. 907 * @param { AsyncCallback<void> } callback - The callback of shareForm. 908 * @throws { BusinessError } 201 - Permissions denied. 909 * @throws { BusinessError } 202 - The application is not a system application. 910 * @throws { BusinessError } 401 - Parameter error. Possible causes: 911 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 912 * @throws { BusinessError } 16500050 - IPC connection error. 913 * @throws { BusinessError } 16501000 - An internal functional error occurred. 914 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 915 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 916 * @syscap SystemCapability.Ability.Form 917 * @systemapi 918 * @since 9 919 */ 920 function shareForm(formId: string, deviceId: string, callback: AsyncCallback<void>): void; 921 922 /** 923 * Share form by formId and deviceId. 924 * 925 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC 926 * @param { string } formId - Indicates the form ID. 927 * @param { string } deviceId - Indicates the remote device ID. 928 * @returns { Promise<void> } The promise returned by the function. 929 * @throws { BusinessError } 201 - Permissions denied. 930 * @throws { BusinessError } 202 - The application is not a system application. 931 * @throws { BusinessError } 401 - Parameter error. Possible causes: 932 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 933 * @throws { BusinessError } 16500050 - IPC connection error. 934 * @throws { BusinessError } 16501000 - An internal functional error occurred. 935 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 936 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 937 * @syscap SystemCapability.Ability.Form 938 * @systemapi 939 * @since 9 940 */ 941 function shareForm(formId: string, deviceId: string): Promise<void>; 942 943 /** 944 * Notify form that privacy whether to be protected. 945 * 946 * @permission ohos.permission.REQUIRE_FORM 947 * @param { Array<string> } formIds - Indicates the specified form id. 948 * @param { boolean } isProtected - Indicates whether to be protected. 949 * @param { AsyncCallback<void> } callback - The callback of notifyFormsPrivacyProtected. 950 * @throws { BusinessError } 201 - Permissions denied. 951 * @throws { BusinessError } 202 - The application is not a system application. 952 * @throws { BusinessError } 401 - Parameter error. Possible causes: 953 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 954 * @throws { BusinessError } 16500050 - IPC connection error. 955 * @throws { BusinessError } 16500060 - Service connection error. 956 * @throws { BusinessError } 16501000 - An internal functional error occurred. 957 * @syscap SystemCapability.Ability.Form 958 * @systemapi 959 * @since 9 960 */ 961 function notifyFormsPrivacyProtected( 962 formIds: Array<string>, 963 isProtected: boolean, 964 callback: AsyncCallback<void> 965 ): void; 966 967 /** 968 * Notify form that privacy whether to be protected. 969 * 970 * @permission ohos.permission.REQUIRE_FORM 971 * @param { Array<string> } formIds - Indicates the specified form id. 972 * @param { boolean } isProtected - Indicates whether to be protected. 973 * @returns { Promise<void> } The promise returned by the function. 974 * @throws { BusinessError } 201 - Permissions denied. 975 * @throws { BusinessError } 202 - The application is not a system application. 976 * @throws { BusinessError } 401 - Parameter error. Possible causes: 977 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 978 * @throws { BusinessError } 16500050 - IPC connection error. 979 * @throws { BusinessError } 16500060 - Service connection error. 980 * @throws { BusinessError } 16501000 - An internal functional error occurred. 981 * @syscap SystemCapability.Ability.Form 982 * @systemapi 983 * @since 9 984 */ 985 function notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean): Promise<void>; 986 987 /** 988 * Acquire form data by formId. 989 * 990 * @permission ohos.permission.REQUIRE_FORM 991 * @param { string } formId - Indicates the form ID. 992 * @param { AsyncCallback<{ [key: string]: Object }> } callback - The callback of acquireFormData. 993 * @throws { BusinessError } 201 - Permissions denied. 994 * @throws { BusinessError } 401 - Parameter error. Possible causes: 995 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 996 * @throws { BusinessError } 16500050 - An IPC connection error happened. 997 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 998 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 999 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1000 * invalid input parameter during form operation 1001 * @syscap SystemCapability.Ability.Form 1002 * @systemapi 1003 * @StageModelOnly 1004 * @since 10 1005 */ 1006 /** 1007 * Acquire form data by formId. 1008 * 1009 * @permission ohos.permission.REQUIRE_FORM 1010 * @param { string } formId - Indicates the form ID. 1011 * @param { AsyncCallback<Record<string, Object>> } callback - The callback of acquireFormData. 1012 * @throws { BusinessError } 201 - Permissions denied. 1013 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1014 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1015 * @throws { BusinessError } 16500050 - IPC connection error. 1016 * @throws { BusinessError } 16500060 - Service connection error. 1017 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 1018 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1019 * invalid input parameter during form operation 1020 * @syscap SystemCapability.Ability.Form 1021 * @systemapi 1022 * @StageModelOnly 1023 * @since 11 1024 */ 1025 function acquireFormData(formId: string, callback: AsyncCallback<Record<string, Object>>): void; 1026 1027 /** 1028 * Acquire form data by formId. 1029 * 1030 * @permission ohos.permission.REQUIRE_FORM 1031 * @param { string } formId - Indicates the form ID. 1032 * @returns { Promise<{ [key: string]: Object }> } The promise returned by the function. 1033 * @throws { BusinessError } 201 - Permissions denied. 1034 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1035 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1036 * @throws { BusinessError } 16500050 - An IPC connection error happened. 1037 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 1038 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 1039 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1040 * invalid input parameter during form operation 1041 * @syscap SystemCapability.Ability.Form 1042 * @systemapi 1043 * @StageModelOnly 1044 * @since 10 1045 */ 1046 /** 1047 * Acquire form data by formId. 1048 * 1049 * @permission ohos.permission.REQUIRE_FORM 1050 * @param { string } formId - Indicates the form ID. 1051 * @returns { Promise<Record<string, Object>> } The promise returned by the function. 1052 * @throws { BusinessError } 201 - Permissions denied. 1053 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1054 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1055 * @throws { BusinessError } 16500050 - IPC connection error. 1056 * @throws { BusinessError } 16500060 - Service connection error. 1057 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 1058 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1059 * invalid input parameter during form operation 1060 * @syscap SystemCapability.Ability.Form 1061 * @systemapi 1062 * @StageModelOnly 1063 * @since 11 1064 */ 1065 function acquireFormData(formId: string): Promise<Record<string, Object>>; 1066 1067 /** 1068 * Notify the form framework to set a router proxy for the specified cards. 1069 * <p>Once a card sets up a router proxy, the form framework will no longer invoke its onRouter callback, 1070 * and FMS will not trigger the actual jump.</p> 1071 * 1072 * @permission ohos.permission.REQUIRE_FORM 1073 * @param { Array<string> } formIds - Indicates the IDs of the forms that requires setting up a router proxy. 1074 * @param { Callback<Want> } proxy - Indicates the router proxy to be set up. 1075 * @param { AsyncCallback<void> } callback - The callback of setRouterProxy. 1076 * @throws { BusinessError } 201 - Permissions denied. 1077 * @throws { BusinessError } 202 - The application is not a system application. 1078 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1079 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1080 * @throws { BusinessError } 16500050 - IPC connection error. 1081 * @throws { BusinessError } 16500060 - Service connection error. 1082 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1083 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1084 * @syscap SystemCapability.Ability.Form 1085 * @systemapi 1086 * @since 11 1087 */ 1088 function setRouterProxy(formIds: Array<string>, proxy: Callback<Want>, callback: AsyncCallback<void>): void; 1089 1090 /** 1091 * Notify the form framework to set a router proxy for the specified cards. 1092 * <p>Once a card sets up a router proxy, the form framework will no longer invoke its onRouter callback, 1093 * and FMS will not trigger the actual jump.</p> 1094 * 1095 * @permission ohos.permission.REQUIRE_FORM 1096 * @param { Array<string> } formIds - Indicates the IDs of the forms that requires setting up a router proxy. 1097 * @param { Callback<Want> } proxy - Indicates the router proxy to be set up. 1098 * @returns { Promise<void> } The promise returned by the function. 1099 * @throws { BusinessError } 201 - Permissions denied. 1100 * @throws { BusinessError } 202 - The application is not a system application. 1101 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1102 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1103 * @throws { BusinessError } 16500050 - IPC connection error. 1104 * @throws { BusinessError } 16500060 - Service connection error. 1105 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1106 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1107 * @syscap SystemCapability.Ability.Form 1108 * @systemapi 1109 * @since 11 1110 */ 1111 function setRouterProxy(formIds: Array<string>, proxy: Callback<Want>): Promise<void>; 1112 1113 /** 1114 * Notify the form framework to clear the router proxy set for the specified cards. 1115 * 1116 * @permission ohos.permission.REQUIRE_FORM 1117 * @param { Array<string> } formIds - Indicates the IDs of the forms that requires clearing of router proxy. 1118 * @param { AsyncCallback<void> } callback - The callback of clearRouterProxy. 1119 * @throws { BusinessError } 201 - Permissions denied. 1120 * @throws { BusinessError } 202 - The application is not a system application. 1121 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1122 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1123 * @throws { BusinessError } 16500050 - IPC connection error. 1124 * @throws { BusinessError } 16500060 - Service connection error. 1125 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1126 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1127 * @syscap SystemCapability.Ability.Form 1128 * @systemapi 1129 * @since 11 1130 */ 1131 function clearRouterProxy(formIds: Array<string>, callback: AsyncCallback<void>): void; 1132 1133 /** 1134 * Notify the form framework to clear the router proxy set for the specified cards. 1135 * 1136 * @permission ohos.permission.REQUIRE_FORM 1137 * @param { Array<string> } formIds - Indicates the IDs of the forms that requires clearing of router proxy. 1138 * @returns { Promise<void> } The promise returned by the function. 1139 * @throws { BusinessError } 201 - Permissions denied. 1140 * @throws { BusinessError } 202 - The application is not a system application. 1141 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1142 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1143 * @throws { BusinessError } 16500050 - IPC connection error. 1144 * @throws { BusinessError } 16500060 - Service connection error. 1145 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1146 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1147 * @syscap SystemCapability.Ability.Form 1148 * @systemapi 1149 * @since 11 1150 */ 1151 function clearRouterProxy(formIds: Array<string>): Promise<void>; 1152 1153 /** 1154 * Set result of publish form. 1155 * 1156 * @permission ohos.permission.REQUIRE_FORM 1157 * @param { string } formId - Indicates the form id. 1158 * @param { formInfo.PublishFormResult } result - The result of publish form. 1159 * @throws { BusinessError } 201 - Permissions denied. 1160 * @throws { BusinessError } 202 - The application is not a system application. 1161 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1162 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1163 * @throws { BusinessError } 16500050 - IPC connection error. 1164 * @throws { BusinessError } 16500060 - Service connection error. 1165 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1166 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 1167 * @syscap SystemCapability.Ability.Form 1168 * @systemapi 1169 * @stagemodelonly 1170 * @since 12 1171 */ 1172 function setPublishFormResult(formId: string, result: formInfo.PublishFormResult): void; 1173 1174 /** 1175 * Set permanent dynamic ArkTS forms recyclable, they will be recycled when memory is low. 1176 * 1177 * @permission ohos.permission.REQUIRE_FORM 1178 * @param { Array<string> } formIds - Indicates the form id list of permanent dynamic ArkTS forms. 1179 * @returns { Promise<void> } The promise returned by the function. 1180 * @throws { BusinessError } 201 - Permissions denied. 1181 * @throws { BusinessError } 202 - caller is not system app. 1182 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1183 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1184 * @throws { BusinessError } 16500050 - IPC connection error. 1185 * @throws { BusinessError } 16500060 - Service connection error. 1186 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1187 * @syscap SystemCapability.Ability.Form 1188 * @systemapi 1189 * @stagemodelonly 1190 * @since 11 1191 */ 1192 function setFormsRecyclable(formIds: Array<string>): Promise<void>; 1193 1194 /** 1195 * Set permanent dynamic ArkTS forms recyclable, they will be recycled when memory is low. 1196 * 1197 * @permission ohos.permission.REQUIRE_FORM 1198 * @param { Array<string> } formIds - Indicates the form id list of permanent dynamic ArkTS forms. 1199 * @param { AsyncCallback<void> } callback - The callback of setFormsRecyclable. 1200 * @throws { BusinessError } 201 - Permissions denied. 1201 * @throws { BusinessError } 202 - caller is not system app. 1202 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1203 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1204 * @throws { BusinessError } 16500050 - IPC connection error. 1205 * @throws { BusinessError } 16500060 - Service connection error. 1206 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1207 * @syscap SystemCapability.Ability.Form 1208 * @systemapi 1209 * @stagemodelonly 1210 * @since 11 1211 */ 1212 function setFormsRecyclable(formIds: Array<string>, callback: AsyncCallback<void>): void; 1213 1214 /** 1215 * Recycle permanent dynamic ArkTS forms. 1216 * 1217 * @permission ohos.permission.REQUIRE_FORM 1218 * @param { Array<string> } formIds - Indicates the IDs of the forms to be recycled. 1219 * @returns { Promise<void> } The promise returned by the function. 1220 * @throws { BusinessError } 201 - Permissions denied. 1221 * @throws { BusinessError } 202 - The application is not a system application. 1222 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1223 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1224 * @throws { BusinessError } 16500050 - IPC connection error. 1225 * @throws { BusinessError } 16500060 - Service connection error. 1226 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1227 * @syscap SystemCapability.Ability.Form 1228 * @systemapi 1229 * @stagemodelonly 1230 * @since 12 1231 */ 1232 function recycleForms(formIds: Array<string>): Promise<void>; 1233 1234 /** 1235 * Recover recycled permanent dynamic ArkTS forms. 1236 * 1237 * @permission ohos.permission.REQUIRE_FORM 1238 * @param { Array<string> } formIds - Indicates the form id list of recycled permanent dynamic ArkTS forms. 1239 * @returns { Promise<void> } The promise returned by the function. 1240 * @throws { BusinessError } 201 - Permissions denied. 1241 * @throws { BusinessError } 202 - caller is not system app. 1242 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1243 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1244 * @throws { BusinessError } 16500050 - IPC connection error. 1245 * @throws { BusinessError } 16500060 - Service connection error. 1246 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1247 * @syscap SystemCapability.Ability.Form 1248 * @systemapi 1249 * @stagemodelonly 1250 * @since 11 1251 */ 1252 function recoverForms(formIds: Array<string>): Promise<void>; 1253 1254 /** 1255 * Recover recycled permanent dynamic ArkTS forms. 1256 * 1257 * @permission ohos.permission.REQUIRE_FORM 1258 * @param { Array<string> } formIds - Indicates the form id list of recycled permanent dynamic ArkTS forms. 1259 * @param { AsyncCallback<void> } callback - The callback of recoverForms. 1260 * @throws { BusinessError } 201 - Permissions denied. 1261 * @throws { BusinessError } 202 - caller is not system app. 1262 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1263 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1264 * @throws { BusinessError } 16500050 - IPC connection error. 1265 * @throws { BusinessError } 16500060 - Service connection error. 1266 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1267 * @syscap SystemCapability.Ability.Form 1268 * @systemapi 1269 * @stagemodelonly 1270 * @since 11 1271 */ 1272 function recoverForms(formIds: Array<string>, callback: AsyncCallback<void>): void; 1273 1274 /** 1275 * Update location of the form. 1276 * 1277 * @permission ohos.permission.REQUIRE_FORM 1278 * @param { string } formId - Indicates the form id. 1279 * @param { formInfo.FormLocation } location - The location of the form. 1280 * @throws { BusinessError } 201 - Permissions denied. 1281 * @throws { BusinessError } 202 - caller is not system app. 1282 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1283 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1284 * @throws { BusinessError } 16500050 - IPC connection error. 1285 * @throws { BusinessError } 16500060 - Service connection error. 1286 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1287 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 1288 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1289 * @syscap SystemCapability.Ability.Form 1290 * @systemapi 1291 * @stagemodelonly 1292 * @since 12 1293 */ 1294 function updateFormLocation(formId: string, location: formInfo.FormLocation): void; 1295 1296 /** 1297 * Listens to the event of get live form status. 1298 * 1299 * @param { 'getLiveFormStatus' } type - Indicates event type. 1300 * @param { formInfo.GetLiveFormStatusCallback } callback - The callback of get live form status. 1301 * @throws { BusinessError } 202 - The application is not a system application. 1302 * @syscap SystemCapability.Ability.Form 1303 * @systemapi 1304 * @since 20 1305 */ 1306 function on(type: 'getLiveFormStatus', 1307 callback: formInfo.GetLiveFormStatusCallback): void; 1308 1309 /** 1310 * Cancels Listening to the event of get live form status. 1311 * 1312 * @param { 'getLiveFormStatus' } type - Indicates event type. 1313 * @param { formInfo.GetLiveFormStatusCallback } [callback] - The callback of get live form status. 1314 * @throws { BusinessError } 202 - The application is not a system application. 1315 * @syscap SystemCapability.Ability.Form 1316 * @systemapi 1317 * @since 20 1318 */ 1319 function off(type: 'getLiveFormStatus', 1320 callback?: formInfo.GetLiveFormStatusCallback): void; 1321 1322 /** 1323 * Update size of the form. 1324 * 1325 * @permission ohos.permission.REQUIRE_FORM 1326 * @param { string } formId - Indicates the form id. 1327 * @param { formInfo.FormDimension } newDimension - The new dimension of the form. 1328 * @param { formInfo.Rect } newRect - The new size of the form. 1329 * @throws { BusinessError } 201 - Permissions denied. 1330 * @throws { BusinessError } 202 - caller is not system app. 1331 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1332 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 1333 * @throws { BusinessError } 16501012 - The dimension parameter is incorrect 1334 * @syscap SystemCapability.Ability.Form 1335 * @systemapi 1336 * @since 20 1337 */ 1338 function updateFormSize(formId: string, newDimension: formInfo.FormDimension, newRect: formInfo.Rect): void; 1339} 1340export default formHost; 1341