1 /* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_FORM_FWK_FORM_MGR_INTERFACE_H 17 #define OHOS_FORM_FWK_FORM_MGR_INTERFACE_H 18 19 #include <vector> 20 #include "form_info.h" 21 #include "form_info_filter.h" 22 #include "form_instance.h" 23 #include "form_instances_filter.h" 24 #include "form_js_info.h" 25 #include "form_provider_data.h" 26 #include "form_provider_data_proxy.h" 27 #include "form_share_info.h" 28 #include "form_state_info.h" 29 #include "ipc_types.h" 30 #include "iremote_broker.h" 31 #include "running_form_info.h" 32 #include "form_lock_info.h" 33 34 #include "want.h" 35 36 namespace OHOS { 37 namespace AppExecFwk { 38 using OHOS::AAFwk::Want; 39 40 /** 41 * @class IFormMgr 42 * IFormMgr interface is used to access form manager service. 43 */ 44 class IFormMgr : public OHOS::IRemoteBroker { 45 public: 46 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.FormMgr") 47 48 /** 49 * @brief Add form with want, send want to form manager service. 50 * @param formId The Id of the forms to add. 51 * @param want The want of the form to add. 52 * @param callerToken Caller ability token. 53 * @param formInfo Form info. 54 * @return Returns ERR_OK on success, others on failure. 55 */ 56 virtual int AddForm(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken, 57 FormJsInfo &formInfo) = 0; 58 59 /** 60 * @brief Add form with want, send want to form manager service. 61 * @param want The want of the form to add. 62 * @param runningFormInfo Running form info. 63 * @return Returns ERR_OK on success, others on failure. 64 */ CreateForm(const Want & want,RunningFormInfo & runningFormInfo)65 virtual int CreateForm(const Want &want, RunningFormInfo &runningFormInfo) 66 { 67 return ERR_OK; 68 }; 69 70 /** 71 * @brief Delete forms with formIds, send formIds to form manager service. 72 * @param formId The Id of the forms to delete. 73 * @param callerToken Caller ability token. 74 * @return Returns ERR_OK on success, others on failure. 75 */ 76 virtual int DeleteForm(const int64_t formId, const sptr<IRemoteObject> &callerToken) = 0; 77 78 /** 79 * @brief Stop rendering form. 80 * @param formId The Id of the forms to delete. 81 * @param compId The compId of the forms to delete. 82 * @return Returns ERR_OK on success, others on failure. 83 */ StopRenderingForm(const int64_t formId,const std::string & compId)84 virtual int StopRenderingForm(const int64_t formId, const std::string &compId) 85 { 86 return ERR_OK; 87 }; 88 89 /** 90 * @brief Release forms with formIds, send formIds to form manager service. 91 * @param formId The Id of the forms to release. 92 * @param callerToken Caller ability token. 93 * @param delCache Delete Cache or not. 94 * @return Returns ERR_OK on success, others on failure. 95 */ 96 virtual int ReleaseForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const bool delCache) = 0; 97 98 /** 99 * @brief Update form with formId, send formId to form manager service. 100 * @param formId The Id of the form to update. 101 * @param formProviderData Form binding data. 102 * @return Returns ERR_OK on success, others on failure. 103 */ 104 virtual int UpdateForm(const int64_t formId, const FormProviderData &formProviderData) = 0; 105 106 /** 107 * @brief Set next refresh time. 108 * @param formId The Id of the form to update. 109 * @param nextTime Next refresh time. 110 * @return Returns ERR_OK on success, others on failure. 111 */ 112 virtual int SetNextRefreshTime(const int64_t formId, const int64_t nextTime) = 0; 113 114 /** 115 * @brief Release renderer. 116 * @param formId The Id of the forms to release. 117 * @param compId The compId of the forms to release. 118 * @return Returns ERR_OK on success, others on failure. 119 */ ReleaseRenderer(int64_t formId,const std::string & compId)120 virtual int ReleaseRenderer(int64_t formId, const std::string &compId) { return ERR_OK; } 121 122 /** 123 * @brief Request to publish a form to the form host. 124 * 125 * @param want The want of the form to publish. 126 * @param withFormBindingData Indicates whether the formBindingData is carried with. 127 * @param formBindingData Indicates the form data. 128 * @param formId Return the form id to be published. 129 * @return Returns ERR_OK on success, others on failure. 130 */ 131 virtual ErrCode RequestPublishForm(Want &want, bool withFormBindingData, 132 std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId) = 0; 133 SetPublishFormResult(const int64_t formId,Constants::PublishFormResult & errorCodeInfo)134 virtual ErrCode SetPublishFormResult(const int64_t formId, Constants::PublishFormResult &errorCodeInfo) 135 { 136 return ERR_OK; 137 } 138 AcquireAddFormResult(const int64_t formId)139 virtual ErrCode AcquireAddFormResult(const int64_t formId) 140 { 141 return ERR_OK; 142 } 143 144 /** 145 * @brief Request to publish a form to the form host for normal authority. 146 * 147 * @param want The want of the form to publish. 148 * @param withFormBindingData Indicates whether the formBindingData is carried with. 149 * @param formBindingData Indicates the form data. 150 * @param formId Return the form id to be published. 151 * @return Returns ERR_OK on success, others on failure. 152 */ 153 virtual ErrCode RequestPublishFormWithSnapshot(Want &want, bool withFormBindingData, 154 std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId) = 0; 155 156 /** 157 * @brief Lifecycle update. 158 * @param formIds The Id of the forms. 159 * @param callerToken Caller ability token. 160 * @param updateType update type, enable if true and disable if false. 161 * @return Returns ERR_OK on success, others on failure. 162 */ 163 virtual int LifecycleUpdate(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 164 bool updateType) = 0; 165 166 /** 167 * @brief Request form with formId and want, send formId and want to form manager service. 168 * @param formId The Id of the form to request. 169 * @param callerToken Caller ability token. 170 * @param want The want of the form to add. 171 * @return Returns ERR_OK on success, others on failure. 172 */ 173 virtual int RequestForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const Want &want) = 0; 174 175 /** 176 * @brief Form visible/invisible notify, send formIds to form manager service. 177 * @param formIds The Id list of the forms to notify. 178 * @param callerToken Caller ability token. 179 * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE. 180 * @return Returns ERR_OK on success, others on failure. 181 */ 182 virtual int NotifyWhetherVisibleForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 183 const int32_t formVisibleType) = 0; 184 185 /** 186 * @brief Query whether has visible form by tokenId. 187 * @param tokenId Unique identification of application. 188 * @return Returns true if has visible form, false otherwise. 189 */ 190 virtual bool HasFormVisible(const uint32_t tokenId) = 0; 191 192 /** 193 * @brief temp form to normal form. 194 * @param formId The Id of the form. 195 * @param callerToken Caller ability token. 196 * @return Returns ERR_OK on success, others on failure. 197 */ 198 virtual int CastTempForm(const int64_t formId, const sptr<IRemoteObject> &callerToken) = 0; 199 200 /** 201 * @brief Dump all of form storage infos. 202 * @param formInfos All of form storage infos. 203 * @return Returns ERR_OK on success, others on failure. 204 */ 205 virtual int DumpStorageFormInfos(std::string &formInfos) = 0; 206 /** 207 * @brief Dump form info by a bundle name. 208 * @param bundleName The bundle name of form provider. 209 * @param formInfos Form infos. 210 * @return Returns ERR_OK on success, others on failure. 211 */ 212 virtual int DumpFormInfoByBundleName(const std::string &bundleName, std::string &formInfos) = 0; 213 /** 214 * @brief Dump form info by a bundle name. 215 * @param formId The id of the form. 216 * @param formInfo Form info. 217 * @return Returns ERR_OK on success, others on failure. 218 */ 219 virtual int DumpFormInfoByFormId(const std::int64_t formId, std::string &formInfo) = 0; 220 /** 221 * @brief Dump form timer by form id. 222 * @param formId The id of the form. 223 * @param formInfo Form timer. 224 * @return Returns ERR_OK on success, others on failure. 225 */ 226 virtual int DumpFormTimerByFormId(const std::int64_t formId, std::string &isTimingService) = 0; 227 /** 228 * @brief Process js message event. 229 * @param formId Indicates the unique id of form. 230 * @param want information passed to supplier. 231 * @param callerToken Caller ability token. 232 * @return Returns true if execute success, false otherwise. 233 */ 234 virtual int MessageEvent(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken) = 0; 235 236 /** 237 * @brief Process Background event. 238 * @param formId Indicates the unique id of form. 239 * @param want the want of the ability to start. 240 * @param callerToken Caller ability token. 241 * @return Returns true if execute success, false otherwise. 242 */ 243 virtual int BackgroundEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken) = 0; 244 245 /** 246 * @brief Process js router event. 247 * @param formId Indicates the unique id of form. 248 * @param want the want of the ability to start. 249 * @param callerToken Caller ability token. 250 * @return Returns true if execute success, false otherwise. 251 */ 252 virtual int RouterEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken) = 0; 253 254 /** 255 * @brief Delete the invalid forms. 256 * @param formIds Indicates the ID of the valid forms. 257 * @param callerToken Caller ability token. 258 * @param numFormsDeleted Returns the number of the deleted forms. 259 * @return Returns ERR_OK on success, others on failure. 260 */ 261 virtual int DeleteInvalidForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 262 int32_t &numFormsDeleted) = 0; 263 264 /** 265 * @brief Acquire form state info by passing a set of parameters (using Want) to the form provider. 266 * @param want Indicates a set of parameters to be transparently passed to the form provider. 267 * @param callerToken Caller ability token. 268 * @param stateInfo Returns the form's state info of the specify. 269 * @return Returns ERR_OK on success, others on failure. 270 */ 271 virtual int AcquireFormState(const Want &want, const sptr<IRemoteObject> &callerToken, 272 FormStateInfo &stateInfo) = 0; 273 274 /** 275 * @brief Notify the form is visible or not. 276 * @param formIds Indicates the ID of the forms. 277 * @param isVisible Visible or not. 278 * @param callerToken Host client. 279 * @return Returns ERR_OK on success, others on failure. 280 */ 281 virtual int NotifyFormsVisible(const std::vector<int64_t> &formIds, bool isVisible, 282 const sptr<IRemoteObject> &callerToken) = 0; 283 284 /** 285 * @brief Notify the form is privacy protected or not. 286 * @param formIds Indicates the ID of the forms. 287 * @param isProtected isProtected or not. 288 * @param callerToken Host client. 289 * @return Returns ERR_OK on success, others on failure. 290 */ 291 virtual int NotifyFormsPrivacyProtected(const std::vector<int64_t> &formIds, bool isProtected, 292 const sptr<IRemoteObject> &callerToken) = 0; 293 294 /** 295 * @brief Notify the form is enable to be updated or not. 296 * @param formIds Indicates the ID of the forms. 297 * @param isEnableUpdate enable update or not. 298 * @param callerToken Host client. 299 * @return Returns ERR_OK on success, others on failure. 300 */ 301 virtual int NotifyFormsEnableUpdate(const std::vector<int64_t> &formIds, bool isEnableUpdate, 302 const sptr<IRemoteObject> &callerToken) = 0; 303 304 /** 305 * @brief Get All FormsInfo. 306 * @param formInfos Return the forms' information of all forms provided. 307 * @return Returns ERR_OK on success, others on failure. 308 */ 309 virtual int GetAllFormsInfo(std::vector<FormInfo> &formInfos) = 0; 310 311 /** 312 * @brief Get forms info by bundle name . 313 * @param bundleName Application name. 314 * @param formInfos Return the forms' information of the specify application name. 315 * @return Returns ERR_OK on success, others on failure. 316 */ 317 virtual int GetFormsInfoByApp(std::string &bundleName, std::vector<FormInfo> &formInfos) = 0; 318 319 /** 320 * @brief Get forms info by bundle name and module name. 321 * @param bundleName bundle name. 322 * @param moduleName Module name of hap. 323 * @param formInfos Return the forms' information of the specify bundle name and module name. 324 * @return Returns ERR_OK on success, others on failure. 325 */ 326 virtual int GetFormsInfoByModule(std::string &bundleName, std::string &moduleName, 327 std::vector<FormInfo> &formInfos) = 0; 328 329 /** 330 * @brief Get forms info specfied by filter parameters. 331 * @param filter Filter that contains necessary conditions, such as bundle name, module name, dimensions. 332 * @param formInfos Return the forms' information specified by filter. 333 * @return Returns ERR_OK on success, others on failure. 334 */ GetFormsInfoByFilter(const FormInfoFilter & filter,std::vector<FormInfo> & formInfos)335 virtual int GetFormsInfoByFilter(const FormInfoFilter &filter, std::vector<FormInfo> &formInfos) 336 { 337 return ERR_OK; 338 } 339 340 /** 341 * @brief This function is called by formProvider and gets forms info by the bundle name of the calling ability. 342 * The bundle name will be retrieved by form service manager. 343 * @param filter Filter that contains attributes that the formInfos have to have. 344 * @param formInfos Return the forms' information of the calling bundle name 345 * @return Returns ERR_OK on success, others on failure. 346 */ 347 virtual int32_t GetFormsInfo(const FormInfoFilter &filter, std::vector<FormInfo> &formInfos) = 0; 348 349 /** 350 * @brief This function is called by formProvider and gets forms info by formId of the calling ability. 351 * The conditions will be retrieved by form service manager. 352 * @param formId 353 * @param formInfo Return the forms' information 354 * @return Returns ERR_OK on success, others on failure. 355 */ GetPublishedFormInfoById(const int64_t formId,RunningFormInfo & formInfo)356 virtual int32_t GetPublishedFormInfoById(const int64_t formId, RunningFormInfo &formInfo) 357 { 358 return 0; 359 } 360 361 /** 362 * @brief This function is called by formProvider and gets forms info. 363 * @param formInfos Return the forms' information 364 * @return Returns ERR_OK on success, others on failure. 365 */ GetPublishedFormInfos(std::vector<RunningFormInfo> & formInfos)366 virtual int32_t GetPublishedFormInfos(std::vector<RunningFormInfo> &formInfos) 367 { 368 return 0; 369 } 370 371 /** 372 * @brief Check if the request of publishing a form is supported by the host. 373 * @return Returns true if the request is supported and false otherwise. 374 */ 375 virtual bool IsRequestPublishFormSupported() = 0; 376 377 /** 378 * @brief Start an ability. This function can only be called by a form extension of a system app. 379 * @param want includes ability name, parameters and related info sending to an ability. 380 * @param callerToken token of the ability that initially calls this function. 381 * @return Returns ERR_OK on success, others on failure. 382 */ 383 virtual int32_t StartAbility(const Want &want, const sptr<IRemoteObject> &callerToken) = 0; 384 385 /** 386 * @brief Start an ability by form manager service. 387 * @param want includes ability name, parameters and related info sending to an ability. 388 * @return Returns ERR_OK on success, others on failure. 389 */ StartAbilityByFms(const Want & want)390 virtual int32_t StartAbilityByFms(const Want &want) 391 { 392 return 0; 393 } 394 395 /** 396 * @brief Start an ability by cross bundle. 397 * @param want includes ability name, parameters and related info sending to an ability. 398 * @return Returns ERR_OK on success, others on failure. 399 */ StartAbilityByCrossBundle(const Want & want)400 virtual int32_t StartAbilityByCrossBundle(const Want &want) 401 { 402 return 0; 403 } 404 405 /** 406 * @brief Share form by formID and deviceID. 407 * @param formId Indicates the unique id of form. 408 * @param deviceId Indicates the remote device ID. 409 * @param callerToken Host client. 410 * @param requestCode Indicates the request code of this share form. 411 * @return Returns ERR_OK on success, others on failure. 412 */ 413 virtual int32_t ShareForm(int64_t formId, const std::string &deviceId, const sptr<IRemoteObject> &callerToken, 414 int64_t requestCode) = 0; 415 416 /** 417 * @brief Acquire form data by formId. 418 * @param formId The Id of the form to acquire data. 419 * @param requestCode The request code of this form. 420 * @param callerToken Indicates the host client. 421 * @param formData Return the forms' information of customization 422 * @return Returns ERR_OK on success, others on failure. 423 */ 424 virtual int32_t AcquireFormData(int64_t formId, int64_t requestCode, const sptr<IRemoteObject> &callerToken, 425 AAFwk::WantParams &formData) = 0; 426 427 /** 428 * @brief Receive form sharing information from remote. 429 * @param info Indicates form sharing information. 430 * @return Returns ERR_OK on success, others on failure. 431 */ 432 virtual int32_t RecvFormShareInfoFromRemote(const FormShareInfo &info) = 0; 433 434 /** 435 * @brief Check form manager service ready. 436 * @return Return true if form manager service Ready; return false otherwise. 437 */ 438 virtual bool CheckFMSReady() = 0; 439 440 /** 441 * @brief Check whether the form is system app. 442 * @param bundleName The bundleName of the form. 443 * @return Returns true if the form app is system, others false. 444 */ IsSystemAppForm(const std::string & bundleName)445 virtual bool IsSystemAppForm(const std::string &bundleName) 446 { 447 return false; 448 } 449 450 /** 451 * @brief Register form add observer by bundle. 452 * @param bundleName BundleName of the form host 453 * @param callerToken Caller ability token. 454 * @return Returns ERR_OK on success, others on failure. 455 */ 456 virtual ErrCode RegisterFormAddObserverByBundle(const std::string bundleName, 457 const sptr<IRemoteObject> &callerToken) = 0; 458 459 /** 460 * @brief Register form remove observer by bundle. 461 * @param bundleName BundleName of the form host 462 * @param callerToken Caller ability token. 463 * @return Returns ERR_OK on success, others on failure. 464 */ 465 virtual ErrCode RegisterFormRemoveObserverByBundle(const std::string bundleName, 466 const sptr<IRemoteObject> &callerToken) = 0; 467 468 /** 469 * @brief The Call Event triggers the callee method. 470 * @param funcName function name which is used by callee. 471 * @param params parameter which is used by callee. 472 * @return Returns ERR_OK on success, others on failure. 473 */ 474 virtual int32_t SetBackgroundFunction(const std::string funcName, const std::string params) = 0; 475 /** 476 * @brief get forms count. 477 * @param isTempFormFlag Indicates temp form or not. 478 * @param formCount Returns the number of the cast or temp form. 479 * @return Returns ERR_OK on success, others on failure. 480 */ 481 virtual int32_t GetFormsCount(bool isTempFormFlag, int32_t &formCount) = 0; 482 483 /** 484 * @brief get host forms count. 485 * @param bundleName Indicates form host bundleName. 486 * @param formCount Returns the number of the host form. 487 * @return Returns ERR_OK on success, others on failure. 488 */ 489 virtual int32_t GetHostFormsCount(std::string &bundleName, int32_t &formCount) = 0; 490 491 /** 492 * @brief Get the running form infos. 493 * @param isUnusedIncluded Indicates whether to include unused forms. 494 * @param runningFormInfos Return the running forms' infos currently. 495 * @return Returns ERR_OK on success, others on failure. 496 */ 497 virtual ErrCode GetRunningFormInfos(bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos) = 0; 498 499 /** 500 * @brief Get the running form infos by bundle name. 501 * @param bundleName Application name. 502 * @param isUnusedIncluded Indicates whether to include unused forms. 503 * @param runningFormInfos Return the running forms' infos of the specify application name. 504 * @return Returns ERR_OK on success, others on failure. 505 */ 506 virtual ErrCode GetRunningFormInfosByBundleName( 507 const std::string &bundleName, bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos) = 0; 508 509 /** 510 * @brief Get form instances by filter info. 511 * @param formInstancesFilter includes bundleName, moduleName, formName, abilityName to get formInstances. 512 * @param formInstances return formInstances 513 * @return return ERR_OK on get info success, others on failure. 514 */ 515 virtual ErrCode GetFormInstancesByFilter(const FormInstancesFilter &formInstancesFilter, 516 std::vector<FormInstance> &formInstances) = 0; 517 518 /** 519 * @brief Get form instance by formId. 520 * @param formId formId Indicates the unique id of form. 521 * @param formInstance return formInstance 522 * @return return ERR_OK on get info success, others on failure. 523 */ 524 virtual ErrCode GetFormInstanceById(const int64_t formId, FormInstance &formInstance) = 0; 525 526 /** 527 * @brief Get form instance by formId, include form store in DB. 528 * @param formId formId Indicates the unique id of form. 529 * @param isUnusedIncluded Indicates whether to include unused form instance. 530 * @param formInstance return formInstance 531 * @return return ERR_OK on get info success, others on failure. 532 */ GetFormInstanceById(const int64_t formId,bool isUnusedIncluded,FormInstance & formInstance)533 virtual ErrCode GetFormInstanceById(const int64_t formId, bool isUnusedIncluded, FormInstance &formInstance) 534 { 535 return 0; 536 } 537 538 /** 539 * @brief Register form add observer. 540 * @param bundleName BundleName of the form host 541 * @param callerToken Caller ability token. 542 * @return Returns ERR_OK on success, others on failure. 543 */ 544 virtual ErrCode RegisterAddObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) = 0; 545 546 /** 547 * @brief Register form remove observer. 548 * @param bundleName BundleName of the form host 549 * @param callerToken Caller ability token. 550 * @return Returns ERR_OK on success, others on failure. 551 */ 552 virtual ErrCode RegisterRemoveObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) = 0; 553 554 /** 555 * @brief Register form router event proxy. 556 * @param formIds Indicates the id of the forms. 557 * @param callerToken Router proxy call back client. 558 * @return Returns ERR_OK on success, others on failure. 559 */ 560 virtual ErrCode RegisterFormRouterProxy(const std::vector<int64_t> &formIds, 561 const sptr<IRemoteObject> &callerToken) = 0; 562 563 /** 564 * @brief Unregister form router event proxy. 565 * @param formIds Indicates the id of the forms. 566 * @return Returns ERR_OK on success, others on failure. 567 */ 568 virtual ErrCode UnregisterFormRouterProxy(const std::vector<int64_t> &formIds) = 0; 569 570 /** 571 * @brief Update proxy form with formId. 572 * @param formId The Id of the form to update. 573 * @param FormProviderData Form binding data. 574 * @param std::vector<FormDataProxy> Form proxy vector. 575 * @return Returns ERR_OK on success, others on failure. 576 */ UpdateProxyForm(int64_t formId,const FormProviderData & FormProviderData,const std::vector<FormDataProxy> & formDataProxies)577 virtual ErrCode UpdateProxyForm(int64_t formId, const FormProviderData &FormProviderData, 578 const std::vector<FormDataProxy> &formDataProxies) { return ERR_OK; } 579 580 /** 581 * @brief Request to publish a proxy form to the form host. 582 * @param want The want of the form to publish. 583 * @param withFormBindingData Indicates whether the formBindingData is carried with. 584 * @param formBindingData Indicates the form data. 585 * @param formId Return the form id to be published. 586 * @param std::vector<FormDataProxy> Form proxy vector. 587 * @return Returns ERR_OK on success, others on failure. 588 */ RequestPublishProxyForm(Want & want,bool withFormBindingData,std::unique_ptr<FormProviderData> & formBindingData,int64_t & formId,const std::vector<FormDataProxy> & formDataProxies)589 virtual ErrCode RequestPublishProxyForm(Want &want, bool withFormBindingData, 590 std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId, 591 const std::vector<FormDataProxy> &formDataProxies) { return ERR_OK; } 592 593 /** 594 * @brief Registers the callback to publish form. The callback is used to process the publish form request 595 * when the system handler is not found. 596 * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor. 597 * @return Returns ERR_OK on success, others on failure. 598 */ RegisterPublishFormInterceptor(const sptr<IRemoteObject> & interceptorCallback)599 virtual int32_t RegisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback) 600 { 601 return 0; 602 } 603 604 /** 605 * @brief Unregisters the callback to publish form. The callback is used to process the publish form request 606 * when the system handler is not found. 607 * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor. 608 * @return Returns ERR_OK on success, others on failure. 609 */ UnregisterPublishFormInterceptor(const sptr<IRemoteObject> & interceptorCallback)610 virtual int32_t UnregisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback) 611 { 612 return 0; 613 } 614 615 /** 616 * @brief Register click callback observer. 617 * @param bundleName BundleName of the form host. 618 * @param formEventType Form event type. 619 * @param observer Form click event callback listener. 620 * @return Returns ERR_OK on success, others on failure. 621 */ 622 virtual ErrCode RegisterClickEventObserver( 623 const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer) = 0; 624 625 /** 626 * @brief Unregister click callback observer. 627 * @param bundleName BundleName of the form host. 628 * @param formEventType Form event type. 629 * @param observer Form click event callback listener. 630 * @return Returns ERR_OK on success, others on failure. 631 */ 632 virtual ErrCode UnregisterClickEventObserver( 633 const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer) = 0; 634 635 /** 636 * @brief Set forms recyclable 637 * @param formIds Indicates the id of the forms. 638 * @return Returns ERR_OK on success, others on failure. 639 */ SetFormsRecyclable(const std::vector<int64_t> & formIds)640 virtual int32_t SetFormsRecyclable(const std::vector<int64_t> &formIds) 641 { 642 return 0; 643 } 644 645 /** 646 * @brief Recycle forms 647 * @param formIds Indicates the id of the forms. 648 * @param want The want of forms to be recycled. 649 * @return Returns ERR_OK on success, others on failure. 650 */ RecycleForms(const std::vector<int64_t> & formIds,const Want & want)651 virtual int32_t RecycleForms(const std::vector<int64_t> &formIds, const Want &want) 652 { 653 return 0; 654 } 655 656 /** 657 * @brief Recover recycled forms 658 * @param formIds Indicates the id of the forms. 659 * @param want The want of forms to be recovered. 660 * @return Returns ERR_OK on success, others on failure. 661 */ RecoverForms(const std::vector<int64_t> & formIds,const Want & want)662 virtual int32_t RecoverForms(const std::vector<int64_t> &formIds, const Want &want) 663 { 664 return 0; 665 } 666 667 /** 668 * @brief Update formLocation with formId. 669 * @param formId The Id of the form to update. 670 * @param formLocation The FormLocation. 671 * @return Returns ERR_OK on success, others on failure. 672 */ UpdateFormLocation(const int64_t & formId,const int32_t & formLocation)673 virtual ErrCode UpdateFormLocation(const int64_t &formId, const int32_t &formLocation) 674 { 675 return ERR_OK; 676 } 677 678 /** 679 * @brief Update form with formRefreshType, send to form manager service. 680 * @param formRefreshType The type of the form to refresh, 0: AllForm 1: 2: AppForm 2: AtomicServiceForm 681 * @return Returns ERR_OK on success, others on failure. 682 */ BatchRefreshForms(const int32_t formRefreshType)683 virtual int32_t BatchRefreshForms(const int32_t formRefreshType) 684 { 685 return 0; 686 } 687 688 /** 689 * @brief enable/disable form update. 690 * @param bundleName BundleName of the form host. 691 * @param enable True for enable form, false for disable form. 692 * @return Returns ERR_OK on success, others on failure. 693 */ EnableForms(const std::string bundleName,const bool enable)694 virtual int32_t EnableForms(const std::string bundleName, const bool enable) 695 { 696 return 0; 697 } 698 699 /** 700 * @brief Check form bundle is controlled. 701 * @param bundleName The bundle name of form to be check. 702 * @return Returns true for form bundle is controlled. 703 */ IsFormBundleForbidden(const std::string & bundleName)704 virtual bool IsFormBundleForbidden(const std::string &bundleName) 705 { 706 return false; 707 } 708 709 /** 710 * @brief lock/unlock form update. 711 * @param formLockInfos Indicates the lockForm data. 712 * @param type Indicates the Lock Type. 713 * @return Returns ERR_OK on success, others on failure. 714 */ LockForms(const std::vector<FormLockInfo> & formLockInfos,OHOS::AppExecFwk::LockChangeType type)715 virtual int32_t LockForms(const std::vector<FormLockInfo> &formLockInfos, OHOS::AppExecFwk::LockChangeType type) 716 { 717 return 0; 718 } 719 720 /** 721 * @brief Check form bundle is protect. 722 * @param bundleName The bundle name of form to be check. 723 * @param formId The Id of the form to query. 724 * @return Returns true for form bundle is protect. 725 */ IsFormBundleProtected(const std::string & bundleName,int64_t formId)726 virtual bool IsFormBundleProtected(const std::string &bundleName, int64_t formId) 727 { 728 return false; 729 } 730 731 /** 732 * @brief Check form bundle is exempt. 733 * @param formId The Id of the form to query. 734 * @return Returns true for form bundle is exempt. 735 */ IsFormBundleExempt(int64_t formId)736 virtual bool IsFormBundleExempt(int64_t formId) 737 { 738 return false; 739 } 740 741 /** 742 * @brief Notify the form is locked or not. 743 * @param formId Indicates the ID of the form. 744 * @param isLocked locked or not. 745 * @return Returns ERR_OK on success, others on failure. 746 */ NotifyFormLocked(const int64_t & formId,bool isLocked)747 virtual int32_t NotifyFormLocked(const int64_t &formId, bool isLocked) 748 { 749 return 0; 750 } 751 752 /** 753 * @brief Update size of form. 754 * @param formId The Id of the form to update. 755 * @param width The width value to be updated. 756 * @param height The height value to be updated. 757 * @param borderWidth The borderWidth value to be updated. 758 * @return Returns ERR_OK on success, others on failure. 759 */ UpdateFormSize(const int64_t & formId,float width,float height,float borderWidth)760 virtual ErrCode UpdateFormSize(const int64_t &formId, float width, float height, float borderWidth) 761 { 762 return ERR_OK; 763 } 764 765 /** 766 * @brief Open the form edit ability. 767 * @param abilityName The form edit ability name. 768 * @param formId The edit form ID. 769 * @param isMainPage Open the main edit page. 770 * @return Returns ERR_OK on success, others on failure. 771 */ OpenFormEditAbility(const std::string & abilityName,const int64_t & formId,bool isMainPage)772 virtual ErrCode OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage) 773 { 774 return ERR_OK; 775 } 776 777 /** 778 * @brief Register overflow proxy in fms 779 * @param callerToken The form host proxy 780 * @return Return true for form register success 781 */ RegisterOverflowProxy(const sptr<IRemoteObject> & callerToken)782 virtual bool RegisterOverflowProxy(const sptr<IRemoteObject> &callerToken) 783 { 784 return false; 785 } 786 787 /** 788 * @brief Unregister overflow proxy in fms 789 * @return Return true for form unregister success 790 */ UnregisterOverflowProxy()791 virtual bool UnregisterOverflowProxy() 792 { 793 return false; 794 } 795 796 /** 797 * @brief Request overflow with specific range 798 * @param formId The id of the form to request overflow 799 * @param overflowInfo The overflowInfo to explict overflow area and duration 800 * @param isOverflow True for request overflow, false for cancel overflow, default value is true 801 * @return Return ERR_OK on success, others on failure 802 */ 803 virtual ErrCode RequestOverflow(const int64_t formId, const OverflowInfo &overflowInfo, bool isOverflow = true) 804 { 805 return ERR_OK; 806 } 807 808 /** 809 * @brief Register change sceneAnimation state proxy in fms. 810 * @param callerToken The form host proxy. 811 * @return Returns true for change SceneAnimation state proxy register success. 812 */ RegisterChangeSceneAnimationStateProxy(const sptr<IRemoteObject> & callerToken)813 virtual bool RegisterChangeSceneAnimationStateProxy(const sptr<IRemoteObject> &callerToken) 814 { 815 return false; 816 } 817 818 /** 819 * @brief Unregister change sceneAnimation state proxy in fms. 820 * @return Returns true for change SceneAnimation state proxy unregister success. 821 */ UnregisterChangeSceneAnimationStateProxy()822 virtual bool UnregisterChangeSceneAnimationStateProxy() 823 { 824 return false; 825 } 826 827 /** 828 * @brief Change SceneAnimation State. 829 * @param formId The formId. 830 * @param state 1 for activate SceneAnimation, 0 for deactivate SceneAnimation 831 * @return Return ERR_OK on success, others on failure 832 */ ChangeSceneAnimationState(const int64_t formId,int32_t state)833 virtual ErrCode ChangeSceneAnimationState(const int64_t formId, int32_t state) 834 { 835 return ERR_OK; 836 } 837 838 /** 839 * @brief Set get form rect proxy in fms. 840 * @param callerToken The form host proxy. 841 * @return Returns ERR_OK for setting success. 842 */ RegisterGetFormRectProxy(const sptr<IRemoteObject> & callerToken)843 virtual bool RegisterGetFormRectProxy(const sptr<IRemoteObject> &callerToken) 844 { 845 return false; 846 } 847 848 /** 849 * @brief Unregister get form rect proxy in fms. 850 * @return Returns true for get form rect proxy unregister success. 851 */ UnregisterGetFormRectProxy()852 virtual bool UnregisterGetFormRectProxy() 853 { 854 return false; 855 } 856 857 /** 858 * @brief Get the form rect. 859 * @param formId The formId. 860 * @param rect The desktop's rect related to the specified formId. 861 * @return Returns error code of method execute, which ERR_OK represents success. 862 */ GetFormRect(const int64_t formId,Rect & rect)863 virtual ErrCode GetFormRect(const int64_t formId, Rect &rect) 864 { 865 return ERR_OK; 866 } 867 868 /** 869 * @brief Update form size. 870 * @param formId The Id of the form to update. 871 * @param newDimension The dimension value to be updated. 872 * @param newRect The rect value to be updated. 873 * @return Returns ERR_OK on success, others on failure. 874 */ UpdateFormSize(const int64_t formId,const int32_t newDimension,const Rect & newRect)875 virtual ErrCode UpdateFormSize(const int64_t formId, const int32_t newDimension, const Rect &newRect) 876 { 877 return ERR_OK; 878 } 879 880 /** 881 * @brief Set get live form status proxy in fms. 882 * @param callerToken The form host proxy. 883 * @return Returns true for get live form status proxy register success. 884 */ RegisterGetLiveFormStatusProxy(const sptr<IRemoteObject> & callerToken)885 virtual bool RegisterGetLiveFormStatusProxy(const sptr<IRemoteObject> &callerToken) 886 { 887 return false; 888 } 889 890 /** 891 * @brief Unregister get live form status proxy in fms. 892 * @return Returns true for get live form status proxy unregister success. 893 */ UnregisterGetLiveFormStatusProxy()894 virtual bool UnregisterGetLiveFormStatusProxy() 895 { 896 return false; 897 } 898 899 enum class Message { 900 // ipc id 1-1000 for kit 901 // ipc id 1001-2000 for DMS 902 // ipc id 2001-3000 for tools 903 // ipc id for create (3001) 904 FORM_MGR_ADD_FORM = 3001, 905 FORM_MGR_ADD_FORM_OHOS, 906 FORM_MGR_DELETE_FORM, 907 FORM_MGR_UPDATE_FORM, 908 FORM_MGR_LIFECYCLE_UPDATE, 909 FORM_MGR_REQUEST_FORM, 910 FORM_MGR_RELEASE_FORM, 911 FORM_MGR_RELEASE_CACHED_FORM, 912 FORM_MGR_CAST_TEMP_FORM, 913 FORM_MGR_EVENT_NOTIFY, 914 FORM_MGR_CHECK_AND_DELETE_INVALID_FORMS, 915 FORM_MGR_SET_NEXT_REFRESH_TIME, 916 FORM_MGR_NOTIFY_FORM_WHETHER_VISIBLE, 917 FORM_MGR_STORAGE_FORM_INFOS, 918 FORM_MGR_FORM_INFOS_BY_NAME, 919 FORM_MGR_FORM_INFOS_BY_ID, 920 FORM_MGR_FORM_TIMER_INFO_BY_ID, 921 FORM_MGR_MESSAGE_EVENT, 922 FORM_MGR_BATCH_ADD_FORM_RECORDS_ST, 923 FORM_MGR_CLEAR_FORM_RECORDS_ST, 924 FORM_MGR_DISTRIBUTED_DATA_ADD_FORM__ST, 925 FORM_MGR_DISTRIBUTED_DATA_DELETE_FORM__ST, 926 FORM_MGR_DELETE_INVALID_FORMS, 927 FORM_MGR_ACQUIRE_FORM_STATE, 928 FORM_MGR_NOTIFY_FORMS_VISIBLE, 929 FORM_MGR_NOTIFY_FORMS_ENABLE_UPDATE, 930 FORM_MGR_GET_ALL_FORMS_INFO, 931 FORM_MGR_GET_FORMS_INFO_BY_APP, 932 FORM_MGR_GET_FORMS_INFO_BY_MODULE, 933 FORM_MGR_GET_FORMS_INFO, 934 FORM_MGR_ROUTER_EVENT, 935 FORM_MGR_UPDATE_ROUTER_ACTION, 936 FORM_MGR_ADD_FORM_INFO, 937 FORM_MGR_REMOVE_FORM_INFO, 938 FORM_MGR_REQUEST_PUBLISH_FORM, 939 FORM_MGR_IS_REQUEST_PUBLISH_FORM_SUPPORTED, 940 FORM_MGR_SHARE_FORM, 941 FORM_MGR_RECV_FORM_SHARE_INFO_FROM_REMOTE, 942 FORM_MGR_START_ABILITY, 943 FORM_MGR_NOTIFY_FORMS_PRIVACY_PROTECTED, 944 FORM_MGR_CHECK_FMS_READY, 945 FORM_MGR_BACKGROUND_EVENT, 946 FORM_MGR_STOP_RENDERING_FORM, 947 FORM_MGR_REGISTER_FORM_ADD_OBSERVER_BY_BUNDLE, 948 FORM_MGR_REGISTER_FORM_REMOVE_OBSERVER_BY_BUNDLE, 949 FORM_MGR_ACQUIRE_DATA, 950 FORM_MGR_GET_FORMS_COUNT, 951 FORM_MGR_GET_HOST_FORMS_COUNT, 952 FORM_MGR_GET_RUNNING_FORM_INFOS, 953 FORM_MGR_GET_RUNNING_FORM_INFOS_BY_BUNDLE, 954 FORM_MGR_GET_FORM_INSTANCES_FROM_BY_FILTER, 955 FORM_MGR_GET_FORM_INSTANCES_FROM_BY_ID, 956 FORM_MGR_REGISTER_ADD_OBSERVER, 957 FORM_MGR_REGISTER_REMOVE_OBSERVER, 958 FORM_MGR_UPDATE_PROXY_FORM, 959 FORM_MGR_REQUEST_PUBLISH_PROXY_FORM, 960 FORM_MGR_RELEASE_RENDERER, 961 FORM_MGR_REGISTER_PUBLISH_FORM_INTERCEPTOR, 962 FORM_MGR_UNREGISTER_PUBLISH_FORM_INTERCEPTOR, 963 FORM_MGR_REGISTER_CLICK_EVENT_OBSERVER, 964 FORM_MGR_UNREGISTER_CLICK_EVENT_OBSERVER, 965 FORM_MGR_REGISTER_FORM_ROUTER_PROXY, 966 FORM_MGR_UNREGISTER_FORM_ROUTER_PROXY, 967 FORM_MGR_SET_FORMS_RECYCLABLE, 968 FORM_MGR_RECYCLE_FORMS, 969 FORM_MGR_RECOVER_FORMS, 970 FORM_MGR_HAS_FORM_VISIBLE_WITH_TOKENID, 971 FORM_MGR_UPDATE_FORM_LOCATION, 972 FORM_MGR_GET_FORMS_INFO_BY_FILTER, 973 FORM_MGR_CREATE_FORM, 974 FORM_MGR_PUBLISH_FORM_ERRCODE_RESULT, 975 FORM_MGR_ACQUIRE_ADD_FORM_RESULT, 976 FORM_MGR_REQUEST_PUBLISH_FORM_WITH_SNAPSHOT, 977 FORM_MGR_BATCH_REFRESH_FORMS, 978 FORM_MGR_ENABLE_FORMS, 979 FORM_MGR_IS_SYSTEM_APP_FORM, 980 FORM_MGR_IS_FORM_BUNDLE_FORBIDDEN, 981 FORM_MGR_UPDATE_FORM_SIZE, 982 FORM_MGR_LOCK_FORMS, 983 FORM_MGR_IS_FORM_BUNDLE_PEOTECTED, 984 FORM_MGR_IS_FORM_BUNDLE_EXEMPT, 985 FORM_MGR_NOTIFY_FORM_LOCKED, 986 FORM_MGR_START_ABILITY_BY_FMS, 987 FORM_MGR_START_ABILITY_BY_CROSS_BUNDLE, 988 FORM_MGR_GET_PUBLISHED_FORM_INFOS, 989 FORM_MGR_GET_PUBLISHED_FORM_INFO_BY_ID, 990 FORM_MGR_OPEN_FORM_EDIT_ABILITY, 991 FORM_MGR_REGISTER_OVERFLOW_PROXY, 992 FORM_MGR_UNREGISTER_OVERFLOW_PROXY, 993 FORM_MGR_REQUEST_OVERFLOW, 994 FORM_MGR_REGISTER_CHANGE_SCENEANIMATION_STATE_PROXY, 995 FORM_MGR_UNREGISTER_CHANGE_SCENEANIMATION_STATE_PROXY, 996 FORM_MGR_CHANGE_SCENE_ANIMATION_STATE, 997 FORM_MGR_REGISTER_GET_FORM_RECT, 998 FORM_MGR_UNREGISTER_GET_FORM_RECT, 999 FORM_MGR_GET_FORM_RECT, 1000 FORM_MGR_NOTIFY_UPDATE_FORM_SIZE, 1001 FORM_MGR_REGISTER_GET_LIVE_FORM_STATUS, 1002 FORM_MGR_UNREGISTER_GET_LIVE_FORM_STATUS, 1003 }; 1004 }; 1005 } // namespace AppExecFwk 1006 } // namespace OHOS 1007 #endif // OHOS_FORM_FWK_FORM_MGR_INTERFACE_H 1008