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 33 #include "want.h" 34 35 namespace OHOS { 36 namespace AppExecFwk { 37 using OHOS::AAFwk::Want; 38 39 /** 40 * @class IFormMgr 41 * IFormMgr interface is used to access form manager service. 42 */ 43 class IFormMgr : public OHOS::IRemoteBroker { 44 public: 45 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.FormMgr") 46 47 /** 48 * @brief Add form with want, send want to form manager service. 49 * @param formId The Id of the forms to add. 50 * @param want The want of the form to add. 51 * @param callerToken Caller ability token. 52 * @param formInfo Form info. 53 * @return Returns ERR_OK on success, others on failure. 54 */ 55 virtual int AddForm(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken, 56 FormJsInfo &formInfo) = 0; 57 58 /** 59 * @brief Add form with want, send want to form manager service. 60 * @param want The want of the form to add. 61 * @param runningFormInfo Running form info. 62 * @return Returns ERR_OK on success, others on failure. 63 */ CreateForm(const Want & want,RunningFormInfo & runningFormInfo)64 virtual int CreateForm(const Want &want, RunningFormInfo &runningFormInfo) 65 { 66 return ERR_OK; 67 }; 68 69 /** 70 * @brief Delete forms with formIds, send formIds to form manager service. 71 * @param formId The Id of the forms to delete. 72 * @param callerToken Caller ability token. 73 * @return Returns ERR_OK on success, others on failure. 74 */ 75 virtual int DeleteForm(const int64_t formId, const sptr<IRemoteObject> &callerToken) = 0; 76 77 /** 78 * @brief Stop rendering form. 79 * @param formId The Id of the forms to delete. 80 * @param compId The compId of the forms to delete. 81 * @return Returns ERR_OK on success, others on failure. 82 */ StopRenderingForm(const int64_t formId,const std::string & compId)83 virtual int StopRenderingForm(const int64_t formId, const std::string &compId) 84 { 85 return ERR_OK; 86 }; 87 88 /** 89 * @brief Release forms with formIds, send formIds to form manager service. 90 * @param formId The Id of the forms to release. 91 * @param callerToken Caller ability token. 92 * @param delCache Delete Cache or not. 93 * @return Returns ERR_OK on success, others on failure. 94 */ 95 virtual int ReleaseForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const bool delCache) = 0; 96 97 /** 98 * @brief Update form with formId, send formId to form manager service. 99 * @param formId The Id of the form to update. 100 * @param formProviderData Form binding data. 101 * @return Returns ERR_OK on success, others on failure. 102 */ 103 virtual int UpdateForm(const int64_t formId, const FormProviderData &formProviderData) = 0; 104 105 /** 106 * @brief Set next refresh time. 107 * @param formId The Id of the form to update. 108 * @param nextTime Next refresh time. 109 * @return Returns ERR_OK on success, others on failure. 110 */ 111 virtual int SetNextRefreshTime(const int64_t formId, const int64_t nextTime) = 0; 112 113 /** 114 * @brief Release renderer. 115 * @param formId The Id of the forms to release. 116 * @param compId The compId of the forms to release. 117 * @return Returns ERR_OK on success, others on failure. 118 */ ReleaseRenderer(int64_t formId,const std::string & compId)119 virtual int ReleaseRenderer(int64_t formId, const std::string &compId) { return ERR_OK; } 120 121 /** 122 * @brief Request to publish a form to the form host. 123 * 124 * @param want The want of the form to publish. 125 * @param withFormBindingData Indicates whether the formBindingData is carried with. 126 * @param formBindingData Indicates the form data. 127 * @param formId Return the form id to be published. 128 * @return Returns ERR_OK on success, others on failure. 129 */ 130 virtual ErrCode RequestPublishForm(Want &want, bool withFormBindingData, 131 std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId) = 0; 132 SetPublishFormResult(const int64_t formId,Constants::PublishFormResult & errorCodeInfo)133 virtual ErrCode SetPublishFormResult(const int64_t formId, Constants::PublishFormResult &errorCodeInfo) 134 { 135 return ERR_OK; 136 } 137 AcquireAddFormResult(const int64_t formId)138 virtual ErrCode AcquireAddFormResult(const int64_t formId) 139 { 140 return ERR_OK; 141 } 142 143 /** 144 * @brief Request to publish a form to the form host for normal authority. 145 * 146 * @param want The want of the form to publish. 147 * @param withFormBindingData Indicates whether the formBindingData is carried with. 148 * @param formBindingData Indicates the form data. 149 * @param formId Return the form id to be published. 150 * @return Returns ERR_OK on success, others on failure. 151 */ 152 virtual ErrCode RequestPublishFormWithSnapshot(Want &want, bool withFormBindingData, 153 std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId) = 0; 154 155 /** 156 * @brief Lifecycle update. 157 * @param formIds The Id of the forms. 158 * @param callerToken Caller ability token. 159 * @param updateType update type, enable if true and disable if false. 160 * @return Returns ERR_OK on success, others on failure. 161 */ 162 virtual int LifecycleUpdate(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 163 bool updateType) = 0; 164 165 /** 166 * @brief Request form with formId and want, send formId and want to form manager service. 167 * @param formId The Id of the form to request. 168 * @param callerToken Caller ability token. 169 * @param want The want of the form to add. 170 * @return Returns ERR_OK on success, others on failure. 171 */ 172 virtual int RequestForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const Want &want) = 0; 173 174 /** 175 * @brief Form visible/invisible notify, send formIds to form manager service. 176 * @param formIds The Id list of the forms to notify. 177 * @param callerToken Caller ability token. 178 * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE. 179 * @return Returns ERR_OK on success, others on failure. 180 */ 181 virtual int NotifyWhetherVisibleForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 182 const int32_t formVisibleType) = 0; 183 184 /** 185 * @brief Query whether has visible form by tokenId. 186 * @param tokenId Unique identification of application. 187 * @return Returns true if has visible form, false otherwise. 188 */ 189 virtual bool HasFormVisible(const uint32_t tokenId) = 0; 190 191 /** 192 * @brief temp form to normal form. 193 * @param formId The Id of the form. 194 * @param callerToken Caller ability token. 195 * @return Returns ERR_OK on success, others on failure. 196 */ 197 virtual int CastTempForm(const int64_t formId, const sptr<IRemoteObject> &callerToken) = 0; 198 199 /** 200 * @brief Dump all of form storage infos. 201 * @param formInfos All of form storage infos. 202 * @return Returns ERR_OK on success, others on failure. 203 */ 204 virtual int DumpStorageFormInfos(std::string &formInfos) = 0; 205 /** 206 * @brief Dump form info by a bundle name. 207 * @param bundleName The bundle name of form provider. 208 * @param formInfos Form infos. 209 * @return Returns ERR_OK on success, others on failure. 210 */ 211 virtual int DumpFormInfoByBundleName(const std::string &bundleName, std::string &formInfos) = 0; 212 /** 213 * @brief Dump form info by a bundle name. 214 * @param formId The id of the form. 215 * @param formInfo Form info. 216 * @return Returns ERR_OK on success, others on failure. 217 */ 218 virtual int DumpFormInfoByFormId(const std::int64_t formId, std::string &formInfo) = 0; 219 /** 220 * @brief Dump form timer by form id. 221 * @param formId The id of the form. 222 * @param formInfo Form timer. 223 * @return Returns ERR_OK on success, others on failure. 224 */ 225 virtual int DumpFormTimerByFormId(const std::int64_t formId, std::string &isTimingService) = 0; 226 /** 227 * @brief Process js message event. 228 * @param formId Indicates the unique id of form. 229 * @param want information passed to supplier. 230 * @param callerToken Caller ability token. 231 * @return Returns true if execute success, false otherwise. 232 */ 233 virtual int MessageEvent(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken) = 0; 234 235 /** 236 * @brief Process Background event. 237 * @param formId Indicates the unique id of form. 238 * @param want the want of the ability to start. 239 * @param callerToken Caller ability token. 240 * @return Returns true if execute success, false otherwise. 241 */ 242 virtual int BackgroundEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken) = 0; 243 244 /** 245 * @brief Process js router event. 246 * @param formId Indicates the unique id of form. 247 * @param want the want of the ability to start. 248 * @param callerToken Caller ability token. 249 * @return Returns true if execute success, false otherwise. 250 */ 251 virtual int RouterEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken) = 0; 252 253 /** 254 * @brief Delete the invalid forms. 255 * @param formIds Indicates the ID of the valid forms. 256 * @param callerToken Caller ability token. 257 * @param numFormsDeleted Returns the number of the deleted forms. 258 * @return Returns ERR_OK on success, others on failure. 259 */ 260 virtual int DeleteInvalidForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 261 int32_t &numFormsDeleted) = 0; 262 263 /** 264 * @brief Acquire form state info by passing a set of parameters (using Want) to the form provider. 265 * @param want Indicates a set of parameters to be transparently passed to the form provider. 266 * @param callerToken Caller ability token. 267 * @param stateInfo Returns the form's state info of the specify. 268 * @return Returns ERR_OK on success, others on failure. 269 */ 270 virtual int AcquireFormState(const Want &want, const sptr<IRemoteObject> &callerToken, 271 FormStateInfo &stateInfo) = 0; 272 273 /** 274 * @brief Notify the form is visible or not. 275 * @param formIds Indicates the ID of the forms. 276 * @param isVisible Visible or not. 277 * @param callerToken Host client. 278 * @return Returns ERR_OK on success, others on failure. 279 */ 280 virtual int NotifyFormsVisible(const std::vector<int64_t> &formIds, bool isVisible, 281 const sptr<IRemoteObject> &callerToken) = 0; 282 283 /** 284 * @brief Notify the form is privacy protected or not. 285 * @param formIds Indicates the ID of the forms. 286 * @param isProtected isProtected or not. 287 * @param callerToken Host client. 288 * @return Returns ERR_OK on success, others on failure. 289 */ 290 virtual int NotifyFormsPrivacyProtected(const std::vector<int64_t> &formIds, bool isProtected, 291 const sptr<IRemoteObject> &callerToken) = 0; 292 293 /** 294 * @brief Notify the form is enable to be updated or not. 295 * @param formIds Indicates the ID of the forms. 296 * @param isEnableUpdate enable update or not. 297 * @param callerToken Host client. 298 * @return Returns ERR_OK on success, others on failure. 299 */ 300 virtual int NotifyFormsEnableUpdate(const std::vector<int64_t> &formIds, bool isEnableUpdate, 301 const sptr<IRemoteObject> &callerToken) = 0; 302 303 /** 304 * @brief Get All FormsInfo. 305 * @param formInfos Return the forms' information of all forms provided. 306 * @return Returns ERR_OK on success, others on failure. 307 */ 308 virtual int GetAllFormsInfo(std::vector<FormInfo> &formInfos) = 0; 309 310 /** 311 * @brief Get forms info by bundle name . 312 * @param bundleName Application name. 313 * @param formInfos Return the forms' information of the specify application name. 314 * @return Returns ERR_OK on success, others on failure. 315 */ 316 virtual int GetFormsInfoByApp(std::string &bundleName, std::vector<FormInfo> &formInfos) = 0; 317 318 /** 319 * @brief Get forms info by bundle name and module name. 320 * @param bundleName bundle name. 321 * @param moduleName Module name of hap. 322 * @param formInfos Return the forms' information of the specify bundle name and module name. 323 * @return Returns ERR_OK on success, others on failure. 324 */ 325 virtual int GetFormsInfoByModule(std::string &bundleName, std::string &moduleName, 326 std::vector<FormInfo> &formInfos) = 0; 327 328 /** 329 * @brief Get forms info specfied by filter parameters. 330 * @param filter Filter that contains necessary conditions, such as bundle name, module name, dimensions. 331 * @param formInfos Return the forms' information specified by filter. 332 * @return Returns ERR_OK on success, others on failure. 333 */ GetFormsInfoByFilter(const FormInfoFilter & filter,std::vector<FormInfo> & formInfos)334 virtual int GetFormsInfoByFilter(const FormInfoFilter &filter, std::vector<FormInfo> &formInfos) 335 { 336 return ERR_OK; 337 } 338 339 /** 340 * @brief This function is called by formProvider and gets forms info by the bundle name of the calling ability. 341 * The bundle name will be retrieved by form service manager. 342 * @param filter Filter that contains attributes that the formInfos have to have. 343 * @param formInfos Return the forms' information of the calling bundle name 344 * @return Returns ERR_OK on success, others on failure. 345 */ 346 virtual int32_t GetFormsInfo(const FormInfoFilter &filter, std::vector<FormInfo> &formInfos) = 0; 347 348 /** 349 * @brief Check if the request of publishing a form is supported by the host. 350 * @return Returns true if the request is supported and false otherwise. 351 */ 352 virtual bool IsRequestPublishFormSupported() = 0; 353 354 /** 355 * @brief Start an ability. This function can only be called by a form extension of a system app. 356 * @param want includes ability name, parameters and relative info sending to an ability. 357 * @param callerToken token of the ability that initially calls this function. 358 * @return Returns ERR_OK on success, others on failure. 359 */ 360 virtual int32_t StartAbility(const Want &want, const sptr<IRemoteObject> &callerToken) = 0; 361 362 /** 363 * @brief Share form by formID and deviceID. 364 * @param formId Indicates the unique id of form. 365 * @param deviceId Indicates the remote device ID. 366 * @param callerToken Host client. 367 * @param requestCode Indicates the request code of this share form. 368 * @return Returns ERR_OK on success, others on failure. 369 */ 370 virtual int32_t ShareForm(int64_t formId, const std::string &deviceId, const sptr<IRemoteObject> &callerToken, 371 int64_t requestCode) = 0; 372 373 /** 374 * @brief Acquire form data by formId. 375 * @param formId The Id of the form to acquire data. 376 * @param requestCode The request code of this form. 377 * @param callerToken Indicates the host client. 378 * @param formData Return the forms' information of customization 379 * @return Returns ERR_OK on success, others on failure. 380 */ 381 virtual int32_t AcquireFormData(int64_t formId, int64_t requestCode, const sptr<IRemoteObject> &callerToken, 382 AAFwk::WantParams &formData) = 0; 383 384 /** 385 * @brief Receive form sharing information from remote. 386 * @param info Indicates form sharing information. 387 * @return Returns ERR_OK on success, others on failure. 388 */ 389 virtual int32_t RecvFormShareInfoFromRemote(const FormShareInfo &info) = 0; 390 391 /** 392 * @brief Check form manager service ready. 393 * @return Return true if form manager service Ready; return false otherwise. 394 */ 395 virtual bool CheckFMSReady() = 0; 396 397 /** 398 * @brief Check whether the form is system app. 399 * @param bundleName The bundleName of the form. 400 * @return Returns true if the form app is system, others false. 401 */ IsSystemAppForm(const std::string & bundleName)402 virtual bool IsSystemAppForm(const std::string &bundleName) 403 { 404 return false; 405 } 406 407 /** 408 * @brief Register form add observer by bundle. 409 * @param bundleName BundleName of the form host 410 * @param callerToken Caller ability token. 411 * @return Returns ERR_OK on success, others on failure. 412 */ 413 virtual ErrCode RegisterFormAddObserverByBundle(const std::string bundleName, 414 const sptr<IRemoteObject> &callerToken) = 0; 415 416 /** 417 * @brief Register form remove observer by bundle. 418 * @param bundleName BundleName of the form host 419 * @param callerToken Caller ability token. 420 * @return Returns ERR_OK on success, others on failure. 421 */ 422 virtual ErrCode RegisterFormRemoveObserverByBundle(const std::string bundleName, 423 const sptr<IRemoteObject> &callerToken) = 0; 424 425 /** 426 * @brief The Call Event triggers the callee method. 427 * @param funcName function name which is used by callee. 428 * @param params parameter which is used by callee. 429 * @return Returns ERR_OK on success, others on failure. 430 */ 431 virtual int32_t SetBackgroundFunction(const std::string funcName, const std::string params) = 0; 432 /** 433 * @brief get forms count. 434 * @param isTempFormFlag Indicates temp form or not. 435 * @param formCount Returns the number of the cast or temp form. 436 * @return Returns ERR_OK on success, others on failure. 437 */ 438 virtual int32_t GetFormsCount(bool isTempFormFlag, int32_t &formCount) = 0; 439 440 /** 441 * @brief get host forms count. 442 * @param bundleName Indicates form host bundleName. 443 * @param formCount Returns the number of the host form. 444 * @return Returns ERR_OK on success, others on failure. 445 */ 446 virtual int32_t GetHostFormsCount(std::string &bundleName, int32_t &formCount) = 0; 447 448 /** 449 * @brief Get the running form infos. 450 * @param isUnusedIncluded Indicates whether to include unused forms. 451 * @param runningFormInfos Return the running forms' infos currently. 452 * @return Returns ERR_OK on success, others on failure. 453 */ 454 virtual ErrCode GetRunningFormInfos(bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos) = 0; 455 456 /** 457 * @brief Get the running form infos by bundle name. 458 * @param bundleName Application name. 459 * @param isUnusedIncluded Indicates whether to include unused forms. 460 * @param runningFormInfos Return the running forms' infos of the specify application name. 461 * @return Returns ERR_OK on success, others on failure. 462 */ 463 virtual ErrCode GetRunningFormInfosByBundleName( 464 const std::string &bundleName, bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos) = 0; 465 466 /** 467 * @brief Get form instances by filter info. 468 * @param formInstancesFilter includes bundleName, moduleName, formName, abilityName to get formInstances. 469 * @param formInstances return formInstances 470 * @return return ERR_OK on get info success, others on failure. 471 */ 472 virtual ErrCode GetFormInstancesByFilter(const FormInstancesFilter &formInstancesFilter, 473 std::vector<FormInstance> &formInstances) = 0; 474 475 /** 476 * @brief Get form instance by formId. 477 * @param formId formId Indicates the unique id of form. 478 * @param formInstance return formInstance 479 * @return return ERR_OK on get info success, others on failure. 480 */ 481 virtual ErrCode GetFormInstanceById(const int64_t formId, FormInstance &formInstance) = 0; 482 483 /** 484 * @brief Get form instance by formId, include form store in DB. 485 * @param formId formId Indicates the unique id of form. 486 * @param isUnusedIncluded Indicates whether to include unused form instance. 487 * @param formInstance return formInstance 488 * @return return ERR_OK on get info success, others on failure. 489 */ GetFormInstanceById(const int64_t formId,bool isUnusedIncluded,FormInstance & formInstance)490 virtual ErrCode GetFormInstanceById(const int64_t formId, bool isUnusedIncluded, FormInstance &formInstance) 491 { 492 return 0; 493 } 494 495 /** 496 * @brief Register form add observer. 497 * @param bundleName BundleName of the form host 498 * @param callerToken Caller ability token. 499 * @return Returns ERR_OK on success, others on failure. 500 */ 501 virtual ErrCode RegisterAddObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) = 0; 502 503 /** 504 * @brief Register form remove observer. 505 * @param bundleName BundleName of the form host 506 * @param callerToken Caller ability token. 507 * @return Returns ERR_OK on success, others on failure. 508 */ 509 virtual ErrCode RegisterRemoveObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) = 0; 510 511 /** 512 * @brief Register form router event proxy. 513 * @param formIds Indicates the id of the forms. 514 * @param callerToken Router proxy call back client. 515 * @return Returns ERR_OK on success, others on failure. 516 */ 517 virtual ErrCode RegisterFormRouterProxy(const std::vector<int64_t> &formIds, 518 const sptr<IRemoteObject> &callerToken) = 0; 519 520 /** 521 * @brief Unregister form router event proxy. 522 * @param formIds Indicates the id of the forms. 523 * @return Returns ERR_OK on success, others on failure. 524 */ 525 virtual ErrCode UnregisterFormRouterProxy(const std::vector<int64_t> &formIds) = 0; 526 527 /** 528 * @brief Update proxy form with formId. 529 * @param formId The Id of the form to update. 530 * @param FormProviderData Form binding data. 531 * @param std::vector<FormDataProxy> Form proxy vector. 532 * @return Returns ERR_OK on success, others on failure. 533 */ UpdateProxyForm(int64_t formId,const FormProviderData & FormProviderData,const std::vector<FormDataProxy> & formDataProxies)534 virtual ErrCode UpdateProxyForm(int64_t formId, const FormProviderData &FormProviderData, 535 const std::vector<FormDataProxy> &formDataProxies) { return ERR_OK; } 536 537 /** 538 * @brief Request to publish a proxy form to the form host. 539 * @param want The want of the form to publish. 540 * @param withFormBindingData Indicates whether the formBindingData is carried with. 541 * @param formBindingData Indicates the form data. 542 * @param formId Return the form id to be published. 543 * @param std::vector<FormDataProxy> Form proxy vector. 544 * @return Returns ERR_OK on success, others on failure. 545 */ RequestPublishProxyForm(Want & want,bool withFormBindingData,std::unique_ptr<FormProviderData> & formBindingData,int64_t & formId,const std::vector<FormDataProxy> & formDataProxies)546 virtual ErrCode RequestPublishProxyForm(Want &want, bool withFormBindingData, 547 std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId, 548 const std::vector<FormDataProxy> &formDataProxies) { return ERR_OK; } 549 550 /** 551 * @brief Registers the callback to publish form. The callback is used to process the publish form request 552 * when the system handler is not found. 553 * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor. 554 * @return Returns ERR_OK on success, others on failure. 555 */ RegisterPublishFormInterceptor(const sptr<IRemoteObject> & interceptorCallback)556 virtual int32_t RegisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback) 557 { 558 return 0; 559 } 560 561 /** 562 * @brief Unregisters the callback to publish form. The callback is used to process the publish form request 563 * when the system handler is not found. 564 * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor. 565 * @return Returns ERR_OK on success, others on failure. 566 */ UnregisterPublishFormInterceptor(const sptr<IRemoteObject> & interceptorCallback)567 virtual int32_t UnregisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback) 568 { 569 return 0; 570 } 571 572 /** 573 * @brief Register click callback observer. 574 * @param bundleName BundleName of the form host. 575 * @param formEventType Form event type. 576 * @param observer Form click event callback listener. 577 * @return Returns ERR_OK on success, others on failure. 578 */ 579 virtual ErrCode RegisterClickEventObserver( 580 const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer) = 0; 581 582 /** 583 * @brief Unregister click callback observer. 584 * @param bundleName BundleName of the form host. 585 * @param formEventType Form event type. 586 * @param observer Form click event callback listener. 587 * @return Returns ERR_OK on success, others on failure. 588 */ 589 virtual ErrCode UnregisterClickEventObserver( 590 const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer) = 0; 591 592 /** 593 * @brief Set forms recyclable 594 * @param formIds Indicates the id of the forms. 595 * @return Returns ERR_OK on success, others on failure. 596 */ SetFormsRecyclable(const std::vector<int64_t> & formIds)597 virtual int32_t SetFormsRecyclable(const std::vector<int64_t> &formIds) 598 { 599 return 0; 600 } 601 602 /** 603 * @brief Recycle forms 604 * @param formIds Indicates the id of the forms. 605 * @param want The want of forms to be recycled. 606 * @return Returns ERR_OK on success, others on failure. 607 */ RecycleForms(const std::vector<int64_t> & formIds,const Want & want)608 virtual int32_t RecycleForms(const std::vector<int64_t> &formIds, const Want &want) 609 { 610 return 0; 611 } 612 613 /** 614 * @brief Recover recycled forms 615 * @param formIds Indicates the id of the forms. 616 * @param want The want of forms to be recovered. 617 * @return Returns ERR_OK on success, others on failure. 618 */ RecoverForms(const std::vector<int64_t> & formIds,const Want & want)619 virtual int32_t RecoverForms(const std::vector<int64_t> &formIds, const Want &want) 620 { 621 return 0; 622 } 623 624 /** 625 * @brief Update formLocation with formId. 626 * @param formId The Id of the form to update. 627 * @param formLocation The FormLocation. 628 * @return Returns ERR_OK on success, others on failure. 629 */ UpdateFormLocation(const int64_t & formId,const int32_t & formLocation)630 virtual ErrCode UpdateFormLocation(const int64_t &formId, const int32_t &formLocation) 631 { 632 return ERR_OK; 633 } 634 635 /** 636 * @brief Update form with formRefreshType, send to form manager service. 637 * @param formRefreshType The type of the form to refresh, 0: AllForm 1: 2: AppForm 2: AtomicServiceForm 638 * @return Returns ERR_OK on success, others on failure. 639 */ BatchRefreshForms(const int32_t formRefreshType)640 virtual int32_t BatchRefreshForms(const int32_t formRefreshType) 641 { 642 return 0; 643 } 644 645 /** 646 * @brief enable/disable form update. 647 * @param bundleName BundleName of the form host. 648 * @param enable True for enable form, false for disable form. 649 * @return Returns ERR_OK on success, others on failure. 650 */ EnableForms(const std::string bundleName,const bool enable)651 virtual int32_t EnableForms(const std::string bundleName, const bool enable) 652 { 653 return 0; 654 } 655 656 /** 657 * @brief Check form bundle is controlled. 658 * @param bundleName The bundle name of form to be check. 659 * @return Returns true for form bundle is controlled. 660 */ IsFormBundleForbidden(const std::string & bundleName)661 virtual bool IsFormBundleForbidden(const std::string &bundleName) 662 { 663 return false; 664 } 665 666 /** 667 * @brief Update size of form. 668 * @param formId The Id of the form to update. 669 * @param width The width value to be updated. 670 * @param height The height value to be updated. 671 * @param borderWidth The borderWidth value to be updated. 672 * @return Returns ERR_OK on success, others on failure. 673 */ UpdateFormSize(const int64_t & formId,float width,float height,float borderWidth)674 virtual ErrCode UpdateFormSize(const int64_t &formId, float width, float height, float borderWidth) 675 { 676 return ERR_OK; 677 } 678 679 enum class Message { 680 // ipc id 1-1000 for kit 681 // ipc id 1001-2000 for DMS 682 // ipc id 2001-3000 for tools 683 // ipc id for create (3001) 684 FORM_MGR_ADD_FORM = 3001, 685 FORM_MGR_ADD_FORM_OHOS, 686 FORM_MGR_DELETE_FORM, 687 FORM_MGR_UPDATE_FORM, 688 FORM_MGR_LIFECYCLE_UPDATE, 689 FORM_MGR_REQUEST_FORM, 690 FORM_MGR_RELEASE_FORM, 691 FORM_MGR_RELEASE_CACHED_FORM, 692 FORM_MGR_CAST_TEMP_FORM, 693 FORM_MGR_EVENT_NOTIFY, 694 FORM_MGR_CHECK_AND_DELETE_INVALID_FORMS, 695 FORM_MGR_SET_NEXT_REFRESH_TIME, 696 FORM_MGR_NOTIFY_FORM_WHETHER_VISIBLE, 697 FORM_MGR_STORAGE_FORM_INFOS, 698 FORM_MGR_FORM_INFOS_BY_NAME, 699 FORM_MGR_FORM_INFOS_BY_ID, 700 FORM_MGR_FORM_TIMER_INFO_BY_ID, 701 FORM_MGR_MESSAGE_EVENT, 702 FORM_MGR_BATCH_ADD_FORM_RECORDS_ST, 703 FORM_MGR_CLEAR_FORM_RECORDS_ST, 704 FORM_MGR_DISTRIBUTED_DATA_ADD_FORM__ST, 705 FORM_MGR_DISTRIBUTED_DATA_DELETE_FORM__ST, 706 FORM_MGR_DELETE_INVALID_FORMS, 707 FORM_MGR_ACQUIRE_FORM_STATE, 708 FORM_MGR_NOTIFY_FORMS_VISIBLE, 709 FORM_MGR_NOTIFY_FORMS_ENABLE_UPDATE, 710 FORM_MGR_GET_ALL_FORMS_INFO, 711 FORM_MGR_GET_FORMS_INFO_BY_APP, 712 FORM_MGR_GET_FORMS_INFO_BY_MODULE, 713 FORM_MGR_GET_FORMS_INFO, 714 FORM_MGR_ROUTER_EVENT, 715 FORM_MGR_UPDATE_ROUTER_ACTION, 716 FORM_MGR_ADD_FORM_INFO, 717 FORM_MGR_REMOVE_FORM_INFO, 718 FORM_MGR_REQUEST_PUBLISH_FORM, 719 FORM_MGR_IS_REQUEST_PUBLISH_FORM_SUPPORTED, 720 FORM_MGR_SHARE_FORM, 721 FORM_MGR_RECV_FORM_SHARE_INFO_FROM_REMOTE, 722 FORM_MGR_START_ABILITY, 723 FORM_MGR_NOTIFY_FORMS_PRIVACY_PROTECTED, 724 FORM_MGR_CHECK_FMS_READY, 725 FORM_MGR_BACKGROUND_EVENT, 726 FORM_MGR_STOP_RENDERING_FORM, 727 FORM_MGR_REGISTER_FORM_ADD_OBSERVER_BY_BUNDLE, 728 FORM_MGR_REGISTER_FORM_REMOVE_OBSERVER_BY_BUNDLE, 729 FORM_MGR_ACQUIRE_DATA, 730 FORM_MGR_GET_FORMS_COUNT, 731 FORM_MGR_GET_HOST_FORMS_COUNT, 732 FORM_MGR_GET_RUNNING_FORM_INFOS, 733 FORM_MGR_GET_RUNNING_FORM_INFOS_BY_BUNDLE, 734 FORM_MGR_GET_FORM_INSTANCES_FROM_BY_FILTER, 735 FORM_MGR_GET_FORM_INSTANCES_FROM_BY_ID, 736 FORM_MGR_REGISTER_ADD_OBSERVER, 737 FORM_MGR_REGISTER_REMOVE_OBSERVER, 738 FORM_MGR_UPDATE_PROXY_FORM, 739 FORM_MGR_REQUEST_PUBLISH_PROXY_FORM, 740 FORM_MGR_RELEASE_RENDERER, 741 FORM_MGR_REGISTER_PUBLISH_FORM_INTERCEPTOR, 742 FORM_MGR_UNREGISTER_PUBLISH_FORM_INTERCEPTOR, 743 FORM_MGR_REGISTER_CLICK_EVENT_OBSERVER, 744 FORM_MGR_UNREGISTER_CLICK_EVENT_OBSERVER, 745 FORM_MGR_REGISTER_FORM_ROUTER_PROXY, 746 FORM_MGR_UNREGISTER_FORM_ROUTER_PROXY, 747 FORM_MGR_SET_FORMS_RECYCLABLE, 748 FORM_MGR_RECYCLE_FORMS, 749 FORM_MGR_RECOVER_FORMS, 750 FORM_MGR_HAS_FORM_VISIBLE_WITH_TOKENID, 751 FORM_MGR_UPDATE_FORM_LOCATION, 752 FORM_MGR_GET_FORMS_INFO_BY_FILTER, 753 FORM_MGR_CREATE_FORM, 754 FORM_MGR_PUBLISH_FORM_ERRCODE_RESULT, 755 FORM_MGR_ACQUIRE_ADD_FORM_RESULT, 756 FORM_MGR_REQUEST_PUBLISH_FORM_WITH_SNAPSHOT, 757 FORM_MGR_BATCH_REFRESH_FORMS, 758 FORM_MGR_ENABLE_FORMS, 759 FORM_MGR_IS_SYSTEM_APP_FORM, 760 FORM_MGR_IS_FORM_BUNDLE_FORBIDDEN, 761 FORM_MGR_UPDATE_FORM_SIZE, 762 }; 763 }; 764 } // namespace AppExecFwk 765 } // namespace OHOS 766 #endif // OHOS_FORM_FWK_FORM_MGR_INTERFACE_H 767