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 #include "cloud_sync_service_proxy.h"
16
17 #include "cloud_download_uri_manager.h"
18 #include "cloud_file_sync_service_interface_code.h"
19
20 #include <sstream>
21
22 #include "dfs_error.h"
23 #include "iservice_registry.h"
24 #ifdef SUPPORT_MEDIA_LIBRARY
25 #include "media_file_uri.h"
26 #endif
27 #include "system_ability_definition.h"
28 #include "utils_log.h"
29
30 namespace OHOS::FileManagement::CloudSync {
31 using namespace std;
32
33 constexpr int LOAD_SA_TIMEOUT_MS = 4000;
34 static const int MAX_WRITE_DENTRY_FILE_SIZE = 500;
35
UnRegisterCallbackInner(const std::string & bundleName)36 int32_t CloudSyncServiceProxy::UnRegisterCallbackInner(const std::string &bundleName)
37 {
38 LOGI("Start UnRegisterCallbackInner");
39 MessageParcel data;
40 MessageParcel reply;
41 MessageOption option;
42
43 if (!data.WriteInterfaceToken(GetDescriptor())) {
44 LOGE("Failed to write interface token");
45 return E_BROKEN_IPC;
46 }
47
48 auto remote = Remote();
49 if (!remote) {
50 LOGE("remote is nullptr");
51 return E_BROKEN_IPC;
52 }
53
54 if (!data.WriteString(bundleName)) {
55 LOGE("Failed to send the bundle name");
56 return E_INVAL_ARG;
57 }
58
59 int32_t ret = remote->SendRequest(
60 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_UNREGISTER_CALLBACK), data, reply, option);
61 if (ret != E_OK) {
62 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
63 return E_BROKEN_IPC;
64 }
65 LOGI("UnRegisterCallbackInner Success");
66 return reply.ReadInt32();
67 }
68
RegisterCallbackInner(const sptr<IRemoteObject> & remoteObject,const std::string & bundleName)69 int32_t CloudSyncServiceProxy::RegisterCallbackInner(const sptr<IRemoteObject> &remoteObject,
70 const std::string &bundleName)
71 {
72 LOGI("Start RegisterCallbackInner");
73 MessageParcel data;
74 MessageParcel reply;
75 MessageOption option;
76
77 if (!remoteObject) {
78 LOGI("Empty callback stub");
79 return E_INVAL_ARG;
80 }
81
82 if (!data.WriteInterfaceToken(GetDescriptor())) {
83 LOGE("Failed to write interface token");
84 return E_BROKEN_IPC;
85 }
86
87 if (!data.WriteRemoteObject(remoteObject)) {
88 LOGE("Failed to send the callback stub");
89 return E_INVAL_ARG;
90 }
91
92 if (!data.WriteString(bundleName)) {
93 LOGE("Failed to send the bundle name");
94 return E_INVAL_ARG;
95 }
96
97 auto remote = Remote();
98 if (!remote) {
99 LOGE("remote is nullptr");
100 return E_BROKEN_IPC;
101 }
102 int32_t ret = remote->SendRequest(
103 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_REGISTER_CALLBACK), data, reply, option);
104 if (ret != E_OK) {
105 LOGE("Failed to send out the request, errno: %{public}d", ret);
106 return E_BROKEN_IPC;
107 }
108 LOGI("RegisterCallbackInner Success");
109 return reply.ReadInt32();
110 }
111
StartSyncInner(bool forceFlag,const std::string & bundleName)112 int32_t CloudSyncServiceProxy::StartSyncInner(bool forceFlag, const std::string &bundleName)
113 {
114 LOGI("Start Sync");
115 MessageParcel data;
116 MessageParcel reply;
117 MessageOption option;
118
119 if (!data.WriteInterfaceToken(GetDescriptor())) {
120 LOGE("Failed to write interface token");
121 return E_BROKEN_IPC;
122 }
123
124 if (!data.WriteBool(forceFlag)) {
125 LOGE("Failed to send the force flag");
126 return E_INVAL_ARG;
127 }
128
129 if (!data.WriteString(bundleName)) {
130 LOGE("Failed to send the bundle name");
131 return E_INVAL_ARG;
132 }
133
134 auto remote = Remote();
135 if (!remote) {
136 LOGE("remote is nullptr");
137 return E_BROKEN_IPC;
138 }
139 int32_t ret = remote->SendRequest(static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_START_SYNC),
140 data, reply, option);
141 if (ret != E_OK) {
142 LOGE("Failed to send out the request, errno: %{public}d", ret);
143 return E_BROKEN_IPC;
144 }
145 LOGI("StartSyncInner Success");
146 return reply.ReadInt32();
147 }
148
TriggerSyncInner(const std::string & bundleName,const int32_t & userId)149 int32_t CloudSyncServiceProxy::TriggerSyncInner(const std::string &bundleName, const int32_t &userId)
150 {
151 LOGI("Trigger Sync");
152 MessageParcel data;
153 MessageParcel reply;
154 MessageOption option;
155
156 if (!data.WriteInterfaceToken(GetDescriptor())) {
157 LOGE("Failed to write interface token");
158 return E_BROKEN_IPC;
159 }
160
161 if (!data.WriteString(bundleName)) {
162 LOGE("Failed to send the bundle name");
163 return E_INVAL_ARG;
164 }
165
166 if (!data.WriteInt32(userId)) {
167 LOGE("Failed to send the user id");
168 return E_INVAL_ARG;
169 }
170
171 auto remote = Remote();
172 if (!remote) {
173 LOGE("remote is nullptr");
174 return E_BROKEN_IPC;
175 }
176 int32_t ret = remote->SendRequest(
177 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_TRIGGER_SYNC), data, reply, option);
178 if (ret != E_OK) {
179 LOGE("Failed to send out the request, errno: %{public}d", ret);
180 return E_BROKEN_IPC;
181 }
182 LOGI("TriggerSyncInner Success");
183 return reply.ReadInt32();
184 }
185
GetSyncTimeInner(int64_t & syncTime,const std::string & bundleName)186 int32_t CloudSyncServiceProxy::GetSyncTimeInner(int64_t &syncTime, const std::string &bundleName)
187 {
188 LOGI("Start GetSyncTimeInner");
189 LOGI("Start Sync");
190 MessageParcel data;
191 MessageParcel reply;
192 MessageOption option;
193
194 if (!data.WriteInterfaceToken(GetDescriptor())) {
195 LOGE("Failed to write interface token");
196 return E_BROKEN_IPC;
197 }
198
199 auto remote = Remote();
200 if (!remote) {
201 LOGE("remote is nullptr");
202 return E_BROKEN_IPC;
203 }
204
205 if (!data.WriteString(bundleName)) {
206 LOGE("Failed to send the bundle name");
207 return E_INVAL_ARG;
208 }
209
210 int32_t ret = remote->SendRequest(
211 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_GET_SYNC_TIME), data, reply, option);
212 if (ret != E_OK) {
213 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
214 return E_BROKEN_IPC;
215 }
216
217 syncTime = reply.ReadInt64();
218
219 return reply.ReadInt32();
220 }
221
BatchDentryFileInsert(const std::vector<DentryFileInfoObj> & fileInfo,std::vector<std::string> & failCloudId)222 int32_t CloudSyncServiceProxy::BatchDentryFileInsert(const std::vector<DentryFileInfoObj> &fileInfo,
223 std::vector<std::string> &failCloudId)
224 {
225 LOGI("BatchDentryFileInsert");
226 MessageParcel data;
227 MessageParcel reply;
228 MessageOption option;
229
230 if (!data.WriteInterfaceToken(GetDescriptor())) {
231 LOGE("Failed to write interface token");
232 return E_BROKEN_IPC;
233 }
234
235 if (fileInfo.size() > MAX_WRITE_DENTRY_FILE_SIZE || fileInfo.size() == 0 || !data.WriteInt32(fileInfo.size())) {
236 LOGE("Failed to send the vector size");
237 return E_INVAL_ARG;
238 }
239
240 for (const auto &obj : fileInfo) {
241 if (!data.WriteParcelable(&obj)) {
242 LOGE("Failed to send the fileInfo");
243 return E_INVAL_ARG;
244 }
245 }
246
247 auto remote = Remote();
248 if (!remote) {
249 LOGE("remote is nullptr");
250 return E_BROKEN_IPC;
251 }
252 int32_t ret = remote->SendRequest(
253 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DENTRY_FILE_INSERT), data, reply, option);
254 if (ret != E_OK) {
255 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
256 return E_BROKEN_IPC;
257 }
258 LOGI("BatchDentryFileInsert Success");
259 reply.ReadStringVector(&failCloudId);
260 return reply.ReadInt32();
261 }
262
CleanCacheInner(const std::string & uri)263 int32_t CloudSyncServiceProxy::CleanCacheInner(const std::string &uri)
264 {
265 LOGI("Start CleanCacheInner");
266 MessageParcel data;
267 MessageParcel reply;
268 MessageOption option;
269
270 if (!data.WriteInterfaceToken(GetDescriptor())) {
271 LOGE("Failed to write interface token");
272 return E_BROKEN_IPC;
273 }
274
275 if (!data.WriteString(uri)) {
276 LOGE("Failed to send the uri");
277 return E_BROKEN_IPC;
278 }
279
280 auto remote = Remote();
281 if (!remote) {
282 LOGE("remote is nullptr");
283 return E_BROKEN_IPC;
284 }
285 int32_t ret = remote->SendRequest(static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_CLEAN_CACHE),
286 data, reply, option);
287 if (ret != E_OK) {
288 LOGE("Failed to send out the request, errno: %{public}d", ret);
289 return E_BROKEN_IPC;
290 }
291
292 return reply.ReadInt32();
293 }
294
StopSyncInner(const std::string & bundleName,bool forceFlag)295 int32_t CloudSyncServiceProxy::StopSyncInner(const std::string &bundleName, bool forceFlag)
296 {
297 LOGI("StopSync");
298 MessageParcel data;
299 MessageParcel reply;
300 MessageOption option;
301
302 if (!data.WriteInterfaceToken(GetDescriptor())) {
303 LOGE("Failed to write interface token");
304 return E_BROKEN_IPC;
305 }
306
307 auto remote = Remote();
308 if (!remote) {
309 LOGE("remote is nullptr");
310 return E_BROKEN_IPC;
311 }
312
313 if (!data.WriteString(bundleName)) {
314 LOGE("Failed to send the bundle name");
315 return E_INVAL_ARG;
316 }
317
318 if (!data.WriteBool(forceFlag)) {
319 LOGE("Failed to send the forceFlag");
320 return E_INVAL_ARG;
321 }
322
323 int32_t ret = remote->SendRequest(static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_STOP_SYNC),
324 data, reply, option);
325 if (ret != E_OK) {
326 LOGE("Failed to send out the request, errno: %{public}d", ret);
327 return E_BROKEN_IPC;
328 }
329 LOGI("StopSyncInner Success");
330 return reply.ReadInt32();
331 }
332
ResetCursor(const std::string & bundleName)333 int32_t CloudSyncServiceProxy::ResetCursor(const std::string &bundleName)
334 {
335 LOGI("ResetCursor");
336 MessageParcel data;
337 MessageParcel reply;
338 MessageOption option;
339
340 if (!data.WriteInterfaceToken(GetDescriptor())) {
341 LOGE("Failed to write interface token");
342 return E_BROKEN_IPC;
343 }
344
345 auto remote = Remote();
346 if (!remote) {
347 LOGE("remote is nullptr");
348 return E_BROKEN_IPC;
349 }
350
351 if (!data.WriteString(bundleName)) {
352 LOGE("Failed to send the bundle name");
353 return E_INVAL_ARG;
354 }
355
356 int32_t ret = remote->SendRequest(
357 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_RESET_CURSOR), data, reply, option);
358 if (ret != E_OK) {
359 LOGE("Failed to send out the request, errno: %{public}d", ret);
360 return E_BROKEN_IPC;
361 }
362 LOGI("ResetCursor Success");
363 return reply.ReadInt32();
364 }
365
ChangeAppSwitch(const std::string & accoutId,const std::string & bundleName,bool status)366 int32_t CloudSyncServiceProxy::ChangeAppSwitch(const std::string &accoutId, const std::string &bundleName, bool status)
367 {
368 LOGI("ChangeAppSwitch");
369 MessageParcel data;
370 MessageParcel reply;
371 MessageOption option;
372
373 if (!data.WriteInterfaceToken(GetDescriptor())) {
374 LOGE("Failed to write interface token");
375 return E_BROKEN_IPC;
376 }
377
378 if (!data.WriteString(accoutId)) {
379 LOGE("Failed to send the account id");
380 return E_INVAL_ARG;
381 }
382
383 if (!data.WriteString(bundleName)) {
384 LOGE("Failed to send the bundle name");
385 return E_INVAL_ARG;
386 }
387
388 if (!data.WriteBool(status)) {
389 LOGE("Failed to send the switch status");
390 return E_INVAL_ARG;
391 }
392
393 auto remote = Remote();
394 if (!remote) {
395 LOGE("remote is nullptr");
396 return E_BROKEN_IPC;
397 }
398 int32_t ret = remote->SendRequest(
399 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_CHANGE_APP_SWITCH), data, reply, option);
400 if (ret != E_OK) {
401 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
402 return E_BROKEN_IPC;
403 }
404 LOGI("ChangeAppSwitch Success");
405 return reply.ReadInt32();
406 }
407
OptimizeStorage(const int32_t agingDays)408 int32_t CloudSyncServiceProxy::OptimizeStorage(const int32_t agingDays)
409 {
410 LOGI("OptimizeStorage");
411 MessageParcel data;
412 MessageParcel reply;
413 MessageOption option;
414
415 if (!data.WriteInterfaceToken(GetDescriptor())) {
416 LOGE("Failed to write interface token");
417 return E_BROKEN_IPC;
418 }
419
420 if (!data.WriteInt32(agingDays)) {
421 LOGE("Failed to send the agingDays");
422 return E_INVAL_ARG;
423 }
424
425 auto remote = Remote();
426 if (!remote) {
427 LOGE("remote is nullptr");
428 return E_BROKEN_IPC;
429 }
430 int32_t ret = remote->SendRequest(
431 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_OPTIMIZE_STORAGE), data, reply, option);
432 if (ret != E_OK) {
433 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
434 return E_BROKEN_IPC;
435 }
436 LOGI("OptimizeStorage Success");
437 return reply.ReadInt32();
438 }
439
Clean(const std::string & accountId,const CleanOptions & cleanOptions)440 int32_t CloudSyncServiceProxy::Clean(const std::string &accountId, const CleanOptions &cleanOptions)
441 {
442 LOGI("Clean");
443 MessageParcel data;
444 MessageParcel reply;
445 MessageOption option;
446
447 if (!data.WriteInterfaceToken(GetDescriptor())) {
448 LOGE("Failed to write interface token");
449 return E_BROKEN_IPC;
450 }
451
452 if (!data.WriteString(accountId)) {
453 LOGE("Failed to send the account id");
454 return E_INVAL_ARG;
455 }
456
457 if (!data.WriteParcelable(&cleanOptions)) {
458 LOGE("failed to write cleanOptions");
459 return E_INVAL_ARG;
460 }
461
462 auto remote = Remote();
463 if (!remote) {
464 LOGE("remote is nullptr");
465 return E_BROKEN_IPC;
466 }
467 int32_t ret = remote->SendRequest(static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_CLEAN), data,
468 reply, option);
469 if (ret != E_OK) {
470 LOGE("Failed to send out the request, errno: %{public}d", ret);
471 return E_BROKEN_IPC;
472 }
473 LOGI("Clean Success");
474 return reply.ReadInt32();
475 }
476
EnableCloud(const std::string & accoutId,const SwitchDataObj & switchData)477 int32_t CloudSyncServiceProxy::EnableCloud(const std::string &accoutId, const SwitchDataObj &switchData)
478 {
479 LOGI("EnableCloud");
480 MessageParcel data;
481 MessageParcel reply;
482 MessageOption option;
483
484 if (!data.WriteInterfaceToken(GetDescriptor())) {
485 LOGE("Failed to write interface token");
486 return E_BROKEN_IPC;
487 }
488
489 if (!data.WriteString(accoutId)) {
490 LOGE("Failed to send the account id");
491 return E_INVAL_ARG;
492 }
493
494 if (!data.WriteParcelable(&switchData)) {
495 LOGE("Failed to send the bundle switch");
496 return E_INVAL_ARG;
497 }
498
499 auto remote = Remote();
500 if (!remote) {
501 LOGE("remote is nullptr");
502 return E_BROKEN_IPC;
503 }
504 int32_t ret = remote->SendRequest(
505 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_ENABLE_CLOUD), data, reply, option);
506 if (ret != E_OK) {
507 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
508 return E_BROKEN_IPC;
509 }
510 LOGI("EnableCloud Success");
511 return reply.ReadInt32();
512 }
513
DisableCloud(const std::string & accoutId)514 int32_t CloudSyncServiceProxy::DisableCloud(const std::string &accoutId)
515 {
516 LOGI("DisableCloud");
517 MessageParcel data;
518 MessageParcel reply;
519 MessageOption option;
520
521 if (!data.WriteInterfaceToken(GetDescriptor())) {
522 LOGE("Failed to write interface token");
523 return E_BROKEN_IPC;
524 }
525
526 if (!data.WriteString(accoutId)) {
527 LOGE("Failed to send the account id");
528 return E_INVAL_ARG;
529 }
530
531 auto remote = Remote();
532 if (!remote) {
533 LOGE("remote is nullptr");
534 return E_BROKEN_IPC;
535 }
536 int32_t ret = remote->SendRequest(
537 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DISABLE_CLOUD), data, reply, option);
538 if (ret != E_OK) {
539 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
540 return E_BROKEN_IPC;
541 }
542 LOGI("DisableCloud Success");
543 return reply.ReadInt32();
544 }
545
NotifyDataChange(const std::string & accoutId,const std::string & bundleName)546 int32_t CloudSyncServiceProxy::NotifyDataChange(const std::string &accoutId, const std::string &bundleName)
547 {
548 LOGI("NotifyDataChange");
549 MessageParcel data;
550 MessageParcel reply;
551 MessageOption option;
552
553 if (!data.WriteInterfaceToken(GetDescriptor())) {
554 LOGE("Failed to write interface token");
555 return E_BROKEN_IPC;
556 }
557
558 if (!data.WriteString(accoutId)) {
559 LOGE("Failed to send the account id");
560 return E_INVAL_ARG;
561 }
562
563 if (!data.WriteString(bundleName)) {
564 LOGE("Failed to send the bundle name");
565 return E_INVAL_ARG;
566 }
567
568 auto remote = Remote();
569 if (!remote) {
570 LOGE("remote is nullptr");
571 return E_BROKEN_IPC;
572 }
573 int32_t ret = remote->SendRequest(
574 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_NOTIFY_DATA_CHANGE), data, reply, option);
575 if (ret != E_OK) {
576 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
577 return E_BROKEN_IPC;
578 }
579 LOGI("NotifyDataChange Success");
580 return reply.ReadInt32();
581 }
582
NotifyEventChange(int32_t userId,const std::string & eventId,const std::string & extraData)583 int32_t CloudSyncServiceProxy::NotifyEventChange(
584 int32_t userId, const std::string &eventId, const std::string &extraData)
585 {
586 LOGI("NotifyEventChange");
587 MessageParcel data;
588 MessageParcel reply;
589 MessageOption option;
590
591 if (!data.WriteInterfaceToken(GetDescriptor())) {
592 LOGE("Failed to write interface token");
593 return E_BROKEN_IPC;
594 }
595
596 if (!data.WriteInt32(userId)) {
597 LOGE("Failed to send the user id");
598 return E_INVAL_ARG;
599 }
600
601 if (!data.WriteString(eventId)) {
602 LOGE("Failed to send the event id");
603 return E_INVAL_ARG;
604 }
605
606 if (!data.WriteString(extraData)) {
607 LOGE("Failed to send the extra data");
608 return E_INVAL_ARG;
609 }
610
611 auto remote = Remote();
612 if (!remote) {
613 LOGE("remote is nullptr");
614 return E_BROKEN_IPC;
615 }
616 int32_t ret = remote->SendRequest(
617 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_NOTIFY_EVENT_CHANGE), data, reply, option);
618 if (ret != E_OK) {
619 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
620 return E_BROKEN_IPC;
621 }
622 LOGI("NotifyEventChange Success");
623 return reply.ReadInt32();
624 }
625
StartDownloadFile(const std::string & uri)626 int32_t CloudSyncServiceProxy::StartDownloadFile(const std::string &uri)
627 {
628 #ifdef SUPPORT_MEDIA_LIBRARY
629 LOGI("StartDownloadFile Start");
630 MessageParcel data;
631 MessageParcel reply;
632 MessageOption option;
633
634 if (!data.WriteInterfaceToken(GetDescriptor())) {
635 LOGE("Failed to write interface token");
636 return E_BROKEN_IPC;
637 }
638
639 string path = uri;
640 if (uri.find("file://media") == 0) {
641 OHOS::Media::MediaFileUri mediaUri(uri);
642 path = mediaUri.GetFilePath();
643
644 CloudDownloadUriManager &uriMgr = CloudDownloadUriManager::GetInstance();
645 uriMgr.AddPathToUri(path, uri);
646 }
647
648 LOGI("StartDownloadFile Start, uri: %{public}s, path: %{public}s",
649 GetAnonyString(uri).c_str(), GetAnonyString(path).c_str());
650
651 if (!data.WriteString(path)) {
652 LOGE("Failed to send the cloud id");
653 return E_INVAL_ARG;
654 }
655
656 auto remote = Remote();
657 if (!remote) {
658 LOGE("remote is nullptr");
659 return E_BROKEN_IPC;
660 }
661 int32_t ret = remote->SendRequest(
662 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_START_DOWNLOAD_FILE), data, reply, option);
663 if (ret != E_OK) {
664 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
665 return E_BROKEN_IPC;
666 }
667 LOGI("StartDownloadFile Success");
668 return reply.ReadInt32();
669 #else
670 LOGE("Function StartDownloadFile is undefined");
671 return 0;
672 #endif
673 }
674
StartFileCacheWriteParcel(MessageParcel & data,const std::vector<std::string> & pathVec,bool & isCallbackValid,const sptr<IRemoteObject> & downloadCallback)675 int32_t CloudSyncServiceProxy::StartFileCacheWriteParcel(MessageParcel &data,
676 const std::vector<std::string> &pathVec,
677 bool &isCallbackValid,
678 const sptr<IRemoteObject> &downloadCallback)
679 {
680 if (!data.WriteStringVector(pathVec)) {
681 LOGE("Failed to send the cloud id");
682 return E_INVAL_ARG;
683 }
684
685 if (!data.WriteBool(isCallbackValid)) {
686 LOGE("Failed to send the isCallbackValid flag");
687 return E_INVAL_ARG;
688 }
689
690 if (isCallbackValid) {
691 if (!data.WriteRemoteObject(downloadCallback)) {
692 LOGE("Failed to send the callback stub");
693 return E_INVAL_ARG;
694 }
695 }
696 return E_OK;
697 }
698
StartFileCache(const std::vector<std::string> & uriVec,int64_t & downloadId,bool isCallbackValid,const sptr<IRemoteObject> & downloadCallback)699 int32_t CloudSyncServiceProxy::StartFileCache(const std::vector<std::string> &uriVec,
700 int64_t &downloadId,
701 bool isCallbackValid,
702 const sptr<IRemoteObject> &downloadCallback)
703 {
704 LOGI("StartFileCache Start");
705 MessageParcel data;
706 MessageParcel reply;
707 MessageOption option;
708
709 if (!data.WriteInterfaceToken(GetDescriptor())) {
710 LOGE("Failed to write interface token");
711 return E_BROKEN_IPC;
712 }
713
714 std::vector<std::string> pathVec;
715 for (unsigned long i = 0; i < uriVec.size(); i++) {
716 string path = uriVec[i];
717 #ifdef SUPPORT_MEDIA_LIBRARY
718 if (uriVec[i].find("file://media") == 0) {
719 OHOS::Media::MediaFileUri mediaUri(uriVec[i]);
720 path = mediaUri.GetFilePath();
721 }
722 #endif
723 CloudDownloadUriManager &uriMgr = CloudDownloadUriManager::GetInstance();
724 uriMgr.AddPathToUri(path, uriVec[i]);
725 pathVec.push_back(path);
726
727 LOGI("StartFileCache Start, uriVec[%{public}ld]: %{public}s, path: %{public}s",
728 i, GetAnonyString(uriVec[i]).c_str(), GetAnonyString(path).c_str());
729 }
730
731 auto retParcel = StartFileCacheWriteParcel(data, pathVec, isCallbackValid, downloadCallback);
732 if (retParcel != E_OK) {
733 LOGE("StartFileCacheWriteParcel failed");
734 return retParcel;
735 }
736
737 auto remote = Remote();
738 if (!remote) {
739 LOGE("remote is nullptr");
740 return E_BROKEN_IPC;
741 }
742 int32_t ret = remote->SendRequest(
743 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_START_FILE_CACHE), data, reply, option);
744 if (ret != E_OK) {
745 LOGE("Failed to send out the request, errno %{public}d", ret);
746 return ret;
747 }
748
749 downloadId = reply.ReadInt64();
750
751 CloudDownloadUriManager &uriMgr = CloudDownloadUriManager::GetInstance();
752 uriMgr.AddDownloadIdToPath(downloadId, pathVec);
753
754 LOGI("StartFileCache Success, downloadId: %{public}lld", static_cast<long long>(downloadId));
755
756 return reply.ReadInt32();
757 }
758
StopDownloadFile(const std::string & uri,bool needClean)759 int32_t CloudSyncServiceProxy::StopDownloadFile(const std::string &uri, bool needClean)
760 {
761 LOGI("StopDownloadFile Start");
762 MessageParcel data;
763 MessageParcel reply;
764 MessageOption option;
765
766 if (!data.WriteInterfaceToken(GetDescriptor())) {
767 LOGE("Failed to write interface token");
768 return E_BROKEN_IPC;
769 }
770
771 string path = uri;
772 #ifdef SUPPORT_MEDIA_LIBRARY
773 if (uri.find("file://media") == 0) {
774 OHOS::Media::MediaFileUri Muri(uri);
775 path = Muri.GetFilePath();
776 }
777 #endif
778 LOGI("StopDownloadFile Start, uri: %{public}s, path: %{public}s",
779 GetAnonyString(uri).c_str(), GetAnonyString(path).c_str());
780
781 if (!data.WriteString(path)) {
782 LOGE("Failed to send the cloud id");
783 return E_INVAL_ARG;
784 }
785
786 if (!data.WriteBool(needClean)) {
787 LOGE("Failed to send the needClean flag");
788 return E_INVAL_ARG;
789 }
790
791 auto remote = Remote();
792 if (!remote) {
793 LOGE("remote is nullptr");
794 return E_BROKEN_IPC;
795 }
796 int32_t ret = remote->SendRequest(
797 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_STOP_DOWNLOAD_FILE), data, reply, option);
798 if (ret != E_OK) {
799 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
800 return E_BROKEN_IPC;
801 }
802 CloudDownloadUriManager& uriMgr = CloudDownloadUriManager::GetInstance();
803 uriMgr.RemoveUri(path);
804 LOGI("StopDownloadFile Success");
805 return reply.ReadInt32();
806 }
807
StopFileCache(const int64_t & downloadId,bool needClean)808 int32_t CloudSyncServiceProxy::StopFileCache(const int64_t &downloadId, bool needClean)
809 {
810 LOGI("StopFileCache Start");
811 MessageParcel data;
812 MessageParcel reply;
813 MessageOption option;
814
815 if (!data.WriteInterfaceToken(GetDescriptor())) {
816 LOGE("Failed to write interface token");
817 return E_BROKEN_IPC;
818 }
819
820 LOGI("StopFileCache Start, downloadId: %{public}lld, needClean: %{public}d",
821 static_cast<long long>(downloadId), needClean);
822
823 if (!data.WriteInt64(downloadId)) {
824 LOGE("Failed to send the cloud id");
825 return E_INVAL_ARG;
826 }
827
828 if (!data.WriteBool(needClean)) {
829 LOGE("Failed to send the needClean flag");
830 return E_INVAL_ARG;
831 }
832
833 auto remote = Remote();
834 if (!remote) {
835 LOGE("remote is nullptr");
836 return E_BROKEN_IPC;
837 }
838 int32_t ret = remote->SendRequest(
839 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_STOP_FILE_CACHE), data, reply, option);
840 if (ret != E_OK) {
841 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
842 return ret;
843 }
844 // if StopFileCache finished, we need call RemoveUri later
845 LOGI("StopFileCache Success");
846 return reply.ReadInt32();
847 }
848
DownloadThumb()849 int32_t CloudSyncServiceProxy::DownloadThumb()
850 {
851 LOGI("DownloadThumb Start");
852 MessageParcel data;
853 MessageParcel reply;
854 MessageOption option;
855
856 if (!data.WriteInterfaceToken(GetDescriptor())) {
857 LOGE("Failed to write interface token");
858 return E_BROKEN_IPC;
859 }
860 auto remote = Remote();
861 if (!remote) {
862 LOGE("remote is nullptr");
863 return E_BROKEN_IPC;
864 }
865 int32_t ret = remote->SendRequest(
866 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DOWNLOAD_THUMB), data, reply, option);
867 if (ret != E_OK) {
868 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
869 return ret;
870 }
871 LOGI("DownloadThumb Success");
872 return reply.ReadInt32();
873 }
874
RegisterDownloadFileCallback(const sptr<IRemoteObject> & downloadCallback)875 int32_t CloudSyncServiceProxy::RegisterDownloadFileCallback(const sptr<IRemoteObject> &downloadCallback)
876 {
877 LOGI("RegisterDownloadFileCallback Start");
878 MessageParcel data;
879 MessageParcel reply;
880 MessageOption option;
881
882 if (!downloadCallback) {
883 LOGI("Empty callback stub");
884 return E_INVAL_ARG;
885 }
886
887 if (!data.WriteInterfaceToken(GetDescriptor())) {
888 LOGE("Failed to write interface token");
889 return E_BROKEN_IPC;
890 }
891
892 if (!data.WriteRemoteObject(downloadCallback)) {
893 LOGE("Failed to send the callback stub");
894 return E_INVAL_ARG;
895 }
896
897 auto remote = Remote();
898 if (!remote) {
899 LOGE("remote is nullptr");
900 return E_BROKEN_IPC;
901 }
902 int32_t ret = remote->SendRequest(
903 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_REGISTER_DOWNLOAD_FILE_CALLBACK), data,
904 reply, option);
905 if (ret != E_OK) {
906 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
907 return E_BROKEN_IPC;
908 }
909 LOGI("RegisterDownloadFileCallback Success");
910 return reply.ReadInt32();
911 }
912
UnregisterDownloadFileCallback()913 int32_t CloudSyncServiceProxy::UnregisterDownloadFileCallback()
914 {
915 LOGI("UnregisterDownloadFileCallback Start");
916 MessageParcel data;
917 MessageParcel reply;
918 MessageOption option;
919
920 if (!data.WriteInterfaceToken(GetDescriptor())) {
921 LOGE("Failed to write interface token");
922 return E_BROKEN_IPC;
923 }
924
925 auto remote = Remote();
926 if (!remote) {
927 LOGE("remote is nullptr");
928 return E_BROKEN_IPC;
929 }
930 int32_t ret = remote->SendRequest(
931 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_UNREGISTER_DOWNLOAD_FILE_CALLBACK), data,
932 reply, option);
933 if (ret != E_OK) {
934 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
935 return E_BROKEN_IPC;
936 }
937 LOGI("UnregisterDownloadFileCallback Success");
938 return reply.ReadInt32();
939 }
940
UploadAsset(const int32_t userId,const std::string & request,std::string & result)941 int32_t CloudSyncServiceProxy::UploadAsset(const int32_t userId, const std::string &request, std::string &result)
942 {
943 LOGD("UploadAsset");
944 MessageParcel data;
945 MessageParcel reply;
946 MessageOption option;
947
948 if (!data.WriteInterfaceToken(GetDescriptor())) {
949 LOGE("Failed to write interface token");
950 return E_BROKEN_IPC;
951 }
952
953 if (!data.WriteInt32(userId)) {
954 LOGE("Failed to send the user id");
955 return E_INVAL_ARG;
956 }
957
958 if (!data.WriteString(request)) {
959 LOGE("Failed to send the request");
960 return E_INVAL_ARG;
961 }
962
963 auto remote = Remote();
964 if (!remote) {
965 LOGE("remote is nullptr");
966 return E_BROKEN_IPC;
967 }
968 int32_t ret = remote->SendRequest(
969 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_UPLOAD_ASSET), data, reply, option);
970 if (ret != E_OK) {
971 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
972 return E_BROKEN_IPC;
973 }
974 ret = reply.ReadInt32();
975 result = reply.ReadString();
976 LOGD("UploadAsset Success");
977 return ret;
978 }
979
DownloadFile(const int32_t userId,const std::string & bundleName,AssetInfoObj & assetInfoObj)980 int32_t CloudSyncServiceProxy::DownloadFile(const int32_t userId,
981 const std::string &bundleName,
982 AssetInfoObj &assetInfoObj)
983 {
984 LOGI("DownloadFile");
985 MessageParcel data;
986 MessageParcel reply;
987 MessageOption option;
988
989 if (!data.WriteInterfaceToken(GetDescriptor())) {
990 LOGE("Failed to write interface token");
991 return E_BROKEN_IPC;
992 }
993
994 if (!data.WriteInt32(userId)) {
995 LOGE("Failed to send the user id");
996 return E_INVAL_ARG;
997 }
998
999 if (!data.WriteString(bundleName)) {
1000 LOGE("Failed to send the bundle name");
1001 return E_INVAL_ARG;
1002 }
1003
1004 if (!data.WriteParcelable(&assetInfoObj)) {
1005 LOGE("Failed to send the bundle assetInfo");
1006 return E_INVAL_ARG;
1007 }
1008
1009 auto remote = Remote();
1010 if (!remote) {
1011 LOGE("remote is nullptr");
1012 return E_BROKEN_IPC;
1013 }
1014 int32_t ret = remote->SendRequest(
1015 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DOWNLOAD_FILE), data, reply, option);
1016 if (ret != E_OK) {
1017 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
1018 return E_BROKEN_IPC;
1019 }
1020 LOGI("DownloadFile Success");
1021 return reply.ReadInt32();
1022 }
1023
DownloadFiles(const int32_t userId,const std::string & bundleName,const std::vector<AssetInfoObj> & assetInfoObj,std::vector<bool> & assetResultMap)1024 int32_t CloudSyncServiceProxy::DownloadFiles(const int32_t userId,
1025 const std::string &bundleName,
1026 const std::vector<AssetInfoObj> &assetInfoObj,
1027 std::vector<bool> &assetResultMap)
1028 {
1029 LOGI("DownloadFiles");
1030 MessageParcel data;
1031 MessageParcel reply;
1032 MessageOption option;
1033
1034 if (!data.WriteInterfaceToken(GetDescriptor())) {
1035 LOGE("Failed to write interface token");
1036 return E_BROKEN_IPC;
1037 }
1038
1039 if (!data.WriteInt32(userId)) {
1040 LOGE("Failed to send the user id");
1041 return E_INVAL_ARG;
1042 }
1043
1044 if (!data.WriteString(bundleName)) {
1045 LOGE("Failed to send the bundle name");
1046 return E_INVAL_ARG;
1047 }
1048
1049 if (assetInfoObj.size() > INT_MAX ||
1050 assetInfoObj.size() == 0 ||
1051 !data.WriteInt32(assetInfoObj.size())) {
1052 LOGE("Failed to send the vector size");
1053 return E_INVAL_ARG;
1054 }
1055
1056 for (const auto &obj : assetInfoObj) {
1057 if (!data.WriteParcelable(&obj)) {
1058 LOGE("Failed to send the assetInfoObj");
1059 return E_INVAL_ARG;
1060 }
1061 }
1062
1063 auto remote = Remote();
1064 if (!remote) {
1065 LOGE("remote is nullptr");
1066 return E_BROKEN_IPC;
1067 }
1068 int32_t ret = remote->SendRequest(
1069 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DOWNLOAD_FILES), data, reply, option);
1070 if (ret != E_OK) {
1071 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
1072 return E_BROKEN_IPC;
1073 }
1074 LOGI("DownloadFile Success");
1075 bool readParcel = reply.ReadBoolVector(&assetResultMap);
1076 if (readParcel != true) {
1077 LOGE("Failed to ReadBoolVector");
1078 return E_INVAL_ARG;
1079 }
1080 return reply.ReadInt32();
1081 }
1082
DownloadAsset(const uint64_t taskId,const int32_t userId,const std::string & bundleName,const std::string & networkId,AssetInfoObj & assetInfoObj)1083 int32_t CloudSyncServiceProxy::DownloadAsset(const uint64_t taskId,
1084 const int32_t userId,
1085 const std::string &bundleName,
1086 const std::string &networkId,
1087 AssetInfoObj &assetInfoObj)
1088 {
1089 LOGI("DownloadFile");
1090 MessageParcel data;
1091 MessageParcel reply;
1092 MessageOption option;
1093
1094 if (!data.WriteInterfaceToken(GetDescriptor())) {
1095 LOGE("Failed to write interface token");
1096 return E_BROKEN_IPC;
1097 }
1098
1099 if (!data.WriteUint64(taskId)) {
1100 LOGE("Failed to send the task id");
1101 return E_INVAL_ARG;
1102 }
1103
1104 if (!data.WriteInt32(userId)) {
1105 LOGE("Failed to send the user id");
1106 return E_INVAL_ARG;
1107 }
1108
1109 if (!data.WriteString(bundleName)) {
1110 LOGE("Failed to send the bundle name");
1111 return E_INVAL_ARG;
1112 }
1113
1114 if (!data.WriteString(networkId)) {
1115 LOGE("Failed to send the bundle name");
1116 return E_INVAL_ARG;
1117 }
1118
1119 if (!data.WriteParcelable(&assetInfoObj)) {
1120 LOGE("Failed to send the bundle assetInfo");
1121 return E_INVAL_ARG;
1122 }
1123
1124 auto remote = Remote();
1125 if (!remote) {
1126 LOGE("remote is nullptr");
1127 return E_BROKEN_IPC;
1128 }
1129 int32_t ret = remote->SendRequest(
1130 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DOWNLOAD_ASSET), data, reply, option);
1131 if (ret != E_OK) {
1132 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
1133 return E_BROKEN_IPC;
1134 }
1135 LOGI("DownloadFile Success");
1136 return reply.ReadInt32();
1137 }
1138
RegisterDownloadAssetCallback(const sptr<IRemoteObject> & remoteObject)1139 int32_t CloudSyncServiceProxy::RegisterDownloadAssetCallback(const sptr<IRemoteObject> &remoteObject)
1140 {
1141 LOGI("Start RegisterDownloadAssetCallback");
1142 MessageParcel data;
1143 MessageParcel reply;
1144 MessageOption option;
1145
1146 if (!remoteObject) {
1147 LOGI("Empty callback stub");
1148 return E_INVAL_ARG;
1149 }
1150
1151 if (!data.WriteInterfaceToken(GetDescriptor())) {
1152 LOGE("Failed to write interface token");
1153 return E_BROKEN_IPC;
1154 }
1155
1156 if (!data.WriteRemoteObject(remoteObject)) {
1157 LOGE("Failed to send the callback stub");
1158 return E_INVAL_ARG;
1159 }
1160
1161 auto remote = Remote();
1162 if (!remote) {
1163 LOGE("remote is nullptr");
1164 return E_BROKEN_IPC;
1165 }
1166 int32_t ret = remote->SendRequest(
1167 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_REGISTER_DOWNLOAD_ASSET_CALLBACK), data,
1168 reply, option);
1169 if (ret != E_OK) {
1170 stringstream ss;
1171 ss << "Failed to send out the requeset, errno:" << ret;
1172 LOGE("%{public}s", ss.str().c_str());
1173 return E_BROKEN_IPC;
1174 }
1175 LOGI("RegisterDownloadAssetCallback Success");
1176 return reply.ReadInt32();
1177 }
1178
DeleteAsset(const int32_t userId,const std::string & uri)1179 int32_t CloudSyncServiceProxy::DeleteAsset(const int32_t userId, const std::string &uri)
1180 {
1181 LOGD("DeleteAsset");
1182 MessageParcel data;
1183 MessageParcel reply;
1184 MessageOption option;
1185
1186 if (!data.WriteInterfaceToken(GetDescriptor())) {
1187 LOGE("Failed to write interface token");
1188 return E_BROKEN_IPC;
1189 }
1190
1191 if (!data.WriteInt32(userId)) {
1192 LOGE("Failed to send the user id");
1193 return E_INVAL_ARG;
1194 }
1195
1196 if (!data.WriteString(uri)) {
1197 LOGE("Failed to send the uri");
1198 return E_INVAL_ARG;
1199 }
1200
1201 auto remote = Remote();
1202 if (!remote) {
1203 LOGE("remote is nullptr");
1204 return E_BROKEN_IPC;
1205 }
1206 int32_t ret = remote->SendRequest(
1207 static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DELETE_ASSET), data, reply, option);
1208 if (ret != E_OK) {
1209 LOGE("Failed to send out the requeset, errno: %{public}d", ret);
1210 return E_BROKEN_IPC;
1211 }
1212 ret = reply.ReadInt32();
1213 LOGI("DeleteAsset Success");
1214 return ret;
1215 }
1216
GetInstance()1217 sptr<ICloudSyncService> CloudSyncServiceProxy::GetInstance()
1218 {
1219 LOGD("getinstance");
1220 unique_lock<mutex> lock(instanceMutex_);
1221 if (serviceProxy_ != nullptr) {
1222 return serviceProxy_;
1223 }
1224
1225 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1226 if (samgr == nullptr) {
1227 LOGE("Samgr is nullptr");
1228 return nullptr;
1229 }
1230 sptr<ServiceProxyLoadCallback> cloudSyncLoadCallback = new ServiceProxyLoadCallback();
1231 if (cloudSyncLoadCallback == nullptr) {
1232 LOGE("cloudSyncLoadCallback is nullptr");
1233 return nullptr;
1234 }
1235 int32_t ret = samgr->LoadSystemAbility(FILEMANAGEMENT_CLOUD_SYNC_SERVICE_SA_ID, cloudSyncLoadCallback);
1236 if (ret != E_OK) {
1237 LOGE("Failed to Load systemAbility, systemAbilityId:%{pulbic}d, ret code:%{pulbic}d",
1238 FILEMANAGEMENT_CLOUD_SYNC_SERVICE_SA_ID, ret);
1239 return nullptr;
1240 }
1241 unique_lock<mutex> proxyLock(proxyMutex_);
1242 auto waitStatus = cloudSyncLoadCallback->proxyConVar_.wait_for(
1243 proxyLock, std::chrono::milliseconds(LOAD_SA_TIMEOUT_MS),
1244 [cloudSyncLoadCallback]() { return cloudSyncLoadCallback->isLoadSuccess_.load(); });
1245 if (!waitStatus) {
1246 LOGE("Load CloudSynd SA timeout");
1247 return nullptr;
1248 }
1249 return serviceProxy_;
1250 }
1251
InvaildInstance()1252 void CloudSyncServiceProxy::InvaildInstance()
1253 {
1254 LOGI("invalid instance");
1255 unique_lock<mutex> lock(instanceMutex_);
1256 serviceProxy_ = nullptr;
1257 CloudDownloadUriManager::GetInstance().Reset();
1258 }
1259
OnLoadSystemAbilitySuccess(int32_t systemAbilityId,const sptr<IRemoteObject> & remoteObject)1260 void CloudSyncServiceProxy::ServiceProxyLoadCallback::OnLoadSystemAbilitySuccess(
1261 int32_t systemAbilityId,
1262 const sptr<IRemoteObject> &remoteObject)
1263 {
1264 LOGI("Load CloudSync SA success,systemAbilityId:%{public}d, remoteObj result:%{private}s", systemAbilityId,
1265 (remoteObject == nullptr ? "false" : "true"));
1266 unique_lock<mutex> lock(proxyMutex_);
1267 if (serviceProxy_ != nullptr) {
1268 LOGE("CloudSync SA proxy has been loaded");
1269 } else {
1270 serviceProxy_ = iface_cast<ICloudSyncService>(remoteObject);
1271 }
1272 isLoadSuccess_.store(true);
1273 proxyConVar_.notify_one();
1274 }
1275
OnLoadSystemAbilityFail(int32_t systemAbilityId)1276 void CloudSyncServiceProxy::ServiceProxyLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
1277 {
1278 LOGI("Load CloudSync SA failed,systemAbilityId:%{public}d", systemAbilityId);
1279 unique_lock<mutex> lock(proxyMutex_);
1280 serviceProxy_ = nullptr;
1281 isLoadSuccess_.store(false);
1282 proxyConVar_.notify_one();
1283 }
1284 } // namespace OHOS::FileManagement::CloudSync
1285