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_PROXY_H
17 #define OHOS_FORM_FWK_FORM_MGR_PROXY_H
18 
19 #include "form_db_info.h"
20 #include "form_info.h"
21 #include "form_mgr_interface.h"
22 #include "form_state_info.h"
23 #include "form_instance.h"
24 #include "form_instances_filter.h"
25 #include "iremote_proxy.h"
26 
27 namespace OHOS {
28 namespace AppExecFwk {
29 /**
30  * @class FormMgrProxy
31  * FormMgrProxy is used to access form manager service.
32  */
33 class FormMgrProxy : public IRemoteProxy<IFormMgr> {
34 public:
35     explicit FormMgrProxy(const sptr<IRemoteObject> &impl);
36     virtual ~FormMgrProxy() = default;
37     /**
38      * @brief Add form with want, send want to form manager service.
39      * @param formId The Id of the forms to add.
40      * @param want The want of the form to add.
41      * @param callerToken Caller ability token.
42      * @param formInfo Form info.
43      * @return Returns ERR_OK on success, others on failure.
44      */
45     virtual int AddForm(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken,
46         FormJsInfo &formInfo) override;
47 
48     /**
49      * @brief Add form with want, send want to form manager service.
50      * @param want The want of the form to add.
51      * @param runningFormInfo Running form info.
52      * @return Returns ERR_OK on success, others on failure.
53      */
54     virtual int CreateForm(const Want &want, RunningFormInfo &runningFormInfo) override;
55 
56     /**
57      * @brief Delete forms with formIds, send formIds to form manager service.
58      * @param formId The Id of the forms to delete.
59      * @param callerToken Caller ability token.
60      * @return Returns ERR_OK on success, others on failure.
61      */
62     virtual int DeleteForm(const int64_t formId, const sptr<IRemoteObject> &callerToken) override;
63 
64     /**
65      * @brief Stop rendering form.
66      * @param formId The Id of the forms to delete.
67      * @param compId The compId of the forms to delete.
68      * @return Returns ERR_OK on success, others on failure.
69      */
70     virtual int StopRenderingForm(const int64_t formId, const std::string &compId) override;
71 
72      /**
73      * @brief Release forms with formIds, send formIds to form manager service.
74      * @param formId The Id of the forms to release.
75      * @param callerToken Caller ability token.
76      * @param delCache Delete Cache or not.
77      * @return Returns ERR_OK on success, others on failure.
78      */
79     virtual int ReleaseForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const bool delCache) override;
80 
81     /**
82      * @brief Update form with formId, send formId to form manager service.
83      * @param formId The Id of the form to update.
84      * @param FormProviderData Form binding data.
85      * @return Returns ERR_OK on success, others on failure.
86      */
87     virtual int UpdateForm(const int64_t formId, const FormProviderData &FormProviderData) override;
88 
89     /**
90      * @brief Set next refresh time.
91      * @param formId The Id of the form to update.
92      * @param nextTime Next refresh time.
93      * @return Returns ERR_OK on success, others on failure.
94      */
95     virtual int SetNextRefreshTime(const int64_t formId, const int64_t nextTime) override;
96 
97     /**
98      * @brief Release renderer.
99      * @param formId The Id of the forms to release.
100      * @param compId The compId of the forms to release.
101      * @return Returns ERR_OK on success, others on failure.
102      */
103     virtual int ReleaseRenderer(int64_t formId, const std::string &compId) override;
104 
105     /**
106      * @brief Request to publish a form to the form host.
107      *
108      * @param want The want of the form to publish.
109      * @param withFormBindingData Indicates whether the formBindingData is carried with.
110      * @param formBindingData Indicates the form data.
111      * @param formId Return the form id to be published.
112      * @return Returns ERR_OK on success, others on failure.
113      */
114     ErrCode RequestPublishForm(Want &want, bool withFormBindingData,
115                                std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId) override;
116 
117     ErrCode SetPublishFormResult(const int64_t formId, Constants::PublishFormResult &errorCodeInfo) override;
118 
119     ErrCode AcquireAddFormResult(const int64_t formId) override;
120     /**
121      * @brief Lifecycle update.
122      * @param formIds The Id of the forms.
123      * @param callerToken Caller ability token.
124      * @param updateType update type, enable if true and disable if false.
125      * @return Returns ERR_OK on success, others on failure.
126      */
127     virtual int LifecycleUpdate(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken,
128     bool updateType) override;
129 
130     /**
131      * @brief Request form with formId and want, send formId and want to form manager service.
132      * @param formId The Id of the form to update.
133      * @param callerToken Caller ability token.
134      * @param want The want of the form to add.
135      * @return Returns ERR_OK on success, others on failure.
136      */
137     virtual int RequestForm(const int64_t formId, const sptr<IRemoteObject> &callerToken, const Want &want) override;
138 
139     /**
140      * @brief Form visible/invisible notify, send formIds to form manager service.
141      * @param formIds The Id list of the forms to notify.
142      * @param callerToken Caller ability token.
143      * @param formVisibleType The form visible type, including FORM_VISIBLE and FORM_INVISIBLE.
144      * @return Returns ERR_OK on success, others on failure.
145      */
146     virtual int NotifyWhetherVisibleForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken,
147     const int32_t formVisibleType) override;
148 
149     /**
150      * @brief Query whether has visible form by tokenId.
151      * @param tokenId Unique identification of application.
152      * @return Returns true if has visible form, false otherwise.
153      */
154     virtual bool HasFormVisible(const uint32_t tokenId) override;
155 
156     /**
157      * @brief temp form to normal form.
158      * @param formId The Id of the form.
159      * @param callerToken Caller ability token.
160      * @return Returns ERR_OK on success, others on failure.
161      */
162     virtual int CastTempForm(const int64_t formId, const sptr<IRemoteObject> &callerToken) override;
163 
164     /**
165      * @brief Dump all of form storage infos.
166      * @param formInfos All of form storage infos.
167      * @return Returns ERR_OK on success, others on failure.
168      */
169     virtual int DumpStorageFormInfos(std::string &formInfos) override;
170     /**
171      * @brief Dump form info by a bundle name.
172      * @param bundleName The bundle name of form provider.
173      * @param formInfos Form infos.
174      * @return Returns ERR_OK on success, others on failure.
175      */
176     virtual int DumpFormInfoByBundleName(const std::string &bundleName, std::string &formInfos) override;
177     /**
178      * @brief Dump form info by a bundle name.
179      * @param formId The id of the form.
180      * @param formInfo Form info.
181      * @return Returns ERR_OK on success, others on failure.
182      */
183     virtual int DumpFormInfoByFormId(const std::int64_t formId, std::string &formInfo) override;
184     /**
185      * @brief Dump timer info by form id.
186      * @param formId The id of the form.
187      * @param formInfo Form timer info.
188      * @return Returns ERR_OK on success, others on failure.
189      */
190     virtual int DumpFormTimerByFormId(const std::int64_t formId, std::string &isTimingService) override;
191     /**
192      * @brief Process js message event.
193      * @param formId Indicates the unique id of form.
194      * @param want information passed to supplier.
195      * @param callerToken Caller ability token.
196      * @return Returns true if execute success, false otherwise.
197      */
198     virtual int MessageEvent(const int64_t formId, const Want &want, const sptr<IRemoteObject> &callerToken) override;
199 
200     /**
201      * @brief Process js router event.
202      * @param formId Indicates the unique id of form.
203      * @param want the want of the ability to start.
204      * @param callerToken Caller ability token.
205      * @return Returns true if execute success, false otherwise.
206      */
207     virtual int RouterEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken) override;
208 
209     /**
210      * @brief Process Background event.
211      * @param formId Indicates the unique id of form.
212      * @param want the want of the ability to start.
213      * @param callerToken Caller ability token.
214      * @return Returns true if execute success, false otherwise.
215      */
216     virtual int BackgroundEvent(const int64_t formId, Want &want, const sptr<IRemoteObject> &callerToken) override;
217 
218     /**
219      * @brief Delete the invalid forms.
220      * @param formIds Indicates the ID of the valid forms.
221      * @param callerToken Caller ability token.
222      * @param numFormsDeleted Returns the number of the deleted forms.
223      * @return Returns ERR_OK on success, others on failure.
224      */
225     virtual int DeleteInvalidForms(const std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken,
226                                    int32_t &numFormsDeleted) override;
227 
228     /**
229      * @brief Acquire form state info by passing a set of parameters (using Want) to the form provider.
230      * @param want Indicates a set of parameters to be transparently passed to the form provider.
231      * @param callerToken Caller ability token.
232      * @param stateInfo Returns the form's state info of the specify.
233      * @return Returns ERR_OK on success, others on failure.
234      */
235     virtual int AcquireFormState(const Want &want, const sptr<IRemoteObject> &callerToken,
236                                  FormStateInfo &stateInfo) override;
237 
238     /**
239      * @brief Notify the form is visible or not.
240      * @param formIds Indicates the ID of the forms.
241      * @param isVisible Visible or not.
242      * @param callerToken Host client.
243      * @return Returns ERR_OK on success, others on failure.
244      */
245     virtual int NotifyFormsVisible(const std::vector<int64_t> &formIds, bool isVisible,
246                                    const sptr<IRemoteObject> &callerToken) override;
247 
248     /**
249      * @brief Notify the form is privacy protected or not.
250      * @param formIds Indicates the ID of the forms.
251      * @param isProtected isProtected or not.
252      * @param callerToken Host client.
253      * @return Returns ERR_OK on success, others on failure.
254      */
255     int NotifyFormsPrivacyProtected(const std::vector<int64_t> &formIds, bool isProtected,
256                                             const sptr<IRemoteObject> &callerToken) override;
257 
258     /**
259      * @brief Notify the form is enable to be updated or not.
260      * @param formIds Indicates the ID of the forms.
261      * @param isEnableUpdate enable update or not.
262      * @param callerToken Host client.
263      * @return Returns ERR_OK on success, others on failure.
264      */
265     virtual int NotifyFormsEnableUpdate(const std::vector<int64_t> &formIds, bool isEnableUpdate,
266                                         const sptr<IRemoteObject> &callerToken) override;
267 
268     /**
269      * @brief Get All FormsInfo.
270      * @param formInfos Return the forms' information of all forms provided.
271      * @return Returns ERR_OK on success, others on failure.
272      */
273     virtual int GetAllFormsInfo(std::vector<FormInfo> &formInfos) override;
274 
275     /**
276      * @brief Get forms info by bundle name .
277      * @param bundleName Application name.
278      * @param formInfos Return the forms' information of the specify application name.
279      * @return Returns ERR_OK on success, others on failure.
280      */
281     virtual int GetFormsInfoByApp(std::string &bundleName, std::vector<FormInfo> &formInfos) override;
282 
283     /**
284      * @brief Get forms info by bundle name and module name.
285      * @param bundleName bundle name.
286      * @param moduleName Module name of hap.
287      * @param formInfos Return the forms' information of the specify bundle name and module name.
288      * @return Returns ERR_OK on success, others on failure.
289      */
290     virtual int GetFormsInfoByModule(std::string &bundleName, std::string &moduleName,
291                                      std::vector<FormInfo> &formInfos) override;
292 
293     /**
294      * @brief Get forms info specfied by filter parameters.
295      * @param filter Filter that contains necessary conditions, such as bundle name, module name, dimensions.
296      * @param formInfos Return the forms' information specified by filter.
297      * @return Returns ERR_OK on success, others on failure.
298      */
299     virtual int GetFormsInfoByFilter(const FormInfoFilter &filter, std::vector<FormInfo> &formInfos) override;
300 
301     /**
302     * @brief This function is called by formProvider and gets forms info by the bundle name of the calling ability.
303     *        The bundle name will be retrieved by form service manager.
304     * @param filter Filter that contains attributes that the formInfos have to have.
305     * @param formInfos Return the forms' information of the calling bundle name
306     * @return Returns ERR_OK on success, others on failure.
307     */
308     int32_t GetFormsInfo(const FormInfoFilter &filter, std::vector<FormInfo> &formInfos) override;
309 
310     /**
311      * @brief Check if the request of publishing a form is supported by the host.
312      * @return Returns true if the request is supported and false otherwise.
313      */
314     bool IsRequestPublishFormSupported() override;
315 
316     /**
317      * @brief Start an ability. This function can only be called by a form extension of a system app.
318      * @param want includes ability name, parameters and relative info sending to an ability.
319      * @param callerToken token of the ability that initially calls this function.
320      * @return Returns ERR_OK on success, others on failure.
321      */
322     int32_t StartAbility(const Want &want, const sptr<IRemoteObject> &callerToken) override;
323 
324     /**
325      * @brief Share form by formID and deviceID.
326      * @param formId Indicates the unique id of form.
327      * @param deviceId Indicates the remote device ID.
328      * @param callerToken Host client.
329      * @param requestCode the request code of this share form.
330      * @return Returns ERR_OK on success, others on failure.
331      */
332     int32_t ShareForm(int64_t formId, const std::string &deviceId, const sptr<IRemoteObject> &callerToken,
333         int64_t requestCode) override;
334 
335     /**
336      * @brief Acquire form data by formId.
337      * @param formId The Id of the form to acquire data.
338      * @param requestCode The request code of this form.
339      * @param callerToken Indicates the host client.
340      * @param formData Return the forms' information of customization
341      * @return Returns ERR_OK on success, others on failure.
342      */
343     int32_t AcquireFormData(int64_t formId, int64_t requestCode, const sptr<IRemoteObject> &callerToken,
344          AAFwk::WantParams &formData) override;
345 
346     /**
347      * @brief Receive form sharing information from remote.
348      * @param info Indicates form sharing information.
349      * @return Returns ERR_OK on success, others on failure.
350      */
351     int32_t RecvFormShareInfoFromRemote(const FormShareInfo &info) override;
352 
353     /**
354     * @brief Check form manager service ready.
355     * @return Return true if form manager service Ready; return false otherwise.
356     */
357     bool CheckFMSReady() override;
358 
359     /**
360      * @brief Check whether the form is system app.
361      * @param bundleName The bundleName of the form.
362      * @return Returns true if the form app is system, others false.
363      */
364     bool IsSystemAppForm(const std::string &bundleName) override;
365 
366     /**
367      * @brief Register form add observer by bundle.
368      * @param bundleName BundleName of the form host
369      * @param callerToken Caller ability token.
370      * @return Returns ERR_OK on success, others on failure.
371      */
372     ErrCode RegisterFormAddObserverByBundle(const std::string bundleName,
373         const sptr<IRemoteObject> &callerToken) override;
374 
375     /**
376      * @brief Register form remove observer by bundle.
377      * @param bundleName BundleName of the form host
378      * @param callerToken Caller ability token.
379      * @return Returns ERR_OK on success, others on failure.
380      */
381     ErrCode RegisterFormRemoveObserverByBundle(const std::string bundleName,
382         const sptr<IRemoteObject> &callerToken) override;
383 
384     /**
385      * @brief The Call Event triggers the callee method.
386      * @param funcName function name which is used by callee.
387      * @param params parameter which is used by callee.
388      * @return Returns ERR_OK on success, others on failure.
389      */
390     int32_t SetBackgroundFunction(const std::string funcName, const std::string params) override;
391 
392     /**
393     * @brief get forms count.
394     * @param isTempFormFlag Indicates temp form or not.
395     * @param formCount Returns the number of the cast or temp form.
396     * @return Returns ERR_OK on success, others on failure.
397     */
398     int32_t GetFormsCount(bool isTempFormFlag, int32_t &formCount) override;
399 
400     /**
401     * @brief get host forms count.
402     * @param bundleName Indicates form host bundleName.
403     * @param formCount Returns the number of the host form.
404     * @return Returns ERR_OK on success, others on failure.
405     */
406     int32_t GetHostFormsCount(std::string &bundleName, int32_t &formCount) override;
407 
408     /**
409      * @brief Get the running form infos.
410      * @param isUnusedIncluded Indicates whether to include unused forms.
411      * @param runningFormInfos Return the running forms' infos currently.
412      * @return Returns ERR_OK on success, others on failure.
413      */
414     ErrCode GetRunningFormInfos(bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos) override;
415 
416     /**
417      * @brief Get the running form infos by bundle name.
418      * @param bundleName Application name.
419      * @param isUnusedIncluded Indicates whether to include unused forms.
420      * @param runningFormInfos Return the running forms' infos of the specify application name.
421      * @return Returns ERR_OK on success, others on failure.
422      */
423     ErrCode GetRunningFormInfosByBundleName(
424         const std::string &bundleName, bool isUnusedIncluded, std::vector<RunningFormInfo> &runningFormInfos) override;
425 
426     /**
427      * @brief Get form instances by filter info.
428      * @param formInstancesFilter includes bundleName, moduleName, formName, abilityName to get formInstances.
429      * @param formInstances return formInstances
430      * @return return ERR_OK on get info success, others on failure.
431      */
432     ErrCode GetFormInstancesByFilter(const FormInstancesFilter &formInstancesFilter,
433         std::vector<FormInstance> &formInstances) override;
434 
435    /**
436     * @brief Get form instance by formId.
437     * @param formId formId Indicates the unique id of form.
438     * @param formInstance return formInstance
439     * @return return ERR_OK on get info success, others on failure.
440     */
441     ErrCode GetFormInstanceById(const int64_t formId, FormInstance &formInstance) override;
442 
443     /**
444      * @brief Get form instance by formId, include form store in DB.
445      * @param formId formId Indicates the unique id of form.
446      * @param isUnusedIncluded Indicates whether to include unused form.
447      * @param formInstance return formInstance
448      * @return return ERR_OK on get info success, others on failure.
449      */
450     ErrCode GetFormInstanceById(const int64_t formId, bool isUnusedIncluded, FormInstance &formInstance) override;
451 
452     /**
453      * @brief Register form add observer.
454      * @param bundleName BundleName of the form host
455      * @param callerToken Caller ability token.
456      * @return Returns ERR_OK on success, others on failure.
457      */
458     ErrCode RegisterAddObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) override;
459 
460     /**
461      * @brief Register form remove observer.
462      * @param bundleName BundleName of the form host
463      * @param callerToken Caller ability token.
464      * @return Returns ERR_OK on success, others on failure.
465      */
466     ErrCode RegisterRemoveObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) override;
467 
468     /**
469      * @brief Register form router event proxy.
470      * @param formIds Indicates the id of the forms.
471      * @param callerToken Router proxy call back client.
472      * @return Returns ERR_OK on success, others on failure.
473      */
474     ErrCode RegisterFormRouterProxy(const std::vector<int64_t> &formIds,
475         const sptr<IRemoteObject> &callerToken) override;
476 
477     /**
478      * @brief Unregister form router event proxy.
479      * @param formIds Indicates the id of the forms.
480      * @return Returns ERR_OK on success, others on failure.
481      */
482     ErrCode UnregisterFormRouterProxy(const std::vector<int64_t> &formIds) override;
483 
484     /**
485      * @brief Update proxy form with formId, send formId to form manager service.
486      * @param formId The Id of the form to update.
487      * @param FormProviderData Form binding data.
488      * @param std::vector<FormDataProxy> Form proxy vector.
489      * @return Returns ERR_OK on success, others on failure.
490      */
491     ErrCode UpdateProxyForm(int64_t formId, const FormProviderData &FormProviderData,
492         const std::vector<FormDataProxy> &formDataProxies) override;
493 
494     /**
495      * @brief Request to publish a proxy form to the form host.
496      * @param want The want of the form to publish.
497      * @param withFormBindingData Indicates whether the formBindingData is carried with.
498      * @param formBindingData Indicates the form data.
499      * @param formId Return the form id to be published.
500      * @param std::vector<FormDataProxy> Form proxy vector.
501      * @return Returns ERR_OK on success, others on failure.
502      */
503     virtual ErrCode RequestPublishProxyForm(Want &want, bool withFormBindingData,
504         std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId,
505         const std::vector<FormDataProxy> &formDataProxies) override;
506 
507     /**
508      * @brief Registers the callback to publish form. The callback is used to process the publish form request
509      * when the system handler is not found.
510      * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor.
511      * @return Returns ERR_OK on success, others on failure.
512      */
513     int32_t RegisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback) override;
514 
515     /**
516      * @brief Unregisters the callback to publish form. The callback is used to process the publish form request
517      * when the system handler is not found.
518      * @param interceptorCallback The injected callback, should implementation IFormPublishInterceptor.
519      * @return Returns ERR_OK on success, others on failure.
520      */
521     int32_t UnregisterPublishFormInterceptor(const sptr<IRemoteObject> &interceptorCallback) override;
522 
523     /**
524      * @brief Register click callback observer.
525      * @param bundleName BundleName of the form host.
526      * @param formEventType Form event type.
527      * @param observer Form click event callback listener.
528      * @return Returns ERR_OK on success, others on failure.
529      */
530     ErrCode RegisterClickEventObserver(
531         const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer) override;
532 
533     /**
534      * @brief Unregister click callback observer.
535      * @param bundleName BundleName of the form host.
536      * @param formEventType Form event type.
537      * @param observer Form click event callback listener.
538      * @return Returns ERR_OK on success, others on failure.
539      */
540     ErrCode UnregisterClickEventObserver(
541         const std::string &bundleName, const std::string &formEventType, const sptr<IRemoteObject> &observer) override;
542 
543     /**
544      * @brief Set forms recyclable
545      * @param formIds Indicates the id of the forms.
546      * @return Returns ERR_OK on success, others on failure.
547      */
548     int32_t SetFormsRecyclable(const std::vector<int64_t> &formIds) override;
549 
550     /**
551      * @brief Recycle forms
552      * @param formIds Indicates the id of the forms.
553      * @param want The want of forms to be recycled.
554      * @return Returns ERR_OK on success, others on failure.
555      */
556     int32_t RecycleForms(const std::vector<int64_t> &formIds, const Want &want) override;
557 
558     /**
559      * @brief Recover recycled forms
560      * @param formIds Indicates the id of the forms.
561      * @param want The want of forms to be recovered.
562      * @return Returns ERR_OK on success, others on failure.
563      */
564     int32_t RecoverForms(const std::vector<int64_t> &formIds, const Want &want) override;
565 
566     /**
567      * @brief Update formLocation with formId.
568      * @param formId The Id of the form to update.
569      * @param formLocation The FormLocation.
570      * @return Returns ERR_OK on success, others on failure.
571      */
572     ErrCode UpdateFormLocation(const int64_t &formId, const int32_t &formLocation) override;
573 
574     /**
575      * @brief Request to publish a form to the form host with normal authority.
576      *
577      * @param want The want of the form to publish.
578      * @param withFormBindingData Indicates whether the formBindingData is carried wit
579      * @param formBindingData Indicates the form data.
580      * @param formId Return the form id to be published.
581      * @return Returns ERR_OK on success, others on failure.
582      */
583     ErrCode RequestPublishFormWithSnapshot(Want &want, bool withFormBindingData,
584         std::unique_ptr<FormProviderData> &formBindingData, int64_t &formId) override;
585 
586     /**
587      * @brief Update form with formRefreshType, send to form manager service.
588      * @param formRefreshType The type of the form to refresh, 0: AllForm 1: 2: AppForm 2: AtomicServiceForm
589      * @return Returns ERR_OK on success, others on failure.
590      */
591     int32_t BatchRefreshForms(const int32_t formRefreshType) override;
592 
593     /**
594      * @brief enable/disable form update.
595      * @param bundleName BundleName of the form host.
596      * @param enable True for enable form, false for disable form.
597      * @return Returns ERR_OK on success, others on failure.
598      */
599     int32_t EnableForms(const std::string bundleName, const bool enable) override;
600 
601     /**
602      * @brief Check form bundle is controlled.
603      * @param bundleName The bundle name of form to be check.
604      * @return Returns true for form bundle is controlled.
605      */
606     bool IsFormBundleForbidden(const std::string &bundleName) override;
607 
608     /**
609      * @brief Update size of form.
610      * @param formId The Id of the form to update.
611      * @param width The width value to be updated.
612      * @param height The height value to be updated.
613      * @param borderWidth The borderWidth value to be updated.
614      * @return Returns ERR_OK on success, others on failure.
615      */
616     ErrCode UpdateFormSize(const int64_t &formId, float width, float height, float borderWidth) override;
617 private:
618     template<typename T>
619     int GetParcelableInfos(MessageParcel &reply, std::vector<T> &parcelableInfos);
620     bool WriteInterfaceToken(MessageParcel &data);
621     template<typename T>
622     int GetParcelableInfo(IFormMgr::Message code, MessageParcel &data, T &parcelableInfo);
623     int SendTransactCmd(IFormMgr::Message code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
624     int GetStringInfo(IFormMgr::Message code, MessageParcel &data, std::string &stringInfo);
625     int32_t GetFormsInfo(IFormMgr::Message code, MessageParcel &data, std::vector<FormInfo> &formInfos);
626     ErrCode GetRunningFormInfos(IFormMgr::Message code, MessageParcel &data,
627         std::vector<RunningFormInfo> &runningFormInfos);
628     int32_t GetFormInstance(IFormMgr::Message code, MessageParcel &data, std::vector<FormInstance> &formInstances);
629     bool WriteFormDataProxies(MessageParcel &data, const std::vector<FormDataProxy> &formDataProxies);
630 private:
631     static inline BrokerDelegator<FormMgrProxy> delegator_;
632 };
633 }  // namespace AppExecFwk
634 }  // namespace OHOS
635 #endif  // OHOS_FORM_FWK_FORM_MGR_PROXY_H
636