diff --git a/interfaces/inner_api/native/cloud_file_kit_inner/data_sync_const.h b/interfaces/inner_api/native/cloud_file_kit_inner/data_sync_const.h index 0733e676e0508a31817d75c5539d2f06dd333088..0667b09e2d37cde8daa08a1571df96316bc2686c 100644 --- a/interfaces/inner_api/native/cloud_file_kit_inner/data_sync_const.h +++ b/interfaces/inner_api/native/cloud_file_kit_inner/data_sync_const.h @@ -65,6 +65,14 @@ const int64_t MILLISECOND_TO_NANOSECOND = 1e6; const std::string GALLERY_BUNDLE_NAME = "com.ohos.photos"; const std::string MEDIALIBRARY_BUNDLE_NAME = "com.ohos.medialibrary.medialibrarydata"; +static const std::string CLOUDSYNC_STATUS_KEY = "persist.kernel.cloudsync.status"; +static const std::string CLOUDSYNC_STATUS_LOGOUT = "0"; +static const std::string CLOUDSYNC_STATUS_START = "1"; +static const std::string CLOUDSYNC_STATUS_INC_SYNC = "2"; +static const std::string CLOUDSYNC_STATUS_FULL_SYNC = "3"; +static const std::string CLOUDSYNC_STATUS_FINISH = "4"; +static const std::string CLOUDSYNC_STATUS_SWITCHOFF = "5"; + static inline uint64_t GetCurrentTimeStamp() { struct timespec t; diff --git a/services/cloudsyncservice.para b/services/cloudsyncservice.para index 07becc39144e158a11673b50c03e2b9b2043879f..ec68c1c0e81b0bb4264796b142ee51c094004b39 100644 --- a/services/cloudsyncservice.para +++ b/services/cloudsyncservice.para @@ -12,4 +12,5 @@ # limitations under the License. persist.kernel.cloudsync.network_unavailable = false -persist.kernel.cloudsync.battery_level_low = false \ No newline at end of file +persist.kernel.cloudsync.battery_level_low = false +persist.kernel.cloudsync.status = 0 \ No newline at end of file diff --git a/services/cloudsyncservice.para.dac b/services/cloudsyncservice.para.dac index e3d317e3ed9bcea9dd4ba4edb114d7c27d21362d..1f6bfa826a76b80c1006d2c48d44396e6f27de10 100644 --- a/services/cloudsyncservice.para.dac +++ b/services/cloudsyncservice.para.dac @@ -12,4 +12,5 @@ # limitations under the License. persist.kernel.cloudsync.network_unavailable = dfs:samgr:0640 -persist.kernel.cloudsync.battery_level_low = dfs:samgr:0640 \ No newline at end of file +persist.kernel.cloudsync.battery_level_low = dfs:samgr:0640 +persist.kernel.cloudsync.status = dfs:user_data_rw:0640 \ No newline at end of file diff --git a/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp b/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp index 83e284594b00e7c8d271cba39b597b2cefd9301e..2f19f01a2dff3d6006bb6d53d1fe817d57c31a3f 100644 --- a/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp +++ b/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp @@ -29,6 +29,7 @@ #include "ipc/download_asset_callback_manager.h" #include "meta_file.h" #include "net_conn_callback_observer.h" +#include "parameters.h" #include "periodic_check_task.h" #include "plugin_loader.h" #include "network_status.h" @@ -400,6 +401,7 @@ int32_t CloudSyncService::ChangeAppSwitch(const std::string &accoutId, const std if (status) { return dataSyncManager_->TriggerStartSync(bundleName, callerUserId, false, SyncTriggerType::CLOUD_TRIGGER); } else { + system::SetParameter(CLOUDSYNC_STATUS_KEY, CLOUDSYNC_STATUS_SWITCHOFF); return dataSyncManager_->TriggerStopSync(bundleName, callerUserId, SyncTriggerType::CLOUD_TRIGGER); } } @@ -431,6 +433,7 @@ int32_t CloudSyncService::NotifyEventChange(int32_t userId, const std::string &e int32_t CloudSyncService::DisableCloud(const std::string &accoutId) { auto callerUserId = DfsuAccessTokenHelper::GetUserId(); + system::SetParameter(CLOUDSYNC_STATUS_KEY, CLOUDSYNC_STATUS_LOGOUT); return dataSyncManager_->DisableCloud(callerUserId); }