mirror of
https://gitee.com/openharmony/filemanagement_dfs_service
synced 2024-11-27 02:00:31 +00:00
commit
a544ea61c8
@ -67,7 +67,7 @@ int32_t DataSyncManager::IsSkipSync(const std::string &bundleName, const int32_t
|
||||
|
||||
int32_t DataSyncManager::StartDownloadFile(const BundleNameUserInfo &bundleNameUserInfo,
|
||||
const std::vector<std::string> pathVec,
|
||||
int64_t &downloadId)
|
||||
int64_t &downloadId, std::bitset<FIELD_KEY_MAX_SIZE> fieldkey)
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ public:
|
||||
int32_t DisableCloud(const std::string &accoutId) override;
|
||||
int32_t StartDownloadFile(const std::string &uri) override;
|
||||
int32_t StartFileCache(const std::string &uri) override;
|
||||
int32_t StartFileCache(const std::vector<std::string> &uriVec, int64_t &downloadId) override;
|
||||
int32_t StartFileCache(const std::vector<std::string> &uriVec, int64_t &downloadId,
|
||||
std::bitset<FIELD_KEY_MAX_SIZE> fieldkey = FIELDKEY_CONTENT) override;
|
||||
int32_t StopDownloadFile(const std::string &uri, bool needClean = false) override;
|
||||
int32_t StopFileCache(const int64_t &downloadId, bool needClean = false) override;
|
||||
int32_t RegisterDownloadFileCallback(const std::shared_ptr<CloudDownloadCallback> downloadCallback) override;
|
||||
|
@ -43,7 +43,8 @@ public:
|
||||
int32_t DisableCloud(const std::string &accoutId) override;
|
||||
int32_t StartDownloadFile(const std::string &uri) override;
|
||||
int32_t StartFileCache(const std::vector<std::string> &uriVec,
|
||||
int64_t &downloadId) override;
|
||||
int64_t &downloadId,
|
||||
std::bitset<FIELD_KEY_MAX_SIZE> fieldkey = FIELDKEY_CONTENT) override;
|
||||
int32_t StopDownloadFile(const std::string &uri, bool needClean = false) override;
|
||||
int32_t StopFileCache(const int64_t &downloadId, bool needClean = false) override;
|
||||
int32_t RegisterDownloadFileCallback(const sptr<IRemoteObject> &downloadCallback) override;
|
||||
|
@ -243,7 +243,8 @@ int32_t CloudSyncManagerImpl::StartFileCache(const std::string &uri)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t CloudSyncManagerImpl::StartFileCache(const std::vector<std::string> &uriVec, int64_t &downloadId)
|
||||
int32_t CloudSyncManagerImpl::StartFileCache(const std::vector<std::string> &uriVec,
|
||||
int64_t &downloadId, std::bitset<FIELD_KEY_MAX_SIZE> fieldkey)
|
||||
{
|
||||
LOGI("StartFileCache batch start, uriVec size: %{public}zu", uriVec.size());
|
||||
if (uriVec.empty()) {
|
||||
@ -260,7 +261,7 @@ int32_t CloudSyncManagerImpl::StartFileCache(const std::vector<std::string> &uri
|
||||
return E_SA_LOAD_FAILED;
|
||||
}
|
||||
SetDeathRecipient(CloudSyncServiceProxy->AsObject());
|
||||
int32_t ret = CloudSyncServiceProxy->StartFileCache(uriVec, downloadId);
|
||||
int32_t ret = CloudSyncServiceProxy->StartFileCache(uriVec, downloadId, fieldkey);
|
||||
LOGI("StartFileCache batch ret %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ int32_t CloudSyncServiceProxy::StartDownloadFile(const std::string &uri)
|
||||
}
|
||||
|
||||
int32_t CloudSyncServiceProxy::StartFileCache(const std::vector<std::string> &uriVec,
|
||||
int64_t &downloadId)
|
||||
int64_t &downloadId, std::bitset<FIELD_KEY_MAX_SIZE> fieldkey)
|
||||
{
|
||||
LOGI("StartFileCache Start");
|
||||
MessageParcel data;
|
||||
@ -632,6 +632,11 @@ int32_t CloudSyncServiceProxy::StartFileCache(const std::vector<std::string> &ur
|
||||
LOGE("Failed to send the cloud id");
|
||||
return E_INVAL_ARG;
|
||||
}
|
||||
int32_t intValue = static_cast<int32_t>(fieldkey.to_ulong());
|
||||
if (!data.WriteInt32(intValue)) {
|
||||
LOGE("Failed to send the fieldkey");
|
||||
return E_INVAL_ARG;
|
||||
}
|
||||
|
||||
auto remote = Remote();
|
||||
if (!remote) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "cloud_file_sync_service_interface_code.h"
|
||||
#include "cloud_sync_common.h"
|
||||
#include "dfs_error.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "system_ability_definition.h"
|
||||
@ -208,7 +209,7 @@ int32_t CloudSyncServiceProxy::StartDownloadFile(const std::string &uri)
|
||||
}
|
||||
|
||||
int32_t CloudSyncServiceProxy::StartFileCache(const std::vector<std::string> &uriVec,
|
||||
int64_t &downloadId)
|
||||
int64_t &downloadId, std::bitset<FIELD_KEY_MAX_SIZE> fieldkey)
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#ifndef OHOS_CLOUD_FILE_DATA_SYNC_MANAGER_H
|
||||
#define OHOS_CLOUD_FILE_DATA_SYNC_MANAGER_H
|
||||
|
||||
#include <bitset>
|
||||
#include <memory>
|
||||
|
||||
#include "data_sync_const.h"
|
||||
@ -46,7 +47,8 @@ public:
|
||||
virtual int32_t IsSkipSync(const std::string &bundleName, const int32_t userId, bool forceFlag);
|
||||
virtual int32_t StartDownloadFile(const BundleNameUserInfo &bundleNameUserInfo,
|
||||
const std::vector<std::string> pathVec,
|
||||
int64_t &downloadId);
|
||||
int64_t &downloadId,
|
||||
std::bitset<FIELD_KEY_MAX_SIZE> fieldkey = CloudSync::FIELDKEY_CONTENT);
|
||||
virtual int32_t StopDownloadFile(const BundleNameUserInfo &bundleNameUserInfo,
|
||||
const std::string path,
|
||||
bool needClean = false);
|
||||
|
@ -16,12 +16,19 @@
|
||||
#ifndef OHOS_FILEMGMT_CLOUD_SYNC_COMMON_H
|
||||
#define OHOS_FILEMGMT_CLOUD_SYNC_COMMON_H
|
||||
|
||||
#include <bitset>
|
||||
#include <map>
|
||||
|
||||
#include "parcel.h"
|
||||
#include "cloud_sync_asset_manager.h"
|
||||
|
||||
namespace OHOS::FileManagement::CloudSync {
|
||||
#define FIELD_KEY_MAX_SIZE 4
|
||||
enum FieldKey {
|
||||
FIELDKEY_CONTENT = 1 << 0,
|
||||
FIELDKEY_THUMB = 1 << 1,
|
||||
FIELDKEY_LCD = 1 << 2,
|
||||
};
|
||||
|
||||
struct DownloadProgressObj : public Parcelable {
|
||||
enum Status : int32_t {
|
||||
|
@ -105,7 +105,8 @@ public:
|
||||
virtual int32_t Clean(const std::string &accountId, const CleanOptions &cleanOptions) = 0;
|
||||
virtual int32_t StartDownloadFile(const std::string &path) = 0;
|
||||
virtual int32_t StartFileCache(const std::string &path) = 0;
|
||||
virtual int32_t StartFileCache(const std::vector<std::string> &pathVec, int64_t &downloadId) = 0;
|
||||
virtual int32_t StartFileCache(const std::vector<std::string> &pathVec, int64_t &downloadId,
|
||||
std::bitset<FIELD_KEY_MAX_SIZE> fieldkey = FIELDKEY_CONTENT) = 0;
|
||||
virtual int32_t StopDownloadFile(const std::string &path, bool needClean = false) = 0;
|
||||
virtual int32_t StopFileCache(const int64_t &downloadId, bool needClean = false) = 0;
|
||||
virtual int32_t RegisterDownloadFileCallback(const std::shared_ptr<CloudDownloadCallback> downloadCallback) = 0;
|
||||
|
@ -42,7 +42,8 @@ public:
|
||||
virtual int32_t DisableCloud(const std::string &accoutId) = 0;
|
||||
virtual int32_t StartDownloadFile(const std::string &path) = 0;
|
||||
virtual int32_t StartFileCache(const std::vector<std::string> &pathVec,
|
||||
int64_t &downloadId) = 0;
|
||||
int64_t &downloadId,
|
||||
std::bitset<FIELD_KEY_MAX_SIZE> fieldkey = FIELDKEY_CONTENT) = 0;
|
||||
virtual int32_t StopDownloadFile(const std::string &path, bool needClean = false) = 0;
|
||||
virtual int32_t StopFileCache(const int64_t &downloadId, bool needClean = false) = 0;
|
||||
virtual int32_t RegisterDownloadFileCallback(const sptr<IRemoteObject> &downloadCallback) = 0;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
int32_t DisableCloud(const std::string &accoutId) override;
|
||||
int32_t StartDownloadFile(const std::string &path) override;
|
||||
int32_t StartFileCache(const std::vector<std::string> &uriVec,
|
||||
int64_t &downloadId) override;
|
||||
int64_t &downloadId, std::bitset<FIELD_KEY_MAX_SIZE> fieldkey = FIELDKEY_CONTENT) override;
|
||||
int32_t StopDownloadFile(const std::string &path, bool needClean = false) override;
|
||||
int32_t StopFileCache(const int64_t &downloadId, bool needClean = false) override;
|
||||
int32_t RegisterDownloadFileCallback(const sptr<IRemoteObject> &downloadCallback) override;
|
||||
|
@ -516,7 +516,7 @@ int32_t CloudSyncService::Clean(const std::string &accountId, const CleanOptions
|
||||
return E_OK;
|
||||
}
|
||||
int32_t CloudSyncService::StartFileCache(const std::vector<std::string> &uriVec,
|
||||
int64_t &downloadId)
|
||||
int64_t &downloadId, std::bitset<FIELD_KEY_MAX_SIZE> fieldkey)
|
||||
{
|
||||
BundleNameUserInfo bundleNameUserInfo;
|
||||
int ret = GetBundleNameUserInfo(bundleNameUserInfo);
|
||||
@ -525,7 +525,7 @@ int32_t CloudSyncService::StartFileCache(const std::vector<std::string> &uriVec,
|
||||
return ret;
|
||||
}
|
||||
LOGI("start StartFileCache");
|
||||
return dataSyncManager_->StartDownloadFile(bundleNameUserInfo, uriVec, downloadId);
|
||||
return dataSyncManager_->StartDownloadFile(bundleNameUserInfo, uriVec, downloadId, fieldkey);
|
||||
}
|
||||
|
||||
int32_t CloudSyncService::StartDownloadFile(const std::string &path)
|
||||
|
@ -378,6 +378,7 @@ int32_t CloudSyncServiceStub::HandleStartFileCache(MessageParcel &data, MessageP
|
||||
LOGE("Failed to get the cloud id.");
|
||||
return E_INVAL_ARG;
|
||||
}
|
||||
int32_t fieldkey = data.ReadInt32();
|
||||
|
||||
if (!DfsuAccessTokenHelper::CheckCallerPermission(PERM_AUTH_URI)) {
|
||||
for (auto &uri : pathVec) {
|
||||
@ -388,7 +389,7 @@ int32_t CloudSyncServiceStub::HandleStartFileCache(MessageParcel &data, MessageP
|
||||
}
|
||||
}
|
||||
int64_t downloadId = 0;
|
||||
int32_t res = StartFileCache(pathVec, downloadId);
|
||||
int32_t res = StartFileCache(pathVec, downloadId, fieldkey);
|
||||
reply.WriteInt64(downloadId);
|
||||
reply.WriteInt32(res);
|
||||
LOGI("End HandleStartFileCache");
|
||||
|
@ -101,7 +101,8 @@ public:
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
int32_t StartFileCache(const std::vector<std::string> &pathVec, int64_t &downloadId)
|
||||
int32_t StartFileCache(const std::vector<std::string> &pathVec, int64_t &downloadId,
|
||||
std::bitset<FIELD_KEY_MAX_SIZE> fieldkey)
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
|
@ -45,7 +45,8 @@ public:
|
||||
MOCK_METHOD2(EnableCloud, int32_t(const std::string &accoutId, const SwitchDataObj &switchData));
|
||||
MOCK_METHOD1(DisableCloud, int32_t(const std::string &accoutId));
|
||||
MOCK_METHOD1(StartDownloadFile, int32_t(const std::string &path));
|
||||
MOCK_METHOD2(StartFileCache, int32_t(const std::vector<std::string> &pathVec, int64_t &downloadId));
|
||||
MOCK_METHOD3(StartFileCache, int32_t(const std::vector<std::string> &pathVec, int64_t &downloadId,
|
||||
std::bitset<FIELD_KEY_MAX_SIZE> fieldkey));
|
||||
MOCK_METHOD2(StopDownloadFile, int32_t(const std::string &path, bool needClean));
|
||||
MOCK_METHOD2(StopFileCache, int32_t(const int64_t &downloadId, bool needClean));
|
||||
MOCK_METHOD1(RegisterDownloadFileCallback, int32_t(const sptr<IRemoteObject> &downloadCallback));
|
||||
|
Loading…
Reference in New Issue
Block a user