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_ADAPTER_H
17 #define OHOS_FORM_FWK_FORM_MGR_ADAPTER_H
18 
19 #include <singleton.h>
20 
21 #include "bundle_info.h"
22 #include "bundle_mgr_interface.h"
23 #include "form_constants.h"
24 #include "form_info.h"
25 #include "form_info_filter.h"
26 #include "form_instance.h"
27 #include "form_instances_filter.h"
28 #include "form_item_info.h"
29 #include "form_js_info.h"
30 #include "form_provider_data.h"
31 #include "form_publish_interceptor_interface.h"
32 #include "form_serial_queue.h"
33 #include "form_state_info.h"
34 #include "form_task_mgr.h"
35 #include "iremote_object.h"
36 #include "running_form_info.h"
37 #include "want.h"
38 #ifdef THEME_MGR_ENABLE
39 #include "theme_manager_client.h"
40 #endif
41 
42 namespace OHOS {
43 namespace AppExecFwk {
44 using Want = OHOS::AAFwk::Want;
45 using WantParams = OHOS::AAFwk::WantParams;
46 
47 enum class AddFormResultErrorCode : int8_t {
48     UNKNOWN = 0,
49     SUCCESS,
50     FAILED,
51     TIMEOUT
52 };
53 
54 /**
55  * @class FormMgrAdapter
56  * Form request handler from form host.
57  */
58 class FormMgrAdapter  final : public DelayedRefSingleton<FormMgrAdapter> {
59 DECLARE_DELAYED_REF_SINGLETON(FormMgrAdapter)
60 public:
61     DISALLOW_COPY_AND_MOVE(FormMgrAdapter);
62 
63     /**
64      * @brief Init properties like visibleNotifyDelayTime.
65      */
66     void Init();
67 
68     /**
69      * @brief Add form with want, send want to form manager service.
70      * @param formId The Id of the forms to add.
71      * @param want The want of the form to add.
72      * @param callerToken Caller ability token.
73      * @param formInfo Form info.
74      * @return Returns ERR_OK on success, others on failure.
75      */
76     int AddForm(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken, FormJsInfo &formInfo);
77 
78     /**
79      * @brief Add form with want, send want to form manager service.
80      * @param want The want of the form to add.
81      * @param runningFormInfo Running form info.
82      * @return Returns ERR_OK on success, others on failure.
83      */
84     int CreateForm(const Want &want, RunningFormInfo &runningFormInfo);
85 
86     /**
87      * @brief Delete forms with formIds, send formIds to form manager service.
88      * @param formId The Id of the forms to delete.
89      * @param callerToken Caller ability token.
90      * @return Returns ERR_OK on success, others on failure.
91      */
92     int DeleteForm(const int64_t formId, const sptr<IRemoteObject> &callerToken);
93 
94     /**
95      * @brief Stop rendering form.
96      * @param formId The Id of the forms to delete.
97      * @param compId The compId of the forms to delete.
98      * @return Returns ERR_OK on success, others on failure.
99      */
100     int StopRenderingForm(const int64_t formId, const std::string &compId);
101 
102     /**
103      * @brief Release forms with formIds, send formIds to form Mgr service.
104      * @param formId The Id of the forms to release.
105      * @param callerToken Caller ability token.
106      * @param delCache Delete Cache or not.
107      * @return Returns ERR_OK on success, others on failure.
108      */
109     int ReleaseForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const bool delCache);
110 
111     /**
112      * @brief Update form with formId.
113      * @param formId The Id of the form to update.
114      * @param callingUid Provider ability uid.
115      * @param formProviderData form provider data.
116      * @param std::vector<FormDataProxy> Form proxy vector.
117      * @return Returns ERR_OK on success, others on failure.
118      */
119     int UpdateForm(const int64_t formId, const int32_t callingUid, const FormProviderData &formProviderData,
120         const std::vector<FormDataProxy> &formDataProxies = {});
121 
122     /**
123      * @brief Request form with formId and want, send formId and want to form manager service.
124      *
125      * @param formId The Id of the form to update.
126      * @param callerToken Caller ability token.
127      * @param want The want of the form to request.
128      * @return Returns ERR_OK on success, others on failure.
129      */
130     int RequestForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const Want &want);
131 
132     /**
133      * @brief Form visible/invisible notify, send formIds to form manager service.
134      *
135      * @param formIds The vector of form Ids.
136      * @param callerToken Caller ability token.
137      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
138      * @return Returns ERR_OK on success, others on failure.
139      */
140     ErrCode NotifyWhetherVisibleForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken,
141         const int32_t formVisibleType);
142 
143     /**
144      * @brief Query whether has visible form by tokenId.
145      * @param tokenId Unique identification of application.
146      * @return Returns true if has visible form, false otherwise.
147      */
148     bool HasFormVisible(const uint32_t tokenId);
149 
150     /**
151      * @brief Padding the formInstances map for visibleNotify.
152      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
153      * @param formId Form Id.
154      * @param formInstanceMaps formInstances for visibleNotify.
155      */
156     void PaddingNotifyVisibleFormsMap(const int32_t formVisibleType, int64_t formId,
157         std::map<std::string, std::vector<FormInstance>> &formInstanceMaps);
158 
159     /**
160      * @brief temp form to normal form.
161      * @param formId The Id of the form.
162      * @param callerToken Caller ability token.
163      * @return Returns ERR_OK on success, others on failure.
164      */
165     int CastTempForm(const int64_t formId, const sptr<IRemoteObject> &callerToken);
166 
167     /**
168      * @brief Dump all of form storage infos.
169      * @param formInfos All of form storage infos.
170      * @return Returns ERR_OK on success, others on failure.
171      */
172     int DumpStorageFormInfos(std::string &formInfos) const;
173     /**
174      * @brief Dump all of temporary form infos.
175      * @param formInfos All of temporary form infos.
176      * @return Returns ERR_OK on success, others on failure.
177      */
178     int DumpTemporaryFormInfos(std::string &formInfos) const;
179     /**
180      * @brief Dump form infos of all bundles, this is static info.
181      * @param formInfos All of static form infos.
182      * @return Returns ERR_OK on success, others on failure.
183      */
184     int DumpStaticBundleFormInfos(std::string &formInfos) const;
185 
186     /**
187      * @brief Dump has form visible with bundleInfo.
188      * @param bundleInfo Bundle info like bundleName_userId_instIndex.
189      * @param formInfos Form dump infos.
190      * @return Returns ERR_OK on success, others on failure.
191      */
192     int DumpHasFormVisible(const std::string &bundleInfo, std::string &formInfos) const;
193 
194     /**
195      * @brief Dump form info by a bundle name.
196      * @param bundleName The bundle name of form provider.
197      * @param formInfos Form infos.
198      * @return Returns ERR_OK on success, others on failure.
199      */
200     int DumpFormInfoByBundleName(const std::string &bundleName, std::string &formInfos) const;
201     /**
202      * @brief Dump form info by a bundle name.
203      * @param formId The id of the form.
204      * @param formInfo Form info.
205      * @return Returns ERR_OK on success, others on failure.
206      */
207     int DumpFormInfoByFormId(const std::int64_t formId, std::string &formInfo) const;
208     /**
209      * @brief Dump form timer by form id.
210      * @param formId The id of the form.
211      * @param isTimingService "true" or "false".
212      * @return Returns ERR_OK on success, others on failure.
213      */
214     int DumpFormTimerByFormId(const std::int64_t formId, std::string &isTimingService) const;
215 
216     /**
217      * @brief Dump running form info.
218      * @param runningFormInfosResult The dump info of all the running form info.
219      * @return Returns ERR_OK on success, others on failure.
220      */
221     int DumpFormRunningFormInfos(std::string &runningFormInfosResult) const;
222 
223     /**
224      * @brief set next refresh time.
225      * @param formId The id of the form.
226      * @param nextTime next refresh time.
227      * @return Returns ERR_OK on success, others on failure.
228      */
229     int SetNextRefreshTime(const int64_t formId, const int64_t nextTime);
230 
231     /**
232      * @brief Release renderer.
233      * @param formId The Id of the forms to release.
234      * @param compId The compId of the forms to release.
235      * @return Returns ERR_OK on success, others on failure.
236      */
237     int ReleaseRenderer(int64_t formId, const std::string &compId);
238 
239     /**
240      * @brief Request to publish a form to the form host.
241      *
242      * @param want The want of the form to publish.
243      * @param withFormBindingData Indicates whether the formBindingData is carried with.
244      * @param formBindingData Indicates the form data.
245      * @param formId Return the form id to be published.
246      * @param needCheckFormPermission Indicates whether the app have system permissions.default value is true.
247      * @return Returns ERR_OK on success, others on failure.
248      */
249     ErrCode RequestPublishForm(Want &want, bool withFormBindingData,
250         std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId,
251         const std::vector<FormDataProxy> &formDataProxies = {}, bool needCheckFormPermission = true);
252 
253     ErrCode SetPublishFormResult(const int64_t formId, Constants::PublishFormResult &errorCodeInfo);
254 
255     ErrCode AcquireAddFormResult(const int64_t formId);
256     /**
257      * @brief Check if the request of publishing a form is supported by the host.
258      * @return Returns true if the request is supported and false otherwise.
259      */
260     bool IsRequestPublishFormSupported();
261 
262     /**
263      * @brief enable update form.
264      * @param formIDs The id of the forms.
265      * @param callerToken Caller ability token.
266      * @return Returns ERR_OK on success, others on failure.
267      */
268     int EnableUpdateForm(const std::vector<int64_t> formIDs, const sptr<IRemoteObject> &callerToken);
269 
270     /**
271      * @brief disable update form.
272      * @param formIDs The id of the forms.
273      * @param callerToken Caller ability token.
274      * @return Returns ERR_OK on success, others on failure.
275      */
276     int DisableUpdateForm(const std::vector<int64_t> formIDs, const sptr<IRemoteObject> &callerToken);
277 
278     /**
279      * @brief Process js message event.
280      * @param formId Indicates the unique id of form.
281      * @param want information passed to supplier.
282      * @param callerToken Caller ability token.
283      * @return Returns true if execute success, false otherwise.
284      */
285     int MessageEvent(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken);
286 
287     /**
288      * @brief Process js router event.
289      * @param formId Indicates the unique id of form.
290      * @param want the want of the ability to start.
291      * @param callerToken Caller ability token.
292      * @return Returns true if execute success, false otherwise.
293      */
294     int RouterEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken);
295 
296     /**
297      * @brief Process background router event.
298      * @param formId Indicates the unique id of form.
299      * @param want the want of the ability to start.
300      * @param callerToken Caller ability token.
301      * @return Returns true if execute success, false otherwise.
302      */
303     int BackgroundEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken);
304 
305     /**
306      * @brief Acquire form data from form provider.
307      * @param formId The Id of the from.
308      * @param want The want of the request.
309      * @param remoteObject Form provider proxy object.
310      */
311     void AcquireProviderFormInfo(const int64_t formId, const Want &want, const sptr<IRemoteObject> &remoteObject);
312     /**
313      * @brief Notify form provider for delete form.
314      * @param formId The Id of the from.
315      * @param want The want of the form.
316      * @param remoteObject Form provider proxy object.
317      * @return none.
318      */
319     void NotifyFormDelete(const int64_t formId, const Want &want, const sptr<IRemoteObject> &remoteObject);
320 
321     /**
322      * @brief Delete the invalid forms.
323      * @param formIds Indicates the ID of the valid forms.
324      * @param callerToken Caller ability token.
325      * @param numFormsDeleted Returns the number of the deleted forms.
326      * @return Returns ERR_OK on success, others on failure.
327      */
328     int DeleteInvalidForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken,
329                            int32_t &numFormsDeleted);
330 
331     /**
332      * @brief Acquire form state info by passing a set of parameters (using Want) to the form provider.
333      * @param want Indicates a set of parameters to be transparently passed to the form provider.
334      * @param callerToken Caller ability token.
335      * @param stateInfo Returns the form's state info of the specify.
336      * @return Returns ERR_OK on success, others on failure.
337      */
338     int AcquireFormState(const Want &want, const sptr<IRemoteObject> &callerToken, FormStateInfo &stateInfo);
339 
340     /**
341      * @brief Acquire form data by formId.
342      * @param formId The Id of the form to acquire data.
343      * @param callerToken Indicates the host client.
344      * @param requestCode The request code of this acquire form.
345      * @param formData Return the forms' information of customization
346      * @return Returns ERR_OK on success, others on failure.
347      */
348     int AcquireFormData(int64_t formId, int64_t requestCode, const sptr<IRemoteObject> &callerToken,
349          AAFwk::WantParams &formData);
350 
351     /**
352      * @brief Notify the form is visible or not.
353      * @param formIds Indicates the ID of the forms.
354      * @param isVisible Visible or not.
355      * @param callerToken Host client.
356      * @return Returns ERR_OK on success, others on failure.
357      */
358     int NotifyFormsVisible(const std::vector<int64_t> &formIds, bool isVisible, const sptr<IRemoteObject> &callerToken);
359 
360     /**
361      * @brief Notify the form is enable to be updated or not.
362      * @param formIds Indicates the ID of the forms.
363      * @param isEnableUpdate enable update or not.
364      * @param callerToken Host client.
365      * @return Returns ERR_OK on success, others on failure.
366      */
367     int NotifyFormsEnableUpdate(const std::vector<int64_t> &formIds, bool isEnableUpdate,
368                                 const sptr<IRemoteObject> &callerToken);
369 
370     /**
371       * @brief Get All FormsInfo.
372       * @param formInfos Return the forms' information of all forms provided.
373       * @return Returns ERR_OK on success, others on failure.
374       */
375     int GetAllFormsInfo(std::vector<FormInfo> &formInfos);
376 
377     /**
378      * @brief Get forms info by bundle name .
379      * @param bundleName Application name.
380      * @param formInfos Return the forms' information of the specify application name.
381      * @return Returns ERR_OK on success, others on failure.
382      */
383     int GetFormsInfoByApp(const std::string &bundleName, std::vector<FormInfo> &formInfos);
384 
385     /**
386      * @brief Get forms info by bundle name and module name.
387      * @param bundleName bundle name.
388      * @param moduleName Module name of hap.
389      * @param formInfos Return the forms' information of the specify bundle name and module name.
390      * @return Returns ERR_OK on success, others on failure.
391      */
392     int GetFormsInfoByModule(const std::string &bundleName, const std::string &moduleName,
393         std::vector<FormInfo> &formInfos);
394 
395     /**
396      * @brief Get forms info specfied by filter parameters.
397      * @param filter Filter that contains necessary conditions, such as bundle name, module name, dimensions.
398      * @param formInfos Return the forms' information specified by filter.
399      * @return Returns ERR_OK on success, others on failure.
400      */
401     int GetFormsInfoByFilter(const FormInfoFilter &filter, std::vector<FormInfo> &formInfos);
402 
403     /**
404     * @brief get forms count.
405     * @param isTempFormFlag Indicates temp form or not.
406     * @param formCount Returns the number of the cast or temp form.
407     * @return Returns ERR_OK on success, others on failure.
408     */
409     int32_t GetFormsCount(bool isTempFormFlag, int32_t &formCount);
410 
411     /**
412     * @brief get host forms count.
413     * @param bundleName Indicates form host bundleName.
414     * @param formCount Returns the number of the host form.
415     * @return Returns ERR_OK on success, others on failure.
416     */
417     int32_t GetHostFormsCount(std::string &bundleName, int32_t &formCount);
418 
419     /**
420      * @brief Handle form add observer.
421      * @return Returns ERR_OK on success, others on failure.
422      */
423     ErrCode HandleFormAddObserver(const int64_t formId);
424 
425     /**
426      * @brief Handle form add observer.
427      * @param runningFormInfo the running forms' infos of the specify application name.
428      * @return Returns ERR_OK on success, others on failure.
429      */
430     ErrCode HandleFormRemoveObserver(const RunningFormInfo runningFormInfo);
431 
432     /**
433      * @brief Register form add observer by bundle.
434      * @param bundleName BundleName of the form host
435      * @param callerToken Caller ability token.
436      * @return Returns ERR_OK on success, others on failure.
437      */
438     ErrCode RegisterFormAddObserverByBundle(const std::string bundleName, const sptr<IRemoteObject> &callerToken);
439 
440     /**
441      * @brief Register form remove observer by bundle.
442      * @param bundleName BundleName of the form host
443      * @param callerToken Caller ability token.
444      * @return Returns ERR_OK on success, others on failure.
445      */
446     ErrCode RegisterFormRemoveObserverByBundle(const std::string bundleName, const sptr<IRemoteObject> &callerToken);
447 
448     /**
449      * @brief Get all 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     ErrCode GetRunningFormInfos(bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos);
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     ErrCode GetRunningFormInfosByBundleName(
464         const std::string &bundleName, bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos);
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     ErrCode GetFormInstancesByFilter(const FormInstancesFilter &formInstancesFilter,
473         std::vector<FormInstance> &formInstances);
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     ErrCode GetFormInstanceById(const int64_t formId, FormInstance &formInstance);
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.
487      * @param formInstance return formInstance
488      * @return return ERR_OK on get info success, others on failure.
489      */
490     ErrCode GetFormInstanceById(const int64_t formId, bool isUnusedIncluded, FormInstance &formInstance);
491 
492     /**
493      * @brief Register form add observer.
494      * @param bundleName BundleName of the form host
495      * @param callerToken Caller ability token.
496      * @return Returns ERR_OK on success, others on failure.
497      */
498     ErrCode RegisterAddObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken);
499 
500     /**
501      * @brief Register form remove observer.
502      * @param bundleName BundleName of the form host
503      * @param callerToken Caller ability token.
504      * @return Returns ERR_OK on success, others on failure.
505      */
506     ErrCode RegisterRemoveObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken);
507 
508     /**
509      * @brief Register form router event proxy.
510      * @param formIds Indicates the ID of the forms.
511      * @param callerToken Router proxy call back client.
512      * @return Returns ERR_OK on success, others on failure.
513      */
514     ErrCode RegisterFormRouterProxy(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken);
515 
516     /**
517      * @brief Unregister form router event proxy.
518      * @param formIds Indicates the ID of the forms.
519      * @return Returns ERR_OK on success, others on failure.
520      */
521     ErrCode UnregisterFormRouterProxy(const std::vector<int64_t> &formIds);
522 
523     /**
524      * @brief Registers the callback for publish form. The callback is used to process the publish form request
525      * when the system handler is not found.
526      * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor.
527      * @return Returns ERR_OK on success, others on failure.
528      */
529     int32_t RegisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback);
530 
531     /**
532      * @brief Unregisters the callback for publish form. The callback is used to process the publish form request
533      * when the system handler is not found.
534      * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor.
535      * @return Returns ERR_OK on success, others on failure.
536      */
537     int32_t UnregisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback);
538 
539     /**
540      * @brief Register click callback observer.
541      * @param bundleName BundleName of the form host.
542      * @param formEventType Form event type.
543      * @param callerToken Caller ability token.
544      * @return Returns ERR_OK on success, others on failure.
545      */
546     ErrCode RegisterClickEventObserver(
547         const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer);
548 
549     /**
550      * @brief Unregister click callback observer.
551      * @param bundleName BundleName of the form host.
552      * @param formEventType Form event type.
553      * @param callerToken Caller ability token.
554      * @return Returns ERR_OK on success, others on failure.
555      */
556     ErrCode UnregisterClickEventObserver(
557         const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer);
558 
559     /**
560      * @brief Compare the locally configured update duration with the update duration in additionalInfo and
561      * return a larger value.
562      * @param formId The Id of the form.
563      * @param updateDuration The valid form update duration.
564      * @return Returns true on success, false on failure.
565      */
566     bool GetValidFormUpdateDuration(const int64_t formId, int64_t &updateDuration) const;
567 
568     /**
569      * @brief Handle forms visible/invisible notify after delay time, notification will be cancelled when
570      * formVisibleState recovered during the delay time.
571      * @param formIds the Ids of forms need to notify.
572      * @param formInstanceMaps formInstances for visibleNotify.
573      * @param eventMaps eventMaps for event notify.
574      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
575      */
576     void HandlerNotifyWhetherVisibleForms(const std::vector<int64_t> &formIds,
577         std::map<std::string, std::vector<FormInstance>> formInstanceMaps,
578         std::map<std::string, std::vector<int64_t>> eventMaps, const int32_t formVisibleType);
579 
580     /**
581      * @brief Set forms recyclable
582      * @param formIds Indicates the id of the forms.
583      * @return Returns ERR_OK on success, others on failure.
584      */
585     int32_t SetFormsRecyclable(const std::vector<int64_t> &formIds);
586 
587     /**
588      * @brief Recycle forms
589      * @param formIds Indicates the id of the forms.
590      * @param want The want of forms to be recycled.
591      * @param isCheckCallingUid is need check CallingUid, default is true.
592      * @return Returns ERR_OK on success, others on failure.
593      */
594     int32_t RecycleForms(const std::vector<int64_t> &formIds, const Want &want, bool isCheckCallingUid = true);
595 
596     /**
597      * @brief Recover recycled forms
598      * @param formIds Indicates the id of the forms.
599      * @param want The want of forms to be recovered.
600      * @return Returns ERR_OK on success, others on failure.
601      */
602     int32_t RecoverForms(const std::vector<int64_t> &formIds, const Want &want);
603 
604     /**
605      * @brief Update form cloud update duration when additionalInfo changed.
606      * @param bundleName The bundleName of the form with a specified update duration in app gallery.
607      */
608     void UpdateFormCloudUpdateDuration(const std::string &bundleName);
609 
610     /**
611      * @brief Update formLocation with formId.
612      * @param formId The Id of the form to update.
613      * @param formLocation formLocation.
614      * @return Returns ERR_OK on success, others on failure.
615      */
616     ErrCode UpdateFormLocation(const int64_t &formId, const int32_t &formLocation);
617 
618     /**
619      * @brief Update form with formRefreshType, send to form manager service.
620      * @param formRefreshType The type of the form to refresh, 0: AllForm 1: 2: AppForm 2: AtomicServiceForm
621      * @return Returns ERR_OK on success, others on failure.
622      */
623     ErrCode BatchRefreshForms(const int32_t formRefreshType);
624 
625 #ifdef RES_SCHEDULE_ENABLE
626     /**
627      * @brief Set the value which indicate whether Refresh Timer task should be triggered.
628      * @param isTimerTaskNeeded The value of whether Refresh Timer task should be triggered.
629      */
630     void SetTimerTaskNeeded(bool isTimerTaskNeeded);
631 #endif // RES_SCHEDULE_ENABLE
632 
633     /**
634      * @brief enable/disable form update.
635      * @param bundleName BundleName of the form host.
636      * @param enable True for enable form, false for disable form.
637      * @return Returns ERR_OK on success, others on failure.
638      */
639     int32_t EnableForms(const std::string bundleName, const bool enable);
640 
641 private:
642     /**
643      * @brief Get form configure info.
644      * @param want The want of the request.
645      * @param formItemInfo Form configure info.
646      * @return Returns ERR_OK on success, others on failure.
647      */
648     ErrCode GetFormConfigInfo(const Want& want, FormItemInfo &formItemInfo);
649 
650     /**
651      * @brief Get bundle info.
652      * @param want The want of the request.
653      * @param bundleInfo Bundle info.
654      * @param packageName Package name.
655      * @return Returns ERR_OK on success, others on failure.
656      */
657     ErrCode GetBundleInfo(const AAFwk::Want &want, BundleInfo &bundleInfo, std::string &packageName);
658 
659     /**
660      * @brief Get form info.
661      * @param want The want of the request.
662      * @param formInfo Form info.
663      * @return Returns ERR_OK on success, others on failure.
664      */
665     ErrCode GetFormInfo(const AAFwk::Want &want, FormInfo &formInfo);
666 
667     /**
668      * @brief Get form configure info.
669      * @param want The want of the request.
670      * @param bundleInfo Bundle info.
671      * @param formInfo Form info.
672      * @param formItemInfo Form configure info.
673      * @return Returns ERR_OK on success, others on failure.
674      */
675     ErrCode GetFormItemInfo(const AAFwk::Want &want, const BundleInfo &bundleInfo, const FormInfo &formInfo,
676         FormItemInfo &formItemInfo);
677 
678     /**
679      * @brief Dimension valid check.
680      * @param formInfo Form info.
681      * @param dimensionId Dimension id.
682      * @return Returns true on success, false on failure.
683      */
684     bool IsDimensionValid(const FormInfo &formInfo, int dimensionId) const;
685 
686     /**
687      * @brief Create form configure info.
688      * @param bundleInfo Bundle info.
689      * @param formInfo Form info.
690      * @param itemInfo Form configure info.
691      * @param want The want of the request.
692      * @return Returns ERR_OK on success, others on failure.
693      */
694     ErrCode CreateFormItemInfo(const BundleInfo& bundleInfo, const FormInfo& formInfo, FormItemInfo& itemInfo,
695         const AAFwk::Want &want);
696 
697     /**
698      * @brief Set form item info params.
699      * @param bundleInfo Bundle info.
700      * @param formInfo Form info.
701      * @param itemInfo Form item info.
702      */
703     void SetFormItemInfoParams(const BundleInfo& bundleInfo, const FormInfo& formInfo, FormItemInfo& itemInfo);
704 
705     /**
706      * @brief Set form item module info.
707      * @param hapModuleInfo Hap module info.
708      * @param formInfo Form info.
709      * @param itemInfo Form item info.
710      */
711     void SetFormItemModuleInfo(const HapModuleInfo& hapModuleInfo, const FormInfo& formInfo,
712         FormItemInfo& itemInfo);
713 
714     /**
715      * @brief Allocate form by formId.
716      * @param info Form configure info.
717      * @param callerToken Caller ability token.
718      * @param wantParams WantParams of the request.
719      * @param formInfo Form info for form host.
720      * @return Returns ERR_OK on success, others on failure.
721      */
722     ErrCode AllotFormById(const FormItemInfo &info, const sptr<IRemoteObject> &callerToken,
723         const WantParams &wantParams, FormJsInfo &formInfo);
724 
725     /**
726      * @brief Allocate form by form configure info.
727      * @param info Form configure info.
728      * @param callerToken Caller ability token.
729      * @param wantParams WantParams of the request.
730      * @param formInfo Form info for form host.
731      * @return Returns ERR_OK on success, others on failure.
732      */
733     ErrCode AllotFormByInfo(const FormItemInfo &info, const sptr<IRemoteObject> &callerToken,
734         const WantParams& wantParams, FormJsInfo &formInfo);
735 
736     /**
737      * @brief Acquire form data from form provider.
738      * @param formId The Id of the form..
739      * @param info Form configure info.
740      * @param wantParams WantParams of the request.
741      * @return Returns ERR_OK on success, others on failure.
742      */
743     ErrCode AcquireProviderFormInfoAsync(const int64_t formId, const FormItemInfo &info, const WantParams &wantParams);
744 
745     ErrCode InnerAcquireProviderFormInfoAsync(const int64_t formId,
746         const FormItemInfo &info, const WantParams &wantParams);
747 
748     /**
749      * @brief Handle release form.
750      * @param formId The form id.
751      * @param callerToken Caller ability token.
752      * @return Returns ERR_OK on success, others on failure.
753      */
754     ErrCode HandleReleaseForm(const int64_t formId, const sptr<IRemoteObject> &callerToken);
755 
756     /**
757      * @brief Handle delete form.
758      * @param formId The form id.
759      * @param callerToken Caller ability token.
760      * @return Returns ERR_OK on success, others on failure.
761      */
762     ErrCode HandleDeleteForm(const int64_t formId, const sptr<IRemoteObject> &callerToken);
763 
764     /**
765      * @brief Handle delete temp form.
766      * @param formId The form id.
767      * @param callerToken Caller ability token.
768      * @return Returns ERR_OK on success, others on failure.
769      */
770     ErrCode HandleDeleteTempForm(const int64_t formId, const sptr<IRemoteObject> &callerToken);
771 
772     /**
773      * @brief Handle delete form storage.
774      * @param dbRecord Form storage information.
775      * @param uid calling user id.
776      * @param formId The form id.
777      * @return Function result and has other host flag.
778      */
779     ErrCode HandleDeleteFormCache(FormRecord &dbRecord, const int uid, const int64_t formId);
780 
781     /**
782      * @brief Add existed form record.
783      * @param info Form configure info.
784      * @param callerToken Caller ability token.
785      * @param record Form data.
786      * @param formId The form id.
787      * @param wantParams WantParams of the request.
788      * @param formInfo Form info for form host.
789      * @return Returns ERR_OK on success, others on failure.
790      */
791     ErrCode AddExistFormRecord(const FormItemInfo &info, const sptr<IRemoteObject> &callerToken,
792         const FormRecord &record, const int64_t formId, const WantParams &wantParams, FormJsInfo &formInfo);
793 
794     /**
795      * @brief Add new form record.
796      * @param info Form configure info.
797      * @param formId The form id.
798      * @param callerToken Caller ability token.
799      * @param wantParams WantParams of the request.
800      * @param formInfo Form info for form host.
801      * @return Returns ERR_OK on success, others on failure.
802      */
803     ErrCode AddNewFormRecord(const FormItemInfo &info, const int64_t formId,
804         const sptr<IRemoteObject> &callerToken, const WantParams &wantParams, FormJsInfo &formInfo);
805 
806     /**
807      * @brief Send event notify to form provider. The event notify type include FORM_VISIBLE and FORM_INVISIBLE.
808      *
809      * @param providerKey The provider key string which consists of the provider bundle name and ability name.
810      * @param formIdsByProvider The map of form Ids and their event type which have the same provider.
811      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
812      * @return Returns ERR_OK on success, others on failure.
813      */
814     ErrCode HandleEventNotify(const std::string &providerKey, const std::vector<int64_t> &formIdsByProvider,
815         const int32_t formVisibleType);
816 
817     /**
818      * @brief Increase the timer refresh count.
819      *
820      * @param formId The form id.
821      */
822     void IncreaseTimerRefreshCount(const int64_t formId);
823 
824     /**
825      * @brief handle update form flag.
826      * @param formIDs The id of the forms.
827      * @param callerToken Caller ability token.
828      * @param flag form flag.
829      * @param isOnlyEnableUpdate form enable update form flag.
830      * @return Returns ERR_OK on success, others on failure.
831      */
832     ErrCode HandleUpdateFormFlag(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken,
833                                  bool flag, bool isOnlyEnableUpdate);
834 
835     /**
836      * @brief check form cached.
837      * @param record Form information.
838      * @return Returns true on cached, false on not.
839      */
840     bool IsFormCached(const FormRecord record);
841 
842     /**
843      * @brief set next refresh time locked.
844      * @param formId The form's id.
845      * @param nextTime next refresh time.
846      * @param userId User ID.
847      * @return Returns ERR_OK on success, others on failure.
848      */
849     int SetNextRefreshTimeLocked(const int64_t formId, const int64_t nextTime, const int32_t userId = 0);
850 
851     /**
852      * @brief check if update is valid.
853      * @param formId The form's id.
854      * @param bundleName Provider ability bundleName.
855      * @return Returns true or false.
856      */
857     bool IsUpdateValid(const int64_t formId, const std::string &bundleName);
858     /**
859      * @brief Handle cast temp form.
860      * @param formId The form id.
861      * @param record Form information.
862      * @return Returns ERR_OK on success, others on failure.
863      */
864     ErrCode HandleCastTempForm(const int64_t formId, const FormRecord &record);
865 
866     /**
867      * @brief Add form timer.
868      * @param formRecord Form information.
869      * @return Returns ERR_OK on success, others on failure.
870      */
871     ErrCode AddFormTimer(const FormRecord &formRecord);
872 
873     /**
874      * @brief Genera checking the publish form.
875      * @param want The want of the form to publish.
876      * @param bundleName BundleName
877      * @param needCheckFormPermission Indicates whether the app have system permissions.default value is true.
878      * @return Returns ERR_OK on success, others on failure.
879      */
880     ErrCode CheckFormBundleName(Want &want, std::string &bundleName, bool needCheckFormPermission);
881 
882     /**
883      * @brief check the publish form.
884      * @param want The want of the form to publish.
885      * @param needCheckFormPermission Indicates whether the app have system permissions.default value is true.
886      * @return Returns ERR_OK on success, others on failure.
887      */
888     ErrCode CheckPublishForm(Want &want, bool needCheckFormPermission = true);
889 
890     /**
891      * @brief Query the request host.
892      * @param want The want of the form to publish.
893      * @return Returns ERR_OK on success, others on failure.
894      */
895     ErrCode QueryPublishFormToHost(Want &want);
896 
897     /**
898      * @brief Post request publish form to host.
899      * @param want The want of the form to publish.
900      * @return Returns ERR_OK on success, others on failure.
901      */
902     ErrCode RequestPublishFormToHost(Want &want);
903 
904     /**
905      * @brief check request publish form want.
906      * @param want The want of the form to publish.
907      * @return Returns true if have snapshot info, others on none.
908      */
909     bool CheckSnapshotWant(const Want &want);
910 
911     /**
912      * @brief check the argv of AddRequestPublishForm.
913      * @param want The want of the form to add.
914      * @param formProviderWant The want of the form to publish from provider.
915      * @return Returns ERR_OK on success, others on failure.
916      */
917     ErrCode CheckAddRequestPublishForm(const Want &want, const Want &formProviderWant);
918 
919     /**
920      * @brief add request publish form.
921      * @param formItemInfo Form configure info.
922      * @param want The want of the form to add.
923      * @param callerToken Caller ability token.
924      * @param formJsInfo Return form info to form host.
925      * @return Returns ERR_OK on success, others on failure.
926      */
927     ErrCode AddRequestPublishForm(const FormItemInfo &formItemInfo, const Want &want,
928         const sptr<IRemoteObject> &callerToken, FormJsInfo &formJsInfo);
929 
930     /**
931      * @brief get bundleName.
932      * @param bundleName for output.
933      * @param needCheckFormPermission Indicates whether the app have system permissions.default value is true.
934      * @return Returns true on success, others on failure.
935      */
936     bool GetBundleName(std::string &bundleName, bool needCheckFormPermission = true);
937 
938     /**
939      * @brief Check if the form should update information to the host.
940      *
941      * @param matchedFormId The Id of the form
942      * @param userId User ID.
943      * @param callerToken Caller ability token.
944      * @param formRecord Form storage information
945      * @return Returns true on success, false on failure.
946      */
947     bool isFormShouldUpdateProviderInfoToHost(const int64_t &matchedFormId, const int32_t &userId,
948         const sptr<IRemoteObject> &callerToken, FormRecord &formRecord);
949 
950     /**
951      * @brief Update provider info to host
952      *
953      * @param matchedFormId The Id of the form
954      * @param userId User ID.
955      * @param callerToken Caller ability token.
956      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
957      * @param formRecord Form storage information
958      * @return Returns true on success, false on failure.
959      */
960     bool UpdateProviderInfoToHost(const int64_t &matchedFormId, const int32_t &userId,
961         const sptr<IRemoteObject> &callerToken, const int32_t &formVisibleType, FormRecord &formRecord);
962 
963     /**
964      * @brief if the ability have permission for keeping background running is true,
965      * @param iBundleMgr BundleManagerProxy
966      * @param bundleName BundleName
967      * @param userId UserId
968      * @return Returns true if the form provider is system app, false if not.
969      */
970     bool CheckIsSystemAppByBundleName(const sptr<IBundleMgr> &iBundleMgr,
971         const int32_t &userId, const std::string &bundleName);
972 
973     /**
974      * @brief if the ability have permission for keeping background running is true,
975      * @param iBundleMgr BundleManagerProxy
976      * @param bundleName BundleName
977      * @return Returns true if the ability have permission for keeping background running, false if not.
978      */
979     bool CheckKeepBackgroundRunningPermission(const sptr<IBundleMgr> &iBundleMgr, const std::string &bundleName);
980     /**
981      * @brief Create eventMaps for event notify.
982      *
983      * @param matchedFormId The Id of the form
984      * @param formRecord Form storage information
985      * @param eventMaps eventMaps for event notify
986      * @return Returns true on success, false on failure.
987      */
988     bool CreateHandleEventMap(const int64_t matchedFormId, const FormRecord &formRecord,
989         std::map<std::string, std::vector<int64_t>> &eventMaps);
990     /**
991      * @brief Get current user ID.
992      * @param callingUid calling Uid.
993      * @return Returns user ID.
994      */
995     int32_t GetCurrentUserId(const int callingUid);
996     /**
997      * @brief AcquireFormState want check.
998      * @param bundleName The bundle name of the form.
999      * @param abilityName The ability name of the form.
1000      * @param want The want of the form.
1001      * @param provider the provider info.
1002      * @return Returns ERR_OK on success, others on failure.
1003      */
1004     ErrCode AcquireFormStateCheck(const std::string &bundleName, const std::string &abilityName, const Want &want,
1005                                   std::string &provider);
1006     /**
1007      * @brief check if the form host is system app
1008      * @param formRecord Form storage information
1009      * @return Returns true if the form host is system app, false if not.
1010      */
1011     bool checkFormHostHasSaUid(const FormRecord &formRecord);
1012 
1013     /**
1014      * @brief Check whether the caller for publish form is in the whitelist.
1015      * @param iBundleMgr BundleManagerProxy
1016      * @param bundleName BundleName of caller
1017      * @param want want of target form
1018      * @param needCheckFormPermission Indicates whether the app have system permissions.default value is true.
1019      * @return Returns true if the caller is in the whitelist, others if not.
1020      */
1021     bool IsValidPublishEvent(const sptr<IBundleMgr> &iBundleMgr, const std::string &bundleName, const Want &want,
1022         bool needCheckFormPermission = true);
1023 
1024     /**
1025      * @brief Allocate form by specific Id.
1026      * @param info Form configure info.
1027      * @param callerToken Caller ability token.
1028      * @param wantParams WantParams of the request.
1029      * @param formInfo Form info for form host.
1030      * @return Returns ERR_OK on success, others on failure.
1031      */
1032     ErrCode AllotFormBySpecificId(const FormItemInfo &info,
1033         const sptr<IRemoteObject> &callerToken, const WantParams &wantParams, FormJsInfo &formInfo);
1034 
1035     /**
1036      * @brief when form observer died clean the resource.
1037      * @param remote remote object.
1038      */
1039     void CleanResource(const wptr<IRemoteObject> &remote);
1040 
1041     /**
1042      * @brief Set value of deathRecipient_.
1043      * @param callerToken Caller ability token.
1044      * @param deathRecipient DeathRecipient object.
1045      */
1046     void SetDeathRecipient(const sptr<IRemoteObject> &callerToken,
1047         const sptr<IRemoteObject::DeathRecipient> &deathRecipient);
1048     mutable std::mutex formObserversMutex_;
1049     mutable std::mutex deathRecipientsMutex_;
1050     std::map<std::string, std::vector<sptr<IRemoteObject>>> formObservers_;
1051     std::map<sptr<IRemoteObject>, sptr<IRemoteObject::DeathRecipient>> deathRecipients_;
1052 
1053     void NotifyFormClickEvent(int64_t formId, const std::string &formClickType);
1054 
1055     /**
1056      * @brief Get caller type.
1057      * @param bundleName the caller's bundle name.
1058      */
1059     int32_t GetCallerType(std::string bundleName);
1060 
1061     /**
1062      * @brief Check if the form is allow to publish.
1063      * @param bundleName the caller's bundle name.
1064      * @param wants Wants of the request.
1065      */
1066     bool IsErmsSupportPublishForm(std::string bundleName, std::vector<Want> wants);
1067 
1068     /**
1069      * @brief Check if the caller is formRenderService.
1070      * @param callingUid the caller's Uid.
1071      * @return Returns true if the caller is formRenderService, false if not.
1072      */
1073     bool IsFormRenderServiceCall(int callingUid);
1074 
1075     /**
1076      * @brief Notify forms visible/invisible to remoteCallers.
1077      * @param bundleName the caller's bundle name.
1078      * @param remoteObjects refs of remoteCallers.
1079      * @param formInstanceMaps formInstances for visibleNotify.
1080      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
1081      */
1082     void NotifyWhetherFormsVisible(const std::string &bundleName,
1083         std::vector<sptr<IRemoteObject>> &remoteObjects,
1084         std::map<std::string, std::vector<FormInstance>> &formInstanceMaps, const int32_t formVisibleType);
1085 
1086     /**
1087      * @brief Forms formInstanceMaps or eventMaps should remove when visible/invisible status recovered.
1088      * @param formInstanceMaps formInstances for visibleNotify.
1089      * @param eventMaps eventMaps for event notify.
1090      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
1091      */
1092     void FilterDataByVisibleType(std::map<std::string, std::vector<FormInstance>> &formInstanceMaps,
1093         std::map<std::string, std::vector<int64_t>> &eventMaps, const int32_t formVisibleType);
1094 
1095     /**
1096      * @brief Forms formInstanceMaps should remove when visible/invisible status recovered.
1097      * @param formInstanceMaps formInstances for visibleNotify.
1098      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
1099      * @param restoreFormRecords formRecords of forms no need to notify.
1100      */
1101     void FilterFormInstanceMapsByVisibleType(std::map<std::string, std::vector<FormInstance>> &formInstanceMaps,
1102         const int32_t formVisibleType, std::map<int64_t, FormRecord> &restoreFormRecords);
1103 
1104     /**
1105      * @brief Forms eventMaps should remove when visible/invisible status recovered.
1106      * @param eventMaps eventMaps for event notify.
1107      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
1108      * @param restoreFormRecords formRecords of forms no need to notify.
1109      */
1110     void FilterEventMapsByVisibleType(std::map<std::string, std::vector<int64_t>> &eventMaps,
1111         const int32_t formVisibleType, std::map<int64_t, FormRecord> &restoreFormRecords);
1112 
1113     ErrCode CheckFormCountLimit(const int64_t formId, const Want &want);
1114 
1115     ErrCode AllotForm(const int64_t formId, const Want &want,
1116         const sptr<IRemoteObject> &callerToken, FormJsInfo &formInfo, const FormItemInfo &formItemInfo);
1117 
1118     void GetUpdateDurationFromAdditionalInfo(const std::string &additionalInfo, std::vector<int> &durationArray) const;
1119 
1120     void IncreaseAddFormRequestTimeOutTask(const int64_t formId);
1121 
1122     void CancelAddFormRequestTimeOutTask(const int64_t formId, const int result);
1123 
1124     ErrCode CheckAddFormTaskTimeoutOrFailed(const int64_t formId, AddFormResultErrorCode &formStates);
1125 
1126     void RemoveFormIdMapElement(const int64_t formId);
1127 
1128     /**
1129      * @class ClientDeathRecipient
1130      * notices IRemoteBroker died.
1131      */
1132     class ClientDeathRecipient : public IRemoteObject::DeathRecipient {
1133     public:
1134         /**
1135          * @brief Constructor
1136          */
1137         ClientDeathRecipient() = default;
1138         virtual ~ClientDeathRecipient() = default;
1139         /**
1140          * @brief handle remote object died event.
1141          * @param remote remote object.
1142          */
1143         void OnRemoteDied(const wptr<IRemoteObject> &remote) override;
1144     };
1145 
1146 private:
1147     sptr<IFormPublishInterceptor> formPublishInterceptor_ = nullptr;
1148     int32_t visibleNotifyDelay_ = Constants::DEFAULT_VISIBLE_NOTIFY_DELAY;
1149     std::map<int64_t, AddFormResultErrorCode> formIdMap_;
1150     std::shared_ptr<FormSerialQueue> serialQueue_ = nullptr;
1151     std::mutex formResultMutex_;
1152     std::condition_variable condition_;
1153 #ifdef THEME_MGR_ENABLE
1154     /**
1155      * @brief Fill ThemeFormInfo with want and formId
1156      * @param formId Indicates the id of form.
1157      * @param themeFormInfo Info of theme form defined by ThemeManager.
1158      * @param want The want of form.
1159      */
1160     void FillThemeFormInfo(const Want &want, ThemeManager::ThemeFormInfo &themeFormInfo, int64_t formId);
1161 
1162     /**
1163      * @brief Call ThemeManager to delete form and clear record in database.
1164      * @param formId Indicates the id of form.
1165      * @return Returns ERR_OK on success, others on failure.
1166      */
1167     int DeleteThemeForm(const int64_t formId);
1168 
1169     /**
1170      * @brief Add theme form record in database.
1171      * @param want The want of form.
1172      * @param formId Indicates the id of form.
1173      * @return Returns ERR_OK on success, others on failure.
1174      */
1175     int AddThemeDBRecord(const Want &want, int64_t formId);
1176 
1177     /**
1178      * @brief Allot theme form record in FormDataMgr.
1179      * @param want The want of form.
1180      * @param formId Indicates the id of form.
1181      * @return Returns formrecord created.
1182      */
1183     FormRecord AllotThemeRecord(const Want &want, int64_t formId);
1184 #endif
1185 
1186     /**
1187      * @brief Delete common forms with formId.
1188      * @param formId Indicates the id of form.
1189      * @param callerToken Caller ability token.
1190      * @return Returns ERR_OK on success, others on failure.
1191      */
1192     int DeleteCommonForm(const int64_t formId, const sptr<IRemoteObject> &callerToken);
1193 
1194     void CheckUpdateFormRecord(const int64_t formId, const FormItemInfo &info, FormRecord &record);
1195 };
1196 }  // namespace AppExecFwk
1197 }  // namespace OHOS
1198 
1199 #endif // OHOS_FORM_FWK_FORM_MGR_ADAPTER_H
1200