• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #define LOG_TAG "RdbServiceStub"
17 
18 #include "rdb_service_stub.h"
19 
20 #include <ipc_skeleton.h>
21 
22 #include "itypes_util.h"
23 #include "log_print.h"
24 #include "rdb_result_set_stub.h"
25 #include "utils/anonymous.h"
26 
27 namespace OHOS::DistributedRdb {
28 using Anonymous = DistributedData::Anonymous;
OnRemoteObtainDistributedTableName(MessageParcel & data,MessageParcel & reply)29 int32_t RdbServiceStub::OnRemoteObtainDistributedTableName(MessageParcel &data, MessageParcel &reply)
30 {
31     RdbSyncerParam param;
32     std::string device;
33     std::string table;
34     if (!ITypesUtil::Unmarshal(data, param, device, table)) {
35         ZLOGE("Unmarshal device:%{public}s table:%{public}s", Anonymous::Change(device).c_str(), table.c_str());
36         return IPC_STUB_INVALID_DATA_ERR;
37     }
38 
39     std::string distributedTableName = ObtainDistributedTableName(param, device, table);
40     int32_t status = distributedTableName.empty() ? RDB_ERROR : RDB_OK;
41     if (!ITypesUtil::Marshal(reply, status, distributedTableName)) {
42         ZLOGE("Marshal distributedTableName:%{public}s", distributedTableName.c_str());
43         return IPC_STUB_WRITE_PARCEL_ERR;
44     }
45     return RDB_OK;
46 }
47 
OnBeforeOpen(MessageParcel & data,MessageParcel & reply)48 int32_t RdbServiceStub::OnBeforeOpen(MessageParcel &data, MessageParcel &reply)
49 {
50     RdbSyncerParam param;
51     if (!ITypesUtil::Unmarshal(data, param)) {
52         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
53             Anonymous::Change(param.storeName_).c_str());
54         return IPC_STUB_INVALID_DATA_ERR;
55     }
56     auto status = BeforeOpen(param);
57     if (!ITypesUtil::Marshal(reply, status, param)) {
58         ZLOGE("Marshal status:0x%{public}x", status);
59         return IPC_STUB_WRITE_PARCEL_ERR;
60     }
61     return RDB_OK;
62 }
63 
OnAfterOpen(MessageParcel & data,MessageParcel & reply)64 int32_t RdbServiceStub::OnAfterOpen(MessageParcel &data, MessageParcel &reply)
65 {
66     RdbSyncerParam param;
67     if (!ITypesUtil::Unmarshal(data, param)) {
68         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
69             Anonymous::Change(param.storeName_).c_str());
70         return IPC_STUB_INVALID_DATA_ERR;
71     }
72     auto status = AfterOpen(param);
73     if (!ITypesUtil::Marshal(reply, status)) {
74         ZLOGE("Marshal status:0x%{public}x", status);
75         return IPC_STUB_WRITE_PARCEL_ERR;
76     }
77     return RDB_OK;
78 }
79 
OnReportStatistic(MessageParcel & data,MessageParcel & reply)80 int32_t RdbServiceStub::OnReportStatistic(MessageParcel& data, MessageParcel& reply)
81 {
82     RdbSyncerParam param;
83     RdbStatEvent statEvent;
84     if (!ITypesUtil::Unmarshal(data, param, statEvent)) {
85         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
86             Anonymous::Change(param.storeName_).c_str());
87         return IPC_STUB_INVALID_DATA_ERR;
88     }
89     auto status = ReportStatistic(param, statEvent);
90     if (!ITypesUtil::Marshal(reply, status)) {
91         ZLOGE("Marshal status:0x%{public}x", status);
92         return IPC_STUB_WRITE_PARCEL_ERR;
93     }
94     return RDB_OK;
95 }
96 
OnDelete(MessageParcel & data,MessageParcel & reply)97 int32_t RdbServiceStub::OnDelete(MessageParcel &data, MessageParcel &reply)
98 {
99     RdbSyncerParam param;
100     if (!ITypesUtil::Unmarshal(data, param)) {
101         ZLOGE("Unmarshal storeName_:%{public}s", Anonymous::Change(param.storeName_).c_str());
102         return IPC_STUB_INVALID_DATA_ERR;
103     }
104     auto status = Delete(param);
105     if (!ITypesUtil::Marshal(reply, status)) {
106         ZLOGE("Marshal status:0x%{public}x", status);
107         return IPC_STUB_WRITE_PARCEL_ERR;
108     }
109     return RDB_OK;
110 }
111 
OnRemoteInitNotifier(MessageParcel & data,MessageParcel & reply)112 int32_t RdbServiceStub::OnRemoteInitNotifier(MessageParcel &data, MessageParcel &reply)
113 {
114     RdbSyncerParam param;
115     sptr<IRemoteObject> notifier;
116     if (!ITypesUtil::Unmarshal(data, param, notifier) || notifier == nullptr) {
117         ZLOGE("Unmarshal bundleName:%{public}s storeName_:%{public}s notifier is nullptr:%{public}d",
118             param.bundleName_.c_str(), Anonymous::Change(param.storeName_).c_str(), notifier == nullptr);
119         return IPC_STUB_INVALID_DATA_ERR;
120     }
121     auto status = InitNotifier(param, notifier);
122     if (!ITypesUtil::Marshal(reply, status)) {
123         ZLOGE("Marshal status:0x%{public}x", status);
124         return IPC_STUB_WRITE_PARCEL_ERR;
125     }
126     return RDB_OK;
127 }
128 
OnRemoteSetDistributedTables(MessageParcel & data,MessageParcel & reply)129 int32_t RdbServiceStub::OnRemoteSetDistributedTables(MessageParcel &data, MessageParcel &reply)
130 {
131     RdbSyncerParam param;
132     std::vector<std::string> tables;
133     std::vector<Reference> references;
134     int32_t type;
135     bool isRebuild;
136     if (!ITypesUtil::Unmarshal(data, param, tables, references, type, isRebuild)) {
137         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s tables size:%{public}zu type:%{public}d",
138             param.bundleName_.c_str(), Anonymous::Change(param.storeName_).c_str(), tables.size(), type);
139         return IPC_STUB_INVALID_DATA_ERR;
140     }
141 
142     auto status = SetDistributedTables(param, tables, references, isRebuild, type);
143     if (!ITypesUtil::Marshal(reply, status)) {
144         ZLOGE("Marshal status:0x%{public}x", status);
145         return IPC_STUB_WRITE_PARCEL_ERR;
146     }
147     return RDB_OK;
148 }
149 
OnRemoteDoSync(MessageParcel & data,MessageParcel & reply)150 int32_t RdbServiceStub::OnRemoteDoSync(MessageParcel &data, MessageParcel &reply)
151 {
152     RdbSyncerParam param;
153     Option option {};
154     PredicatesMemo predicates;
155     if (!ITypesUtil::Unmarshal(data, param, option, predicates)) {
156         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s tables:%{public}zu", param.bundleName_.c_str(),
157             Anonymous::Change(param.storeName_).c_str(), predicates.tables_.size());
158         return IPC_STUB_INVALID_DATA_ERR;
159     }
160 
161     Details result = {};
162     auto status = Sync(param, option, predicates, [&result](Details &&details) { result = std::move(details); });
163     if (!ITypesUtil::Marshal(reply, status, result)) {
164         ZLOGE("Marshal status:0x%{public}x result size:%{public}zu", status, result.size());
165         return IPC_STUB_WRITE_PARCEL_ERR;
166     }
167     return RDB_OK;
168 }
169 
OnRemoteDoAsync(MessageParcel & data,MessageParcel & reply)170 int32_t RdbServiceStub::OnRemoteDoAsync(MessageParcel &data, MessageParcel &reply)
171 {
172     RdbSyncerParam param;
173     Option option {};
174     PredicatesMemo predicates;
175     if (!ITypesUtil::Unmarshal(data, param, option, predicates)) {
176         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s seqNum:%{public}u table:%{public}s",
177             param.bundleName_.c_str(), Anonymous::Change(param.storeName_).c_str(), option.seqNum,
178             predicates.tables_.empty() ? "null" : predicates.tables_.begin()->c_str());
179         return IPC_STUB_INVALID_DATA_ERR;
180     }
181     auto status = Sync(param, option, predicates, nullptr);
182     if (!ITypesUtil::Marshal(reply, status)) {
183         ZLOGE("Marshal status:0x%{public}x", status);
184         return IPC_STUB_WRITE_PARCEL_ERR;
185     }
186     return RDB_OK;
187 }
188 
OnRemoteDoSubscribe(MessageParcel & data,MessageParcel & reply)189 int32_t RdbServiceStub::OnRemoteDoSubscribe(MessageParcel &data, MessageParcel &reply)
190 {
191     RdbSyncerParam param;
192     SubscribeOption option;
193     if (!ITypesUtil::Unmarshal(data, param, option)) {
194         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
195             Anonymous::Change(param.storeName_).c_str());
196         return IPC_STUB_INVALID_DATA_ERR;
197     }
198 
199     auto status = Subscribe(param, option, nullptr);
200     if (!ITypesUtil::Marshal(reply, status)) {
201         ZLOGE("Marshal status:0x%{public}x", status);
202         return IPC_STUB_WRITE_PARCEL_ERR;
203     }
204     return RDB_OK;
205 }
206 
OnRemoteDoUnSubscribe(MessageParcel & data,MessageParcel & reply)207 int32_t RdbServiceStub::OnRemoteDoUnSubscribe(MessageParcel &data, MessageParcel &reply)
208 {
209     RdbSyncerParam param;
210     SubscribeOption option;
211     if (!ITypesUtil::Unmarshal(data, param, option)) {
212         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
213             Anonymous::Change(param.storeName_).c_str());
214         return IPC_STUB_INVALID_DATA_ERR;
215     }
216 
217     auto status = UnSubscribe(param, option, nullptr);
218     if (!ITypesUtil::Marshal(reply, status)) {
219         ZLOGE("Marshal status:0x%{public}x", status);
220         return IPC_STUB_WRITE_PARCEL_ERR;
221     }
222     return RDB_OK;
223 }
224 
OnRemoteDoRemoteQuery(MessageParcel & data,MessageParcel & reply)225 int32_t RdbServiceStub::OnRemoteDoRemoteQuery(MessageParcel& data, MessageParcel& reply)
226 {
227     RdbSyncerParam param;
228     std::string device;
229     std::string sql;
230     std::vector<std::string> selectionArgs;
231     if (!ITypesUtil::Unmarshal(data, param, device, sql, selectionArgs)) {
232         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s device:%{public}s sql:%{public}s "
233             "selectionArgs size:%{public}zu", param.bundleName_.c_str(),
234             Anonymous::Change(param.storeName_).c_str(), Anonymous::Change(device).c_str(),
235             Anonymous::Change(sql).c_str(), selectionArgs.size());
236         return IPC_STUB_INVALID_DATA_ERR;
237     }
238 
239     auto [status, resultSet] = RemoteQuery(param, device, sql, selectionArgs);
240     sptr<RdbResultSetStub> object = new(std::nothrow) RdbResultSetStub(resultSet);
241     if (object == nullptr) {
242         ZLOGE("Failed to create RdbResultSetStub object.bundleName:%{public}s storeName:%{public}s",
243             param.bundleName_.c_str(), Anonymous::Change(param.storeName_).c_str());
244         return ERR_NULL_OBJECT;
245     }
246     if (!ITypesUtil::Marshal(reply, status, object->AsObject())) {
247         ZLOGE("Marshal status:0x%{public}x", status);
248         return IPC_STUB_WRITE_PARCEL_ERR;
249     }
250     return RDB_OK;
251 }
252 
CheckInterfaceToken(MessageParcel & data)253 bool RdbServiceStub::CheckInterfaceToken(MessageParcel& data)
254 {
255     auto localDescriptor = GetDescriptor();
256     auto remoteDescriptor = data.ReadInterfaceToken();
257     if (remoteDescriptor != localDescriptor) {
258         ZLOGE("interface token is not equal");
259         return false;
260     }
261     return true;
262 }
263 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply)264 int RdbServiceStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply)
265 {
266     ZLOGI("code:%{public}u, callingPid:%{public}d", code, IPCSkeleton::GetCallingPid());
267     if (!CheckInterfaceToken(data)) {
268         return RDB_ERROR;
269     }
270     if (code >= 0 && code < static_cast<uint32_t>(RdbServiceCode::RDB_SERVICE_CMD_MAX)) {
271         return (this->*HANDLERS[code])(data, reply);
272     }
273     return RDB_ERROR;
274 }
275 
OnRemoteRegisterDetailProgressObserver(MessageParcel & data,MessageParcel & reply)276 int32_t RdbServiceStub::OnRemoteRegisterDetailProgressObserver(MessageParcel& data, MessageParcel& reply)
277 {
278     RdbSyncerParam param;
279     if (!ITypesUtil::Unmarshal(data, param)) {
280         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
281             Anonymous::Change(param.storeName_).c_str());
282         return IPC_STUB_INVALID_DATA_ERR;
283     }
284 
285     auto status = RegisterAutoSyncCallback(param, nullptr);
286     if (!ITypesUtil::Marshal(reply, status)) {
287         ZLOGE("Marshal status:0x%{public}x", status);
288         return IPC_STUB_WRITE_PARCEL_ERR;
289     }
290     return RDB_OK;
291 }
292 
OnRemoteUnregisterDetailProgressObserver(MessageParcel & data,MessageParcel & reply)293 int32_t RdbServiceStub::OnRemoteUnregisterDetailProgressObserver(MessageParcel& data, MessageParcel& reply)
294 {
295     RdbSyncerParam param;
296     if (!ITypesUtil::Unmarshal(data, param)) {
297         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
298             Anonymous::Change(param.storeName_).c_str());
299         return IPC_STUB_INVALID_DATA_ERR;
300     }
301 
302     auto status = UnregisterAutoSyncCallback(param, nullptr);
303     if (!ITypesUtil::Marshal(reply, status)) {
304         ZLOGE("Marshal status:0x%{public}x", status);
305         return IPC_STUB_WRITE_PARCEL_ERR;
306     }
307     return RDB_OK;
308 }
309 
OnRemoteNotifyDataChange(MessageParcel & data,MessageParcel & reply)310 int32_t RdbServiceStub::OnRemoteNotifyDataChange(MessageParcel &data, MessageParcel &reply)
311 {
312     RdbSyncerParam param;
313     RdbChangedData rdbChangedData;
314     RdbNotifyConfig rdbNotifyConfig;
315     if (!ITypesUtil::Unmarshal(data, param, rdbChangedData, rdbNotifyConfig)) {
316         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s ", param.bundleName_.c_str(),
317               Anonymous::Change(param.storeName_).c_str());
318         return IPC_STUB_INVALID_DATA_ERR;
319     }
320 
321     auto status = NotifyDataChange(param, rdbChangedData, rdbNotifyConfig);
322     if (!ITypesUtil::Marshal(reply, status)) {
323         ZLOGE("Marshal status:0x%{public}x", status);
324         return IPC_STUB_WRITE_PARCEL_ERR;
325     }
326     return RDB_OK;
327 }
328 
OnRemoteSetSearchable(MessageParcel & data,MessageParcel & reply)329 int32_t RdbServiceStub::OnRemoteSetSearchable(MessageParcel &data, MessageParcel &reply)
330 {
331     RdbSyncerParam param;
332     bool isSearchable = true;
333     if (!ITypesUtil::Unmarshal(data, param, isSearchable)) {
334         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s ", param.bundleName_.c_str(),
335               Anonymous::Change(param.storeName_).c_str());
336         return IPC_STUB_INVALID_DATA_ERR;
337     }
338 
339     auto status = SetSearchable(param, isSearchable);
340     if (!ITypesUtil::Marshal(reply, status)) {
341         ZLOGE("Marshal status:0x%{public}x", status);
342         return IPC_STUB_WRITE_PARCEL_ERR;
343     }
344     return RDB_OK;
345 }
346 
OnRemoteQuerySharingResource(MessageParcel & data,MessageParcel & reply)347 int32_t RdbServiceStub::OnRemoteQuerySharingResource(MessageParcel& data, MessageParcel& reply)
348 {
349     RdbSyncerParam param;
350     PredicatesMemo predicates;
351     std::vector<std::string> columns;
352     if (!ITypesUtil::Unmarshal(data, param, predicates, columns)) {
353         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
354             Anonymous::Change(param.storeName_).c_str());
355         return IPC_STUB_INVALID_DATA_ERR;
356     }
357 
358     auto [status, resultSet] = QuerySharingResource(param, predicates, columns);
359     sptr<RdbResultSetStub> object = new(std::nothrow) RdbResultSetStub(resultSet);
360     if (object == nullptr) {
361         ZLOGE("Failed to create RdbResultSetStub object.bundleName:%{public}s storeName:%{public}s",
362             param.bundleName_.c_str(), Anonymous::Change(param.storeName_).c_str());
363         return ERR_NULL_OBJECT;
364     }
365     if (!ITypesUtil::Marshal(reply, status, object->AsObject())) {
366         ZLOGE("Marshal status:0x%{public}x", status);
367         return IPC_STUB_WRITE_PARCEL_ERR;
368     }
369     return RDB_OK;
370 }
371 
OnDisable(MessageParcel & data,MessageParcel & reply)372 int32_t RdbServiceStub::OnDisable(MessageParcel& data, MessageParcel& reply)
373 {
374     RdbSyncerParam param;
375     if (!ITypesUtil::Unmarshal(data, param)) {
376         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
377             Anonymous::Change(param.storeName_).c_str());
378         return IPC_STUB_INVALID_DATA_ERR;
379     }
380 
381     auto status = Disable(param);
382     if (!ITypesUtil::Marshal(reply, status)) {
383         ZLOGE("Marshal status:0x%{public}x", status);
384         return IPC_STUB_WRITE_PARCEL_ERR;
385     }
386     return RDB_OK;
387 }
388 
OnEnable(MessageParcel & data,MessageParcel & reply)389 int32_t RdbServiceStub::OnEnable(MessageParcel& data, MessageParcel& reply)
390 {
391     RdbSyncerParam param;
392     if (!ITypesUtil::Unmarshal(data, param)) {
393         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
394             Anonymous::Change(param.storeName_).c_str());
395         return IPC_STUB_INVALID_DATA_ERR;
396     }
397 
398     auto status = Enable(param);
399     if (!ITypesUtil::Marshal(reply, status)) {
400         ZLOGE("Marshal status:0x%{public}x", status);
401         return IPC_STUB_WRITE_PARCEL_ERR;
402     }
403     return RDB_OK;
404 }
405 
OnGetPassword(MessageParcel & data,MessageParcel & reply)406 int32_t RdbServiceStub::OnGetPassword(MessageParcel &data, MessageParcel &reply)
407 {
408     RdbSyncerParam param;
409     if (!ITypesUtil::Unmarshal(data, param)) {
410         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
411             Anonymous::Change(param.storeName_).c_str());
412         return IPC_STUB_INVALID_DATA_ERR;
413     }
414 
415     std::vector<std::vector<uint8_t>> keys;
416     auto status = GetPassword(param, keys);
417     if (!ITypesUtil::Marshal(reply, status, keys)) {
418         for (auto &key : keys) {
419             key.assign(key.size(), 0);
420         }
421         ZLOGE("Marshal status:0x%{public}x", status);
422         return IPC_STUB_WRITE_PARCEL_ERR;
423     }
424     for (auto &key : keys) {
425         key.assign(key.size(), 0);
426     }
427     return RDB_OK;
428 }
429 
OnLockCloudContainer(MessageParcel & data,MessageParcel & reply)430 int32_t RdbServiceStub::OnLockCloudContainer(MessageParcel &data, MessageParcel &reply)
431 {
432     RdbSyncerParam param;
433     uint32_t expiredTime = 0;
434     if (!ITypesUtil::Unmarshal(data, param, expiredTime)) {
435         ZLOGE("Unmarshal failed");
436         return IPC_STUB_INVALID_DATA_ERR;
437     }
438 
439     auto result = LockCloudContainer(param);
440     return ITypesUtil::Marshal(reply, result.first, result.second) ? RDB_OK : IPC_STUB_WRITE_PARCEL_ERR;
441 }
442 
OnUnlockCloudContainer(MessageParcel & data,MessageParcel & reply)443 int32_t RdbServiceStub::OnUnlockCloudContainer(MessageParcel &data, MessageParcel &reply)
444 {
445     RdbSyncerParam param;
446     if (!ITypesUtil::Unmarshal(data, param)) {
447         ZLOGE("Unmarshal failed");
448         return IPC_STUB_INVALID_DATA_ERR;
449     }
450 
451     auto status = UnlockCloudContainer(param);
452     if (!ITypesUtil::Marshal(reply, status)) {
453         ZLOGE("Marshal status:0x%{public}x", status);
454         return IPC_STUB_WRITE_PARCEL_ERR;
455     }
456     return RDB_OK;
457 }
458 
OnGetDebugInfo(MessageParcel & data,MessageParcel & reply)459 int32_t RdbServiceStub::OnGetDebugInfo(MessageParcel &data, MessageParcel &reply)
460 {
461     RdbSyncerParam param;
462     if (!ITypesUtil::Unmarshal(data, param)) {
463         ZLOGE("Unmarshal failed");
464         return IPC_STUB_INVALID_DATA_ERR;
465     }
466     std::map<std::string, RdbDebugInfo> debugInfo;
467     auto status = GetDebugInfo(param, debugInfo);
468     if (!ITypesUtil::Marshal(reply, status, debugInfo)) {
469         ZLOGE("Marshal status:0x%{public}x", status);
470         return IPC_STUB_WRITE_PARCEL_ERR;
471     }
472     return RDB_OK;
473 }
474 
OnGetDfxInfo(MessageParcel & data,MessageParcel & reply)475 int32_t RdbServiceStub::OnGetDfxInfo(MessageParcel &data, MessageParcel &reply)
476 {
477     RdbSyncerParam param;
478     if (!ITypesUtil::Unmarshal(data, param)) {
479         ZLOGE("Unmarshal failed");
480         return IPC_STUB_INVALID_DATA_ERR;
481     }
482     RdbDfxInfo dfxInfo;
483     auto status = GetDfxInfo(param, dfxInfo);
484     if (!ITypesUtil::Marshal(reply, status, dfxInfo)) {
485         ZLOGE("Marshal status:0x%{public}x", status);
486         return IPC_STUB_WRITE_PARCEL_ERR;
487     }
488     return RDB_OK;
489 }
490 
OnVerifyPromiseInfo(MessageParcel & data,MessageParcel & reply)491 int32_t RdbServiceStub::OnVerifyPromiseInfo(MessageParcel &data, MessageParcel &reply)
492 {
493     RdbSyncerParam param;
494     if (!ITypesUtil::Unmarshal(data, param)) {
495         ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(),
496             Anonymous::Change(param.storeName_).c_str());
497         return IPC_STUB_INVALID_DATA_ERR;
498     }
499     auto status = VerifyPromiseInfo(param);
500     if (!ITypesUtil::Marshal(reply, status)) {
501         ZLOGE("Marshal status:0x%{public}x", status);
502         return IPC_STUB_WRITE_PARCEL_ERR;
503     }
504     return RDB_OK;
505 }
506 } // namespace OHOS::DistributedRdb
507