1/* 2 * Copyright (c) 2022 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 { AsyncCallback } from "./basic"; 17import { Callback } from "./basic"; 18import Want from './@ohos.app.ability.Want'; 19import formInfo from './@ohos.app.form.formInfo'; 20 21/** 22 * Interface of formHost. 23 * @namespace formHost 24 * @syscap SystemCapability.Ability.Form 25 * @systemapi 26 * @since 9 27 */ 28declare namespace formHost { 29 /** 30 * Deletes an obtained form by its ID. 31 * <p>After this method is called, the form won't be available for use by the application and the Form Manager 32 * Service no longer keeps the cache information about the form.</p> 33 * @permission ohos.permission.REQUIRE_FORM 34 * @param { string } formId - Indicates the form ID. 35 * @param { AsyncCallback<void> } callback - The callback of deleteForm. 36 * @throws { BusinessError } 201 - Permissions denied. 37 * @throws { BusinessError } 202 - The application is not a system application. 38 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 39 * @throws { BusinessError } 16500050 - An IPC connection error happened. 40 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 41 * @throws { BusinessError } 16501000 - An internal functional error occurred. 42 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 43 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 44 * @syscap SystemCapability.Ability.Form 45 * @systemapi 46 * @since 9 47 */ 48 function deleteForm(formId: string, callback: AsyncCallback<void>): void; 49 50 /** 51 * Deletes an obtained form by its ID. 52 * <p>After this method is called, the form won't be available for use by the application and the Form Manager 53 * Service no longer keeps the cache information about the form.</p> 54 * @permission ohos.permission.REQUIRE_FORM 55 * @param { string } formId - Indicates the form ID. 56 * @returns { Promise<void> } The promise returned by the function. 57 * @throws { BusinessError } 201 - Permissions denied. 58 * @throws { BusinessError } 202 - The application is not a system application. 59 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 60 * @throws { BusinessError } 16500050 - An IPC connection error happened. 61 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 62 * @throws { BusinessError } 16501000 - An internal functional error occurred. 63 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 64 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 65 * @syscap SystemCapability.Ability.Form 66 * @systemapi 67 * @since 9 68 */ 69 function deleteForm(formId: string): Promise<void>; 70 71 /** 72 * Releases an obtained form by its ID. 73 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 74 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 75 * the {@code formId}.</p> 76 * @permission ohos.permission.REQUIRE_FORM 77 * @param { string } formId - Indicates the form ID 78 * @param { AsyncCallback<void> } callback - The callback of releaseForm. 79 * @throws { BusinessError } 201 - Permissions denied. 80 * @throws { BusinessError } 202 - The application is not a system application. 81 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 82 * @throws { BusinessError } 16500050 - An IPC connection error happened. 83 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 84 * @throws { BusinessError } 16501000 - An internal functional error occurred. 85 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 86 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 87 * @syscap SystemCapability.Ability.Form 88 * @systemapi 89 * @since 9 90 */ 91 function releaseForm(formId: string, callback: AsyncCallback<void>): void; 92 93 /** 94 * Releases an obtained form by its ID. 95 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 96 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 97 * the {@code formId}.</p> 98 * @permission ohos.permission.REQUIRE_FORM 99 * @param { string } formId - Indicates the form ID 100 * @param { boolean } isReleaseCache - Indicates whether release cache or not. 101 * @param { AsyncCallback<void> } callback - The callback of releaseForm. 102 * @throws { BusinessError } 201 - Permissions denied. 103 * @throws { BusinessError } 202 - The application is not a system application. 104 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 105 * @throws { BusinessError } 16500050 - An IPC connection error happened. 106 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 107 * @throws { BusinessError } 16501000 - An internal functional error occurred. 108 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 109 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 110 * @syscap SystemCapability.Ability.Form 111 * @systemapi 112 * @since 9 113 */ 114 function releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback<void>): void; 115 116 /** 117 * Releases an obtained form by its ID. 118 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 119 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 120 * the {@code formId}.</p> 121 * @permission ohos.permission.REQUIRE_FORM 122 * @param { string } formId - Indicates the form ID 123 * @param { boolean } isReleaseCache - Indicates whether release cache or not. 124 * @returns { Promise<void> } The promise returned by the function. 125 * @throws { BusinessError } 201 - Permissions denied. 126 * @throws { BusinessError } 202 - The application is not a system application. 127 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 128 * @throws { BusinessError } 16500050 - An IPC connection error happened. 129 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 130 * @throws { BusinessError } 16501000 - An internal functional error occurred. 131 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 132 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 133 * @syscap SystemCapability.Ability.Form 134 * @systemapi 135 * @since 9 136 */ 137 function releaseForm(formId: string, isReleaseCache?: boolean): Promise<void>; 138 139 /** 140 * Requests for form update. 141 * <p>This method must be called when the application has detected that a system setting item (such as the language, 142 * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form 143 * provider automatically updates the form data (if there is any update) through the form framework, with the update 144 * process being unperceivable by the application.</p> 145 * @permission ohos.permission.REQUIRE_FORM 146 * @param { string } formId - Indicates the ID of the form to update. 147 * @param { AsyncCallback<void> } callback - The callback of requestForm. 148 * @throws { BusinessError } 201 - Permissions denied. 149 * @throws { BusinessError } 202 - The application is not a system application. 150 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 151 * @throws { BusinessError } 16500050 - An IPC connection error happened. 152 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 153 * @throws { BusinessError } 16501000 - An internal functional error occurred. 154 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 155 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 156 * @syscap SystemCapability.Ability.Form 157 * @systemapi 158 * @since 9 159 */ 160 function requestForm(formId: string, callback: AsyncCallback<void>): void; 161 162 /** 163 * Requests for form update. 164 * <p>This method must be called when the application has detected that a system setting item (such as the language, 165 * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form 166 * provider automatically updates the form data (if there is any update) through the form framework, with the update 167 * process being unperceivable by the application.</p> 168 * @permission ohos.permission.REQUIRE_FORM 169 * @param { string } formId - Indicates the ID of the form to update. 170 * @returns { Promise<void> } The promise returned by the function. 171 * @throws { BusinessError } 201 - Permissions denied. 172 * @throws { BusinessError } 202 - The application is not a system application. 173 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 174 * @throws { BusinessError } 16500050 - An IPC connection error happened. 175 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 176 * @throws { BusinessError } 16501000 - An internal functional error occurred. 177 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 178 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 179 * @syscap SystemCapability.Ability.Form 180 * @systemapi 181 * @since 9 182 */ 183 function requestForm(formId: string): Promise<void>; 184 185 /** 186 * Converts a specified temporary form that has been obtained by the application into a normal form. 187 * @permission ohos.permission.REQUIRE_FORM 188 * @param { string } formId - Indicates the ID of the temporary form to convert. 189 * @param { AsyncCallback<void> } callback - The callback of castToNormalForm. 190 * @throws { BusinessError } 201 - Permissions denied. 191 * @throws { BusinessError } 202 - The application is not a system application. 192 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 193 * @throws { BusinessError } 16500050 - An IPC connection error happened. 194 * @throws { BusinessError } 16501000 - An internal functional error occurred. 195 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 196 * @throws { BusinessError } 16501002 - The number of forms exceeds upper bound. 197 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 198 * @syscap SystemCapability.Ability.Form 199 * @systemapi 200 * @since 9 201 */ 202 function castToNormalForm(formId: string, callback: AsyncCallback<void>): void; 203 204 /** 205 * Converts a specified temporary form that has been obtained by the application into a normal form. 206 * @permission ohos.permission.REQUIRE_FORM 207 * @param { string } formId - Indicates the ID of the temporary form to convert. 208 * @returns { Promise<void> } The promise returned by the function. 209 * @throws { BusinessError } 201 - Permissions denied. 210 * @throws { BusinessError } 202 - The application is not a system application. 211 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 212 * @throws { BusinessError } 16500050 - An IPC connection error happened. 213 * @throws { BusinessError } 16501000 - An internal functional error occurred. 214 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 215 * @throws { BusinessError } 16501002 - The number of forms exceeds upper bound. 216 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 217 * @syscap SystemCapability.Ability.Form 218 * @systemapi 219 * @since 9 220 */ 221 function castToNormalForm(formId: string): Promise<void>; 222 223 /** 224 * Sends a notification to the form framework to make the specified forms visible. 225 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 226 * the form visibility change event.</p> 227 * @permission ohos.permission.REQUIRE_FORM 228 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made visible. 229 * @param { AsyncCallback<void> } callback - The callback of notifyVisibleForms. 230 * @throws { BusinessError } 201 - Permissions denied. 231 * @throws { BusinessError } 202 - The application is not a system application. 232 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 233 * @throws { BusinessError } 16500050 - An IPC connection error happened. 234 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 235 * @throws { BusinessError } 16501000 - An internal functional error occurred. 236 * @syscap SystemCapability.Ability.Form 237 * @systemapi 238 * @since 9 239 */ 240 function notifyVisibleForms(formIds: Array<string>, callback: AsyncCallback<void>): void; 241 242 /** 243 * Sends a notification to the form framework to make the specified forms visible. 244 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 245 * the form visibility change event.</p> 246 * @permission ohos.permission.REQUIRE_FORM 247 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made visible. 248 * @returns { Promise<void> } The promise returned by the function. 249 * @throws { BusinessError } 201 - Permissions denied. 250 * @throws { BusinessError } 202 - The application is not a system application. 251 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 252 * @throws { BusinessError } 16500050 - An IPC connection error happened. 253 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 254 * @throws { BusinessError } 16501000 - An internal functional error occurred. 255 * @syscap SystemCapability.Ability.Form 256 * @systemapi 257 * @since 9 258 */ 259 function notifyVisibleForms(formIds: Array<string>): Promise<void>; 260 261 /** 262 * Sends a notification to the form framework to make the specified forms invisible. 263 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 264 * the form visibility change event.</p> 265 * @permission ohos.permission.REQUIRE_FORM 266 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 267 * @param { AsyncCallback<void> } callback - The callback of notifyInvisibleForms. 268 * @throws { BusinessError } 201 - Permissions denied. 269 * @throws { BusinessError } 202 - The application is not a system application. 270 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 271 * @throws { BusinessError } 16500050 - An IPC connection error happened. 272 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 273 * @throws { BusinessError } 16501000 - An internal functional error occurred. 274 * @syscap SystemCapability.Ability.Form 275 * @systemapi 276 * @since 9 277 */ 278 function notifyInvisibleForms(formIds: Array<string>, callback: AsyncCallback<void>): void; 279 280 /** 281 * Sends a notification to the form framework to make the specified forms invisible. 282 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 283 * the form visibility change event.</p> 284 * @permission ohos.permission.REQUIRE_FORM 285 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 286 * @returns { Promise<void> } The promise returned by the function. 287 * @throws { BusinessError } 201 - Permissions denied. 288 * @throws { BusinessError } 202 - The application is not a system application. 289 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 290 * @throws { BusinessError } 16500050 - An IPC connection error happened. 291 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 292 * @throws { BusinessError } 16501000 - An internal functional error occurred. 293 * @syscap SystemCapability.Ability.Form 294 * @systemapi 295 * @since 9 296 */ 297 function notifyInvisibleForms(formIds: Array<string>): Promise<void>; 298 299 /** 300 * Notify the form framework to make the specified forms updatable. 301 * <p>You can use this method to set form refresh state to true, the form can receive new 302 * update from service.</p> 303 * @permission ohos.permission.REQUIRE_FORM 304 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 305 * @param { AsyncCallback<void> } callback - The callback of enableFormsUpdate. 306 * @throws { BusinessError } 201 - Permissions denied. 307 * @throws { BusinessError } 202 - The application is not a system application. 308 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 309 * @throws { BusinessError } 16500050 - An IPC connection error happened. 310 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 311 * @throws { BusinessError } 16501000 - An internal functional error occurred. 312 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 313 * @syscap SystemCapability.Ability.Form 314 * @systemapi 315 * @since 9 316 */ 317 function enableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void>): void; 318 319 /** 320 * Notify the form framework to make the specified forms updatable. 321 * <p>You can use this method to set form refresh state to true, the form can receive new 322 * update from service.</p> 323 * @permission ohos.permission.REQUIRE_FORM 324 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 325 * @returns { Promise<void> } The promise returned by the function. 326 * @throws { BusinessError } 201 - Permissions denied. 327 * @throws { BusinessError } 202 - The application is not a system application. 328 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 329 * @throws { BusinessError } 16500050 - An IPC connection error happened. 330 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 331 * @throws { BusinessError } 16501000 - An internal functional error occurred. 332 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 333 * @syscap SystemCapability.Ability.Form 334 * @systemapi 335 * @since 9 336 */ 337 function enableFormsUpdate(formIds: Array<string>): Promise<void>; 338 339 /** 340 * Notify the form framework to make the specified forms non-updatable. 341 * <p>You can use this method to set form refresh state to false, the form do not receive 342 * new update from service.</p> 343 * @permission ohos.permission.REQUIRE_FORM 344 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 345 * @param { AsyncCallback<void> } callback - The callback of disableFormsUpdate. 346 * @throws { BusinessError } 201 - Permissions denied. 347 * @throws { BusinessError } 202 - The application is not a system application. 348 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 349 * @throws { BusinessError } 16500050 - An IPC connection error happened. 350 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 351 * @throws { BusinessError } 16501000 - An internal functional error occurred. 352 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 353 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 354 * @syscap SystemCapability.Ability.Form 355 * @systemapi 356 * @since 9 357 */ 358 function disableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void>): void; 359 360 /** 361 * Notify the form framework to make the specified forms non updatable. 362 * <p>You can use this method to set form refresh state to false, the form do not receive 363 * new update from service.</p> 364 * @permission ohos.permission.REQUIRE_FORM 365 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 366 * @returns { Promise<void> } The promise returned by the function. 367 * @throws { BusinessError } 201 - Permissions denied. 368 * @throws { BusinessError } 202 - The application is not a system application. 369 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 370 * @throws { BusinessError } 16500050 - An IPC connection error happened. 371 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 372 * @throws { BusinessError } 16501000 - An internal functional error occurred. 373 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 374 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 375 * @syscap SystemCapability.Ability.Form 376 * @systemapi 377 * @since 9 378 */ 379 function disableFormsUpdate(formIds: Array<string>): Promise<void>; 380 381 /** 382 * Checks whether the system is ready. 383 * <p>You can use this method to obtain the system is ready.</p> 384 * @param { AsyncCallback<void> } callback - The callback of isSystemReady. 385 * @throws { BusinessError } 202 - The application is not a system application. 386 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 387 * @syscap SystemCapability.Ability.Form 388 * @systemapi 389 * @since 9 390 */ 391 function isSystemReady(callback: AsyncCallback<void>): void; 392 393 /** 394 * Checks whether the system is ready. 395 * <p>You can use this method to obtain the system is ready.</p> 396 * @returns { Promise<void> } The promise returned by the function. 397 * @throws { BusinessError } 202 - The application is not a system application. 398 * @syscap SystemCapability.Ability.Form 399 * @systemapi 400 * @since 9 401 */ 402 function isSystemReady(): Promise<void>; 403 404 /** 405 * Obtains the FormInfo objects provided by all applications on the device. 406 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 407 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 408 * @throws { BusinessError } 201 - Permissions denied. 409 * @throws { BusinessError } 202 - The application is not a system application. 410 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 411 * @throws { BusinessError } 16500050 - An IPC connection error happened. 412 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 413 * @throws { BusinessError } 16501000 - An internal functional error occurred. 414 * @syscap SystemCapability.Ability.Form 415 * @systemapi 416 * @since 9 417 */ 418 function getAllFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): void; 419 420 /** 421 * Obtains the FormInfo objects provided by all applications on the device. 422 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 423 * @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo. 424 * @throws { BusinessError } 201 - Permissions denied. 425 * @throws { BusinessError } 202 - The application is not a system application. 426 * @throws { BusinessError } 16500050 - An IPC connection error happened. 427 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 428 * @throws { BusinessError } 16501000 - An internal functional error occurred. 429 * @syscap SystemCapability.Ability.Form 430 * @systemapi 431 * @since 9 432 */ 433 function getAllFormsInfo(): Promise<Array<formInfo.FormInfo>>; 434 435 /** 436 * Obtains the FormInfo objects provided by a specified application on the device. 437 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 438 * @param { string } bundleName - Indicates the bundle name of the application. 439 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 440 * @throws { BusinessError } 201 - Permissions denied. 441 * @throws { BusinessError } 202 - The application is not a system application. 442 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 443 * @throws { BusinessError } 16500050 - An IPC connection error happened. 444 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 445 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 446 * @throws { BusinessError } 16501000 - An internal functional error occurred. 447 * @syscap SystemCapability.Ability.Form 448 * @systemapi 449 * @since 9 450 */ 451 function getFormsInfo(bundleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void; 452 453 /** 454 * Obtains the FormInfo objects provided by a specified application on the device. 455 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 456 * @param { string } bundleName - Indicates the bundle name of the application. 457 * @param { string } moduleName - Indicates the module name of the application. 458 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 459 * @throws { BusinessError } 201 - Permissions denied. 460 * @throws { BusinessError } 202 - The application is not a system application. 461 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 462 * @throws { BusinessError } 16500050 - An IPC connection error happened. 463 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 464 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 465 * @throws { BusinessError } 16501000 - An internal functional error occurred. 466 * @syscap SystemCapability.Ability.Form 467 * @systemapi 468 * @since 9 469 */ 470 function getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void; 471 472 /** 473 * Obtains the FormInfo objects provided by a specified application on the device. 474 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 475 * @param { string } bundleName - Indicates the bundle name of the application. 476 * @param { string } moduleName - Indicates the module name of the application. 477 * @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo. 478 * @throws { BusinessError } 201 - Permissions denied. 479 * @throws { BusinessError } 202 - The application is not a system application. 480 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 481 * @throws { BusinessError } 16500050 - An IPC connection error happened. 482 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 483 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 484 * @throws { BusinessError } 16501000 - An internal functional error occurred. 485 * @syscap SystemCapability.Ability.Form 486 * @systemapi 487 * @since 9 488 */ 489 function getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<formInfo.FormInfo>>; 490 491 /** 492 * Deletes invalid forms of the application in the Form Manager Service based on the list of. 493 * <p>You can use this method to delete invalid forms of the application.</p> 494 * @permission ohos.permission.REQUIRE_FORM 495 * @param { Array<string> } formIds - Indicates the specified form id. 496 * @param { AsyncCallback<number> } callback - The callback is used to return the number of invalid forms deleted 497 * by the Form Manager Service. 498 * @throws { BusinessError } 201 - Permissions denied. 499 * @throws { BusinessError } 202 - The application is not a system application. 500 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 501 * @throws { BusinessError } 16500050 - An IPC connection error happened. 502 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 503 * @throws { BusinessError } 16501000 - An internal functional error occurred. 504 * @syscap SystemCapability.Ability.Form 505 * @systemapi 506 * @since 9 507 */ 508 function deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<number>): void; 509 510 /** 511 * Deletes invalid forms of the application in the Form Manager Service based on the list of. 512 * <p>You can use this method to delete invalid forms of the application.</p> 513 * @permission ohos.permission.REQUIRE_FORM 514 * @param { Array<string> } formIds - Indicates the specified form id. 515 * @returns { Promise<number> } Returns the number of invalid forms deleted by the Form Manager Service. 516 * @throws { BusinessError } 201 - Permissions denied. 517 * @throws { BusinessError } 202 - The application is not a system application. 518 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 519 * @throws { BusinessError } 16500050 - An IPC connection error happened. 520 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 521 * @throws { BusinessError } 16501000 - An internal functional error occurred. 522 * @syscap SystemCapability.Ability.Form 523 * @systemapi 524 * @since 9 525 */ 526 function deleteInvalidForms(formIds: Array<string>): Promise<number>; 527 528 /** 529 * Obtains the Form state. 530 * <p>You can use this method to obtains the form state.</p> 531 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 532 * @param { Want } want - Indicates want of the form. 533 * @param { AsyncCallback<formInfo.FormStateInfo> } callback - The callback is used to return the form state. 534 * @throws { BusinessError } 201 - Permissions denied. 535 * @throws { BusinessError } 202 - The application is not a system application. 536 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 537 * @throws { BusinessError } 16500050 - An IPC connection error happened. 538 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 539 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 540 * @throws { BusinessError } 16501000 - An internal functional error occurred. 541 * @syscap SystemCapability.Ability.Form 542 * @systemapi 543 * @since 9 544 */ 545 function acquireFormState(want: Want, callback: AsyncCallback<formInfo.FormStateInfo>): void; 546 547 /** 548 * Obtains the Form state. 549 * <p>You can use this method to obtains the form state.</p> 550 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 551 * @param { Want } want - Indicates want of the form. 552 * @returns { Promise<formInfo.FormStateInfo> } Returns the form state. 553 * @throws { BusinessError } 201 - Permissions denied. 554 * @throws { BusinessError } 202 - The application is not a system application. 555 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 556 * @throws { BusinessError } 16500050 - An IPC connection error happened. 557 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 558 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 559 * @throws { BusinessError } 16501000 - An internal functional error occurred. 560 * @syscap SystemCapability.Ability.Form 561 * @systemapi 562 * @since 9 563 */ 564 function acquireFormState(want: Want): Promise<formInfo.FormStateInfo>; 565 566 /** 567 * Listens to the event of uninstall form. 568 * <p>You can use this method to listen to the event of uninstall form.</p> 569 * @param { string } type - Indicates event type. 570 * @param { Callback<string> } callback - The callback of formUninstall. 571 * @throws { BusinessError } 202 - The application is not a system application. 572 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 573 * @syscap SystemCapability.Ability.Form 574 * @systemapi 575 * @since 9 576 */ 577 function on(type: "formUninstall", callback: Callback<string>): void; 578 579 /** 580 * Cancels listening to the event of uninstall form. 581 * <p>You can use this method to cancel listening to the event of uninstall form.</p> 582 * @param { string } type - Indicates event type. 583 * @param { Callback<string> } callback - The callback of formUninstall. 584 * @throws { BusinessError } 202 - The application is not a system application. 585 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 586 * @syscap SystemCapability.Ability.Form 587 * @systemapi 588 * @since 9 589 */ 590 function off(type: "formUninstall", callback?: Callback<string>): void; 591 592 /** 593 * Notify form is Visible 594 * <p>You can use this method to notify form visible state.</p> 595 * @permission ohos.permission.REQUIRE_FORM 596 * @param { Array<string> } formIds - Indicates the specified form id. 597 * @param { boolean } isVisible - Indicates whether visible. 598 * @param { AsyncCallback<void> } callback - The callback of notifyFormsVisible. 599 * @throws { BusinessError } 201 - Permissions denied. 600 * @throws { BusinessError } 202 - The application is not a system application. 601 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 602 * @throws { BusinessError } 16500050 - An IPC connection error happened. 603 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 604 * @throws { BusinessError } 16501000 - An internal functional error occurred. 605 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 606 * @syscap SystemCapability.Ability.Form 607 * @systemapi 608 * @since 9 609 */ 610 function notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: AsyncCallback<void>): void; 611 612 /** 613 * Notify form is Visible 614 * <p>You can use this method to notify form visible state.</p> 615 * @permission ohos.permission.REQUIRE_FORM 616 * @param { Array<string> } formIds - Indicates the specified form id. 617 * @param { boolean } isVisible - Indicates whether visible. 618 * @returns { Promise<void> } The promise returned by the function. 619 * @throws { BusinessError } 201 - Permissions denied. 620 * @throws { BusinessError } 202 - The application is not a system application. 621 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 622 * @throws { BusinessError } 16500050 - An IPC connection error happened. 623 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 624 * @throws { BusinessError } 16501000 - An internal functional error occurred. 625 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 626 * @syscap SystemCapability.Ability.Form 627 * @systemapi 628 * @since 9 629 */ 630 function notifyFormsVisible(formIds: Array<string>, isVisible: boolean): Promise<void>; 631 632 /** 633 * Notify form enable update state. 634 * <p>You can use this method to notify form enable update state.</p> 635 * @permission ohos.permission.REQUIRE_FORM 636 * @param { Array<string> } formIds - Indicates the specified form id. 637 * @param { boolean } isEnableUpdate - Indicates whether enable update. 638 * @param { AsyncCallback<void> } callback - The callback of notifyFormsEnableUpdate. 639 * @throws { BusinessError } 201 - Permissions denied. 640 * @throws { BusinessError } 202 - The application is not a system application. 641 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 642 * @throws { BusinessError } 16500050 - An IPC connection error happened. 643 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 644 * @throws { BusinessError } 16501000 - An internal functional error occurred. 645 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 646 * @syscap SystemCapability.Ability.Form 647 * @systemapi 648 * @since 9 649 */ 650 function notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean, callback: AsyncCallback<void>): void; 651 652 /** 653 * Notify form enable update state. 654 * <p>You can use this method to notify form enable update state.</p> 655 * @permission ohos.permission.REQUIRE_FORM 656 * @param { Array<string> } formIds - Indicates the specified form id. 657 * @param { boolean } isEnableUpdate - Indicates whether enable update. 658 * @returns { Promise<void> } The promise returned by the function. 659 * @throws { BusinessError } 201 - Permissions denied. 660 * @throws { BusinessError } 202 - The application is not a system application. 661 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 662 * @throws { BusinessError } 16500050 - An IPC connection error happened. 663 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 664 * @throws { BusinessError } 16501000 - An internal functional error occurred. 665 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 666 * @syscap SystemCapability.Ability.Form 667 * @systemapi 668 * @since 9 669 */ 670 function notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean): Promise<void>; 671 672 /** 673 * Share form by formId and deviceId. 674 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC 675 * @param { string } formId - Indicates the form ID. 676 * @param { string } deviceId - Indicates the remote device ID. 677 * @param { AsyncCallback<void> } callback - The callback of shareForm. 678 * @throws { BusinessError } 201 - Permissions denied. 679 * @throws { BusinessError } 202 - The application is not a system application. 680 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 681 * @throws { BusinessError } 16500050 - An IPC connection error happened. 682 * @throws { BusinessError } 16501000 - An internal functional error occurred. 683 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 684 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 685 * @syscap SystemCapability.Ability.Form 686 * @systemapi 687 * @since 9 688 */ 689 function shareForm(formId: string, deviceId: string, callback: AsyncCallback<void>): void; 690 691 /** 692 * Share form by formId and deviceId. 693 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC 694 * @param { string } formId - Indicates the form ID. 695 * @param { string } deviceId - Indicates the remote device ID. 696 * @returns { Promise<void> } The promise returned by the function. 697 * @throws { BusinessError } 201 - Permissions denied. 698 * @throws { BusinessError } 202 - The application is not a system application. 699 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 700 * @throws { BusinessError } 16500050 - An IPC connection error happened. 701 * @throws { BusinessError } 16501000 - An internal functional error occurred. 702 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 703 * @throws { BusinessError } 16501003 - The form can not be operated by the current application. 704 * @syscap SystemCapability.Ability.Form 705 * @systemapi 706 * @since 9 707 */ 708 function shareForm(formId: string, deviceId: string): Promise<void>; 709 710 /** 711 * Notify form that privacy whether to be protected. 712 * @permission ohos.permission.REQUIRE_FORM 713 * @param { Array<string> } formIds - Indicates the specified form id. 714 * @param { boolean } isProtected - Indicates whether to be protected. 715 * @param { AsyncCallback<void> } callback - The callback of notifyFormsPrivacyProtected. 716 * @throws { BusinessError } 201 - Permissions denied. 717 * @throws { BusinessError } 202 - The application is not a system application. 718 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 719 * @throws { BusinessError } 16500050 - An IPC connection error happened. 720 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 721 * @throws { BusinessError } 16501000 - An internal functional error occurred. 722 * @syscap SystemCapability.Ability.Form 723 * @systemapi 724 * @since 9 725 */ 726 function notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean, callback: AsyncCallback<void>): void; 727 728 /** 729 * Notify form that privacy whether to be protected. 730 * @permission ohos.permission.REQUIRE_FORM 731 * @param { Array<string> } formIds - Indicates the specified form id. 732 * @param { boolean } isProtected - Indicates whether to be protected. 733 * @returns { Promise<void> } The promise returned by the function. 734 * @throws { BusinessError } 201 - Permissions denied. 735 * @throws { BusinessError } 202 - The application is not a system application. 736 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 737 * @throws { BusinessError } 16500050 - An IPC connection error happened. 738 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 739 * @throws { BusinessError } 16501000 - An internal functional error occurred. 740 * @syscap SystemCapability.Ability.Form 741 * @systemapi 742 * @since 9 743 */ 744 function notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean): Promise<void>; 745} 746export default formHost;