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 275ec97f51720aba189c6a1252121cb8d89d5b28..8e97eafa8d9bdf779c143d81c3e2c3bd2806c9f2 100644 --- a/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp +++ b/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp @@ -642,23 +642,75 @@ AssetInfoObj *AssetInfoObj::Unmarshalling(Parcel &parcel) bool CleanFileInfoObj::ReadFromParcel(Parcel &parcel) { - parcel.ReadString(cloudId); - parcel.ReadInt64(size); - parcel.ReadInt64(modifiedTime); - parcel.ReadString(path); - parcel.ReadString(fileName); - parcel.ReadStringVector(&attachment); + if (!parcel.ReadInt64(size)) { + LOGE("failed to read size"); + return false; + } + if (!parcel.ReadInt64(modifiedTime)) { + LOGE("failed to read modifiedTime"); + return false; + } + if (!parcel.ReadInt32(fileSourceType)) { + LOGE("failed to read fileSourceType"); + return false; + } + if (!parcel.ReadString(cloudId)) { + LOGE("failed to read cloudId"); + return false; + } + if (!parcel.ReadString(path)) { + LOGE("failed to read path"); + return false; + } + if (!parcel.ReadString(fileName)) { + LOGE("failed to read fileName"); + return false; + } + if (!parcel.ReadString(storagePath)) { + LOGE("failed to read storagePath"); + return false; + } + if (!parcel.ReadStringVector(&attachment)) { + LOGE("failed to read attachment"); + return false; + } return true; } bool CleanFileInfoObj::Marshalling(Parcel &parcel) const { - parcel.WriteString(cloudId); - parcel.WriteInt64(size); - parcel.WriteInt64(modifiedTime); - parcel.WriteString(path); - parcel.WriteString(fileName); - parcel.WriteStringVector(attachment); + if (!parcel.WriteInt64(size)) { + LOGE("failed to write size"); + return false; + } + if (!parcel.WriteInt64(modifiedTime)) { + LOGE("failed to write modifiedTime"); + return false; + } + if (!parcel.WriteInt32(fileSourceType)) { + LOGE("failed to write fileSourceType"); + return false; + } + if (!parcel.WriteString(cloudId)) { + LOGE("failed to write cloudId"); + return false; + } + if (!parcel.WriteString(path)) { + LOGE("failed to write path"); + return false; + } + if (!parcel.WriteString(fileName)) { + LOGE("failed to write fileName"); + return false; + } + if (!parcel.WriteString(storagePath)) { + LOGE("failed to write storagePath"); + return false; + } + if (!parcel.WriteStringVector(attachment)) { + LOGE("failed to write attachment"); + return false; + } 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 508b18c679f18a26edc9c7c223cec711bf1b7b09..5db0ae49fd1b524b47f39b0b06c0c1ebb7676df0 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 @@ -176,20 +176,24 @@ struct AssetInfoObj : public Parcelable { }; struct CleanFileInfo { + int64_t size{0}; + int64_t modifiedTime{0}; + int32_t fileSourceType{0}; std::string cloudId; - int64_t size; - int64_t modifiedTime; std::string path; std::string fileName; + std::string storagePath; std::vector attachment; }; struct CleanFileInfoObj : public Parcelable { + int64_t size{0}; + int64_t modifiedTime{0}; + int32_t fileSourceType{0}; std::string cloudId; - int64_t size; - int64_t modifiedTime; std::string path; std::string fileName; + std::string storagePath; std::vector attachment; bool ReadFromParcel(Parcel &parcel); bool Marshalling(Parcel &parcel) const override; @@ -197,11 +201,13 @@ struct CleanFileInfoObj : public Parcelable { CleanFileInfoObj() = default; CleanFileInfoObj(const CleanFileInfo &FileInfo) - : cloudId(FileInfo.cloudId), - size(FileInfo.size), + : size(FileInfo.size), modifiedTime(FileInfo.modifiedTime), + fileSourceType(FileInfo.fileSourceType), + cloudId(FileInfo.cloudId), path(FileInfo.path), fileName(FileInfo.fileName), + storagePath(FileInfo.storagePath) attachment(FileInfo.attachment) { } diff --git a/services/cloudfiledaemon.cfg b/services/cloudfiledaemon.cfg index 036a50c65eda23b5341dc1b316b6a0b5046a0daa..cc60ee4c7f52fd83ff53738b16e25e05b86d4ad9 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", "dfs_share", "media_rw", "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 e69e673681bc568d20321d9ba14cfb54c064cdfe..11161184cd30fae50869b478e744bf49853835b9 100644 --- a/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp +++ b/services/cloudsyncservice/src/ipc/cloud_sync_service.cpp @@ -1078,7 +1078,10 @@ 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.size, obj.modifiedTime, obj.fileSourceType, obj.cloudId, obj.path, obj.fileName, + obj.storagePath, obj.attachment, + }; cleanFilesInfo.emplace_back(tmpFileInfo); } diff --git a/services/distributedfile.cfg b/services/distributedfile.cfg index e59489ab86f73b657693f251cfd513efb43c3461..11fe2c37efc9fca9610467de0f93e2d7e8b525c7 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", "ddms", "dfs_share", "media_rw"], "caps": ["CHOWN"], "sandbox": 0, "jobs" : { diff --git a/test/unittests/cloudsync_api/cloudsync_impl/cloud_sync_common_test.cpp b/test/unittests/cloudsync_api/cloudsync_impl/cloud_sync_common_test.cpp index 0211865579562b2565c3dfce98262da47dcc8632..e1479ae2eb10c1295628b641bf7e3b81d9409878 100644 --- a/test/unittests/cloudsync_api/cloudsync_impl/cloud_sync_common_test.cpp +++ b/test/unittests/cloudsync_api/cloudsync_impl/cloud_sync_common_test.cpp @@ -1089,6 +1089,7 @@ HWTEST_F(CloudSyncCommonTest, UnmarshallingTest2, TestSize.Level1) { GTEST_LOG_(INFO) << "UnmarshallingTest2 Start"; try { + // ToDo: 待修改 auto Info = make_shared(); Parcel parcel; bool returnValues[3] = {true, true, true};