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 #include "form_mgr_stub.h"
17
18 #include "appexecfwk_errors.h"
19 #include "fms_log_wrapper.h"
20 #include "form_info.h"
21 #include "form_mgr_errors.h"
22 #include "running_form_info.h"
23 #include "ipc_skeleton.h"
24 #include "ipc_types.h"
25 #include "iremote_object.h"
26 #include <vector>
27
28 namespace OHOS {
29 namespace AppExecFwk {
30 const int32_t LIMIT_PARCEL_SIZE = 1024;
31 constexpr size_t MAX_PARCEL_CAPACITY = 4 * 1024 * 1024; // 4M
32 static constexpr int32_t MAX_ALLOW_SIZE = 8 * 1024;
33
SplitString(const std::string & source,std::vector<std::string> & strings)34 void SplitString(const std::string &source, std::vector<std::string> &strings)
35 {
36 size_t splitSize = (source.size() / LIMIT_PARCEL_SIZE);
37 if ((source.size() % LIMIT_PARCEL_SIZE) != 0) {
38 splitSize++;
39 }
40 HILOG_DEBUG("the dump string split into %{public}zu size", splitSize);
41 for (size_t i = 0; i < splitSize; i++) {
42 size_t start = LIMIT_PARCEL_SIZE * i;
43 strings.emplace_back(source.substr(start, LIMIT_PARCEL_SIZE));
44 }
45 }
46
FormMgrStub()47 FormMgrStub::FormMgrStub()
48 {}
49
~FormMgrStub()50 FormMgrStub::~FormMgrStub()
51 {}
52
53 /**
54 * @brief handle remote request.
55 * @param code ipc code.
56 * @param data input param.
57 * @param reply output param.
58 * @param option message option.
59 * @return Returns ERR_OK on success, others on failure.
60 */
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)61 int FormMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
62 {
63 HILOG_DEBUG("code= %{public}u,flags= %{public}d", code, option.GetFlags());
64 std::u16string descriptor = FormMgrStub::GetDescriptor();
65 std::u16string remoteDescriptor = data.ReadInterfaceToken();
66 if (descriptor != remoteDescriptor) {
67 HILOG_ERROR("remote not equal to localDescriptor");
68 return ERR_APPEXECFWK_FORM_INVALID_PARAM;
69 }
70
71 return OnRemoteRequestFirst(code, data, reply, option);
72 }
73
74 /**
75 * @brief the first part of handle remote request.
76 * @param code ipc code.
77 * @param data input param.
78 * @param reply output param.
79 * @param option message option.
80 * @return Returns ERR_OK on success, others on failure.
81 */
OnRemoteRequestFirst(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)82 int FormMgrStub::OnRemoteRequestFirst(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
83 {
84 switch (code) {
85 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_ADD_FORM):
86 return HandleAddForm(data, reply);
87 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_DELETE_FORM):
88 return HandleDeleteForm(data, reply);
89 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_RELEASE_FORM):
90 return HandleReleaseForm(data, reply);
91 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UPDATE_FORM):
92 return HandleUpdateForm(data, reply);
93 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REQUEST_FORM):
94 return HandleRequestForm(data, reply);
95 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_NOTIFY_FORM_WHETHER_VISIBLE):
96 return HandleNotifyWhetherVisibleForms(data, reply);
97 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_CAST_TEMP_FORM):
98 return HandleCastTempForm(data, reply);
99 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_STORAGE_FORM_INFOS):
100 return HandleDumpStorageFormInfos(data, reply);
101 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_FORM_INFOS_BY_NAME):
102 return HandleDumpFormInfoByBundleName(data, reply);
103 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_FORM_INFOS_BY_ID):
104 return HandleDumpFormInfoByFormId(data, reply);
105 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_FORM_TIMER_INFO_BY_ID):
106 return HandleDumpFormTimerByFormId(data, reply);
107 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_SET_NEXT_REFRESH_TIME):
108 return HandleSetNextRefreshTime(data, reply);
109 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_LIFECYCLE_UPDATE):
110 return HandleLifecycleUpdate(data, reply);
111 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_MESSAGE_EVENT):
112 return HandleMessageEvent(data, reply);
113 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_DELETE_INVALID_FORMS):
114 return HandleDeleteInvalidForms(data, reply);
115 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_ACQUIRE_FORM_STATE):
116 return HandleAcquireFormState(data, reply);
117 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_NOTIFY_FORMS_VISIBLE):
118 return HandleNotifyFormsVisible(data, reply);
119 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_NOTIFY_FORMS_PRIVACY_PROTECTED):
120 return HandleNotifyFormsPrivacyProtected(data, reply);
121 default:
122 return OnRemoteRequestSecond(code, data, reply, option);
123 }
124 }
125
126 /**
127 * @brief the second part of handle remote request.
128 * @param code ipc code.
129 * @param data input param.
130 * @param reply output param.
131 * @param option message option.
132 * @return Returns ERR_OK on success, others on failure.
133 */
OnRemoteRequestSecond(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)134 int FormMgrStub::OnRemoteRequestSecond(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
135 {
136 switch (code) {
137 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_NOTIFY_FORMS_ENABLE_UPDATE):
138 return HandleNotifyFormsEnableUpdate(data, reply);
139 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_ALL_FORMS_INFO):
140 return HandleGetAllFormsInfo(data, reply);
141 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_FORMS_INFO_BY_APP):
142 return HandleGetFormsInfoByApp(data, reply);
143 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_FORMS_INFO_BY_MODULE):
144 return HandleGetFormsInfoByModule(data, reply);
145 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_FORMS_INFO_BY_FILTER):
146 return HandleGetFormsInfoByFilter(data, reply);
147 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_FORMS_INFO):
148 return HandleGetFormsInfo(data, reply);
149 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_ROUTER_EVENT):
150 return HandleRouterEvent(data, reply);
151 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_BACKGROUND_EVENT):
152 return HandleBackgroundEvent(data, reply);
153 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REQUEST_PUBLISH_FORM):
154 return HandleRequestPublishForm(data, reply);
155 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_SHARE_FORM):
156 return HandleShareForm(data, reply);
157 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_RECV_FORM_SHARE_INFO_FROM_REMOTE):
158 return HandleRecvFormShareInfoFromRemote(data, reply);
159 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_IS_REQUEST_PUBLISH_FORM_SUPPORTED):
160 return HandleIsRequestPublishFormSupported(data, reply);
161 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_START_ABILITY):
162 return HandleStartAbility(data, reply);
163 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_CHECK_FMS_READY):
164 return HandleCheckFMSReady(data, reply);
165 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_STOP_RENDERING_FORM):
166 return HandleStopRenderingForm(data, reply);
167 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_FORM_ADD_OBSERVER_BY_BUNDLE):
168 return HandleRegisterFormAddObserverByBundle(data, reply);
169 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_FORM_REMOVE_OBSERVER_BY_BUNDLE):
170 return HandleRegisterFormRemoveObserverByBundle(data, reply);
171 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_START_ABILITY_BY_FMS):
172 return HandleStartAbilityByFms(data, reply);
173 default:
174 return OnRemoteRequestThird(code, data, reply, option);
175 }
176 }
177
178 /**
179 * @brief the third part of handle remote request.
180 * @param code ipc code.
181 * @param data input param.
182 * @param reply output param.
183 * @param option message option.
184 * @return Returns ERR_OK on success, others on failure.
185 */
OnRemoteRequestThird(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)186 int FormMgrStub::OnRemoteRequestThird(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
187 {
188 switch (code) {
189 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_ACQUIRE_DATA):
190 return HandleAcquireFormData(data, reply);
191 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_FORMS_COUNT):
192 return HandleGetFormsCount(data, reply);
193 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_HOST_FORMS_COUNT):
194 return HandleGetHostFormsCount(data, reply);
195 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_RUNNING_FORM_INFOS):
196 return HandleGetRunningFormInfos(data, reply);
197 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_RUNNING_FORM_INFOS_BY_BUNDLE):
198 return HandleGetRunningFormInfosByBundleName(data, reply);
199 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_FORM_INSTANCES_FROM_BY_FILTER):
200 return HandleGetFormInstancesByFilter(data, reply);
201 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_FORM_INSTANCES_FROM_BY_ID):
202 return HandleGetFormInstanceById(data, reply);
203 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_ADD_OBSERVER):
204 return HandleRegisterAddObserver(data, reply);
205 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_REMOVE_OBSERVER):
206 return HandleRegisterRemoveObserver(data, reply);
207 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UPDATE_PROXY_FORM):
208 return HandleUpdateProxyForm(data, reply);
209 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REQUEST_PUBLISH_PROXY_FORM):
210 return HandleRequestPublishProxyForm(data, reply);
211 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_RELEASE_RENDERER):
212 return HandleReleaseRenderer(data, reply);
213 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_PUBLISH_FORM_INTERCEPTOR):
214 return HandleRegisterPublishFormInterceptor(data, reply);
215 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UNREGISTER_PUBLISH_FORM_INTERCEPTOR):
216 return HandleUnregisterPublishFormInterceptor(data, reply);
217 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_CLICK_EVENT_OBSERVER):
218 return HandleRegisterClickCallbackEventObserver(data, reply);
219 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_IS_FORM_BUNDLE_PEOTECTED):
220 return HandleIsFormProtected(data, reply);
221 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_NOTIFY_FORM_LOCKED):
222 return HandleNotifyFormLocked(data, reply);
223 default:
224 return OnRemoteRequestFourth(code, data, reply, option);
225 }
226 }
227
228 /**
229 * @brief the fourth part of handle remote request.
230 * @param code ipc code.
231 * @param data input param.
232 * @param reply output param.
233 * @param option message option.
234 * @return Returns ERR_OK on success, others on failure.
235 */
OnRemoteRequestFourth(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)236 int FormMgrStub::OnRemoteRequestFourth(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
237 {
238 switch (code) {
239 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UNREGISTER_CLICK_EVENT_OBSERVER):
240 return HandleUnregisterClickCallbackEventObserver(data, reply);
241 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_FORM_ROUTER_PROXY):
242 return HandleRegisterFormRouterProxy(data, reply);
243 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UNREGISTER_FORM_ROUTER_PROXY):
244 return HandleUnregisterFormRouterProxy(data, reply);
245 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_SET_FORMS_RECYCLABLE):
246 return HandleSetFormsRecyclable(data, reply);
247 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_RECYCLE_FORMS):
248 return HandleRecycleForms(data, reply);
249 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_RECOVER_FORMS):
250 return HandleRecoverForms(data, reply);
251 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_HAS_FORM_VISIBLE_WITH_TOKENID):
252 return HandleHasFormVisible(data, reply);
253 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UPDATE_FORM_LOCATION):
254 return HandleUpdateFormLocation(data, reply);
255 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_PUBLISH_FORM_ERRCODE_RESULT):
256 return HandleSetPublishFormResult(data, reply);
257 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_ACQUIRE_ADD_FORM_RESULT):
258 return HandleAcquireAddFormResult(data, reply);
259 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_CREATE_FORM):
260 return HandleCreateForm(data, reply);
261 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REQUEST_PUBLISH_FORM_WITH_SNAPSHOT):
262 return HandleRequestPublishFormWithSnapshot(data, reply);
263 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_BATCH_REFRESH_FORMS):
264 return HandleBatchRefreshForms(data, reply);
265 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_ENABLE_FORMS):
266 return HandleEnableForms(data, reply);
267 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_IS_SYSTEM_APP_FORM):
268 return HandleIsSystemAppForm(data, reply);
269 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_IS_FORM_BUNDLE_FORBIDDEN):
270 return HandleIsFormBundleForbidden(data, reply);
271 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UPDATE_FORM_SIZE):
272 return HandleUpdateFormSize(data, reply);
273 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_LOCK_FORMS):
274 return HandleLockForms(data, reply);
275 default:
276 return OnRemoteRequestFifth(code, data, reply, option);
277 }
278 }
279
280 /**
281 * @brief the fifth part of handle remote request.
282 * @param code ipc code.
283 * @param data input param.
284 * @param reply output param.
285 * @param option message option.
286 * @return Returns ERR_OK on success, others on failure.
287 */
OnRemoteRequestFifth(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)288 int FormMgrStub::OnRemoteRequestFifth(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
289 {
290 switch (code) {
291 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_PUBLISHED_FORM_INFO_BY_ID):
292 return HandleGetPublishedFormInfoById(data, reply);
293 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_PUBLISHED_FORM_INFOS):
294 return HandleGetPublishedFormInfos(data, reply);
295 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_IS_FORM_BUNDLE_EXEMPT):
296 return HandleIsFormExempt(data, reply);
297 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_OPEN_FORM_EDIT_ABILITY):
298 return HandleOpenFormEditAbility(data, reply);
299 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_OVERFLOW_PROXY):
300 return HandleRegisterOverflowProxy(data, reply);
301 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UNREGISTER_OVERFLOW_PROXY):
302 return HandleUnregisterOverflowProxy(data, reply);
303 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REQUEST_OVERFLOW):
304 return HandleRequestOverflow(data, reply);
305 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_CHANGE_SCENEANIMATION_STATE_PROXY):
306 return HandleRegisterChangeSceneAnimationStateProxy(data, reply);
307 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UNREGISTER_CHANGE_SCENEANIMATION_STATE_PROXY):
308 return HandleUnregisterChangeSceneAnimationStateProxy(data, reply);
309 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_CHANGE_SCENE_ANIMATION_STATE):
310 return HandleChangeSceneAnimationState(data, reply);
311 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_START_ABILITY_BY_CROSS_BUNDLE):
312 return HandleStartAbilityByCrossBundle(data, reply);
313 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_GET_FORM_RECT):
314 return HandleRegisterGetFormRectProxy(data, reply);
315 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UNREGISTER_GET_FORM_RECT):
316 return HandleUnregisterGetFormRectProxy(data, reply);
317 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_GET_FORM_RECT):
318 return HandleGetFormRect(data, reply);
319 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_NOTIFY_UPDATE_FORM_SIZE):
320 return HandleNotifyUpdateFormSize(data, reply);
321 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_REGISTER_GET_LIVE_FORM_STATUS):
322 return HandleRegisterGetLiveFormStatusProxy(data, reply);
323 case static_cast<uint32_t>(IFormMgr::Message::FORM_MGR_UNREGISTER_GET_LIVE_FORM_STATUS):
324 return HandleUnregisterGetLiveFormStatusProxy(data, reply);
325 default:
326 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
327 }
328 }
329
330 /**
331 * @brief handle AddForm message.
332 * @param data input param.
333 * @param reply output param.
334 * @return Returns ERR_OK on success, others on failure.
335 */
HandleAddForm(MessageParcel & data,MessageParcel & reply)336 int32_t FormMgrStub::HandleAddForm(MessageParcel &data, MessageParcel &reply)
337 {
338 int64_t formId = data.ReadInt64();
339 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
340 if (!want) {
341 HILOG_ERROR("fail ReadParcelable<FormReqInfo>");
342 return ERR_APPEXECFWK_PARCEL_ERROR;
343 }
344
345 sptr<IRemoteObject> client = data.ReadRemoteObject();
346 if (client == nullptr) {
347 HILOG_ERROR("RemoteObject invalidate");
348 return ERR_APPEXECFWK_PARCEL_ERROR;
349 }
350
351 FormJsInfo formJsInfo;
352 int32_t result = AddForm(formId, *want, client, formJsInfo);
353 reply.WriteInt32(result);
354 reply.WriteParcelable(&formJsInfo);
355
356 return result;
357 }
358
359 /**
360 * @brief handle CreateForm message.
361 * @param data input param.
362 * @param reply output param.
363 * @return Returns ERR_OK on success, others on failure.
364 */
HandleCreateForm(MessageParcel & data,MessageParcel & reply)365 int32_t FormMgrStub::HandleCreateForm(MessageParcel &data, MessageParcel &reply)
366 {
367 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
368 if (!want) {
369 HILOG_ERROR("fail ReadParcelable");
370 return ERR_APPEXECFWK_PARCEL_ERROR;
371 }
372
373 RunningFormInfo runningFormInfo;
374 int32_t result = CreateForm(*want, runningFormInfo);
375 reply.WriteInt32(result);
376 reply.WriteParcelable(&runningFormInfo);
377 return result;
378 }
379
380 /**
381 * @brief handle DeleteForm message.
382 * @param data input param.
383 * @param reply output param.
384 * @return Returns ERR_OK on success, others on failure.
385 */
HandleDeleteForm(MessageParcel & data,MessageParcel & reply)386 int32_t FormMgrStub::HandleDeleteForm(MessageParcel &data, MessageParcel &reply)
387 {
388 int64_t formId = data.ReadInt64();
389 sptr<IRemoteObject> client = data.ReadRemoteObject();
390 if (client == nullptr) {
391 return ERR_APPEXECFWK_PARCEL_ERROR;
392 }
393 int32_t result = DeleteForm(formId, client);
394 reply.WriteInt32(result);
395 return result;
396 }
397 /**
398 * @brief handle DeleteFormByCompId message.
399 * @param data input param.
400 * @param reply output param.
401 * @return Returns ERR_OK on success, others on failure.
402 */
HandleStopRenderingForm(MessageParcel & data,MessageParcel & reply)403 int32_t FormMgrStub::HandleStopRenderingForm(MessageParcel &data, MessageParcel &reply)
404 {
405 int64_t formId = data.ReadInt64();
406 std::string compId = data.ReadString();
407 int32_t result = StopRenderingForm(formId, compId);
408 reply.WriteInt32(result);
409 return result;
410 }
411 /**
412 * @brief handle ReleaseForm message.
413 * @param data input param.
414 * @param reply output param.
415 * @return Returns ERR_OK on success, others on failure.
416 */
HandleReleaseForm(MessageParcel & data,MessageParcel & reply)417 int32_t FormMgrStub::HandleReleaseForm(MessageParcel &data, MessageParcel &reply)
418 {
419 int64_t formId = data.ReadInt64();
420 sptr<IRemoteObject> client = data.ReadRemoteObject();
421 if (client == nullptr) {
422 return ERR_APPEXECFWK_PARCEL_ERROR;
423 }
424 bool delCache = data.ReadBool();
425
426 int32_t result = ReleaseForm(formId, client, delCache);
427 reply.WriteInt32(result);
428 return result;
429 }
430 /**
431 * @brief handle UpdateForm message.
432 * @param data input param.
433 * @param reply output param.
434 * @return Returns ERR_OK on success, others on failure.
435 */
HandleUpdateForm(MessageParcel & data,MessageParcel & reply)436 int32_t FormMgrStub::HandleUpdateForm(MessageParcel &data, MessageParcel &reply)
437 {
438 int64_t formId = data.ReadInt64();
439 std::unique_ptr<FormProviderData> formBindingData(data.ReadParcelable<FormProviderData>());
440 if (formBindingData == nullptr) {
441 HILOG_ERROR("fail get formBindingData");
442 return ERR_APPEXECFWK_PARCEL_ERROR;
443 }
444 int32_t result = UpdateForm(formId, *formBindingData);
445 reply.WriteInt32(result);
446 return result;
447 }
448 /**
449 * @brief handle SetNextRefreshTime message.
450 * @param data input param.
451 * @param reply output param.
452 * @return Returns ERR_OK on success, others on failure.
453 */
HandleSetNextRefreshTime(MessageParcel & data,MessageParcel & reply)454 int32_t FormMgrStub::HandleSetNextRefreshTime(MessageParcel &data, MessageParcel &reply)
455 {
456 int64_t formId = data.ReadInt64();
457 int64_t nextTime = data.ReadInt64();
458 int32_t result = SetNextRefreshTime(formId, nextTime);
459 reply.WriteInt32(result);
460 return result;
461 }
462
463 /**
464 * @brief handle ReleaseRenderer message.
465 * @param data input param.
466 * @param reply output param.
467 * @return Returns ERR_OK on success, others on failure.
468 */
HandleReleaseRenderer(MessageParcel & data,MessageParcel & reply)469 int32_t FormMgrStub::HandleReleaseRenderer(MessageParcel &data, MessageParcel &reply)
470 {
471 int64_t formId = data.ReadInt64();
472 std::string compId = data.ReadString();
473 int32_t result = ReleaseRenderer(formId, compId);
474 reply.WriteInt32(result);
475 return result;
476 }
477
478 /**
479 * @brief handle RequestPublishForm message.
480 * @param data input param.
481 * @param reply output param.
482 * @return Returns ERR_OK on success, others on failure.
483 */
HandleRequestPublishForm(MessageParcel & data,MessageParcel & reply)484 ErrCode FormMgrStub::HandleRequestPublishForm(MessageParcel &data, MessageParcel &reply)
485 {
486 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
487 if (want == nullptr) {
488 HILOG_ERROR("get want failed");
489 return ERR_APPEXECFWK_PARCEL_ERROR;
490 }
491
492 bool withFormBindingData = data.ReadBool();
493 std::unique_ptr<FormProviderData> formProviderData = nullptr;
494 if (withFormBindingData) {
495 formProviderData.reset(data.ReadParcelable<FormProviderData>());
496 if (formProviderData == nullptr) {
497 HILOG_ERROR("get formProviderData failed");
498 return ERR_APPEXECFWK_PARCEL_ERROR;
499 }
500 }
501 int64_t formId = 0;
502 ErrCode result = RequestPublishForm(*want, withFormBindingData, formProviderData, formId);
503 reply.WriteInt32(result);
504 if (result == ERR_OK) {
505 reply.WriteInt64(formId);
506 }
507 return result;
508 }
509
HandleSetPublishFormResult(MessageParcel & data,MessageParcel & reply)510 ErrCode FormMgrStub::HandleSetPublishFormResult(MessageParcel &data, MessageParcel &reply)
511 {
512 int64_t formId = data.ReadInt64();
513 Constants::PublishFormResult errorCodeInfo;
514 errorCodeInfo.message = data.ReadString();
515 int32_t err = data.ReadInt32();
516 errorCodeInfo.code = (Constants::PublishFormErrorCode)(err) ;
517 ErrCode result = SetPublishFormResult(formId, errorCodeInfo);
518 reply.WriteInt32(result);
519 return result;
520 }
521
HandleAcquireAddFormResult(MessageParcel & data,MessageParcel & reply)522 ErrCode FormMgrStub::HandleAcquireAddFormResult(MessageParcel &data, MessageParcel &reply)
523 {
524 int64_t formId = data.ReadInt64();
525 ErrCode result = AcquireAddFormResult(formId);
526 reply.WriteInt32(result);
527 return result;
528 }
529 /**
530 * @brief handle LifecycleUpdate message.
531 * @param data input param.
532 * @param reply output param.
533 * @return Returns ERR_OK on success, others on failure.
534 */
HandleLifecycleUpdate(MessageParcel & data,MessageParcel & reply)535 int32_t FormMgrStub::HandleLifecycleUpdate(MessageParcel &data, MessageParcel &reply)
536 {
537 std::vector<int64_t> formIds;
538 bool ret = data.ReadInt64Vector(&formIds);
539 if (!ret) {
540 return ERR_APPEXECFWK_PARCEL_ERROR;
541 }
542 sptr<IRemoteObject> client = data.ReadRemoteObject();
543 if (client == nullptr) {
544 HILOG_ERROR("get remote object failed");
545 return ERR_APPEXECFWK_PARCEL_ERROR;
546 }
547 bool updateType = data.ReadBool();
548 int32_t result = LifecycleUpdate(formIds, client, updateType);
549 reply.WriteInt32(result);
550 return result;
551 }
552 /**
553 * @brief handle RequestForm message.
554 * @param data input param.
555 * @param reply output param.
556 * @return Returns ERR_OK on success, others on failure.
557 */
HandleRequestForm(MessageParcel & data,MessageParcel & reply)558 int32_t FormMgrStub::HandleRequestForm(MessageParcel &data, MessageParcel &reply)
559 {
560 HILOG_INFO("call");
561
562 int64_t formId = data.ReadInt64();
563
564 sptr<IRemoteObject> client = data.ReadRemoteObject();
565 if (client == nullptr) {
566 HILOG_ERROR("get remote object failed");
567 return ERR_APPEXECFWK_PARCEL_ERROR;
568 }
569
570 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
571 if (!want) {
572 HILOG_ERROR("ReadParcelable<Want> failed");
573 return ERR_APPEXECFWK_PARCEL_ERROR;
574 }
575
576 int32_t result = RequestForm(formId, client, *want);
577 reply.WriteInt32(result);
578 return result;
579 }
580 /**
581 * @brief handle NotifyVisibleForms message.
582 * @param data input param.
583 * @param reply output param.
584 * @return Returns ERR_OK on success, others on failure.
585 */
HandleNotifyWhetherVisibleForms(MessageParcel & data,MessageParcel & reply)586 int32_t FormMgrStub::HandleNotifyWhetherVisibleForms(MessageParcel &data, MessageParcel &reply)
587 {
588 std::vector<int64_t> formIds;
589 bool ret = data.ReadInt64Vector(&formIds);
590 if (!ret) {
591 return ERR_APPEXECFWK_PARCEL_ERROR;
592 }
593
594 sptr<IRemoteObject> client = data.ReadRemoteObject();
595 if (client == nullptr) {
596 return ERR_APPEXECFWK_PARCEL_ERROR;
597 }
598 int32_t formVisibleType = data.ReadInt32();
599
600 int32_t result = NotifyWhetherVisibleForms(formIds, client, formVisibleType);
601 reply.WriteInt32(result);
602 return result;
603 }
604
605
606 /**
607 * @brief Handle HasFormVisible message.
608 * @param data input param.
609 * @param reply output param.
610 * @return Returns ERR_OK on success, others on failure.
611 */
HandleHasFormVisible(MessageParcel & data,MessageParcel & reply)612 int32_t FormMgrStub::HandleHasFormVisible(MessageParcel &data, MessageParcel &reply)
613 {
614 HILOG_DEBUG("call");
615 uint32_t tokenId = data.ReadUint32();
616 bool result = HasFormVisible(tokenId);
617 if (!reply.WriteBool(result)) {
618 HILOG_ERROR("write action failed");
619 return ERR_APPEXECFWK_PARCEL_ERROR;
620 }
621
622 return ERR_OK;
623 }
624
625 /**
626 * @brief handle CastTempForm message.
627 * @param data input param.
628 * @param reply output param.
629 * @return Returns ERR_OK on success, others on failure.
630 */
HandleCastTempForm(MessageParcel & data,MessageParcel & reply)631 int32_t FormMgrStub::HandleCastTempForm(MessageParcel &data, MessageParcel &reply)
632 {
633 int64_t formId = data.ReadInt64();
634 sptr<IRemoteObject> client = data.ReadRemoteObject();
635 if (client == nullptr) {
636 return ERR_APPEXECFWK_PARCEL_ERROR;
637 }
638
639 int32_t result = CastTempForm(formId, client);
640 reply.WriteInt32(result);
641 return result;
642 }
643 /**
644 * @brief Handle DumpStorageFormInfos message.
645 * @param data input param.
646 * @param reply output param.
647 * @return Returns ERR_OK on success, others on failure.
648 */
HandleDumpStorageFormInfos(MessageParcel & data,MessageParcel & reply)649 int32_t FormMgrStub::HandleDumpStorageFormInfos(MessageParcel &data, MessageParcel &reply)
650 {
651 std::string formInfos;
652 int32_t result = DumpStorageFormInfos(formInfos);
653 reply.WriteInt32(result);
654 if (result == ERR_OK) {
655 std::vector<std::string> dumpInfos;
656 SplitString(formInfos, dumpInfos);
657 if (!reply.WriteStringVector(dumpInfos)) {
658 HILOG_ERROR("WriteStringVector<dumpInfos> failed");
659 return ERR_APPEXECFWK_PARCEL_ERROR;
660 }
661 }
662
663 return result;
664 }
665 /**
666 * @brief Handle DumpFormInfoByBundleName message.
667 * @param data input param.
668 * @param reply output param.
669 * @return Returns ERR_OK on success, others on failure.
670 */
HandleDumpFormInfoByBundleName(MessageParcel & data,MessageParcel & reply)671 int32_t FormMgrStub::HandleDumpFormInfoByBundleName(MessageParcel &data, MessageParcel &reply)
672 {
673 std::string bundleName = data.ReadString();
674 std::string formInfos;
675 int32_t result = DumpFormInfoByBundleName(bundleName, formInfos);
676 reply.WriteInt32(result);
677 if (result == ERR_OK) {
678 HILOG_DEBUG("formInfos:%{public}s", formInfos.c_str());
679 std::vector<std::string> dumpInfos;
680 SplitString(formInfos, dumpInfos);
681 if (!reply.WriteStringVector(dumpInfos)) {
682 HILOG_ERROR("WriteStringVector<dumpInfos> failed");
683 return ERR_APPEXECFWK_PARCEL_ERROR;
684 }
685 }
686
687 return result;
688 }
689 /**
690 * @brief Handle DumpFormInfoByFormId message.
691 * @param data input param.
692 * @param reply output param.
693 * @return Returns ERR_OK on success, others on failure.
694 */
HandleDumpFormInfoByFormId(MessageParcel & data,MessageParcel & reply)695 int32_t FormMgrStub::HandleDumpFormInfoByFormId(MessageParcel &data, MessageParcel &reply)
696 {
697 int64_t formId = data.ReadInt64();
698 std::string formInfo;
699 int32_t result = DumpFormInfoByFormId(formId, formInfo);
700 reply.WriteInt32(result);
701 if (result == ERR_OK) {
702 std::vector<std::string> dumpInfos;
703 SplitString(formInfo, dumpInfos);
704 if (!reply.WriteStringVector(dumpInfos)) {
705 HILOG_ERROR("WriteStringVector<dumpInfos> failed");
706 return ERR_APPEXECFWK_PARCEL_ERROR;
707 }
708 }
709 return result;
710 }
711 /**
712 * @brief Handle DumpFormTimerByFormId message.
713 * @param data input param.
714 * @param reply output param.
715 * @return Returns ERR_OK on success, others on failure.
716 */
HandleDumpFormTimerByFormId(MessageParcel & data,MessageParcel & reply)717 int32_t FormMgrStub::HandleDumpFormTimerByFormId(MessageParcel &data, MessageParcel &reply)
718 {
719 int64_t formId = data.ReadInt64();
720 std::string isTimingService;
721 int32_t result = DumpFormTimerByFormId(formId, isTimingService);
722 reply.WriteInt32(result);
723 if (result == ERR_OK) {
724 std::vector<std::string> dumpInfos;
725 SplitString(isTimingService, dumpInfos);
726 if (!reply.WriteStringVector(dumpInfos)) {
727 HILOG_ERROR("WriteStringVector<dumpInfos> failed");
728 return ERR_APPEXECFWK_PARCEL_ERROR;
729 }
730 }
731 return result;
732 }
733
734 /**
735 * @brief Handle DumpFormInfoByFormId message.
736 * @param data input param.
737 * @param reply output param.
738 * @return Returns ERR_OK on success, others on failure.
739 */
HandleMessageEvent(MessageParcel & data,MessageParcel & reply)740 int32_t FormMgrStub::HandleMessageEvent(MessageParcel &data, MessageParcel &reply)
741 {
742 HILOG_INFO("call");
743 int64_t formId = data.ReadInt64();
744 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
745 if (!want) {
746 HILOG_ERROR("ReadParcelable<Want> failed");
747 return ERR_APPEXECFWK_PARCEL_ERROR;
748 }
749
750 sptr<IRemoteObject> client = data.ReadRemoteObject();
751 if (client == nullptr) {
752 HILOG_ERROR("get remote object failed");
753 return ERR_APPEXECFWK_PARCEL_ERROR;
754 }
755
756 int32_t result = MessageEvent(formId, *want, client);
757 reply.WriteInt32(result);
758 return result;
759 }
760
761 /**
762 * @brief Handle RouterEvent message.
763 * @param data input param.
764 * @param reply output param.
765 * @return Returns ERR_OK on success, others on failure.
766 */
HandleRouterEvent(MessageParcel & data,MessageParcel & reply)767 int32_t FormMgrStub::HandleRouterEvent(MessageParcel &data, MessageParcel &reply)
768 {
769 HILOG_INFO("call");
770 int64_t formId = data.ReadInt64();
771 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
772 if (!want) {
773 HILOG_ERROR("ReadParcelable<Want> failed");
774 return ERR_APPEXECFWK_PARCEL_ERROR;
775 }
776 sptr<IRemoteObject> client = data.ReadRemoteObject();
777 if (client == nullptr) {
778 HILOG_ERROR("get remote object failed");
779 return ERR_APPEXECFWK_PARCEL_ERROR;
780 }
781
782 int32_t result = RouterEvent(formId, *want, client);
783 reply.WriteInt32(result);
784 return result;
785 }
786
787 /**
788 * @brief Handle Background message.
789 * @param data input param.
790 * @param reply output param.
791 * @return Returns ERR_OK on success, others on failure.
792 */
HandleBackgroundEvent(MessageParcel & data,MessageParcel & reply)793 int32_t FormMgrStub::HandleBackgroundEvent(MessageParcel &data, MessageParcel &reply)
794 {
795 HILOG_INFO("call");
796 int64_t formId = data.ReadInt64();
797 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
798 if (!want) {
799 HILOG_ERROR("ReadParcelable<Want> failed");
800 return ERR_APPEXECFWK_PARCEL_ERROR;
801 }
802 sptr<IRemoteObject> client = data.ReadRemoteObject();
803 if (client == nullptr) {
804 HILOG_ERROR("get remote object failed");
805 return ERR_APPEXECFWK_PARCEL_ERROR;
806 }
807
808 int32_t result = BackgroundEvent(formId, *want, client);
809 reply.WriteInt32(result);
810 return result;
811 }
812
813 /**
814 * @brief Handle DeleteInvalidForms message.
815 * @param data input param.
816 * @param reply output param.
817 * @return Returns ERR_OK on success, others on failure.
818 */
HandleDeleteInvalidForms(MessageParcel & data,MessageParcel & reply)819 int32_t FormMgrStub::HandleDeleteInvalidForms(MessageParcel &data, MessageParcel &reply)
820 {
821 HILOG_INFO("call");
822 std::vector<int64_t> formIds;
823 if (!data.ReadInt64Vector(&formIds)) {
824 HILOG_ERROR("ReadInt64Vector failed");
825 return ERR_APPEXECFWK_PARCEL_ERROR;
826 }
827 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
828 if (callerToken == nullptr) {
829 HILOG_ERROR("get remote object failed");
830 return ERR_APPEXECFWK_PARCEL_ERROR;
831 }
832 int32_t numFormsDeleted = 0;
833 int32_t result = DeleteInvalidForms(formIds, callerToken, numFormsDeleted);
834 if (!reply.WriteInt32(result)) {
835 HILOG_ERROR("write result failed");
836 return ERR_APPEXECFWK_PARCEL_ERROR;
837 }
838 if (!reply.WriteInt32(numFormsDeleted)) {
839 HILOG_ERROR("fail write numFormsDeleted");
840 return ERR_APPEXECFWK_PARCEL_ERROR;
841 }
842 return result;
843 }
844
845 /**
846 * @brief Handle AcquireFormState message.
847 * @param data input param.
848 * @param reply output param.
849 * @return Returns ERR_OK on success, others on failure.
850 */
HandleAcquireFormState(MessageParcel & data,MessageParcel & reply)851 int32_t FormMgrStub::HandleAcquireFormState(MessageParcel &data, MessageParcel &reply)
852 {
853 HILOG_INFO("call");
854 FormStateInfo stateInfo {};
855 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
856 if (want == nullptr) {
857 HILOG_ERROR("ReadParcelable want failed");
858 return ERR_APPEXECFWK_PARCEL_ERROR;
859 }
860 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
861 if (callerToken == nullptr) {
862 HILOG_ERROR("get remote object failed");
863 return ERR_APPEXECFWK_PARCEL_ERROR;
864 }
865 int32_t result = AcquireFormState(*want, callerToken, stateInfo);
866 if (!reply.WriteInt32(result)) {
867 HILOG_ERROR("write result failed");
868 return ERR_APPEXECFWK_PARCEL_ERROR;
869 }
870 if (!reply.WriteInt32((int32_t)stateInfo.state)) {
871 HILOG_ERROR("write state failed");
872 return ERR_APPEXECFWK_PARCEL_ERROR;
873 }
874 return result;
875 }
876
877 /**
878 * @brief Handle NotifyFormsVisible message.
879 * @param data input param.
880 * @param reply output param.
881 * @return Returns ERR_OK on success, others on failure.
882 */
HandleNotifyFormsVisible(MessageParcel & data,MessageParcel & reply)883 int32_t FormMgrStub::HandleNotifyFormsVisible(MessageParcel &data, MessageParcel &reply)
884 {
885 HILOG_INFO("call");
886 std::vector<int64_t> formIds;
887 if (!data.ReadInt64Vector(&formIds)) {
888 HILOG_ERROR("ReadInt64Vector failed");
889 return ERR_APPEXECFWK_PARCEL_ERROR;
890 }
891 bool isVisible = false;
892 if (!data.ReadBool(isVisible)) {
893 HILOG_ERROR("ReadBool failed");
894 return ERR_APPEXECFWK_PARCEL_ERROR;
895 }
896 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
897 if (callerToken == nullptr) {
898 HILOG_ERROR("get remote object failed");
899 return ERR_APPEXECFWK_PARCEL_ERROR;
900 }
901
902 int32_t result = NotifyFormsVisible(formIds, isVisible, callerToken);
903 if (!reply.WriteInt32(result)) {
904 HILOG_ERROR("write result failed");
905 return ERR_APPEXECFWK_PARCEL_ERROR;
906 }
907 return result;
908 }
909
HandleNotifyFormsPrivacyProtected(MessageParcel & data,MessageParcel & reply)910 int32_t FormMgrStub::HandleNotifyFormsPrivacyProtected(MessageParcel &data, MessageParcel &reply)
911 {
912 HILOG_DEBUG("call");
913 std::vector<int64_t> formIds;
914 if (!data.ReadInt64Vector(&formIds)) {
915 HILOG_ERROR("ReadInt64Vector failed");
916 return ERR_APPEXECFWK_PARCEL_ERROR;
917 }
918 bool isProtected = false;
919 if (!data.ReadBool(isProtected)) {
920 HILOG_ERROR("ReadBool failed");
921 return ERR_APPEXECFWK_PARCEL_ERROR;
922 }
923 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
924 if (callerToken == nullptr) {
925 HILOG_ERROR("get remote object failed");
926 return ERR_APPEXECFWK_PARCEL_ERROR;
927 }
928
929 int32_t result = NotifyFormsPrivacyProtected(formIds, isProtected, callerToken);
930 if (!reply.WriteInt32(result)) {
931 HILOG_ERROR("write result failed");
932 return ERR_APPEXECFWK_PARCEL_ERROR;
933 }
934 return result;
935 }
936
937 /**
938 * @brief Handle NotifyFormsEnableUpdate message.
939 * @param data input param.
940 * @param reply output param.
941 * @return Returns ERR_OK on success, others on failure.
942 */
HandleNotifyFormsEnableUpdate(MessageParcel & data,MessageParcel & reply)943 int32_t FormMgrStub::HandleNotifyFormsEnableUpdate(MessageParcel &data, MessageParcel &reply)
944 {
945 HILOG_INFO("call");
946 std::vector<int64_t> formIds;
947 if (!data.ReadInt64Vector(&formIds)) {
948 HILOG_ERROR("ReadInt64Vector failed");
949 return ERR_APPEXECFWK_PARCEL_ERROR;
950 }
951 bool isEnableUpdate = false;
952 if (!data.ReadBool(isEnableUpdate)) {
953 HILOG_ERROR("ReadBool failed");
954 return ERR_APPEXECFWK_PARCEL_ERROR;
955 }
956 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
957 if (callerToken == nullptr) {
958 HILOG_ERROR("get remote object failed");
959 return ERR_APPEXECFWK_PARCEL_ERROR;
960 }
961
962 int32_t result = NotifyFormsEnableUpdate(formIds, isEnableUpdate, callerToken);
963 if (!reply.WriteInt32(result)) {
964 HILOG_ERROR("write result failed");
965 return ERR_APPEXECFWK_PARCEL_ERROR;
966 }
967 return result;
968 }
969
970 /**
971 * @brief Handle GetAllFormsInfo message.
972 * @param data input param.
973 * @param reply output param.
974 * @return Returns ERR_OK on success, others on failure.
975 */
HandleGetAllFormsInfo(MessageParcel & data,MessageParcel & reply)976 int32_t FormMgrStub::HandleGetAllFormsInfo(MessageParcel &data, MessageParcel &reply)
977 {
978 HILOG_INFO("max parcel capacity:%{public}zu", MAX_PARCEL_CAPACITY);
979 std::vector<FormInfo> infos;
980 int32_t result = GetAllFormsInfo(infos);
981 (void)reply.SetMaxCapacity(MAX_PARCEL_CAPACITY);
982 reply.WriteInt32(result);
983 if (result == ERR_OK) {
984 if (!WriteParcelableVector(infos, reply)) {
985 HILOG_ERROR("write failed");
986 return ERR_APPEXECFWK_PARCEL_ERROR;
987 }
988 }
989 return result;
990 }
991
992 /**
993 * @brief Handle GetFormsInfoByApp message.
994 * @param data input param.
995 * @param reply output param.
996 * @return Returns ERR_OK on success, others on failure.
997 */
HandleGetFormsInfoByApp(MessageParcel & data,MessageParcel & reply)998 int32_t FormMgrStub::HandleGetFormsInfoByApp(MessageParcel &data, MessageParcel &reply)
999 {
1000 HILOG_DEBUG("call");
1001 std::string bundleName = data.ReadString();
1002 std::vector<FormInfo> infos;
1003 int32_t result = GetFormsInfoByApp(bundleName, infos);
1004 reply.WriteInt32(result);
1005 if (result == ERR_OK) {
1006 if (!WriteParcelableVector(infos, reply)) {
1007 HILOG_ERROR("write failed");
1008 return ERR_APPEXECFWK_PARCEL_ERROR;
1009 }
1010 }
1011 return result;
1012 }
1013
1014 /**
1015 * @brief Handle GetFormsInfoByModule message.
1016 * @param data input param.
1017 * @param reply output param.
1018 * @return Returns ERR_OK on success, others on failure.
1019 */
HandleGetFormsInfoByModule(MessageParcel & data,MessageParcel & reply)1020 int32_t FormMgrStub::HandleGetFormsInfoByModule(MessageParcel &data, MessageParcel &reply)
1021 {
1022 HILOG_DEBUG("call");
1023 std::string bundleName = data.ReadString();
1024 std::string moduleName = data.ReadString();
1025 std::vector<FormInfo> infos;
1026 int32_t result = GetFormsInfoByModule(bundleName, moduleName, infos);
1027 reply.WriteInt32(result);
1028 if (result == ERR_OK) {
1029 if (!WriteParcelableVector(infos, reply)) {
1030 HILOG_ERROR("write failed");
1031 return ERR_APPEXECFWK_PARCEL_ERROR;
1032 }
1033 }
1034 return result;
1035 }
1036
HandleGetFormsInfoByFilter(MessageParcel & data,MessageParcel & reply)1037 int32_t FormMgrStub::HandleGetFormsInfoByFilter(MessageParcel &data, MessageParcel &reply)
1038 {
1039 HILOG_DEBUG("call");
1040 FormInfoFilter filter;
1041 filter.bundleName = data.ReadString();
1042 filter.moduleName = data.ReadString();
1043 data.ReadInt32Vector(&filter.supportDimensions);
1044 data.ReadInt32Vector(&filter.supportShapes);
1045
1046 std::vector<FormInfo> infos;
1047 int32_t result = GetFormsInfoByFilter(filter, infos);
1048 reply.WriteInt32(result);
1049 if (result == ERR_OK && !WriteParcelableVector(infos, reply)) {
1050 HILOG_ERROR("write failed");
1051 return ERR_APPEXECFWK_PARCEL_ERROR;
1052 }
1053 return result;
1054 }
1055
HandleGetFormsInfo(MessageParcel & data,MessageParcel & reply)1056 int32_t FormMgrStub::HandleGetFormsInfo(MessageParcel &data, MessageParcel &reply)
1057 {
1058 HILOG_INFO("call");
1059 // read filter from data.
1060 std::unique_ptr<FormInfoFilter> filter(data.ReadParcelable<FormInfoFilter>());
1061 if (filter == nullptr) {
1062 HILOG_ERROR("fail get filter");
1063 return ERR_APPEXECFWK_PARCEL_ERROR;
1064 }
1065 // write result of calling FMS into reply.
1066 std::vector<FormInfo> infos;
1067 // call FormMgrService to get formInfos into infos.
1068 int32_t result = GetFormsInfo(*filter, infos);
1069 reply.WriteBool(result);
1070 if (result == ERR_OK) {
1071 // write fetched formInfos into reply.
1072 if (!WriteParcelableVector(infos, reply)) {
1073 HILOG_ERROR("write failed");
1074 return ERR_APPEXECFWK_PARCEL_ERROR;
1075 }
1076 }
1077 return result;
1078 }
1079
HandleGetPublishedFormInfoById(MessageParcel & data,MessageParcel & reply)1080 int32_t FormMgrStub::HandleGetPublishedFormInfoById(MessageParcel &data, MessageParcel &reply)
1081 {
1082 HILOG_INFO("call");
1083 int64_t formId = data.ReadInt64();
1084 // write result of calling FMS into reply.
1085 RunningFormInfo info;
1086 // call FormMgrService to get formInfo.
1087 int32_t result = GetPublishedFormInfoById(formId, info);
1088 reply.WriteBool(result);
1089 if (result == ERR_OK && !reply.WriteParcelable(&info)) {
1090 HILOG_ERROR("write failed");
1091 return ERR_APPEXECFWK_PARCEL_ERROR;
1092 }
1093 return result;
1094 }
1095
HandleGetPublishedFormInfos(MessageParcel & data,MessageParcel & reply)1096 int32_t FormMgrStub::HandleGetPublishedFormInfos(MessageParcel &data, MessageParcel &reply)
1097 {
1098 HILOG_INFO("call");
1099 // write result of calling FMS into reply.
1100 std::vector<RunningFormInfo> infos;
1101 // call FormMgrService to get formInfos into infos.
1102 int32_t result = GetPublishedFormInfos(infos);
1103 reply.WriteBool(result);
1104 if (result == ERR_OK && !WriteParcelableVector(infos, reply)) {
1105 HILOG_ERROR("write failed");
1106 return ERR_APPEXECFWK_PARCEL_ERROR;
1107 }
1108 return result;
1109 }
1110
HandleShareForm(MessageParcel & data,MessageParcel & reply)1111 int32_t FormMgrStub::HandleShareForm(MessageParcel &data, MessageParcel &reply)
1112 {
1113 HILOG_DEBUG("call");
1114 int64_t formId = data.ReadInt64();
1115 std::string deviceId = data.ReadString();
1116 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1117 if (callerToken == nullptr) {
1118 HILOG_ERROR("get remote object failed");
1119 return ERR_APPEXECFWK_PARCEL_ERROR;
1120 }
1121 int64_t requestCode = data.ReadInt64();
1122
1123 auto result = ShareForm(formId, deviceId, callerToken, requestCode);
1124 reply.WriteInt32(result);
1125 return result;
1126 }
1127
HandleAcquireFormData(MessageParcel & data,MessageParcel & reply)1128 int32_t FormMgrStub::HandleAcquireFormData(MessageParcel &data, MessageParcel &reply)
1129 {
1130 HILOG_INFO("call");
1131 int64_t formId = data.ReadInt64();
1132 int64_t requestCode = data.ReadInt64();
1133 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1134 if (callerToken == nullptr) {
1135 HILOG_ERROR("get remoteObject failed");
1136 return ERR_APPEXECFWK_PARCEL_ERROR;
1137 }
1138 // write result of calling FMS into reply.
1139 AAFwk::WantParams customizeData;
1140 // call FormMgrService to get formData into data.
1141 int32_t result = AcquireFormData(formId, requestCode, callerToken, customizeData);
1142 reply.WriteInt32(result);
1143 reply.WriteParcelable(&customizeData);
1144 return result;
1145 }
1146
HandleRecvFormShareInfoFromRemote(MessageParcel & data,MessageParcel & reply)1147 int32_t FormMgrStub::HandleRecvFormShareInfoFromRemote(MessageParcel &data, MessageParcel &reply)
1148 {
1149 HILOG_DEBUG("call");
1150 std::unique_ptr<FormShareInfo> info(data.ReadParcelable<FormShareInfo>());
1151 if (!info) {
1152 HILOG_ERROR("fail ReadParcelable<FormShareInfo>");
1153 return ERR_APPEXECFWK_PARCEL_ERROR;
1154 }
1155 auto result = RecvFormShareInfoFromRemote(*info);
1156 reply.WriteInt32(result);
1157 return result;
1158 }
1159
HandleIsRequestPublishFormSupported(MessageParcel & data,MessageParcel & reply)1160 int32_t FormMgrStub::HandleIsRequestPublishFormSupported(MessageParcel &data, MessageParcel &reply)
1161 {
1162 HILOG_INFO("call");
1163 bool result = IsRequestPublishFormSupported();
1164 if (!reply.WriteBool(result)) {
1165 HILOG_ERROR("write action failed");
1166 return ERR_APPEXECFWK_PARCEL_ERROR;
1167 }
1168 return ERR_OK;
1169 }
1170
HandleStartAbility(MessageParcel & data,MessageParcel & reply)1171 int32_t FormMgrStub::HandleStartAbility(MessageParcel &data, MessageParcel &reply)
1172 {
1173 HILOG_INFO("call");
1174 // retrieve want
1175 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
1176 if (want == nullptr) {
1177 HILOG_ERROR("get want failed");
1178 return ERR_APPEXECFWK_PARCEL_ERROR;
1179 }
1180 // retrieve callerToken
1181 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1182 if (callerToken == nullptr) {
1183 HILOG_ERROR("get remote object failed");
1184 return ERR_APPEXECFWK_PARCEL_ERROR;
1185 }
1186 int32_t result = StartAbility(*want, callerToken);
1187 if (!reply.WriteInt32(result)) {
1188 HILOG_ERROR("write result failed");
1189 return ERR_APPEXECFWK_PARCEL_ERROR;
1190 }
1191 return result;
1192 }
1193
HandleStartAbilityByFms(MessageParcel & data,MessageParcel & reply)1194 int32_t FormMgrStub::HandleStartAbilityByFms(MessageParcel &data, MessageParcel &reply)
1195 {
1196 HILOG_INFO("call");
1197 // retrieve want
1198 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
1199 if (want == nullptr) {
1200 HILOG_ERROR("get want failed");
1201 return ERR_APPEXECFWK_PARCEL_ERROR;
1202 }
1203 int32_t result = StartAbilityByFms(*want);
1204 if (!reply.WriteInt32(result)) {
1205 HILOG_ERROR("write result failed");
1206 return ERR_APPEXECFWK_PARCEL_ERROR;
1207 }
1208 return result;
1209 }
1210
HandleStartAbilityByCrossBundle(MessageParcel & data,MessageParcel & reply)1211 int32_t FormMgrStub::HandleStartAbilityByCrossBundle(MessageParcel &data, MessageParcel &reply)
1212 {
1213 HILOG_INFO("call");
1214 // retrieve want
1215 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
1216 if (want == nullptr) {
1217 HILOG_ERROR("get want failed");
1218 return ERR_APPEXECFWK_FORM_GET_SYSMGR_FAILED;
1219 }
1220 int32_t result = StartAbilityByCrossBundle(*want);
1221 if (!reply.WriteInt32(result)) {
1222 HILOG_ERROR("write result failed");
1223 return ERR_APPEXECFWK_FORM_GET_SYSMGR_FAILED;
1224 }
1225 return result;
1226 }
1227
HandleCheckFMSReady(MessageParcel & data,MessageParcel & reply)1228 int32_t FormMgrStub::HandleCheckFMSReady(MessageParcel &data, MessageParcel &reply)
1229 {
1230 HILOG_DEBUG("call");
1231 bool result = CheckFMSReady();
1232 if (!reply.WriteBool(result)) {
1233 HILOG_ERROR("write action failed");
1234 return ERR_APPEXECFWK_PARCEL_ERROR;
1235 }
1236 return ERR_OK;
1237 }
1238
HandleIsSystemAppForm(MessageParcel & data,MessageParcel & reply)1239 ErrCode FormMgrStub::HandleIsSystemAppForm(MessageParcel &data, MessageParcel &reply)
1240 {
1241 std::string bundleName = data.ReadString();
1242 bool result = IsSystemAppForm(bundleName);
1243 if (!reply.WriteBool(result)) {
1244 HILOG_ERROR("write result failed");
1245 return ERR_APPEXECFWK_PARCEL_ERROR;
1246 }
1247 return ERR_OK;
1248 }
1249
HandleRegisterFormAddObserverByBundle(MessageParcel & data,MessageParcel & reply)1250 int32_t FormMgrStub::HandleRegisterFormAddObserverByBundle(MessageParcel &data, MessageParcel &reply)
1251 {
1252 HILOG_DEBUG("call");
1253
1254 std::string bundleName = data.ReadString();
1255 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1256 if (callerToken == nullptr) {
1257 HILOG_ERROR("get remoteObject failed");
1258 return ERR_APPEXECFWK_PARCEL_ERROR;
1259 }
1260 auto result = RegisterFormAddObserverByBundle(bundleName, callerToken);
1261 reply.WriteInt32(result);
1262 return result;
1263 }
1264
HandleRegisterFormRemoveObserverByBundle(MessageParcel & data,MessageParcel & reply)1265 int32_t FormMgrStub::HandleRegisterFormRemoveObserverByBundle(MessageParcel &data, MessageParcel &reply)
1266 {
1267 HILOG_DEBUG("call");
1268
1269 std::string bundleName = data.ReadString();
1270 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1271 if (callerToken == nullptr) {
1272 HILOG_ERROR("get remoteObject failed");
1273 return ERR_APPEXECFWK_PARCEL_ERROR;
1274 }
1275 auto result = RegisterFormRemoveObserverByBundle(bundleName, callerToken);
1276 reply.WriteInt32(result);
1277 return result;
1278 }
1279
HandleGetFormsCount(MessageParcel & data,MessageParcel & reply)1280 int32_t FormMgrStub::HandleGetFormsCount(MessageParcel &data, MessageParcel &reply)
1281 {
1282 HILOG_INFO("call");
1283 bool isTempFormFlag = false;
1284 if (!data.ReadBool(isTempFormFlag)) {
1285 HILOG_ERROR("fail read temp flag");
1286 return ERR_APPEXECFWK_PARCEL_ERROR;
1287 }
1288
1289 int32_t formCount = 0;
1290 int32_t result = GetFormsCount(isTempFormFlag, formCount);
1291 if (!reply.WriteInt32(result)) {
1292 HILOG_ERROR("write result failed");
1293 return ERR_APPEXECFWK_PARCEL_ERROR;
1294 }
1295 if (!reply.WriteInt32(formCount)) {
1296 HILOG_ERROR("write formCount failed");
1297 return ERR_APPEXECFWK_PARCEL_ERROR;
1298 }
1299 return result;
1300 }
1301
HandleGetFormInstancesByFilter(MessageParcel & data,MessageParcel & reply)1302 int32_t FormMgrStub::HandleGetFormInstancesByFilter(MessageParcel &data, MessageParcel &reply)
1303 {
1304 HILOG_DEBUG("call");
1305 std::unique_ptr<FormInstancesFilter> filter(data.ReadParcelable<FormInstancesFilter>());
1306 if (filter == nullptr) {
1307 HILOG_ERROR("fail get filter");
1308 return ERR_APPEXECFWK_PARCEL_ERROR;
1309 }
1310 std::vector<FormInstance> infos;
1311 auto result = GetFormInstancesByFilter(*filter, infos);
1312 HILOG_DEBUG("info size = %{public}zu", infos.size());
1313 reply.WriteInt32(result);
1314 if (result == ERR_OK) {
1315 HILOG_INFO("result is ok");
1316 if (!WriteParcelableVector(infos, reply)) {
1317 HILOG_ERROR("write failed");
1318 return ERR_APPEXECFWK_PARCEL_ERROR;
1319 }
1320 }
1321 return ERR_OK;
1322 }
1323
HandleGetFormInstanceById(MessageParcel & data,MessageParcel & reply)1324 int32_t FormMgrStub::HandleGetFormInstanceById(MessageParcel &data, MessageParcel &reply)
1325 {
1326 HILOG_DEBUG("call");
1327 int64_t formId = data.ReadInt64();
1328 bool isUnusedInclude = data.ReadBool();
1329 FormInstance info;
1330 auto result = GetFormInstanceById(formId, isUnusedInclude, info);
1331 reply.WriteInt32(result);
1332 if (result == ERR_OK) {
1333 if (!reply.WriteParcelable(&info)) {
1334 HILOG_ERROR("write failed");
1335 return ERR_APPEXECFWK_PARCEL_ERROR;
1336 }
1337 }
1338 return ERR_OK;
1339 }
1340
HandleGetHostFormsCount(MessageParcel & data,MessageParcel & reply)1341 int32_t FormMgrStub::HandleGetHostFormsCount(MessageParcel &data, MessageParcel &reply)
1342 {
1343 HILOG_INFO("call");
1344 std::string bundleName = data.ReadString();
1345
1346 int32_t formCount = 0;
1347 int32_t result = GetHostFormsCount(bundleName, formCount);
1348 if (!reply.WriteInt32(result)) {
1349 HILOG_ERROR("write result failed");
1350 return ERR_APPEXECFWK_PARCEL_ERROR;
1351 }
1352 if (!reply.WriteInt32(formCount)) {
1353 HILOG_ERROR("write formCount failed");
1354 return ERR_APPEXECFWK_PARCEL_ERROR;
1355 }
1356 return result;
1357 }
1358
HandleGetRunningFormInfos(MessageParcel & data,MessageParcel & reply)1359 ErrCode FormMgrStub::HandleGetRunningFormInfos(MessageParcel &data, MessageParcel &reply)
1360 {
1361 HILOG_DEBUG("call");
1362 bool isUnusedInclude = data.ReadBool();
1363 std::vector<RunningFormInfo> runningFormInfos;
1364 ErrCode result = GetRunningFormInfos(isUnusedInclude, runningFormInfos);
1365 reply.WriteInt32(result);
1366 if (result == ERR_OK) {
1367 if (!WriteParcelableVector(runningFormInfos, reply)) {
1368 HILOG_ERROR("write failed");
1369 return ERR_APPEXECFWK_PARCEL_ERROR;
1370 }
1371 }
1372 return result;
1373 }
1374
HandleGetRunningFormInfosByBundleName(MessageParcel & data,MessageParcel & reply)1375 ErrCode FormMgrStub::HandleGetRunningFormInfosByBundleName(MessageParcel &data, MessageParcel &reply)
1376 {
1377 HILOG_DEBUG("call");
1378 std::string bundleName = data.ReadString();
1379 bool isUnusedInclude = data.ReadBool();
1380 std::vector<RunningFormInfo> runningFormInfos;
1381 ErrCode result = GetRunningFormInfosByBundleName(bundleName, isUnusedInclude, runningFormInfos);
1382 reply.WriteInt32(result);
1383 if (result == ERR_OK) {
1384 if (!WriteParcelableVector(runningFormInfos, reply)) {
1385 HILOG_ERROR("write failed");
1386 return ERR_APPEXECFWK_PARCEL_ERROR;
1387 }
1388 }
1389 return result;
1390 }
1391
HandleRegisterPublishFormInterceptor(MessageParcel & data,MessageParcel & reply)1392 int32_t FormMgrStub::HandleRegisterPublishFormInterceptor(MessageParcel &data, MessageParcel &reply)
1393 {
1394 HILOG_DEBUG("call");
1395 sptr<IRemoteObject> interceptor = data.ReadRemoteObject();
1396 if (interceptor == nullptr) {
1397 HILOG_ERROR("get remoteObject failed");
1398 return ERR_APPEXECFWK_PARCEL_ERROR;
1399 }
1400 int32_t result = RegisterPublishFormInterceptor(interceptor);
1401 if (!reply.WriteInt32(result)) {
1402 HILOG_ERROR("write result failed");
1403 return ERR_APPEXECFWK_PARCEL_ERROR;
1404 }
1405 return result;
1406 }
1407
HandleUnregisterPublishFormInterceptor(MessageParcel & data,MessageParcel & reply)1408 int32_t FormMgrStub::HandleUnregisterPublishFormInterceptor(MessageParcel &data, MessageParcel &reply)
1409 {
1410 HILOG_DEBUG("call");
1411 sptr<IRemoteObject> interceptor = data.ReadRemoteObject();
1412 if (interceptor == nullptr) {
1413 HILOG_ERROR("get remoteObject failed");
1414 return ERR_APPEXECFWK_PARCEL_ERROR;
1415 }
1416 int32_t result = UnregisterPublishFormInterceptor(interceptor);
1417 if (!reply.WriteInt32(result)) {
1418 HILOG_ERROR("write result failed");
1419 return ERR_APPEXECFWK_PARCEL_ERROR;
1420 }
1421 return result;
1422 }
1423
HandleRegisterClickCallbackEventObserver(MessageParcel & data,MessageParcel & reply)1424 int32_t FormMgrStub::HandleRegisterClickCallbackEventObserver(MessageParcel &data, MessageParcel &reply)
1425 {
1426 HILOG_DEBUG("call");
1427 std::string bundleName = data.ReadString();
1428 std::string formEventType = data.ReadString();
1429 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1430 if (callerToken == nullptr) {
1431 HILOG_ERROR("get remoteObject failed");
1432 return ERR_APPEXECFWK_PARCEL_ERROR;
1433 }
1434 return RegisterClickEventObserver(bundleName, formEventType, callerToken);
1435 }
1436
HandleUnregisterClickCallbackEventObserver(MessageParcel & data,MessageParcel & reply)1437 int32_t FormMgrStub::HandleUnregisterClickCallbackEventObserver(MessageParcel &data, MessageParcel &reply)
1438 {
1439 HILOG_DEBUG("call");
1440 std::string bundleName = data.ReadString();
1441 std::string formEventType = data.ReadString();
1442 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1443 if (callerToken == nullptr) {
1444 HILOG_ERROR("get remoteObject failed");
1445 return ERR_APPEXECFWK_PARCEL_ERROR;
1446 }
1447 return UnregisterClickEventObserver(bundleName, formEventType, callerToken);
1448 }
1449
1450 /**
1451 * @brief Write a parcelabe vector objects to the proxy node.
1452 * @param parcelableVector Indicates the objects to be write.
1453 * @param reply Indicates the reply to be sent;
1454 * @return Returns true if objects send successfully; returns false otherwise.
1455 */
1456 template<typename T>
WriteParcelableVector(std::vector<T> & parcelableVector,Parcel & reply)1457 bool FormMgrStub::WriteParcelableVector(std::vector<T> &parcelableVector, Parcel &reply)
1458 {
1459 if (!reply.WriteInt32(parcelableVector.size())) {
1460 HILOG_ERROR("write ParcelableVector failed");
1461 return false;
1462 }
1463
1464 for (auto &parcelable: parcelableVector) {
1465 if (!reply.WriteParcelable(&parcelable)) {
1466 HILOG_ERROR("write ParcelableVector failed");
1467 return false;
1468 }
1469 }
1470 return true;
1471 }
1472
HandleRegisterAddObserver(MessageParcel & data,MessageParcel & reply)1473 ErrCode FormMgrStub::HandleRegisterAddObserver(MessageParcel &data, MessageParcel &reply)
1474 {
1475 HILOG_DEBUG("call");
1476 std::string bundleName = data.ReadString();
1477 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1478 if (callerToken == nullptr) {
1479 HILOG_ERROR("get remoteObject failed");
1480 return ERR_APPEXECFWK_PARCEL_ERROR;
1481 }
1482 auto result = RegisterAddObserver(bundleName, callerToken);
1483 reply.WriteInt32(result);
1484 return result;
1485 }
1486
HandleRegisterRemoveObserver(MessageParcel & data,MessageParcel & reply)1487 ErrCode FormMgrStub::HandleRegisterRemoveObserver(MessageParcel &data, MessageParcel &reply)
1488 {
1489 HILOG_DEBUG("call");
1490 std::string bundleName = data.ReadString();
1491 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1492 if (callerToken == nullptr) {
1493 HILOG_ERROR("get remoteObject failed");
1494 return ERR_APPEXECFWK_PARCEL_ERROR;
1495 }
1496 auto result = RegisterRemoveObserver(bundleName, callerToken);
1497 reply.WriteInt32(result);
1498 return result;
1499 }
1500
HandleRegisterFormRouterProxy(MessageParcel & data,MessageParcel & reply)1501 ErrCode FormMgrStub::HandleRegisterFormRouterProxy(MessageParcel &data, MessageParcel &reply)
1502 {
1503 HILOG_DEBUG("call");
1504 std::vector<int64_t> formIds;
1505 if (!data.ReadInt64Vector(&formIds)) {
1506 HILOG_ERROR("ReadInt64Vector failed");
1507 return ERR_APPEXECFWK_PARCEL_ERROR;
1508 }
1509 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1510 if (callerToken == nullptr) {
1511 HILOG_ERROR("get remoteObject failed");
1512 return ERR_APPEXECFWK_PARCEL_ERROR;
1513 }
1514 auto result = RegisterFormRouterProxy(formIds, callerToken);
1515 reply.WriteInt32(result);
1516 return result;
1517 }
1518
HandleUnregisterFormRouterProxy(MessageParcel & data,MessageParcel & reply)1519 ErrCode FormMgrStub::HandleUnregisterFormRouterProxy(MessageParcel &data, MessageParcel &reply)
1520 {
1521 HILOG_DEBUG("call");
1522 std::vector<int64_t> formIds;
1523 if (!data.ReadInt64Vector(&formIds)) {
1524 HILOG_ERROR("ReadInt64Vector failed");
1525 return ERR_APPEXECFWK_PARCEL_ERROR;
1526 }
1527 auto result = UnregisterFormRouterProxy(formIds);
1528 reply.WriteInt32(result);
1529 return result;
1530 }
1531
HandleUpdateProxyForm(MessageParcel & data,MessageParcel & reply)1532 ErrCode FormMgrStub::HandleUpdateProxyForm(MessageParcel &data, MessageParcel &reply)
1533 {
1534 int64_t formId = data.ReadInt64();
1535 std::unique_ptr<FormProviderData> formProviderData(data.ReadParcelable<FormProviderData>());
1536 if (formProviderData == nullptr) {
1537 HILOG_ERROR("get formProviderData failed");
1538 return ERR_APPEXECFWK_PARCEL_ERROR;
1539 }
1540 std::vector<FormDataProxy> formDataProxies;
1541 if (!ReadFormDataProxies(data, formDataProxies)) {
1542 HILOG_ERROR("fail get formDataProxies");
1543 return ERR_APPEXECFWK_PARCEL_ERROR;
1544 }
1545 int32_t result = UpdateProxyForm(formId, *formProviderData, formDataProxies);
1546 reply.WriteInt32(result);
1547 return result;
1548 }
1549
HandleRequestPublishProxyForm(MessageParcel & data,MessageParcel & reply)1550 ErrCode FormMgrStub::HandleRequestPublishProxyForm(MessageParcel &data, MessageParcel &reply)
1551 {
1552 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
1553 if (want == nullptr) {
1554 HILOG_ERROR("error to get want");
1555 return ERR_APPEXECFWK_PARCEL_ERROR;
1556 }
1557
1558 bool withFormBindingData = data.ReadBool();
1559 std::unique_ptr<FormProviderData> formProviderData = nullptr;
1560 if (withFormBindingData) {
1561 formProviderData.reset(data.ReadParcelable<FormProviderData>());
1562 if (formProviderData == nullptr) {
1563 HILOG_ERROR("error to get formProviderData");
1564 return ERR_APPEXECFWK_PARCEL_ERROR;
1565 }
1566 }
1567 std::vector<FormDataProxy> formDataProxies;
1568 if (!ReadFormDataProxies(data, formDataProxies)) {
1569 HILOG_ERROR("fail get formDataProxies");
1570 return ERR_APPEXECFWK_PARCEL_ERROR;
1571 }
1572 int64_t formId = 0;
1573 ErrCode result = RequestPublishProxyForm(*want, withFormBindingData, formProviderData, formId, formDataProxies);
1574 reply.WriteInt32(result);
1575 if (result == ERR_OK) {
1576 reply.WriteInt64(formId);
1577 }
1578 return result;
1579 }
ReadFormDataProxies(MessageParcel & data,std::vector<FormDataProxy> & formDataProxies)1580 bool FormMgrStub::ReadFormDataProxies(MessageParcel &data, std::vector<FormDataProxy> &formDataProxies)
1581 {
1582 auto number = data.ReadInt32();
1583 HILOG_DEBUG("proxies number:%{public}d", number);
1584 if (number < 0 || number > INT16_MAX) {
1585 HILOG_ERROR("proxies number over limit:%{public}d", number);
1586 return false;
1587 }
1588
1589 for (int32_t i = 0; i < number; i++) {
1590 FormDataProxy formDataProxy("", "");
1591 formDataProxy.key = Str16ToStr8(data.ReadString16());
1592 formDataProxy.subscribeId = Str16ToStr8(data.ReadString16());
1593 formDataProxies.push_back(formDataProxy);
1594 }
1595 return true;
1596 }
1597
HandleSetFormsRecyclable(MessageParcel & data,MessageParcel & reply)1598 int32_t FormMgrStub::HandleSetFormsRecyclable(MessageParcel &data, MessageParcel &reply)
1599 {
1600 HILOG_DEBUG("call");
1601 std::vector<int64_t> formIds;
1602 if (!data.ReadInt64Vector(&formIds)) {
1603 HILOG_ERROR("ReadInt64Vector failed");
1604 return ERR_APPEXECFWK_PARCEL_ERROR;
1605 }
1606 int32_t result = SetFormsRecyclable(formIds);
1607 if (!reply.WriteInt32(result)) {
1608 HILOG_ERROR("write result failed");
1609 return ERR_APPEXECFWK_PARCEL_ERROR;
1610 }
1611 return result;
1612 }
1613
HandleRecycleForms(MessageParcel & data,MessageParcel & reply)1614 int32_t FormMgrStub::HandleRecycleForms(MessageParcel &data, MessageParcel &reply)
1615 {
1616 HILOG_DEBUG("call");
1617 std::vector<int64_t> formIds;
1618 if (!data.ReadInt64Vector(&formIds)) {
1619 HILOG_ERROR("ReadInt64Vector failed");
1620 return ERR_APPEXECFWK_PARCEL_ERROR;
1621 }
1622 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
1623 if (!want) {
1624 HILOG_ERROR("ReadParcelable<Want> failed");
1625 return ERR_APPEXECFWK_PARCEL_ERROR;
1626 }
1627 int32_t result = RecycleForms(formIds, *want);
1628 if (!reply.WriteInt32(result)) {
1629 HILOG_ERROR("write result failed");
1630 return ERR_APPEXECFWK_PARCEL_ERROR;
1631 }
1632 return result;
1633 }
1634
HandleRecoverForms(MessageParcel & data,MessageParcel & reply)1635 int32_t FormMgrStub::HandleRecoverForms(MessageParcel &data, MessageParcel &reply)
1636 {
1637 HILOG_DEBUG("call");
1638 std::vector<int64_t> formIds;
1639 if (!data.ReadInt64Vector(&formIds)) {
1640 HILOG_ERROR("ReadInt64Vector failed");
1641 return ERR_APPEXECFWK_PARCEL_ERROR;
1642 }
1643 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
1644 if (!want) {
1645 HILOG_ERROR("ReadParcelable<Want> failed");
1646 return ERR_APPEXECFWK_PARCEL_ERROR;
1647 }
1648 int32_t result = RecoverForms(formIds, *want);
1649 if (!reply.WriteInt32(result)) {
1650 HILOG_ERROR("write result failed");
1651 return ERR_APPEXECFWK_PARCEL_ERROR;
1652 }
1653 return result;
1654 }
1655
HandleUpdateFormLocation(MessageParcel & data,MessageParcel & reply)1656 ErrCode FormMgrStub::HandleUpdateFormLocation(MessageParcel &data, MessageParcel &reply)
1657 {
1658 HILOG_DEBUG("call");
1659 int64_t formId = data.ReadInt64();
1660 int32_t formLocation = data.ReadInt32();
1661 ErrCode result = UpdateFormLocation(formId, formLocation);
1662 if (!reply.WriteInt32(result)) {
1663 HILOG_ERROR("write result failed");
1664 return ERR_APPEXECFWK_PARCEL_ERROR;
1665 }
1666 return result;
1667 }
1668
1669 /**
1670 * @brief handle CreateForm message.
1671 * @param data input param.
1672 * @param reply output param.
1673 * @return Returns ERR_OK on success, others on failure.
1674 */
HandleRequestPublishFormWithSnapshot(MessageParcel & data,MessageParcel & reply)1675 ErrCode FormMgrStub::HandleRequestPublishFormWithSnapshot(MessageParcel &data, MessageParcel &reply)
1676 {
1677 std::unique_ptr<Want> want(data.ReadParcelable<Want>());
1678 if (want == nullptr) {
1679 HILOG_ERROR("error to get want");
1680 return ERR_APPEXECFWK_PARCEL_ERROR;
1681 }
1682
1683 bool withFormBindingData = data.ReadBool();
1684 std::unique_ptr<FormProviderData> formBindingData = nullptr;
1685 if (withFormBindingData) {
1686 formBindingData.reset(data.ReadParcelable<FormProviderData>());
1687 if (formBindingData == nullptr) {
1688 HILOG_ERROR("error to get formBindingData");
1689 return ERR_APPEXECFWK_PARCEL_ERROR;
1690 }
1691 }
1692
1693 int64_t formId = 0;
1694 ErrCode result = RequestPublishFormWithSnapshot(*want, withFormBindingData, formBindingData, formId);
1695 if (!reply.WriteInt32(result)) {
1696 HILOG_ERROR("write result failed");
1697 return ERR_APPEXECFWK_PARCEL_ERROR;
1698 } else {
1699 reply.WriteInt64(formId);
1700 }
1701 return result;
1702 }
1703
HandleBatchRefreshForms(MessageParcel & data,MessageParcel & reply)1704 ErrCode FormMgrStub::HandleBatchRefreshForms(MessageParcel &data, MessageParcel &reply)
1705 {
1706 int32_t formRefreshType = data.ReadInt32();
1707 ErrCode result = BatchRefreshForms(formRefreshType);
1708 if (!reply.WriteInt32(result)) {
1709 HILOG_ERROR("write result failed");
1710 return ERR_APPEXECFWK_PARCEL_ERROR;
1711 }
1712 return result;
1713 }
1714
HandleEnableForms(MessageParcel & data,MessageParcel & reply)1715 int32_t FormMgrStub::HandleEnableForms(MessageParcel &data, MessageParcel &reply)
1716 {
1717 HILOG_DEBUG("call");
1718 std::string bundleName = data.ReadString();
1719 if (bundleName.empty()) {
1720 HILOG_ERROR("fail ReadString<bundleName>");
1721 return ERR_APPEXECFWK_PARCEL_ERROR;
1722 }
1723 bool enable = data.ReadBool();
1724 int32_t result = EnableForms(bundleName, enable);
1725 if (!reply.WriteInt32(result)) {
1726 HILOG_ERROR("write result failed");
1727 return ERR_APPEXECFWK_PARCEL_ERROR;
1728 }
1729 return result;
1730 }
1731
HandleIsFormBundleForbidden(MessageParcel & data,MessageParcel & reply)1732 ErrCode FormMgrStub::HandleIsFormBundleForbidden(MessageParcel &data, MessageParcel &reply)
1733 {
1734 HILOG_DEBUG("call");
1735 std::string bundleName = data.ReadString();
1736 bool result = IsFormBundleForbidden(bundleName);
1737 if (!reply.WriteBool(result)) {
1738 HILOG_ERROR("write action failed");
1739 return ERR_APPEXECFWK_PARCEL_ERROR;
1740 }
1741 return ERR_OK;
1742 }
1743
ParseLockChangeType(int32_t value)1744 static LockChangeType ParseLockChangeType(int32_t value)
1745 {
1746 switch (value) {
1747 case static_cast<int32_t>(LockChangeType::SWITCH_CHANGE):
1748 return LockChangeType::SWITCH_CHANGE;
1749 case static_cast<int32_t>(LockChangeType::PROTECT_CHANGE):
1750 return LockChangeType::PROTECT_CHANGE;
1751 default:
1752 HILOG_ERROR("lockChangeType invalid");
1753 return LockChangeType::INVALID_PARAMETER;
1754 }
1755 }
1756
HandleLockForms(MessageParcel & data,MessageParcel & reply)1757 int32_t FormMgrStub::HandleLockForms(MessageParcel &data, MessageParcel &reply)
1758 {
1759 HILOG_DEBUG("call");
1760 std::vector<FormLockInfo> formLockInfo;
1761 int32_t infoSize = data.ReadInt32();
1762 if (infoSize > static_cast<int32_t>(MAX_ALLOW_SIZE)) {
1763 HILOG_ERROR("The vector/array size exceeds the security limit!");
1764 return ERR_APPEXECFWK_PARCEL_ERROR;
1765 }
1766
1767 for (int32_t i = 0; i < infoSize; i++) {
1768 std::unique_ptr<FormLockInfo> info(data.ReadParcelable<FormLockInfo>());
1769 if (!info) {
1770 HILOG_ERROR("error to Read Parcelable infos");
1771 return ERR_APPEXECFWK_PARCEL_ERROR;
1772 }
1773 formLockInfo.push_back(*info);
1774 }
1775
1776 int32_t dataValue = data.ReadInt32();
1777 LockChangeType type = ParseLockChangeType(dataValue);
1778 if (type == LockChangeType::INVALID_PARAMETER) {
1779 return ERR_APPEXECFWK_PARCEL_ERROR;
1780 }
1781
1782 int32_t result = LockForms(formLockInfo, type);
1783 if (!reply.WriteInt32(result)) {
1784 HILOG_ERROR("write result failed");
1785 return ERR_APPEXECFWK_PARCEL_ERROR;
1786 }
1787 return result;
1788 }
1789
HandleIsFormProtected(MessageParcel & data,MessageParcel & reply)1790 ErrCode FormMgrStub::HandleIsFormProtected(MessageParcel &data, MessageParcel &reply)
1791 {
1792 HILOG_DEBUG("call");
1793 std::string bundleName = data.ReadString();
1794 int64_t formId = data.ReadInt64();
1795 bool result = IsFormBundleProtected(bundleName, formId);
1796 if (!reply.WriteBool(result)) {
1797 HILOG_ERROR("write action failed");
1798 return ERR_APPEXECFWK_PARCEL_ERROR;
1799 }
1800 return ERR_OK;
1801 }
1802
HandleIsFormExempt(MessageParcel & data,MessageParcel & reply)1803 ErrCode FormMgrStub::HandleIsFormExempt(MessageParcel &data, MessageParcel &reply)
1804 {
1805 HILOG_DEBUG("call");
1806 int64_t formId = data.ReadInt64();
1807 bool result = IsFormBundleExempt(formId);
1808 if (!reply.WriteBool(result)) {
1809 HILOG_ERROR("write action failed");
1810 return ERR_APPEXECFWK_PARCEL_ERROR;
1811 }
1812 return ERR_OK;
1813 }
1814
HandleNotifyFormLocked(MessageParcel & data,MessageParcel & reply)1815 int32_t FormMgrStub::HandleNotifyFormLocked(MessageParcel &data, MessageParcel &reply)
1816 {
1817 HILOG_DEBUG("call");
1818 int64_t formId = data.ReadInt64();
1819 bool isLocked = data.ReadBool();
1820
1821 bool result = NotifyFormLocked(formId, isLocked);
1822 if (!reply.WriteBool(result)) {
1823 HILOG_ERROR("write action failed");
1824 return ERR_APPEXECFWK_PARCEL_ERROR;
1825 }
1826 return ERR_OK;
1827 }
1828
HandleUpdateFormSize(MessageParcel & data,MessageParcel & reply)1829 ErrCode FormMgrStub::HandleUpdateFormSize(MessageParcel &data, MessageParcel &reply)
1830 {
1831 HILOG_DEBUG("call");
1832 int64_t formId = data.ReadInt64();
1833 float width = data.ReadFloat();
1834 float height = data.ReadFloat();
1835 float borderWidth = data.ReadFloat();
1836 ErrCode result = UpdateFormSize(formId, width, height, borderWidth);
1837 if (!reply.WriteInt32(result)) {
1838 HILOG_ERROR("write result failed");
1839 return ERR_APPEXECFWK_PARCEL_ERROR;
1840 }
1841 return result;
1842 }
1843
HandleOpenFormEditAbility(MessageParcel & data,MessageParcel & reply)1844 ErrCode FormMgrStub::HandleOpenFormEditAbility(MessageParcel &data, MessageParcel &reply)
1845 {
1846 HILOG_DEBUG("call");
1847 std::string abilityName = data.ReadString();
1848 int64_t formId = data.ReadInt64();
1849 bool isMainPage = data.ReadBool();
1850 ErrCode result = OpenFormEditAbility(abilityName, formId, isMainPage);
1851 if (!reply.WriteInt32(result)) {
1852 HILOG_ERROR("write result failed");
1853 return ERR_APPEXECFWK_PARCEL_ERROR;
1854 }
1855 return result;
1856 }
1857
HandleRegisterOverflowProxy(MessageParcel & data,MessageParcel & reply)1858 ErrCode FormMgrStub::HandleRegisterOverflowProxy(MessageParcel &data, MessageParcel &reply)
1859 {
1860 HILOG_INFO("Handle save overflow proxy to service");
1861 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1862 bool result = RegisterOverflowProxy(callerToken);
1863 if (!reply.WriteBool(result)) {
1864 HILOG_ERROR("Write result failed");
1865 return ERR_APPEXECFWK_PARCEL_ERROR;
1866 }
1867 return ERR_OK;
1868 }
1869
HandleUnregisterOverflowProxy(MessageParcel & data,MessageParcel & reply)1870 ErrCode FormMgrStub::HandleUnregisterOverflowProxy(MessageParcel &data, MessageParcel &reply)
1871 {
1872 HILOG_INFO("call");
1873 bool result = UnregisterOverflowProxy();
1874 if (!reply.WriteBool(result)) {
1875 HILOG_ERROR("write proxy failed");
1876 return ERR_APPEXECFWK_PARCEL_ERROR;
1877 }
1878 return ERR_OK;
1879 }
1880
HandleRequestOverflow(MessageParcel & data,MessageParcel & reply)1881 ErrCode FormMgrStub::HandleRequestOverflow(MessageParcel &data, MessageParcel &reply)
1882 {
1883 HILOG_INFO("Call");
1884 int64_t formId = data.ReadInt64();
1885 OverflowInfo* overflowInfoPtr = data.ReadParcelable<OverflowInfo>();
1886 if (overflowInfoPtr == nullptr) {
1887 HILOG_ERROR("Read oveflowInfo failed");
1888 return ERR_APPEXECFWK_PARCEL_ERROR;
1889 }
1890 bool isOverflow = data.ReadBool();
1891 ErrCode result = RequestOverflow(formId, *overflowInfoPtr, isOverflow);
1892 if (!reply.WriteInt32(result)) {
1893 HILOG_ERROR("Write request result failed");
1894 delete overflowInfoPtr;
1895 return ERR_APPEXECFWK_PARCEL_ERROR;
1896 }
1897 delete overflowInfoPtr;
1898 return ERR_OK;
1899 }
1900
HandleRegisterChangeSceneAnimationStateProxy(MessageParcel & data,MessageParcel & reply)1901 ErrCode FormMgrStub::HandleRegisterChangeSceneAnimationStateProxy(MessageParcel &data, MessageParcel &reply)
1902 {
1903 HILOG_INFO("call");
1904 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1905 bool result = RegisterChangeSceneAnimationStateProxy(callerToken);
1906 if (!reply.WriteBool(result)) {
1907 HILOG_ERROR("write result failed");
1908 return ERR_APPEXECFWK_PARCEL_ERROR;
1909 }
1910 return ERR_OK;
1911 }
1912
HandleUnregisterChangeSceneAnimationStateProxy(MessageParcel & data,MessageParcel & reply)1913 ErrCode FormMgrStub::HandleUnregisterChangeSceneAnimationStateProxy(MessageParcel &data, MessageParcel &reply)
1914 {
1915 HILOG_INFO("call");
1916 bool result = UnregisterChangeSceneAnimationStateProxy();
1917 if (!reply.WriteBool(result)) {
1918 HILOG_ERROR("write result failed");
1919 return ERR_APPEXECFWK_PARCEL_ERROR;
1920 }
1921 return ERR_OK;
1922 }
1923
HandleChangeSceneAnimationState(MessageParcel & data,MessageParcel & reply)1924 ErrCode FormMgrStub::HandleChangeSceneAnimationState(MessageParcel &data, MessageParcel &reply)
1925 {
1926 HILOG_INFO("Call");
1927 int64_t formId = data.ReadInt64();
1928 int32_t state = data.ReadInt32();
1929 ErrCode result = ChangeSceneAnimationState(formId, state);
1930 if (!reply.WriteInt32(result)) {
1931 HILOG_ERROR("write result failed");
1932 return ERR_APPEXECFWK_PARCEL_ERROR;
1933 }
1934 return ERR_OK;
1935 }
1936
HandleRegisterGetFormRectProxy(MessageParcel & data,MessageParcel & reply)1937 ErrCode FormMgrStub::HandleRegisterGetFormRectProxy(MessageParcel &data, MessageParcel &reply)
1938 {
1939 HILOG_DEBUG("handle save query proxy to service");
1940 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
1941 bool result = RegisterGetFormRectProxy(callerToken);
1942 if (!reply.WriteBool(result)) {
1943 HILOG_ERROR("write proxy failed");
1944 return ERR_APPEXECFWK_PARCEL_ERROR;
1945 }
1946 return ERR_OK;
1947 }
1948
HandleUnregisterGetFormRectProxy(MessageParcel & data,MessageParcel & reply)1949 ErrCode FormMgrStub::HandleUnregisterGetFormRectProxy(MessageParcel &data, MessageParcel &reply)
1950 {
1951 HILOG_INFO("call");
1952 bool result = UnregisterGetFormRectProxy();
1953 if (!reply.WriteBool(result)) {
1954 HILOG_ERROR("write result failed");
1955 return ERR_APPEXECFWK_PARCEL_ERROR;
1956 }
1957 return ERR_OK;
1958 }
1959
HandleGetFormRect(MessageParcel & data,MessageParcel & reply)1960 ErrCode FormMgrStub::HandleGetFormRect(MessageParcel &data, MessageParcel &reply)
1961 {
1962 int64_t formId = data.ReadInt64();
1963
1964 Rect item;
1965 ErrCode result = GetFormRect(formId, item);
1966 if (!reply.WriteInt32(result)) {
1967 HILOG_ERROR("write get form result result failed");
1968 return ERR_APPEXECFWK_PARCEL_ERROR;
1969 }
1970 if (result == ERR_OK) {
1971 if (!reply.WriteParcelable(&item)) {
1972 HILOG_ERROR("write form rect failed");
1973 return ERR_APPEXECFWK_PARCEL_ERROR;
1974 }
1975 }
1976 return result;
1977 }
1978
HandleNotifyUpdateFormSize(MessageParcel & data,MessageParcel & reply)1979 ErrCode FormMgrStub::HandleNotifyUpdateFormSize(MessageParcel &data, MessageParcel &reply)
1980 {
1981 HILOG_INFO("Call");
1982 int64_t formId = data.ReadInt64();
1983 int32_t newDimension = data.ReadInt32();
1984 std::unique_ptr<Rect> newRect(data.ReadParcelable<Rect>());
1985 if (newRect == nullptr) {
1986 HILOG_ERROR("Read newRect failed");
1987 return ERR_APPEXECFWK_PARCEL_ERROR;
1988 }
1989 ErrCode result = UpdateFormSize(formId, newDimension, *newRect);
1990 if (!reply.WriteInt32(result)) {
1991 HILOG_ERROR("Write request result failed");
1992 return ERR_APPEXECFWK_PARCEL_ERROR;
1993 }
1994 return ERR_OK;
1995 }
1996
HandleRegisterGetLiveFormStatusProxy(MessageParcel & data,MessageParcel & reply)1997 ErrCode FormMgrStub::HandleRegisterGetLiveFormStatusProxy(MessageParcel &data, MessageParcel &reply)
1998 {
1999 HILOG_DEBUG("handle save query proxy to service");
2000 sptr<IRemoteObject> callerToken = data.ReadRemoteObject();
2001 bool result = RegisterGetLiveFormStatusProxy(callerToken);
2002 if (!reply.WriteBool(result)) {
2003 HILOG_ERROR("write proxy failed");
2004 return ERR_APPEXECFWK_PARCEL_ERROR;
2005 }
2006 return ERR_OK;
2007 }
2008
HandleUnregisterGetLiveFormStatusProxy(MessageParcel & data,MessageParcel & reply)2009 ErrCode FormMgrStub::HandleUnregisterGetLiveFormStatusProxy(MessageParcel &data, MessageParcel &reply)
2010 {
2011 HILOG_INFO("call");
2012 bool result = UnregisterGetLiveFormStatusProxy();
2013 if (!reply.WriteBool(result)) {
2014 HILOG_ERROR("write result failed");
2015 return ERR_APPEXECFWK_PARCEL_ERROR;
2016 }
2017 return ERR_OK;
2018 }
2019 } // namespace AppExecFwk
2020 } // namespace OHOS