From e147420498fa42e83853bd8a5789773d48c14f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=9B=BD=E5=87=AF?= Date: Wed, 17 Jul 2024 14:24:43 +0800 Subject: [PATCH] add sys param for medialibrary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 徐国凯 --- .../native/cloud_file_kit_inner/data_sync_const.h | 8 ++++++++ services/cloudsyncservice.para | 3 ++- services/cloudsyncservice.para.dac | 3 ++- services/cloudsyncservice/src/ipc/cloud_sync_service.cpp | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) 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 0733e676e..0667b09e2 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 07becc391..ec68c1c0e 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 e3d317e3e..1f6bfa826 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 83e284594..2f19f01a2 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); } -- Gitee