• 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 #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 #include "media_file_uri.h"
25 #include "system_ability_definition.h"
26 #include "utils_log.h"
27 
28 namespace OHOS::FileManagement::CloudSync {
29 using namespace std;
30 
31 constexpr int LOAD_SA_TIMEOUT_MS = 4000;
32 
UnRegisterCallbackInner()33 int32_t CloudSyncServiceProxy::UnRegisterCallbackInner()
34 {
35     LOGI("Start UnRegisterCallbackInner");
36     MessageParcel data;
37     MessageParcel reply;
38     MessageOption option;
39 
40     if (!data.WriteInterfaceToken(GetDescriptor())) {
41         LOGE("Failed to write interface token");
42         return E_BROKEN_IPC;
43     }
44 
45     auto remote = Remote();
46     if (!remote) {
47         LOGE("remote is nullptr");
48         return E_BROKEN_IPC;
49     }
50     int32_t ret = remote->SendRequest(
51         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_UNREGISTER_CALLBACK), data, reply, option);
52     if (ret != E_OK) {
53         stringstream ss;
54         ss << "Failed to send out the requeset, errno:" << ret;
55         LOGE("%{public}s", ss.str().c_str());
56         return E_BROKEN_IPC;
57     }
58     LOGI("UnRegisterCallbackInner Success");
59     return reply.ReadInt32();
60 }
61 
RegisterCallbackInner(const sptr<IRemoteObject> & remoteObject)62 int32_t CloudSyncServiceProxy::RegisterCallbackInner(const sptr<IRemoteObject> &remoteObject)
63 {
64     LOGI("Start RegisterCallbackInner");
65     MessageParcel data;
66     MessageParcel reply;
67     MessageOption option;
68 
69     if (!remoteObject) {
70         LOGI("Empty callback stub");
71         return E_INVAL_ARG;
72     }
73 
74     if (!data.WriteInterfaceToken(GetDescriptor())) {
75         LOGE("Failed to write interface token");
76         return E_BROKEN_IPC;
77     }
78 
79     if (!data.WriteRemoteObject(remoteObject)) {
80         LOGE("Failed to send the callback stub");
81         return E_INVAL_ARG;
82     }
83 
84     auto remote = Remote();
85     if (!remote) {
86         LOGE("remote is nullptr");
87         return E_BROKEN_IPC;
88     }
89     int32_t ret = remote->SendRequest(
90         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_REGISTER_CALLBACK), data, reply, option);
91     if (ret != E_OK) {
92         stringstream ss;
93         ss << "Failed to send out the requeset, errno:" << ret;
94         LOGE("%{public}s", ss.str().c_str());
95         return E_BROKEN_IPC;
96     }
97     LOGI("RegisterCallbackInner Success");
98     return reply.ReadInt32();
99 }
100 
StartSyncInner(bool forceFlag)101 int32_t CloudSyncServiceProxy::StartSyncInner(bool forceFlag)
102 {
103     LOGI("Start Sync");
104     MessageParcel data;
105     MessageParcel reply;
106     MessageOption option;
107 
108     if (!data.WriteInterfaceToken(GetDescriptor())) {
109         LOGE("Failed to write interface token");
110         return E_BROKEN_IPC;
111     }
112 
113     if (!data.WriteBool(forceFlag)) {
114         LOGE("Failed to send the force flag");
115         return E_INVAL_ARG;
116     }
117 
118     auto remote = Remote();
119     if (!remote) {
120         LOGE("remote is nullptr");
121         return E_BROKEN_IPC;
122     }
123     int32_t ret = remote->SendRequest(static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_START_SYNC),
124                                       data, reply, option);
125     if (ret != E_OK) {
126         stringstream ss;
127         ss << "Failed to send out the requeset, errno:" << ret;
128         LOGE("%{public}s", ss.str().c_str());
129         return E_BROKEN_IPC;
130     }
131     LOGI("StartSyncInner Success");
132     return reply.ReadInt32();
133 }
134 
StopSyncInner()135 int32_t CloudSyncServiceProxy::StopSyncInner()
136 {
137     LOGI("StopSync");
138     MessageParcel data;
139     MessageParcel reply;
140     MessageOption option;
141 
142     if (!data.WriteInterfaceToken(GetDescriptor())) {
143         LOGE("Failed to write interface token");
144         return E_BROKEN_IPC;
145     }
146 
147     auto remote = Remote();
148     if (!remote) {
149         LOGE("remote is nullptr");
150         return E_BROKEN_IPC;
151     }
152     int32_t ret = remote->SendRequest(static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_STOP_SYNC),
153                                       data, reply, option);
154     if (ret != E_OK) {
155         stringstream ss;
156         ss << "Failed to send out the requeset, errno:" << ret;
157         return E_BROKEN_IPC;
158     }
159     LOGI("StopSyncInner Success");
160     return reply.ReadInt32();
161 }
162 
ChangeAppSwitch(const std::string & accoutId,const std::string & bundleName,bool status)163 int32_t CloudSyncServiceProxy::ChangeAppSwitch(const std::string &accoutId, const std::string &bundleName, bool status)
164 {
165     LOGI("ChangeAppSwitch");
166     MessageParcel data;
167     MessageParcel reply;
168     MessageOption option;
169 
170     if (!data.WriteInterfaceToken(GetDescriptor())) {
171         LOGE("Failed to write interface token");
172         return E_BROKEN_IPC;
173     }
174 
175     if (!data.WriteString(accoutId)) {
176         LOGE("Failed to send the account id");
177         return E_INVAL_ARG;
178     }
179 
180     if (!data.WriteString(bundleName)) {
181         LOGE("Failed to send the bundle name");
182         return E_INVAL_ARG;
183     }
184 
185     if (!data.WriteBool(status)) {
186         LOGE("Failed to send the switch status");
187         return E_INVAL_ARG;
188     }
189 
190     auto remote = Remote();
191     if (!remote) {
192         LOGE("remote is nullptr");
193         return E_BROKEN_IPC;
194     }
195     int32_t ret = remote->SendRequest(
196         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_CHANGE_APP_SWITCH), data, reply, option);
197     if (ret != E_OK) {
198         LOGE("Failed to send out the requeset, errno: %{pubilc}d", ret);
199         return E_BROKEN_IPC;
200     }
201     LOGI("ChangeAppSwitch Success");
202     return reply.ReadInt32();
203 }
204 
Clean(const std::string & accountId,const CleanOptions & cleanOptions)205 int32_t CloudSyncServiceProxy::Clean(const std::string &accountId, const CleanOptions &cleanOptions)
206 {
207     LOGI("Clean");
208     MessageParcel data;
209     MessageParcel reply;
210     MessageOption option;
211 
212     if (!data.WriteInterfaceToken(GetDescriptor())) {
213         LOGE("Failed to write interface token");
214         return E_BROKEN_IPC;
215     }
216 
217     if (!data.WriteString(accountId)) {
218         LOGE("Failed to send the account id");
219         return E_INVAL_ARG;
220     }
221 
222     if (!data.WriteParcelable(&cleanOptions)) {
223         LOGE("failed to write cleanOptions");
224         return E_INVAL_ARG;
225     }
226 
227     auto remote = Remote();
228     if (!remote) {
229         LOGE("remote is nullptr");
230         return E_BROKEN_IPC;
231     }
232     int32_t ret = remote->SendRequest(static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_CLEAN), data,
233                                       reply, option);
234     if (ret != E_OK) {
235         LOGE("Failed to send out the request, errno: %{public}d", ret);
236         return E_BROKEN_IPC;
237     }
238     LOGI("Clean Success");
239     return reply.ReadInt32();
240 }
241 
EnableCloud(const std::string & accoutId,const SwitchDataObj & switchData)242 int32_t CloudSyncServiceProxy::EnableCloud(const std::string &accoutId, const SwitchDataObj &switchData)
243 {
244     LOGI("EnableCloud");
245     MessageParcel data;
246     MessageParcel reply;
247     MessageOption option;
248 
249     if (!data.WriteInterfaceToken(GetDescriptor())) {
250         LOGE("Failed to write interface token");
251         return E_BROKEN_IPC;
252     }
253 
254     if (!data.WriteString(accoutId)) {
255         LOGE("Failed to send the account id");
256         return E_INVAL_ARG;
257     }
258 
259     if (!data.WriteParcelable(&switchData)) {
260         LOGE("Failed to send the bundle switch");
261         return E_INVAL_ARG;
262     }
263 
264     auto remote = Remote();
265     if (!remote) {
266         LOGE("remote is nullptr");
267         return E_BROKEN_IPC;
268     }
269     int32_t ret = remote->SendRequest(
270         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_ENABLE_CLOUD), data, reply, option);
271     if (ret != E_OK) {
272         LOGE("Failed to send out the requeset, errno: %{pubilc}d", ret);
273         return E_BROKEN_IPC;
274     }
275     LOGI("EnableCloud Success");
276     return reply.ReadInt32();
277 }
278 
DisableCloud(const std::string & accoutId)279 int32_t CloudSyncServiceProxy::DisableCloud(const std::string &accoutId)
280 {
281     LOGI("DisableCloud");
282     MessageParcel data;
283     MessageParcel reply;
284     MessageOption option;
285 
286     if (!data.WriteInterfaceToken(GetDescriptor())) {
287         LOGE("Failed to write interface token");
288         return E_BROKEN_IPC;
289     }
290 
291     if (!data.WriteString(accoutId)) {
292         LOGE("Failed to send the account id");
293         return E_INVAL_ARG;
294     }
295 
296     auto remote = Remote();
297     if (!remote) {
298         LOGE("remote is nullptr");
299         return E_BROKEN_IPC;
300     }
301     int32_t ret = remote->SendRequest(
302         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DISABLE_CLOUD), data, reply, option);
303     if (ret != E_OK) {
304         LOGE("Failed to send out the requeset, errno: %{pubilc}d", ret);
305         return E_BROKEN_IPC;
306     }
307     LOGI("DisableCloud Success");
308     return reply.ReadInt32();
309 }
310 
NotifyDataChange(const std::string & accoutId,const std::string & bundleName)311 int32_t CloudSyncServiceProxy::NotifyDataChange(const std::string &accoutId, const std::string &bundleName)
312 {
313     LOGI("NotifyDataChange");
314     MessageParcel data;
315     MessageParcel reply;
316     MessageOption option;
317 
318     if (!data.WriteInterfaceToken(GetDescriptor())) {
319         LOGE("Failed to write interface token");
320         return E_BROKEN_IPC;
321     }
322 
323     if (!data.WriteString(accoutId)) {
324         LOGE("Failed to send the account id");
325         return E_INVAL_ARG;
326     }
327 
328     if (!data.WriteString(bundleName)) {
329         LOGE("Failed to send the bundle name");
330         return E_INVAL_ARG;
331     }
332 
333     auto remote = Remote();
334     if (!remote) {
335         LOGE("remote is nullptr");
336         return E_BROKEN_IPC;
337     }
338     int32_t ret = remote->SendRequest(
339         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_NOTIFY_DATA_CHANGE), data, reply, option);
340     if (ret != E_OK) {
341         LOGE("Failed to send out the requeset, errno: %{pubilc}d", ret);
342         return E_BROKEN_IPC;
343     }
344     LOGI("NotifyDataChange Success");
345     return reply.ReadInt32();
346 }
347 
StartDownloadFile(const std::string & uri)348 int32_t CloudSyncServiceProxy::StartDownloadFile(const std::string &uri)
349 {
350     LOGI("StartDownloadFile Start");
351     MessageParcel data;
352     MessageParcel reply;
353     MessageOption option;
354 
355     if (!data.WriteInterfaceToken(GetDescriptor())) {
356         LOGE("Failed to write interface token");
357         return E_BROKEN_IPC;
358     }
359 
360     OHOS::Media::MediaFileUri Muri(uri);
361     string path = Muri.GetFilePath();
362     LOGI("StartDownloadFile Start, uri: %{public}s, path: %{public}s", uri.c_str(), path.c_str());
363 
364     CloudDownloadUriManager &uriMgr = CloudDownloadUriManager::GetInstance();
365     uriMgr.AddPathToUri(path, uri);
366 
367     if (!data.WriteString(path)) {
368         LOGE("Failed to send the cloud id");
369         return E_INVAL_ARG;
370     }
371 
372     auto remote = Remote();
373     if (!remote) {
374         LOGE("remote is nullptr");
375         return E_BROKEN_IPC;
376     }
377     int32_t ret = remote->SendRequest(
378         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_START_DOWNLOAD_FILE), data, reply, option);
379     if (ret != E_OK) {
380         stringstream ss;
381         ss << "Failed to send out the requeset, errno:" << ret;
382         LOGE("%{public}s", ss.str().c_str());
383         return E_BROKEN_IPC;
384     }
385     LOGI("StartDownloadFile Success");
386     return reply.ReadInt32();
387 }
388 
StopDownloadFile(const std::string & uri)389 int32_t CloudSyncServiceProxy::StopDownloadFile(const std::string &uri)
390 {
391     LOGI("StopDownloadFile Start");
392     MessageParcel data;
393     MessageParcel reply;
394     MessageOption option;
395 
396     if (!data.WriteInterfaceToken(GetDescriptor())) {
397         LOGE("Failed to write interface token");
398         return E_BROKEN_IPC;
399     }
400 
401     OHOS::Media::MediaFileUri Muri(uri);
402     string path = Muri.GetFilePath();
403     LOGI("StartDownloadFile Start, uri: %{public}s, path: %{public}s", uri.c_str(), path.c_str());
404 
405     CloudDownloadUriManager &uriMgr = CloudDownloadUriManager::GetInstance();
406     uriMgr.RemoveUri(path);
407 
408     if (!data.WriteString(path)) {
409         LOGE("Failed to send the cloud id");
410         return E_INVAL_ARG;
411     }
412 
413     auto remote = Remote();
414     if (!remote) {
415         LOGE("remote is nullptr");
416         return E_BROKEN_IPC;
417     }
418     int32_t ret = remote->SendRequest(
419         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_STOP_DOWNLOAD_FILE), data, reply, option);
420     if (ret != E_OK) {
421         stringstream ss;
422         ss << "Failed to send out the requeset, errno:" << ret;
423         LOGE("%{public}s", ss.str().c_str());
424         return E_BROKEN_IPC;
425     }
426     LOGI("StopDownloadFile Success");
427     return reply.ReadInt32();
428 }
429 
RegisterDownloadFileCallback(const sptr<IRemoteObject> & downloadCallback)430 int32_t CloudSyncServiceProxy::RegisterDownloadFileCallback(const sptr<IRemoteObject> &downloadCallback)
431 {
432     LOGI("RegisterDownloadFileCallback Start");
433     MessageParcel data;
434     MessageParcel reply;
435     MessageOption option;
436 
437     if (!downloadCallback) {
438         LOGI("Empty callback stub");
439         return E_INVAL_ARG;
440     }
441 
442     if (!data.WriteInterfaceToken(GetDescriptor())) {
443         LOGE("Failed to write interface token");
444         return E_BROKEN_IPC;
445     }
446 
447     if (!data.WriteRemoteObject(downloadCallback)) {
448         LOGE("Failed to send the callback stub");
449         return E_INVAL_ARG;
450     }
451 
452     CloudDownloadUriManager &uriMgr = CloudDownloadUriManager::GetInstance();
453     uriMgr.SetRegisteredFlag();
454 
455     auto remote = Remote();
456     if (!remote) {
457         LOGE("remote is nullptr");
458         return E_BROKEN_IPC;
459     }
460     int32_t ret = remote->SendRequest(
461         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_REGISTER_DOWNLOAD_FILE_CALLBACK), data,
462         reply, option);
463     if (ret != E_OK) {
464         stringstream ss;
465         ss << "Failed to send out the requeset, errno:" << ret;
466         LOGE("%{public}s", ss.str().c_str());
467         return E_BROKEN_IPC;
468     }
469     LOGI("RegisterDownloadFileCallback Success");
470     return reply.ReadInt32();
471 }
472 
UnregisterDownloadFileCallback()473 int32_t CloudSyncServiceProxy::UnregisterDownloadFileCallback()
474 {
475     LOGI("UnregisterDownloadFileCallback Start");
476     MessageParcel data;
477     MessageParcel reply;
478     MessageOption option;
479 
480     if (!data.WriteInterfaceToken(GetDescriptor())) {
481         LOGE("Failed to write interface token");
482         return E_BROKEN_IPC;
483     }
484 
485     CloudDownloadUriManager &uriMgr = CloudDownloadUriManager::GetInstance();
486     uriMgr.UnsetRegisteredFlag();
487 
488     auto remote = Remote();
489     if (!remote) {
490         LOGE("remote is nullptr");
491         return E_BROKEN_IPC;
492     }
493     int32_t ret = remote->SendRequest(
494         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_UNREGISTER_DOWNLOAD_FILE_CALLBACK), data,
495         reply, option);
496     if (ret != E_OK) {
497         stringstream ss;
498         ss << "Failed to send out the requeset, errno:" << ret;
499         LOGE("%{public}s", ss.str().c_str());
500         return E_BROKEN_IPC;
501     }
502     LOGI("UnregisterDownloadFileCallback Success");
503     return reply.ReadInt32();
504 }
505 
UploadAsset(const int32_t userId,const std::string & request,std::string & result)506 int32_t CloudSyncServiceProxy::UploadAsset(const int32_t userId, const std::string &request, std::string &result)
507 {
508     LOGI("UploadAsset");
509     MessageParcel data;
510     MessageParcel reply;
511     MessageOption option;
512 
513     if (!data.WriteInterfaceToken(GetDescriptor())) {
514         LOGE("Failed to write interface token");
515         return E_BROKEN_IPC;
516     }
517 
518     if (!data.WriteInt32(userId)) {
519         LOGE("Failed to send the user id");
520         return E_INVAL_ARG;
521     }
522 
523     if (!data.WriteString(request)) {
524         LOGE("Failed to send the request");
525         return E_INVAL_ARG;
526     }
527 
528     auto remote = Remote();
529     if (!remote) {
530         LOGE("remote is nullptr");
531         return E_BROKEN_IPC;
532     }
533     int32_t ret = remote->SendRequest(
534         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_UPLOAD_ASSET), data, reply, option);
535     if (ret != E_OK) {
536         LOGE("Failed to send out the requeset, errno: %{pubilc}d", ret);
537         return E_BROKEN_IPC;
538     }
539     ret = reply.ReadInt32();
540     result = reply.ReadString();
541     LOGI("UploadAsset Success");
542     return ret;
543 }
544 
DownloadFile(const int32_t userId,const std::string & bundleName,AssetInfoObj & assetInfoObj)545 int32_t CloudSyncServiceProxy::DownloadFile(const int32_t userId,
546                                             const std::string &bundleName,
547                                             AssetInfoObj &assetInfoObj)
548 {
549     LOGI("DownloadFile");
550     MessageParcel data;
551     MessageParcel reply;
552     MessageOption option;
553 
554     if (!data.WriteInterfaceToken(GetDescriptor())) {
555         LOGE("Failed to write interface token");
556         return E_BROKEN_IPC;
557     }
558 
559     if (!data.WriteInt32(userId)) {
560         LOGE("Failed to send the user id");
561         return E_INVAL_ARG;
562     }
563 
564     if (!data.WriteString(bundleName)) {
565         LOGE("Failed to send the bundle name");
566         return E_INVAL_ARG;
567     }
568 
569     if (!data.WriteParcelable(&assetInfoObj)) {
570         LOGE("Failed to send the bundle assetInfo");
571         return E_INVAL_ARG;
572     }
573 
574     auto remote = Remote();
575     if (!remote) {
576         LOGE("remote is nullptr");
577         return E_BROKEN_IPC;
578     }
579     int32_t ret = remote->SendRequest(
580         static_cast<uint32_t>(CloudFileSyncServiceInterfaceCode::SERVICE_CMD_DOWNLOAD_FILE), data, reply, option);
581     if (ret != E_OK) {
582         LOGE("Failed to send out the requeset, errno: %{pubilc}d", ret);
583         return E_BROKEN_IPC;
584     }
585     LOGI("DownloadFile Success");
586     return reply.ReadInt32();
587 }
588 
GetInstance()589 sptr<ICloudSyncService> CloudSyncServiceProxy::GetInstance()
590 {
591     LOGI("getinstance");
592     unique_lock<mutex> lock(proxyMutex_);
593     if (serviceProxy_ != nullptr) {
594         return serviceProxy_;
595     }
596 
597     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
598     if (samgr == nullptr) {
599         LOGE("Samgr is nullptr");
600         return nullptr;
601     }
602     sptr<ServiceProxyLoadCallback> cloudSyncLoadCallback = new ServiceProxyLoadCallback();
603     if (cloudSyncLoadCallback == nullptr) {
604         LOGE("cloudSyncLoadCallback is nullptr");
605         return nullptr;
606     }
607     int32_t ret = samgr->LoadSystemAbility(FILEMANAGEMENT_CLOUD_SYNC_SERVICE_SA_ID, cloudSyncLoadCallback);
608     if (ret != E_OK) {
609         LOGE("Failed to Load systemAbility, systemAbilityId:%{pulbic}d, ret code:%{pulbic}d",
610              FILEMANAGEMENT_CLOUD_SYNC_SERVICE_SA_ID, ret);
611         return nullptr;
612     }
613     auto waitStatus = cloudSyncLoadCallback->proxyConVar_.wait_for(
614         lock, std::chrono::milliseconds(LOAD_SA_TIMEOUT_MS),
615         [cloudSyncLoadCallback]() { return cloudSyncLoadCallback->isLoadSuccess_.load(); });
616     if (!waitStatus) {
617         LOGE("Load CloudSynd SA timeout");
618         return nullptr;
619     }
620     return serviceProxy_;
621 }
622 
InvaildInstance()623 void CloudSyncServiceProxy::InvaildInstance()
624 {
625     LOGI("invalid instance");
626     unique_lock<mutex> lock(proxyMutex_);
627     serviceProxy_ = nullptr;
628 }
629 
OnLoadSystemAbilitySuccess(int32_t systemAbilityId,const sptr<IRemoteObject> & remoteObject)630 void CloudSyncServiceProxy::ServiceProxyLoadCallback::OnLoadSystemAbilitySuccess(
631     int32_t systemAbilityId,
632     const sptr<IRemoteObject> &remoteObject)
633 {
634     LOGI("Load CloudSync SA success,systemAbilityId:%{public}d, remoteObj result:%{private}s", systemAbilityId,
635          (remoteObject == nullptr ? "false" : "true"));
636     unique_lock<mutex> lock(proxyMutex_);
637     serviceProxy_ = iface_cast<ICloudSyncService>(remoteObject);
638     isLoadSuccess_.store(true);
639     proxyConVar_.notify_one();
640 }
641 
OnLoadSystemAbilityFail(int32_t systemAbilityId)642 void CloudSyncServiceProxy::ServiceProxyLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
643 {
644     LOGI("Load CloudSync SA failed,systemAbilityId:%{public}d", systemAbilityId);
645     unique_lock<mutex> lock(proxyMutex_);
646     serviceProxy_ = nullptr;
647     isLoadSuccess_.store(false);
648     proxyConVar_.notify_one();
649 }
650 } // namespace OHOS::FileManagement::CloudSync
651