From 49de8499b8ca9260214d9746da076e4de5de53bf Mon Sep 17 00:00:00 2001 From: fengjq Date: Sun, 31 Aug 2025 19:27:09 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=B8=9C=E6=B9=96=E4=BA=92=E9=80=9A?= =?UTF-8?q?=E3=80=91=E5=A2=9E=E5=8A=A0media=5Frw=E7=BE=A4=E7=BB=84;?= =?UTF-8?q?=E6=89=A9=E5=B1=95BatchCleanFile=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fengjq --- .../cloudsync_kit_inner/src/cloud_sync_common.cpp | 4 ++++ .../native/cloudsync_kit_inner/cloud_sync_common.h | 12 +++++++++--- .../kits/js/cloudfilesync/cloud_file_cache_napi.cpp | 2 +- interfaces/kits/js/cloudfilesync/cloud_file_napi.cpp | 2 +- .../kits/js/cloudfilesync/download_progress_napi.h | 3 ++- services/cloudfiledaemon.cfg | 2 +- .../cloudsyncservice/src/ipc/cloud_sync_service.cpp | 3 ++- services/distributedfile.cfg | 2 +- 8 files changed, 21 insertions(+), 9 deletions(-) diff --git a/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp b/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp index 275ec97f5..5dce6df92 100644 --- a/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp +++ b/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp @@ -648,6 +648,8 @@ bool CleanFileInfoObj::ReadFromParcel(Parcel &parcel) parcel.ReadString(path); parcel.ReadString(fileName); parcel.ReadStringVector(&attachment); + parcel.ReadString(storagePath); + parcel.ReadInt32(fileSourceType); return true; } @@ -659,6 +661,8 @@ bool CleanFileInfoObj::Marshalling(Parcel &parcel) const parcel.WriteString(path); parcel.WriteString(fileName); parcel.WriteStringVector(attachment); + parcel.WriteString(storagePath); + parcel.WriteInt32(fileSourceType); return true; } diff --git a/interfaces/inner_api/native/cloudsync_kit_inner/cloud_sync_common.h b/interfaces/inner_api/native/cloudsync_kit_inner/cloud_sync_common.h index 508b18c67..65a72310d 100644 --- a/interfaces/inner_api/native/cloudsync_kit_inner/cloud_sync_common.h +++ b/interfaces/inner_api/native/cloudsync_kit_inner/cloud_sync_common.h @@ -177,11 +177,13 @@ struct AssetInfoObj : public Parcelable { struct CleanFileInfo { std::string cloudId; - int64_t size; - int64_t modifiedTime; + int64_t size{0}; + int64_t modifiedTime{0}; std::string path; std::string fileName; std::vector attachment; + std::string storagePath; + int32_t fileSourceType{0}; }; struct CleanFileInfoObj : public Parcelable { @@ -191,6 +193,8 @@ struct CleanFileInfoObj : public Parcelable { std::string path; std::string fileName; std::vector attachment; + std::string storagePath; + int32_t fileSourceType; bool ReadFromParcel(Parcel &parcel); bool Marshalling(Parcel &parcel) const override; static CleanFileInfoObj *Unmarshalling(Parcel &parcel); @@ -202,7 +206,9 @@ struct CleanFileInfoObj : public Parcelable { modifiedTime(FileInfo.modifiedTime), path(FileInfo.path), fileName(FileInfo.fileName), - attachment(FileInfo.attachment) + attachment(FileInfo.attachment), + storagePath(FileInfo.storagePath), + fileSourceType(FileInfo.fileSourceType) { } }; diff --git a/interfaces/kits/js/cloudfilesync/cloud_file_cache_napi.cpp b/interfaces/kits/js/cloudfilesync/cloud_file_cache_napi.cpp index 4dcdafeaa..b3f80f7fd 100644 --- a/interfaces/kits/js/cloudfilesync/cloud_file_cache_napi.cpp +++ b/interfaces/kits/js/cloudfilesync/cloud_file_cache_napi.cpp @@ -44,7 +44,7 @@ int32_t CloudFileCacheCallbackImplNapi::StartDownloadInner(const std::string &ur LOGE("Start single download failed! ret = %{public}d", ret); return ret; } - downloadInfos_[downloadId] = std::make_shared(downloadId); + downloadInfos_[downloadId] = std::make_shared(downloadId, uri); return ret; } diff --git a/interfaces/kits/js/cloudfilesync/cloud_file_napi.cpp b/interfaces/kits/js/cloudfilesync/cloud_file_napi.cpp index 31d7d4e83..cd5c1a3ed 100644 --- a/interfaces/kits/js/cloudfilesync/cloud_file_napi.cpp +++ b/interfaces/kits/js/cloudfilesync/cloud_file_napi.cpp @@ -40,7 +40,7 @@ int32_t CloudDownloadCallbackImplNapi::StartDownloadInner(const std::string &uri return ret; } - downloadInfos_[downloadId] = std::make_shared(downloadId); + downloadInfos_[downloadId] = std::make_shared(downloadId, uri); return ret; } diff --git a/interfaces/kits/js/cloudfilesync/download_progress_napi.h b/interfaces/kits/js/cloudfilesync/download_progress_napi.h index 3d54400ec..9aa5c243a 100644 --- a/interfaces/kits/js/cloudfilesync/download_progress_napi.h +++ b/interfaces/kits/js/cloudfilesync/download_progress_napi.h @@ -76,7 +76,8 @@ protected: class SingleProgressNapi : public DlProgressNapi { public: - explicit SingleProgressNapi(int64_t downloadId) : DlProgressNapi(downloadId) {} + SingleProgressNapi(int64_t downloadId, const std::string &uri) + : DlProgressNapi(downloadId), uri_(uri) {} void Update(const DownloadProgressObj &progress) override; napi_value ConvertToValue(napi_env env) override; std::shared_ptr CreateNewObject() override; diff --git a/services/cloudfiledaemon.cfg b/services/cloudfiledaemon.cfg index 036a50c65..0d99072d0 100644 --- a/services/cloudfiledaemon.cfg +++ b/services/cloudfiledaemon.cfg @@ -3,7 +3,7 @@ "name": "cloudfiledaemon", "path": ["/system/bin/sa_main", "/system/profile/cloudfiledaemon.json"], "uid": "1009", - "gid": ["dfs", "user_data_rw", "ddms", "dfs_share", "readproc"], + "gid": ["dfs", "user_data_rw", "ddms", "media_rw", "dfs_share", "readproc"], "caps": ["CHOWN"], "sandbox": 0, "secon": "u:r:cloudfiledaemon:s0", diff --git a/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp b/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp index a353e07ce..b7a09422f 100644 --- a/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp +++ b/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp @@ -1072,7 +1072,8 @@ int32_t CloudSyncService::BatchCleanFile(const std::vector &fi std::vector cleanFilesInfo; for (const auto &obj : fileInfo) { - CleanFileInfo tmpFileInfo{obj.cloudId, obj.size, obj.modifiedTime, obj.path, obj.fileName, obj.attachment}; + CleanFileInfo tmpFileInfo{obj.cloudId, obj.size, obj.modifiedTime, obj.path, obj.fileName, obj.attachment, + obj.storagePath, obj.fileSourceType}; cleanFilesInfo.emplace_back(tmpFileInfo); } diff --git a/services/distributedfile.cfg b/services/distributedfile.cfg index e59489ab8..edbfda351 100644 --- a/services/distributedfile.cfg +++ b/services/distributedfile.cfg @@ -37,7 +37,7 @@ "name": "cloudfileservice", "path": ["/system/bin/sa_main", "/system/profile/cloudfileservice.json"], "uid": "dfs", - "gid": ["dfs", "user_data_rw", "ddms", "dfs_share"], + "gid": ["dfs", "user_data_rw", "media_rw", "ddms", "dfs_share"], "caps": ["CHOWN"], "sandbox": 0, "jobs" : { -- Gitee