• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 "datashare_errno.h"
17 #define LOG_TAG "DataShareServiceStub"
18 
19 #include "data_share_service_stub.h"
20 
21 #include <cinttypes>
22 #include "common_utils.h"
23 #include "data_share_obs_proxy.h"
24 #include "hiview_adapter.h"
25 #include "hiview_fault_adapter.h"
26 #include "ipc_skeleton.h"
27 #include "ishared_result_set.h"
28 #include "itypes_util.h"
29 #include "log_print.h"
30 #include "qos.h"
31 #include "utils.h"
32 #include "utils/anonymous.h"
33 #include "dataproxy_handle_common.h"
34 
35 namespace OHOS {
36 namespace DataShare {
37 
38 class DataShareServiceStub::QosManager {
39 public:
QosManager()40     QosManager()
41     {
42 #ifndef IS_EMULATOR
43         // set thread qos QOS_USER_INTERACTIVE
44         QOS::SetThreadQos(QOS::QosLevel::QOS_USER_INTERACTIVE);
45 #endif
46     }
~QosManager()47     ~QosManager()
48     {
49 #ifndef IS_EMULATOR
50         QOS::ResetThreadQos();
51 #endif
52     }
53 };
54 
CheckInterfaceToken(MessageParcel & data)55 bool DataShareServiceStub::CheckInterfaceToken(MessageParcel &data)
56 {
57     auto localDescriptor = IDataShareService::GetDescriptor();
58     auto remoteDescriptor = data.ReadInterfaceToken();
59     if (remoteDescriptor != localDescriptor) {
60         ZLOGE("interface token is not equal");
61         return false;
62     }
63     return true;
64 }
65 
OnInsertEx(MessageParcel & data,MessageParcel & reply)66 int32_t DataShareServiceStub::OnInsertEx(MessageParcel &data, MessageParcel &reply)
67 {
68     std::string uri;
69     std::string extUri;
70     DataShareValuesBucket bucket;
71     if (!ITypesUtil::Unmarshal(data, uri, extUri, bucket.valuesMap)) {
72         ZLOGE("Unmarshal uri:%{public}s bucket size:%{public}zu", URIUtils::Anonymous(uri).c_str(),
73             bucket.valuesMap.size());
74         return IPC_STUB_INVALID_DATA_ERR;
75     }
76     auto [errCode, status] = InsertEx(uri, extUri, bucket);
77     ZLOGI("Insert uri:%{public}s, e:%{public}x, s:%{public}x",
78         URIUtils::Anonymous(uri).c_str(), errCode, status);
79     if (!ITypesUtil::Marshal(reply, errCode, status)) {
80         ZLOGE("Marshal errCode: 0x%{public}x, status: 0x%{public}x", errCode, status);
81         return IPC_STUB_WRITE_PARCEL_ERR;
82     }
83     return 0;
84 }
85 
OnUpdateEx(MessageParcel & data,MessageParcel & reply)86 int32_t DataShareServiceStub::OnUpdateEx(MessageParcel &data, MessageParcel &reply)
87 {
88     std::string uri;
89     std::string extUri;
90     DataSharePredicates predicate;
91     DataShareValuesBucket bucket;
92     if (!ITypesUtil::Unmarshal(data, uri, extUri, predicate, bucket.valuesMap)) {
93         ZLOGE("Unmarshal uri:%{public}s bucket size:%{public}zu", URIUtils::Anonymous(uri).c_str(),
94             bucket.valuesMap.size());
95         return IPC_STUB_INVALID_DATA_ERR;
96     }
97     auto [errCode, status] = UpdateEx(uri, extUri, predicate, bucket);
98     ZLOGI("Update uri:%{public}s, e:%{public}x, s:%{public}x",
99         URIUtils::Anonymous(uri).c_str(), errCode, status);
100     if (!ITypesUtil::Marshal(reply, errCode, status)) {
101         ZLOGE("Marshal errCode: 0x%{public}x, status: 0x%{public}x", errCode, status);
102         return IPC_STUB_WRITE_PARCEL_ERR;
103     }
104     return 0;
105 }
106 
OnDeleteEx(MessageParcel & data,MessageParcel & reply)107 int32_t DataShareServiceStub::OnDeleteEx(MessageParcel &data, MessageParcel &reply)
108 {
109     std::string uri;
110     std::string extUri;
111     DataSharePredicates predicate;
112     if (!ITypesUtil::Unmarshal(data, uri, extUri, predicate)) {
113         ZLOGE("Unmarshal uri:%{public}s", URIUtils::Anonymous(uri).c_str());
114         return IPC_STUB_INVALID_DATA_ERR;
115     }
116     auto [errCode, status] = DeleteEx(uri, extUri, predicate);
117     ZLOGI("Delete uri:%{public}s, e:%{public}x, s:%{public}x",
118         URIUtils::Anonymous(uri).c_str(), errCode, status);
119     if (!ITypesUtil::Marshal(reply, errCode, status)) {
120         ZLOGE("Marshal errCode: 0x%{public}x, status: 0x%{public}x", errCode, status);
121         return IPC_STUB_WRITE_PARCEL_ERR;
122     }
123     return 0;
124 }
125 
OnQuery(MessageParcel & data,MessageParcel & reply)126 int32_t DataShareServiceStub::OnQuery(MessageParcel &data, MessageParcel &reply)
127 {
128     std::string uri;
129     std::string extUri;
130     DataSharePredicates predicate;
131     std::vector<std::string> columns;
132     if (!ITypesUtil::Unmarshal(data, uri, extUri, predicate, columns)) {
133         ZLOGE("Unmarshal uri:%{public}s columns size:%{public}zu", URIUtils::Anonymous(uri).c_str(),
134             columns.size());
135         return IPC_STUB_INVALID_DATA_ERR;
136     }
137     int status = 0;
138     auto result = ISharedResultSet::WriteToParcel(Query(uri, extUri, predicate, columns, status), reply);
139     if (!ITypesUtil::Marshal(reply, status)) {
140         ZLOGE("Marshal status:0x%{public}x", status);
141         return IPC_STUB_WRITE_PARCEL_ERR;
142     }
143     return 0;
144 }
145 
OnAddTemplate(MessageParcel & data,MessageParcel & reply)146 int32_t DataShareServiceStub::OnAddTemplate(MessageParcel &data, MessageParcel &reply)
147 {
148     std::string uri;
149     int64_t subscriberId;
150     Template tpl;
151     if (!ITypesUtil::Unmarshal(data, uri, subscriberId, tpl.update_, tpl.predicates_,  tpl.scheduler_)) {
152         ZLOGW("read device list failed.");
153         return -1;
154     }
155     int32_t status = AddTemplate(uri, subscriberId, tpl);
156     if (!ITypesUtil::Marshal(reply, status)) {
157         ZLOGE("Marshal status:0x%{public}x", status);
158         return IPC_STUB_WRITE_PARCEL_ERR;
159     }
160     return 0;
161 }
162 
OnDelTemplate(MessageParcel & data,MessageParcel & reply)163 int32_t DataShareServiceStub::OnDelTemplate(MessageParcel &data, MessageParcel &reply)
164 {
165     std::string uri;
166     int64_t subscriberId;
167     if (!ITypesUtil::Unmarshal(data, uri, subscriberId)) {
168         ZLOGW("read device list failed.");
169         return -1;
170     }
171     int32_t status = DelTemplate(uri, subscriberId);
172     if (!ITypesUtil::Marshal(reply, status)) {
173         ZLOGE("Marshal status:0x%{public}x", status);
174         return IPC_STUB_WRITE_PARCEL_ERR;
175     }
176     return 0;
177 }
178 
OnPublish(MessageParcel & data,MessageParcel & reply)179 int32_t DataShareServiceStub::OnPublish(MessageParcel &data, MessageParcel &reply)
180 {
181     Data publishData;
182     std::string bundleName;
183     if (!ITypesUtil::Unmarshal(data, publishData.datas_, publishData.version_, bundleName)) {
184         ZLOGW("read device list failed.");
185         return -1;
186     }
187     std::vector<OperationResult> results = Publish(publishData, bundleName);
188     if (!ITypesUtil::Marshal(reply, results)) {
189         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
190         return -1;
191     }
192     return 0;
193 }
194 
OnGetData(MessageParcel & data,MessageParcel & reply)195 int32_t DataShareServiceStub::OnGetData(MessageParcel &data, MessageParcel &reply)
196 {
197     std::string bundleName;
198     if (!ITypesUtil::Unmarshal(data, bundleName)) {
199         ZLOGW("read device list failed.");
200         return -1;
201     }
202     ZLOGI("bundleName is %{public}s", bundleName.c_str());
203     int errorCode = E_OK;
204     auto results = GetData(bundleName, errorCode);
205     if (!ITypesUtil::Marshal(reply, results.datas_, errorCode)) {
206         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
207         return -1;
208     }
209     return 0;
210 }
211 
OnSubscribeRdbData(MessageParcel & data,MessageParcel & reply)212 int32_t DataShareServiceStub::OnSubscribeRdbData(MessageParcel &data, MessageParcel &reply)
213 {
214     std::vector<std::string> uris;
215     TemplateId templateId;
216     if (!ITypesUtil::Unmarshal(data, uris, templateId)) {
217         ZLOGE("read device list failed.");
218         return -1;
219     }
220     auto remoteObj = data.ReadRemoteObject();
221     sptr<IDataProxyRdbObserver> observer = new (std::nothrow)RdbObserverProxy(remoteObj);
222     if (observer == nullptr) {
223         ZLOGE("obServer is nullptr");
224         return -1;
225     }
226     std::vector<OperationResult> results = SubscribeRdbData(uris, templateId, observer);
227     if (!ITypesUtil::Marshal(reply, results)) {
228         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
229         return -1;
230     }
231     return 0;
232 }
233 
OnUnsubscribeRdbData(MessageParcel & data,MessageParcel & reply)234 int32_t DataShareServiceStub::OnUnsubscribeRdbData(MessageParcel &data, MessageParcel &reply)
235 {
236     std::vector<std::string> uris;
237     TemplateId templateId;
238     if (!ITypesUtil::Unmarshal(data, uris, templateId)) {
239         ZLOGE("read device list failed.");
240         return -1;
241     }
242     std::vector<OperationResult> results = UnsubscribeRdbData(uris, templateId);
243     if (!ITypesUtil::Marshal(reply, results)) {
244         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
245         return -1;
246     }
247     return 0;
248 }
249 
OnEnableRdbSubs(MessageParcel & data,MessageParcel & reply)250 int32_t DataShareServiceStub::OnEnableRdbSubs(MessageParcel &data, MessageParcel &reply)
251 {
252     std::vector<std::string> uris;
253     TemplateId templateId;
254     if (!ITypesUtil::Unmarshal(data, uris, templateId)) {
255         ZLOGE("read device list failed.");
256         return -1;
257     }
258     std::vector<OperationResult> results = EnableRdbSubs(uris, templateId);
259     if (!ITypesUtil::Marshal(reply, results)) {
260         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
261         return -1;
262     }
263     return 0;
264 }
265 
OnDisableRdbSubs(MessageParcel & data,MessageParcel & reply)266 int32_t DataShareServiceStub::OnDisableRdbSubs(MessageParcel &data, MessageParcel &reply)
267 {
268     std::vector<std::string> uris;
269     TemplateId templateId;
270     if (!ITypesUtil::Unmarshal(data, uris, templateId)) {
271         ZLOGE("read device list failed.");
272         return -1;
273     }
274     std::vector<OperationResult> results = DisableRdbSubs(uris, templateId);
275     if (!ITypesUtil::Marshal(reply, results)) {
276         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
277         return -1;
278     }
279     return 0;
280 }
281 
OnSubscribePublishedData(MessageParcel & data,MessageParcel & reply)282 int32_t DataShareServiceStub::OnSubscribePublishedData(MessageParcel &data, MessageParcel &reply)
283 {
284     std::vector<std::string> uris;
285     int64_t subscriberId;
286     if (!ITypesUtil::Unmarshal(data, uris, subscriberId)) {
287         ZLOGE("read device list failed.");
288         return -1;
289     }
290     sptr<PublishedDataObserverProxy> observer = new (std::nothrow)PublishedDataObserverProxy(data.ReadRemoteObject());
291     if (observer == nullptr) {
292         ZLOGE("obServer is nullptr");
293         return -1;
294     }
295     std::vector<OperationResult> results = SubscribePublishedData(uris, subscriberId, observer);
296     if (!ITypesUtil::Marshal(reply, results)) {
297         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
298         return -1;
299     }
300     return 0;
301 }
302 
OnUnsubscribePublishedData(MessageParcel & data,MessageParcel & reply)303 int32_t DataShareServiceStub::OnUnsubscribePublishedData(MessageParcel &data, MessageParcel &reply)
304 {
305     std::vector<std::string> uris;
306     int64_t subscriberId;
307     if (!ITypesUtil::Unmarshal(data, uris, subscriberId)) {
308         ZLOGE("read device list failed.");
309         return -1;
310     }
311     std::vector<OperationResult> results = UnsubscribePublishedData(uris, subscriberId);
312     if (!ITypesUtil::Marshal(reply, results)) {
313         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
314         return -1;
315     }
316     return 0;
317 }
318 
OnEnablePubSubs(MessageParcel & data,MessageParcel & reply)319 int32_t DataShareServiceStub::OnEnablePubSubs(MessageParcel &data, MessageParcel &reply)
320 {
321     std::vector<std::string> uris;
322     int64_t subscriberId;
323     if (!ITypesUtil::Unmarshal(data, uris, subscriberId)) {
324         ZLOGE("read device list failed.");
325         return -1;
326     }
327     std::vector<OperationResult> results = EnablePubSubs(uris, subscriberId);
328     if (!ITypesUtil::Marshal(reply, results)) {
329         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
330         return -1;
331     }
332     return 0;
333 }
334 
OnDisablePubSubs(MessageParcel & data,MessageParcel & reply)335 int32_t DataShareServiceStub::OnDisablePubSubs(MessageParcel &data, MessageParcel &reply)
336 {
337     std::vector<std::string> uris;
338     int64_t subscriberId;
339     if (!ITypesUtil::Unmarshal(data, uris, subscriberId)) {
340         ZLOGE("read device list failed.");
341         return -1;
342     }
343     std::vector<OperationResult> results = DisablePubSubs(uris, subscriberId);
344     if (!ITypesUtil::Marshal(reply, results)) {
345         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
346         return -1;
347     }
348     return 0;
349 }
350 
OnNotifyConnectDone(MessageParcel & data,MessageParcel & reply)351 int32_t DataShareServiceStub::OnNotifyConnectDone(MessageParcel &data, MessageParcel &reply)
352 {
353     OnConnectDone();
354     return 0;
355 }
356 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply)357 int DataShareServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply)
358 {
359     // set thread qos
360     DataShareServiceStub::QosManager qos;
361 
362     int tryTimes = TRY_TIMES;
363     while (!isReady_.load() && tryTimes > 0) {
364         tryTimes--;
365         std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME));
366     }
367     auto callingPid = IPCSkeleton::GetCallingPid();
368     auto fullTokenId = IPCSkeleton::GetCallingFullTokenID();
369     bool isSystemApp = CheckSystemCallingPermission(IPCSkeleton::GetCallingTokenID(), fullTokenId);
370     DataShareThreadLocal::SetFromSystemApp(isSystemApp);
371     if (code >= DATA_SHARE_CMD_SYSTEM_CODE) {
372         if (!isSystemApp) {
373             ZLOGE("CheckSystemCallingPermission fail, token:%{public}" PRIx64
374                 ", callingPid:%{public}d, code:%{public}u", fullTokenId, callingPid, code);
375             return E_NOT_SYSTEM_APP;
376         }
377         code = code - DATA_SHARE_CMD_SYSTEM_CODE;
378     }
379     if (code != DATA_SHARE_SERVICE_CMD_QUERY && code != DATA_SHARE_SERVICE_CMD_GET_SILENT_PROXY_STATUS) {
380         ZLOGI("code:%{public}u, callingPid:%{public}d", code, callingPid);
381     }
382     if (!CheckInterfaceToken(data)) {
383         DataShareThreadLocal::CleanFromSystemApp();
384         return DATA_SHARE_ERROR;
385     }
386     int res = -1;
387     if (code < DATA_SHARE_SERVICE_CMD_MAX) {
388         auto callingTokenid = IPCSkeleton::GetCallingTokenID();
389         auto start = std::chrono::steady_clock::now();
390         res = (this->*HANDLERS[code])(data, reply);
391         auto finish = std::chrono::steady_clock::now();
392         auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(finish - start);
393         CallerInfo callerInfo(callingTokenid, IPCSkeleton::GetCallingUid(), callingPid, duration.count(), code);
394         if (duration >= TIME_THRESHOLD) {
395             int64_t milliseconds = duration.count();
396             ZLOGW("over time, code:%{public}u callingPid:%{public}d, cost:%{public}" PRIi64 "ms",
397                 code, callingPid, milliseconds);
398             callerInfo.isSlowRequest = true;
399         }
400         HiViewAdapter::GetInstance().ReportDataStatistic(callerInfo);
401     }
402     DataShareThreadLocal::CleanFromSystemApp();
403     return res;
404 }
405 
OnNotifyObserver(MessageParcel & data,MessageParcel & reply)406 int32_t DataShareServiceStub::OnNotifyObserver(MessageParcel &data, MessageParcel &reply)
407 {
408     std::string uri;
409     if (!ITypesUtil::Unmarshal(data, uri)) {
410         ZLOGE("read device list failed.");
411         return -1;
412     }
413     NotifyObserver(uri);
414     return 0;
415 }
416 
OnSetSilentSwitch(MessageParcel & data,MessageParcel & reply)417 int32_t DataShareServiceStub::OnSetSilentSwitch(MessageParcel &data, MessageParcel &reply)
418 {
419     std::string uri;
420     bool enable = false;
421     if (!ITypesUtil::Unmarshal(data, uri, enable)) {
422         ZLOGE("Unmarshal set silent switch failed. uri: %{public}s", URIUtils::Anonymous(uri).c_str());
423         return IPC_STUB_INVALID_DATA_ERR;
424     }
425     int32_t status = EnableSilentProxy(uri, enable);
426     if (!ITypesUtil::Marshal(reply, status)) {
427         ZLOGE("Marshal status:0x%{public}x", status);
428         return IPC_STUB_WRITE_PARCEL_ERR;
429     }
430     return E_OK;
431 }
432 
OnGetSilentProxyStatus(MessageParcel & data,MessageParcel & reply)433 int32_t DataShareServiceStub::OnGetSilentProxyStatus(MessageParcel &data, MessageParcel &reply)
434 {
435     std::string uri;
436     if (!ITypesUtil::Unmarshal(data, uri)) {
437         ZLOGE("Unmarshal silent enable failed. uri: %{public}s", URIUtils::Anonymous(uri).c_str());
438         return IPC_STUB_INVALID_DATA_ERR;
439     }
440     int32_t enable = GetSilentProxyStatus(uri);
441     if (!ITypesUtil::Marshal(reply, enable)) {
442         ZLOGE("Marshal enable:%{public}d failed.", enable);
443         return IPC_STUB_WRITE_PARCEL_ERR;
444     }
445     return E_OK;
446 }
447 
OnRegisterObserver(MessageParcel & data,MessageParcel & reply)448 int32_t DataShareServiceStub::OnRegisterObserver(MessageParcel &data, MessageParcel &reply)
449 {
450     return DATA_SHARE_ERROR;
451 }
452 
OnUnregisterObserver(MessageParcel & data,MessageParcel & reply)453 int32_t DataShareServiceStub::OnUnregisterObserver(MessageParcel &data, MessageParcel &reply)
454 {
455     return DATA_SHARE_ERROR;
456 }
457 
SetServiceReady()458 void DataShareServiceStub::SetServiceReady()
459 {
460     isReady_.store(true);
461 }
462 
OnPublishProxyData(MessageParcel & data,MessageParcel & reply)463 int32_t DataShareServiceStub::OnPublishProxyData(MessageParcel& data, MessageParcel& reply)
464 {
465     std::vector<DataShareProxyData> proxyDatas;
466     DataProxyConfig config;
467     if (!ITypesUtil::Unmarshal(data, proxyDatas, config)) {
468         ZLOGE("OnPublishProxyData unmarshal failed");
469         return IPC_STUB_INVALID_DATA_ERR;
470     }
471     std::vector<DataProxyResult> results = PublishProxyData(proxyDatas, config);
472     if (!ITypesUtil::Marshal(reply, results)) {
473         ZLOGE("OnPublishProxyData marshal reply failed.");
474         return IPC_STUB_WRITE_PARCEL_ERR;
475     }
476     return E_OK;
477 }
478 
OnDeleteProxyData(MessageParcel & data,MessageParcel & reply)479 int32_t DataShareServiceStub::OnDeleteProxyData(MessageParcel& data, MessageParcel& reply)
480 {
481     std::vector<std::string> uris;
482     DataProxyConfig config;
483     if (!ITypesUtil::Unmarshal(data, uris, config)) {
484         ZLOGE("unmarshal failed");
485         return IPC_STUB_INVALID_DATA_ERR;
486     }
487     std::vector<DataProxyResult> results = DeleteProxyData(uris, config);
488     if (!ITypesUtil::Marshal(reply, results)) {
489         ZLOGE("OnPublishProxyData marshal reply failed.");
490         return IPC_STUB_WRITE_PARCEL_ERR;
491     }
492     return E_OK;
493 }
494 
OnGetProxyData(MessageParcel & data,MessageParcel & reply)495 int32_t DataShareServiceStub::OnGetProxyData(MessageParcel& data, MessageParcel& reply)
496 {
497     std::vector<std::string> uris;
498     DataProxyConfig config;
499     if (!ITypesUtil::Unmarshal(data, uris, config)) {
500         ZLOGE("unmarshal failed");
501         return IPC_STUB_INVALID_DATA_ERR;
502     }
503     std::vector<DataProxyGetResult> results = GetProxyData(uris, config);
504     if (!ITypesUtil::Marshal(reply, results)) {
505         ZLOGE("OnPublishProxyData marshal reply failed.");
506         return IPC_STUB_WRITE_PARCEL_ERR;
507     }
508     return E_OK;
509 }
510 
OnSubscribeProxyData(MessageParcel & data,MessageParcel & reply)511 int32_t DataShareServiceStub::OnSubscribeProxyData(MessageParcel& data, MessageParcel& reply)
512 {
513     std::vector<std::string> uris;
514     DataProxyConfig config;
515     if (!ITypesUtil::Unmarshal(data, uris)) {
516         ZLOGE("unmarshal failed");
517         return IPC_STUB_INVALID_DATA_ERR;
518     }
519     auto remoteObj = data.ReadRemoteObject();
520     sptr<IProxyDataObserver> observer = new (std::nothrow)ProxyDataObserverProxy(remoteObj);
521     if (observer == nullptr) {
522         ZLOGE("observer is nullptr");
523         return DATA_SHARE_ERROR;
524     }
525     std::vector<DataProxyResult> results = SubscribeProxyData(uris, config, observer);
526     if (!ITypesUtil::Marshal(reply, results)) {
527         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
528         return IPC_STUB_WRITE_PARCEL_ERR;
529     }
530     return 0;
531 }
532 
OnUnsubscribeProxyData(MessageParcel & data,MessageParcel & reply)533 int32_t DataShareServiceStub::OnUnsubscribeProxyData(MessageParcel& data, MessageParcel& reply)
534 {
535     std::vector<std::string> uris;
536     DataProxyConfig config;
537     if (!ITypesUtil::Unmarshal(data, uris)) {
538         ZLOGE("unmarshal failed");
539         return IPC_STUB_INVALID_DATA_ERR;
540     }
541     std::vector<DataProxyResult> results = UnsubscribeProxyData(uris, config);
542     if (!ITypesUtil::Marshal(reply, results)) {
543         ZLOGE("ITypesUtil::Marshal(reply, results) failed");
544         return IPC_STUB_WRITE_PARCEL_ERR;
545     }
546     return 0;
547 }
548 } // namespace DataShare
549 } // namespace OHOS