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