!2292 云图滑动浏览性能优化开发

Merge pull request !2292 from 魏子恒/new
This commit is contained in:
openharmony_ci 2024-11-18 13:56:29 +00:00 committed by Gitee
commit a544ea61c8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 39 additions and 16 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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");

View File

@ -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;
}

View File

@ -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));