1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_FORM_FWK_FORM_MGR_SERVICE_H 17 #define OHOS_FORM_FWK_FORM_MGR_SERVICE_H 18 19 #include <singleton.h> 20 #include <system_ability.h> 21 22 #include "form_event_handler.h" 23 #include "form_instance.h" 24 #include "form_instances_filter.h" 25 #include "form_mgr_stub.h" 26 #include "form_provider_data.h" 27 #include "form_serial_queue.h" 28 #include "form_sys_event_receiver.h" 29 #include "iremote_object.h" 30 #include "mem_status_listener.h" 31 namespace OHOS { 32 namespace AppExecFwk { 33 enum class ServiceRunningState { 34 STATE_NOT_START, 35 STATE_RUNNING, 36 }; 37 /** 38 * @class FormMgrService 39 * FormMgrService provides a facility for managing form life cycle. 40 */ 41 class FormMgrService : public SystemAbility, 42 public FormMgrStub, 43 public std::enable_shared_from_this<FormMgrService> { 44 DECLARE_DELAYED_SINGLETON(FormMgrService); 45 DECLEAR_SYSTEM_ABILITY(FormMgrService); 46 public: 47 /** 48 * @brief Start event for the form manager service. 49 */ 50 void OnStart() override; 51 /** 52 * @brief Stop event for the form manager service. 53 */ 54 void OnStop() override; 55 56 /** 57 * @brief Add form with want, send want to form manager service. 58 * @param formId The Id of the forms to add. 59 * @param want The want of the form to add. 60 * @param callerToken Caller ability token. 61 * @param formInfo Form info. 62 * @return Returns ERR_OK on success, others on failure. 63 */ 64 int AddForm(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken, 65 FormJsInfo &formInfo) override; 66 67 /** 68 * @brief Delete forms with formIds, send formIds to form manager service. 69 * @param formId The Id of the forms to delete. 70 * @param callerToken Caller ability token. 71 * @return Returns ERR_OK on success, others on failure. 72 */ 73 int DeleteForm(const int64_t formId, const sptr<IRemoteObject> &callerToken) override; 74 75 /** 76 * @brief Stop rendering form. 77 * @param formId The Id of the forms to delete. 78 * @param compId The compId of the forms to delete. 79 * @return Returns ERR_OK on success, others on failure. 80 */ 81 int StopRenderingForm(const int64_t formId, const std::string &compId) override; 82 83 /** 84 * @brief Release forms with formIds, send formIds to form manager service. 85 * @param formId The Id of the forms to release. 86 * @param callerToken Caller ability token. 87 * @param delCache Delete Cache or not. 88 * @return Returns ERR_OK on success, others on failure. 89 */ 90 int ReleaseForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const bool delCache) override; 91 92 /** 93 * @brief Update form with formId, send formId to form manager service. 94 * @param formId The Id of the form to update. 95 * @param bundleName Provider ability bundleName. 96 * @param FormProviderData Form binding data. 97 * @return Returns ERR_OK on success, others on failure. 98 */ 99 int UpdateForm(const int64_t formId, const FormProviderData &FormProviderData) override; 100 101 /** 102 * @brief set next refresh time. 103 * @param formId The id of the form. 104 * @param nextTime next refresh time. 105 * @return Returns ERR_OK on success, others on failure. 106 */ 107 int SetNextRefreshTime(const int64_t formId, const int64_t nextTime) override; 108 109 /** 110 * @brief Release renderer. 111 * @param formId The Id of the forms to release. 112 * @param compId The compId of the forms to release. 113 * @return Returns ERR_OK on success, others on failure. 114 */ 115 int ReleaseRenderer(int64_t formId, const std::string &compId) override; 116 117 /** 118 * @brief Request to publish a form to the form host. 119 * 120 * @param want The want of the form to publish. 121 * @param withFormBindingData Indicates whether the formBindingData is carried with. 122 * @param formBindingData Indicates the form data. 123 * @param formId Return the form id to be published. 124 * @return Returns ERR_OK on success, others on failure. 125 */ 126 ErrCode RequestPublishForm(Want &want, bool withFormBindingData, 127 std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId) override; 128 129 /** 130 * @brief lifecycle update. 131 * @param formIds formIds of host client. 132 * @param callerToken Caller ability token. 133 * @param updateType update type, enable if true and disable if false. 134 * @return Returns true on success, false on failure. 135 */ 136 int LifecycleUpdate(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 137 bool updateType) override; 138 139 /** 140 * @brief Request form with formId and want, send formId and want to form manager service. 141 * @param formId The Id of the form to update. 142 * @param callerToken Caller ability token. 143 * @param want The want of the form to add. 144 * @return Returns ERR_OK on success, others on failure. 145 */ 146 int RequestForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const Want &want) override; 147 148 /** 149 * @brief Form visible/invisible notify, send formIds to form manager service. 150 * @param formIds The Id list of the forms to notify. 151 * @param callerToken Caller ability token. 152 * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE. 153 * @return Returns ERR_OK on success, others on failure. 154 */ 155 int NotifyWhetherVisibleForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 156 const int32_t formVisibleType) override; 157 158 /** 159 * @brief temp form to normal form. 160 * @param formId The Id of the form. 161 * @param callerToken Caller ability token. 162 * @return Returns ERR_OK on success, others on failure. 163 */ 164 int CastTempForm(const int64_t formId, const sptr<IRemoteObject> &callerToken) override; 165 166 /** 167 * @brief Dump all of form storage infos. 168 * @param formInfos All of form storage infos. 169 * @return Returns ERR_OK on success, others on failure. 170 */ 171 int DumpStorageFormInfos(std::string &formInfos) override; 172 /** 173 * @brief Dump form info by a bundle name. 174 * @param bundleName The bundle name of form provider. 175 * @param formInfos Form infos. 176 * @return Returns ERR_OK on success, others on failure. 177 */ 178 int DumpFormInfoByBundleName(const std::string &bundleName, std::string &formInfos) override; 179 /** 180 * @brief Dump form info by a bundle name. 181 * @param formId The id of the form. 182 * @param formInfo Form info. 183 * @return Returns ERR_OK on success, others on failure. 184 */ 185 int DumpFormInfoByFormId(const std::int64_t formId, std::string &formInfo) override; 186 /** 187 * @brief Dump form timer by form id. 188 * @param formId The id of the form. 189 * @param formInfo Form info. 190 * @return Returns ERR_OK on success, others on failure. 191 */ 192 int DumpFormTimerByFormId(const std::int64_t formId, std::string &isTimingService) override; 193 /** 194 * @brief Process js message event. 195 * @param formId Indicates the unique id of form. 196 * @param want information passed to supplier. 197 * @param callerToken Caller ability token. 198 * @return Returns true if execute success, false otherwise. 199 */ 200 int MessageEvent(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken) override; 201 202 /** 203 * @brief Process js router event. 204 * @param formId Indicates the unique id of form. 205 * @param want the want of the ability to start. 206 * @param callerToken Caller ability token. 207 * @return Returns true if execute success, false otherwise. 208 */ 209 int RouterEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken) override; 210 211 /** 212 * @brief Process Background event. 213 * @param formId Indicates the unique id of form. 214 * @param want the want of the ability to start. 215 * @param callerToken Caller ability token. 216 * @return Returns true if execute success, false otherwise. 217 */ 218 int BackgroundEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken) override; 219 220 /** 221 * @brief Check whether if the form manager service is ready. 222 * @return Returns true if the form manager service is ready; returns false otherwise. 223 */ 224 bool IsReady() const; 225 226 /** 227 * @brief Delete the invalid forms. 228 * @param formIds Indicates the ID of the valid forms. 229 * @param callerToken Caller ability token. 230 * @param numFormsDeleted Returns the number of the deleted forms. 231 * @return Returns ERR_OK on success, others on failure. 232 */ 233 virtual int DeleteInvalidForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken, 234 int32_t &numFormsDeleted) override; 235 236 /** 237 * @brief Acquire form state info by passing a set of parameters (using Want) to the form provider. 238 * @param want Indicates a set of parameters to be transparently passed to the form provider. 239 * @param callerToken Caller ability token. 240 * @param stateInfo Returns the form's state info of the specify. 241 * @return Returns ERR_OK on success, others on failure. 242 */ 243 virtual int AcquireFormState(const Want &want, const sptr<IRemoteObject> &callerToken, 244 FormStateInfo &stateInfo) override; 245 246 /** 247 * @brief Register form router event proxy. 248 * @param formIds Indicates the ID of the forms. 249 * @param callerToken Host client. 250 * @return Returns ERR_OK on success, others on failure. 251 */ 252 virtual ErrCode RegisterFormRouterProxy(const std::vector<int64_t> &formIds, 253 const sptr<IRemoteObject> &callerToken) override; 254 255 /** 256 * @brief Unregister form router event proxy. 257 * @param formIds Indicates the ID of the forms. 258 * @return Returns ERR_OK on success, others on failure. 259 */ 260 virtual ErrCode UnregisterFormRouterProxy(const std::vector<int64_t> &formIds) override; 261 262 /** 263 * @brief Notify the form is visible or not. 264 * @param formIds Indicates the ID of the forms. 265 * @param isVisible Visible or not. 266 * @param callerToken Host client. 267 * @return Returns ERR_OK on success, others on failure. 268 */ 269 virtual int NotifyFormsVisible(const std::vector<int64_t> &formIds, bool isVisible, 270 const sptr<IRemoteObject> &callerToken) override; 271 272 /** 273 * @brief Notify the form is privacy protected or not. 274 * @param formIds Indicates the ID of the forms. 275 * @param isProtected isProtected or not. 276 * @param callerToken Host client. 277 * @return Returns ERR_OK on success, others on failure. 278 */ 279 int NotifyFormsPrivacyProtected(const std::vector<int64_t> &formIds, bool isProtected, 280 const sptr<IRemoteObject> &callerToken) override; 281 282 /** 283 * @brief Notify the form is enable to be updated or not. 284 * @param formIds Indicates the ID of the forms. 285 * @param isEnableUpdate enable update or not. 286 * @param callerToken Host client. 287 * @return Returns ERR_OK on success, others on failure. 288 */ 289 virtual int NotifyFormsEnableUpdate(const std::vector<int64_t> &formIds, bool isEnableUpdate, 290 const sptr<IRemoteObject> &callerToken) override; 291 292 /** 293 * @brief Get All FormsInfo. 294 * @param formInfos Return the forms' information of all forms provided. 295 * @return Returns ERR_OK on success, others on failure. 296 */ 297 int GetAllFormsInfo(std::vector<FormInfo> &formInfos) override; 298 299 /** 300 * @brief Get forms info by bundle name . 301 * @param bundleName Application name. 302 * @param formInfos Return the forms' information of the specify application name. 303 * @return Returns ERR_OK on success, others on failure. 304 */ 305 int GetFormsInfoByApp(std::string &bundleName, std::vector<FormInfo> &formInfos) override; 306 307 /** 308 * @brief Get forms info by bundle name and module name. 309 * @param bundleName bundle name. 310 * @param moduleName Module name of hap. 311 * @param formInfos Return the forms' information of the specify bundle name and module name. 312 * @return Returns ERR_OK on success, others on failure. 313 */ 314 int GetFormsInfoByModule(std::string &bundleName, std::string &moduleName, 315 std::vector<FormInfo> &formInfos) override; 316 317 /** 318 * @brief This function is called by formProvider and gets forms info by the bundle name of the calling ability. 319 * The bundle name will be retrieved here. 320 * @param filter Filter that contains attributes that the formInfos have to have. 321 * @param formInfos Return the forms' information of the calling bundle name 322 * @return Returns ERR_OK on success, others on failure. 323 */ 324 int32_t GetFormsInfo(const FormInfoFilter &filter, std::vector<FormInfo> &formInfos) override; 325 326 /** 327 * @brief Acquire form data by formId. 328 * @param formId The Id of the form to acquire data. 329 * @param callerToken Indicates the host client. 330 * @param requestCode The request code of this acquire form. 331 * @param formData Return the forms' information of customization 332 * @return Returns ERR_OK on success, others on failure. 333 */ 334 int32_t AcquireFormData(int64_t formId, int64_t requestCode, const sptr<IRemoteObject> &callerToken, 335 AAFwk::WantParams &formData) override; 336 337 /** 338 * @brief Check if the request of publishing a form is supported by the host. 339 * @return Returns true if the request is supported and false otherwise. 340 */ 341 bool IsRequestPublishFormSupported() override; 342 343 /** 344 * @brief Start an ability. This function can only be called by a form extension of a system app. 345 * @param want includes ability name, parameters and relative info sending to an ability. 346 * @param callerToken token of the ability that initially calls this function. 347 * @return Returns ERR_OK on success, others on failure. 348 */ 349 int32_t StartAbility(const Want &want, const sptr<IRemoteObject> &callerToken) override; 350 351 /** 352 * @brief Share form by formID and deviceID. 353 * @param formId Indicates the unique id of form. 354 * @param deviceId Indicates the remote device ID. 355 * @param callerToken Indicates the host client. 356 * @param requestCode The request code of this share form. 357 * @return Returns ERR_OK on success, others on failure. 358 */ 359 int32_t ShareForm(int64_t formId, const std::string &deviceId, 360 const sptr<IRemoteObject> &callerToken, int64_t requestCode) override; 361 362 /** 363 * @brief Receive form sharing information from remote. 364 * @param info Indicates form sharing information. 365 * @return Returns ERR_OK on success, others on failure. 366 */ 367 int32_t RecvFormShareInfoFromRemote(const FormShareInfo &info) override; 368 369 /** 370 * @brief Dump form. 371 * @param fd Indicates the file descriptor for result. 372 * @param args Indicates the input arguments. 373 * @return Returns ERR_OK on success, others on failure. 374 */ 375 int Dump(int fd, const std::vector<std::u16string> &args) override; 376 377 /** 378 * @brief Register form add observer by bundle. 379 * @param bundleName BundleName of the form host 380 * @param callerToken Caller ability token. 381 * @return Returns ERR_OK on success, others on failure. 382 */ 383 ErrCode RegisterFormAddObserverByBundle(const std::string bundleName, 384 const sptr<IRemoteObject> &callerToken) override; 385 386 /** 387 * @brief Register form remove observer by bundle. 388 * @param bundleName BundleName of the form host 389 * @param callerToken Caller ability token. 390 * @return Returns ERR_OK on success, others on failure. 391 */ 392 ErrCode RegisterFormRemoveObserverByBundle(const std::string bundleName, 393 const sptr<IRemoteObject> &callerToken) override; 394 395 /** 396 * @brief Check form manager service ready. 397 * @return Return true if form manager service Ready; return false otherwise. 398 */ 399 bool CheckFMSReady() override; 400 401 /** 402 * @brief The Call Event triggers the callee method. 403 * @param funcName function name which is used by callee. 404 * @param params parameter which is used by callee. 405 * @return Returns ERR_OK on success, others on failure. 406 */ SetBackgroundFunction(const std::string funcName,const std::string params)407 int32_t SetBackgroundFunction(const std::string funcName, const std::string params) override 408 { 409 return ERR_OK; 410 } 411 /** 412 * @brief get forms count. 413 * @param isTempFormFlag Indicates temp form or not. 414 * @param formCount Returns the number of the cast or temp form. 415 * @return Returns ERR_OK on success, others on failure. 416 */ 417 int32_t GetFormsCount(bool isTempFormFlag, int32_t &formCount) override; 418 419 /** 420 * @brief get host forms count. 421 * @param bundleName Indicates form host bundleName. 422 * @param formCount Returns the number of the host form. 423 * @return Returns ERR_OK on success, others on failure. 424 */ 425 int32_t GetHostFormsCount(std::string &bundleName, int32_t &formCount) override; 426 427 /** 428 * @brief Get all running form infos. 429 * @param isUnusedIncluded Indicates whether to include unused forms. 430 * @param runningFormInfos Return the running forms' infos currently. 431 * @return Returns ERR_OK on success, others on failure. 432 */ 433 ErrCode GetRunningFormInfos(bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos) override; 434 435 /** 436 * @brief Get the running form infos by bundle name. 437 * @param bundleName Application name. 438 * @param isUnusedIncluded Indicates whether to include unused forms. 439 * @param runningFormInfos Return the running forms' infos of the specify application name. 440 * @return Returns ERR_OK on success, others on failure. 441 */ 442 ErrCode GetRunningFormInfosByBundleName( 443 const std::string &bundleName, bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos) override; 444 445 /** 446 * @brief Get form instances by filter info. 447 * @param formInstancesFilter include bundleName, moduleName, formName, abilityName to get formInstances. 448 * @param formInstances return formInstances 449 * @return return ERR_OK on get info success,other on failure. 450 */ 451 ErrCode GetFormInstancesByFilter(const FormInstancesFilter &formInstancesFilter, 452 std::vector<FormInstance> &formInstances) override; 453 454 /** 455 * @brief Get form instances by formId. 456 * @param formId formId Indicates the unique id of form. 457 * @param formInstance return formInstance 458 * @return return ERR_OK on get info success, others on failure. 459 */ 460 ErrCode GetFormInstanceById(const int64_t formId, FormInstance &formInstance) override; 461 462 /** 463 * @brief Get form instance by formId, include form store in DB. 464 * @param formId formId Indicates the unique id of form. 465 * @param isUnusedIncluded Indicates whether to include unused form instances. 466 * @param formInstance return formInstance 467 * @return return ERR_OK on get info success, others on failure. 468 */ 469 ErrCode GetFormInstanceById(const int64_t formId, bool isUnusedIncluded, FormInstance &formInstance) override; 470 471 /** 472 * @brief Register form add observer. 473 * @param bundleName BundleName of the form host 474 * @param callerToken Caller ability token. 475 * @return Returns ERR_OK on success, others on failure. 476 */ 477 ErrCode RegisterAddObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) override; 478 479 /** 480 * @brief Register form remove observer. 481 * @param bundleName BundleName of the form host 482 * @param callerToken Caller ability token. 483 * @return Returns ERR_OK on success, others on failure. 484 */ 485 ErrCode RegisterRemoveObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) override; 486 487 /** 488 * @brief Update proxy form with formId. 489 * @param formId The Id of the form to update. 490 * @param FormProviderData Form binding data. 491 * @param std::vector<FormDataProxy> Form proxy vector. 492 * @return Returns ERR_OK on success, others on failure. 493 */ 494 ErrCode UpdateProxyForm(int64_t formId, const FormProviderData &FormProviderData, 495 const std::vector<FormDataProxy> &formDataProxies) override; 496 497 /** 498 * @brief Request to publish a proxy form to the form host. 499 * @param want The want of the form to publish. 500 * @param withFormBindingData Indicates whether the formBindingData is carried with. 501 * @param formBindingData Indicates the form data. 502 * @param formId Return the form id to be published. 503 * @param std::vector<FormDataProxy> Form proxy vector. 504 * @return Returns ERR_OK on success, others on failure. 505 */ 506 ErrCode RequestPublishProxyForm(Want &want, bool withFormBindingData, 507 std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId, 508 const std::vector<FormDataProxy> &formDataProxies) override; 509 510 /** 511 * @brief Read the form_config.xml. 512 * @return Returns ERR_OK on success, others on failure. 513 */ 514 ErrCode ReadFormConfigXML(); 515 516 /** 517 * @brief Registers the callback for publish form. The callback is used to process the publish form request 518 * when the system handler is not found. 519 * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor. 520 * @return Returns ERR_OK on success, others on failure. 521 */ 522 int32_t RegisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback) override; 523 524 /** 525 * @brief Unregisters the callback for publish form. The callback is used to process the publish form request 526 * when the system handler is not found. 527 * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor. 528 * @return Returns ERR_OK on success, others on failure. 529 */ 530 int32_t UnregisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback) override; 531 532 /** 533 * @brief Register click callback observer. 534 * @param observer Form click event callback listener. 535 * @param bundleName BundleName of the form host. 536 * @param formEventType Form event type. 537 * @return Returns ERR_OK on success, others on failure. 538 */ 539 ErrCode RegisterClickEventObserver( 540 const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer) override; 541 542 /** 543 * @brief Unregister click callback observer. 544 * @param bundleName BundleName of the form host. 545 * @param formEventType Form event type. 546 * @param observer Form click event callback listener. 547 * @return Returns ERR_OK on success, others on failure. 548 */ 549 ErrCode UnregisterClickEventObserver( 550 const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer) override; 551 552 /** 553 * @brief Set forms recyclable 554 * @param formIds Indicates the id of the forms. 555 * @return Returns ERR_OK on success, others on failure. 556 */ 557 int32_t SetFormsRecyclable(const std::vector<int64_t> &formIds) override; 558 559 /** 560 * @brief Recycle forms 561 * @param formIds Indicates the id of the forms. 562 * @param want The want of forms to be recycled. 563 * @return Returns ERR_OK on success, others on failure. 564 */ 565 int32_t RecycleForms(const std::vector<int64_t> &formIds, const Want &want) override; 566 567 /** 568 * @brief Recover recycled forms 569 * @param formIds Indicates the id of the forms. 570 * @param want The want of forms to be recovered. 571 * @return Returns ERR_OK on success, others on failure. 572 */ 573 int32_t RecoverForms(const std::vector<int64_t> &formIds, const Want &want) override; 574 private: 575 /** 576 * OnAddSystemAbility, OnAddSystemAbility will be called when the listening SA starts. 577 * 578 * @param systemAbilityId, The said being listened to. 579 * @param deviceId, deviceId is empty. 580 * @return void. 581 */ 582 virtual void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; 583 584 enum class DumpKey { 585 KEY_DUMP_HELP = 0, 586 KEY_DUMP_STORAGE, 587 KEY_DUMP_BY_BUNDLE_NAME, 588 KEY_DUMP_BY_FORM_ID, 589 KEY_DUMP_TEMPORARY, 590 KEY_DUMP_STATIC, 591 }; 592 /** 593 * @brief initialization of form manager service. 594 */ 595 ErrCode Init(); 596 597 ErrCode CheckFormObserverPermission(); 598 599 ErrCode CheckFormPermission( 600 const std::string &permission = AppExecFwk::Constants::PERMISSION_REQUIRE_FORM); 601 602 bool CheckAcrossLocalAccountsPermission() const; 603 604 void InitFormShareMgrSerialQueue(); 605 606 void DumpInit(); 607 void Dump(const std::vector<std::u16string> &args, std::string &result); 608 bool ParseOption(const std::vector<std::u16string> &args, DumpKey &key, std::string &value, std::string &result); 609 void HiDumpHelp([[maybe_unused]] const std::string &args, std::string &result); 610 void HiDumpStorageFormInfos([[maybe_unused]] const std::string &args, std::string &result); 611 void HiDumpTemporaryFormInfos([[maybe_unused]] const std::string &args, std::string &result); 612 void HiDumpStaticBundleFormInfos([[maybe_unused]] const std::string &args, std::string &result); 613 void HiDumpFormInfoByBundleName(const std::string &args, std::string &result); 614 void HiDumpFormInfoByFormId(const std::string &args, std::string &result); 615 bool CheckCallerIsSystemApp() const; 616 static std::string GetCurrentDateTime(); 617 private: 618 static const int32_t ENABLE_FORM_UPDATE = 5; 619 const static std::map<std::string, DumpKey> dumpKeyMap_; 620 using DumpFuncType = void (FormMgrService::*)(const std::string &args, std::string &result); 621 std::string onStartBeginTime_; 622 std::string onStartPublishTime_; 623 std::string onStartEndTime_; 624 std::string onKvDataServiceAddTime_; 625 std::map<DumpKey, DumpFuncType> dumpFuncMap_; 626 ServiceRunningState state_ = ServiceRunningState::STATE_NOT_START; 627 std::shared_ptr<FormEventHandler> handler_ = nullptr; 628 std::shared_ptr<FormSerialQueue> serialQueue_ = nullptr; 629 std::shared_ptr<FormSysEventReceiver> formSysEventReceiver_ = nullptr; 630 mutable std::mutex instanceMutex_; 631 DISALLOW_COPY_AND_MOVE(FormMgrService); 632 std::shared_ptr<MemStatusListener> memStatusListener_ = nullptr; 633 634 void SubscribeSysEventReceiver(); 635 }; 636 } // namespace AppExecFwk 637 } // namespace OHOS 638 #endif // OHOS_FORM_FWK_FORM_MGR_SERVICE_H 639