!775 增量备份StorageDaemon侧增量文件识别逻辑

Merge pull request !775 from yangjingbo/backupIncreaseNew
This commit is contained in:
openharmony_ci 2024-01-30 06:25:07 +00:00 committed by Gitee
commit 50c7433676
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
34 changed files with 313 additions and 6 deletions

View File

@ -93,6 +93,8 @@ public:
}
virtual int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) = 0;
virtual int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes) = 0;
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.StorageManager.IStorageManager");
};

View File

@ -77,6 +77,7 @@ namespace StorageManager {
SET_BUNDLE_QUOTA,
GET_USER_STATS_BY_TYPE,
UPDATE_MEM_PARA,
GET_BUNDLE_STATS_INCREASE,
};
} // namespace StorageManager
} // namespace OHOS

View File

@ -83,6 +83,8 @@ public:
int32_t limitSizeMb) override;
int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) override;
int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes) override;
private:
static inline BrokerDelegator<StorageManagerProxy> delegator_;
int32_t SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);

View File

@ -28,6 +28,33 @@ const uid_t USER_ID_BASE = 200000;
namespace StorageDaemon {
constexpr uint32_t GLOBAL_USER_ID = 0;
constexpr char FILE_SEPARATOR_CHAR = '/';
static const std::string FILE_CONTENT_SEPARATOR = ";";
static const std::string WILDCARD_DEFAULT_INCLUDE = "*";
static const std::string BACKUP_PATH_PREFIX = "/data/service/el2/";
static const std::string BACKUP_PATH_SURFFIX = "/backup/backup_sa/";
static const std::string BACKUP_INCEXC_SYMBOL = "incExc_";
static const std::string BACKUP_STAT_SYMBOL = "stat_";
static const std::string BACKUP_INCLUDE = "INCLUDES";
static const std::string BACKUP_EXCLUDE = "EXCLUDES";
static const std::string DEFAULT_PATH_WITH_WILDCARD = "haps/*";
static const std::string BASE_EL1 = "/data/storage/el1/base/";
static const std::string BASE_EL2 = "/data/storage/el2/base/";
static const std::string PHY_APP = "/data/app/";
static const std::string BASE = "/base/";
static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_FILES = "files";
static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_DATABASE = "database";
static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_PREFERENCE = "preferences";
static const std::string URI_PREFIX = "file://";
static const std::string NORMAL_SAND_PREFIX = "/data/storage";
static const std::string FILE_SAND_PREFIX = "/storage/Users";
static const std::string MEDIA_CLOUD_SAND_PREFIX = "/storage/cloud";
static const std::string MEDIA_SAND_PREFIX = "/storage/media";
static const std::string FILE_AUTHORITY = "docs";
// backup stat file version
static const std::string VER_10_LINE1 = "version=1.0&attrNum=7";
static const std::string VER_10_LINE2 = "path;mode;dir;size;mtime;hash;isIncremental";
static const std::string EL1 = "el1";
static const std::string EL2 = "el2";

View File

@ -114,6 +114,8 @@ ohos_executable("storage_daemon") {
"ability_base:want",
"ability_base:zuri",
"app_file_service:fileshare_native",
"app_file_service:fileuri_native",
"app_file_service:sandbox_helper_native",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"hilog:libhilog",

View File

@ -77,6 +77,8 @@ public:
virtual int32_t GetOccupiedSpace(int32_t idType, int32_t id, int64_t &size) = 0;
virtual int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) = 0;
virtual int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes) = 0;
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.StorageDaemon");
};

View File

@ -77,6 +77,8 @@ public:
const std::string &bundleDataDirPath, int32_t limitSizeMb) override;
virtual int32_t GetOccupiedSpace(int32_t idType, int32_t id, int64_t &size) override;
virtual int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) override;
virtual int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes) override;
class SystemAbilityStatusChangeListener : public OHOS::SystemAbilityStatusChangeStub {
public:
SystemAbilityStatusChangeListener() = default;

View File

@ -51,6 +51,7 @@ namespace StorageDaemon {
SET_BUNDLE_QUOTA,
GET_SPACE,
UPDATE_MEM_PARA,
GET_BUNDLE_STATS_INCREASE,
};
} // namespace StorageDaemon
} // namespace OHOS

View File

@ -66,6 +66,8 @@ public:
const std::string &bundleDataDirPath, int32_t limitSizeMb) override;
virtual int32_t GetOccupiedSpace(int32_t idType, int32_t id, int64_t &size) override;
virtual int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) override;
virtual int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes) override;
private:
static inline BrokerDelegator<StorageDaemonProxy> delegator_;
int32_t SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);

View File

@ -69,6 +69,8 @@ private:
int32_t HandleSetBundleQuota(MessageParcel &data, MessageParcel &reply);
int32_t HandleGetOccupiedSpace(MessageParcel &data, MessageParcel &reply);
int32_t HandleUpdateMemoryPara(MessageParcel &data, MessageParcel &reply);
int32_t HandleGetBundleStatsForIncrease(MessageParcel &data, MessageParcel &reply);
};
} // StorageDaemon
} // OHOS

View File

@ -17,11 +17,26 @@
#define OHOS_STORAGE_DAEMON_QUOTA_MANAGER_H
#include <nocopyable.h>
#include <set>
#include <sys/types.h>
#include <string>
#include <vector>
namespace OHOS {
namespace StorageDaemon {
struct FileStat {
std::string filePath;
int64_t fileSize;
int64_t lastUpdateTime;
int32_t mode;
bool isDir;
bool isIncre;
};
struct BundleStatsParas {
uint32_t userId;
std::string &bundleName;
int64_t lastBackupTime;
};
class QuotaManager final {
public:
virtual ~QuotaManager() = default;
@ -31,6 +46,8 @@ public:
const std::string &bundleDataDirPath, int32_t limitSizeMb);
int32_t GetOccupiedSpace(int32_t idType, int32_t id, int64_t &size);
int32_t SetQuotaPrjId(const std::string &path, int32_t prjId, bool inherit);
int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes);
private:
QuotaManager() = default;
DISALLOW_COPY_AND_MOVE(QuotaManager);

View File

@ -32,6 +32,7 @@
#include "storage_service_log.h"
#include "user/user_manager.h"
#include "user/mount_manager.h"
#include "utils/file_utils.h"
#include "system_ability_definition.h"
#include "file_share.h"
#ifdef DFS_SERVICE
@ -39,7 +40,6 @@
#endif
#ifdef USER_CRYPTO_MIGRATE_KEY
#include "string_ex.h"
#include "utils/file_utils.h"
#include <filesystem>
#endif
@ -56,6 +56,7 @@ static const std::string VFS_CACHE_PRESSURE = "/proc/sys/vm/vfs_cache_pressure";
typedef int32_t (*CreateShareFileFunc)(const std::vector<std::string> &, uint32_t, uint32_t, std::vector<int32_t> &);
typedef int32_t (*DeleteShareFileFunc)(uint32_t, const std::vector<std::string> &);
int32_t StorageDaemon::Shutdown()
{
return E_OK;
@ -590,6 +591,13 @@ int32_t StorageDaemon::GetOccupiedSpace(int32_t idType, int32_t id, int64_t &siz
return QuotaManager::GetInstance()->GetOccupiedSpace(idType, id, size);
}
int32_t StorageDaemon::GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes)
{
return QuotaManager::GetInstance()->GetBundleStatsForIncrease(userId, bundleNames, incrementalBackTimes,
pkgFileSizes);
}
static bool ReadFileToString(const std::string& pathInst, std::string& oldContent)
{
std::fstream fd;

View File

@ -676,6 +676,47 @@ int32_t StorageDaemonProxy::GetOccupiedSpace(int32_t idType, int32_t id, int64_t
return E_OK;
}
int32_t StorageDaemonProxy::GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes)
{
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageDaemonProxy::GetDescriptor())) {
return E_WRITE_DESCRIPTOR_ERR;
}
if (!data.WriteInt32(userId)) {
return E_WRITE_PARCEL_ERR;
}
if (!data.WriteStringVector(bundleNames)) {
return E_WRITE_PARCEL_ERR;
}
if (!data.WriteInt64Vector(incrementalBackTimes)) {
return E_WRITE_PARCEL_ERR;
}
int err = SendRequest(static_cast<int32_t>(StorageDaemonInterfaceCode::GET_BUNDLE_STATS_INCREASE), data, reply,
option);
if (err != E_OK) {
LOGE("StorageDaemonProxy::SendRequest call err = %{public}d", err);
return err;
}
err = reply.ReadInt32();
if (err != E_OK) {
LOGE("StorageDaemonProxy::SendRequest reply.ReadInt32() call err = %{public}d", err);
return err;
}
if (!reply.ReadInt64Vector(&pkgFileSizes)) {
LOGE("StorageDaemonProxy::SendRequest read pkgFileSizes");
return E_WRITE_REPLY_ERR;
}
return E_OK;
}
int32_t StorageDaemonProxy::UpdateMemoryPara(int32_t size, int32_t &oldSize)
{
MessageParcel data;

View File

@ -82,6 +82,8 @@ StorageDaemonStub::StorageDaemonStub()
&StorageDaemonStub::HandleGetOccupiedSpace;
opToInterfaceMap_[static_cast<uint32_t>(StorageDaemonInterfaceCode::UPDATE_MEM_PARA)] =
&StorageDaemonStub::HandleUpdateMemoryPara;
opToInterfaceMap_[static_cast<uint32_t>(StorageDaemonInterfaceCode::GET_BUNDLE_STATS_INCREASE)] =
&StorageDaemonStub::HandleGetBundleStatsForIncrease;
}
int32_t StorageDaemonStub::OnRemoteRequest(uint32_t code,
@ -457,5 +459,30 @@ int32_t StorageDaemonStub::HandleUpdateMemoryPara(MessageParcel &data, MessagePa
}
return E_OK;
}
int32_t StorageDaemonStub::HandleGetBundleStatsForIncrease(MessageParcel &data, MessageParcel &reply)
{
uint32_t userId = data.ReadUint32();
std::vector<std::string> bundleNames;
if (!data.ReadStringVector(&bundleNames)) {
return E_WRITE_REPLY_ERR;
}
std::vector<int64_t> incrementalBackTimes;
if (!data.ReadInt64Vector(&incrementalBackTimes)) {
return E_WRITE_REPLY_ERR;
}
std::vector<int64_t> pkgFileSizes;
int32_t err = GetBundleStatsForIncrease(userId, bundleNames, incrementalBackTimes, pkgFileSizes);
if (!reply.WriteInt32(err)) {
return E_WRITE_REPLY_ERR;
}
if (!reply.WriteInt64Vector(pkgFileSizes)) {
LOGE("StorageDaemonStub::HandleGetBundleStatsForIncrease call GetBundleStatsForIncrease failed");
return E_WRITE_REPLY_ERR;
}
return E_OK;
}
} // StorageDaemon
} // OHOS

View File

@ -72,6 +72,8 @@ ohos_unittest("storage_daemon_test") {
"ability_base:zuri",
"access_token:libaccesstoken_sdk",
"app_file_service:fileshare_native",
"app_file_service:fileuri_native",
"app_file_service:sandbox_helper_native",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"dfs_service:cloud_daemon_kit_inner",

View File

@ -172,6 +172,11 @@ public:
{
return E_OK;
}
virtual int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes) override
{
return E_OK;
}
};
} // namespace StorageDaemon
} // namespace OHOS

View File

@ -54,6 +54,8 @@ public:
MOCK_METHOD1(UnlockUserScreen, int32_t (uint32_t));
MOCK_METHOD2(GetLockScreenStatus, int32_t (uint32_t, bool &));
MOCK_METHOD2(UpdateMemoryPara, int32_t (int32_t, int32_t &));
MOCK_METHOD4(GetBundleStatsForIncrease, int32_t(uint32_t, const std::vector<std::string> &,
const std::vector<int64_t> &, std::vector<int64_t> &));
};
} // namespace StorageDaemon
} // namespace OHOS

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -17,21 +17,31 @@
#include <cstdint>
#include <cstdlib>
#include <dirent.h>
#include <fcntl.h>
#include <fstream>
#include <sstream>
#include <map>
#include <iostream>
#include <linux/dqblk_xfs.h>
#include <linux/fs.h>
#include <linux/quota.h>
#include <map>
#include <sstream>
#include <stack>
#include <sys/ioctl.h>
#include <sys/quota.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <linux/fs.h>
#include <linux/dqblk_xfs.h>
#include <sys/types.h>
#include <tuple>
#include <unique_fd.h>
#include <unistd.h>
#include "file_uri.h"
#include "sandbox_helper.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
#include "storage_service_constant.h"
#include "utils/file_utils.h"
namespace OHOS {
namespace StorageDaemon {
@ -267,5 +277,13 @@ int32_t QuotaManager::SetQuotaPrjId(const std::string &path, int32_t prjId, bool
}
return E_OK;
}
int32_t QuotaManager::GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes)
{
LOGI("GetBundleStatsForIncrease start");
return E_OK;
}
} // StorageDaemon
} // OHOS

View File

@ -37,6 +37,9 @@ ohos_unittest("quota_manager_test") {
]
external_deps = [
"ability_base:zuri",
"app_file_service:fileuri_native",
"app_file_service:sandbox_helper_native",
"c_utils:utils",
"hilog:libhilog",
"init:libbegetutil",

View File

@ -50,6 +50,9 @@ ohos_unittest("user_manager_test") {
]
external_deps = [
"ability_base:zuri",
"app_file_service:fileuri_native",
"app_file_service:sandbox_helper_native",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"hilog:libhilog",

View File

@ -92,6 +92,10 @@ public:
int32_t SetBundleQuota(const std::string &bundleName, int32_t uid, const std::string &bundleDataDirPath,
int32_t limitSizeMb) override;
int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) override;
int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes) override;
private:
StorageManager();
void OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override;

View File

@ -79,6 +79,8 @@ private:
int32_t HandleSetBundleQuota(MessageParcel &data, MessageParcel &reply);
int32_t HandleUpdateMemoryPara(MessageParcel &data, MessageParcel &reply);
int32_t HandleGetBundleStatsForIncrease(MessageParcel &data, MessageParcel &reply);
};
} // StorageManager
} // OHOS

View File

@ -37,6 +37,8 @@ public:
int32_t GetUserStorageStatsByType(int32_t userId, StorageStats &storageStats, std::string type);
int32_t GetCurrentBundleStats(BundleStats &bundleStats);
int32_t GetBundleStats(const std::string &pkgName, int32_t userId, BundleStats &bundleStats);
int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes);
int32_t ResetBundleMgrProxy();
private:

View File

@ -68,6 +68,9 @@ public:
int32_t limitSizeMb);
int32_t GetOccupiedSpace(int32_t idType, int32_t id, int64_t &size);
int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize);
int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes);
private:
sptr<OHOS::StorageDaemon::IStorageDaemon> storageDaemon_;
sptr<IRemoteObject::DeathRecipient> deathRecipient_ = nullptr;

View File

@ -1060,6 +1060,47 @@ int32_t StorageManagerProxy::SetBundleQuota(const std::string &bundleName, int32
return reply.ReadInt32();
}
int32_t StorageManagerProxy::GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes)
{
HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__);
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
return E_WRITE_DESCRIPTOR_ERR;
}
if (!data.WriteInt32(userId)) {
return E_WRITE_PARCEL_ERR;
}
if (!data.WriteStringVector(bundleNames)) {
return E_WRITE_PARCEL_ERR;
}
if (!data.WriteInt64Vector(incrementalBackTimes)) {
return E_WRITE_PARCEL_ERR;
}
int err = SendRequest(static_cast<int32_t>(StorageManagerInterfaceCode::GET_BUNDLE_STATS_INCREASE), data, reply,
option);
if (err != E_OK) {
return err;
}
err = reply.ReadInt32();
if (err != E_OK) {
return err;
}
if (!reply.ReadInt64Vector(&pkgFileSizes)) {
LOGE("StorageManagerProxy::SendRequest read pkgFileSizes");
return E_WRITE_REPLY_ERR;
}
return E_OK;
}
int32_t StorageManagerProxy::UpdateMemoryPara(int32_t size, int32_t &oldSize)
{
MessageParcel data;

View File

@ -491,6 +491,20 @@ int32_t StorageManager::SetBundleQuota(const std::string &bundleName, int32_t ui
return sdCommunication->SetBundleQuota(bundleName, uid, bundleDataDirPath, limitSizeMb);
}
int32_t StorageManager::GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes)
{
#ifdef STORAGE_STATISTICS_MANAGER
LOGI("StorageManger::GetBundleStatsForIncrease start");
int32_t err = DelayedSingleton<StorageStatusService>::GetInstance()->GetBundleStatsForIncrease(userId,
bundleNames, incrementalBackTimes, pkgFileSizes);
return err;
#else
return E_OK;
#endif
}
int32_t StorageManager::GetUserStorageStatsByType(int32_t userId, StorageStats &storageStats, std::string type)
{
#ifdef STORAGE_STATISTICS_MANAGER

View File

@ -32,6 +32,7 @@ const std::string PERMISSION_STORAGE_MANAGER = "ohos.permission.STORAGE_MANAGER"
const std::string PERMISSION_MOUNT_MANAGER = "ohos.permission.MOUNT_UNMOUNT_MANAGER";
const std::string PERMISSION_FORMAT_MANAGER = "ohos.permission.MOUNT_FORMAT_MANAGER";
const std::string PROCESS_NAME_FOUNDATION = "foundation";
bool CheckClientPermission(const std::string& permissionStr)
{
Security::AccessToken::AccessTokenID tokenCaller = IPCSkeleton::GetCallingTokenID();
@ -166,6 +167,8 @@ StorageManagerStub::StorageManagerStub()
&StorageManagerStub::HandleSetBundleQuota;
opToInterfaceMap_[static_cast<uint32_t>(StorageManagerInterfaceCode::UPDATE_MEM_PARA)] =
&StorageManagerStub::HandleUpdateMemoryPara;
opToInterfaceMap_[static_cast<uint32_t>(StorageManagerInterfaceCode::GET_BUNDLE_STATS_INCREASE)] =
&StorageManagerStub::HandleGetBundleStatsForIncrease;
}
int32_t StorageManagerStub::OnRemoteRequest(uint32_t code,
@ -843,6 +846,36 @@ int32_t StorageManagerStub::HandleSetBundleQuota(MessageParcel &data, MessagePar
return E_OK;
}
int32_t StorageManagerStub::HandleGetBundleStatsForIncrease(MessageParcel &data, MessageParcel &reply)
{
if (IPCSkeleton::GetCallingUid() != BACKUP_SA_UID) {
LOGE("StorageManager permissionCheck error, calling uid is invalid, need backup_sa uid.");
return E_PERMISSION_DENIED;
}
uint32_t userId = data.ReadUint32();
std::vector<std::string> bundleNames;
if (!data.ReadStringVector(&bundleNames)) {
return E_WRITE_REPLY_ERR;
}
std::vector<int64_t> incrementalBackTimes;
if (!data.ReadInt64Vector(&incrementalBackTimes)) {
return E_WRITE_REPLY_ERR;
}
std::vector<int64_t> pkgFileSizes;
int32_t err = GetBundleStatsForIncrease(userId, bundleNames, incrementalBackTimes, pkgFileSizes);
if (!reply.WriteUint32(err)) {
return E_WRITE_REPLY_ERR;
}
if (!reply.WriteInt64Vector(pkgFileSizes)) {
LOGE("StorageManagerStub::HandleGetBundleStatsForIncrease call GetBundleStatsForIncrease failed");
return E_WRITE_REPLY_ERR;
}
return E_OK;
}
int32_t StorageManagerStub::HandleGetUserStorageStatsByType(MessageParcel &data, MessageParcel &reply)
{
if (IPCSkeleton::GetCallingUid() != BACKUP_SA_UID) {

View File

@ -245,6 +245,11 @@ public:
{
return E_OK;
}
virtual int32_t GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes) override
{
return E_OK;
}
};
} // namespace StorageManager
} // namespace OHOS

View File

@ -68,6 +68,8 @@ public:
MOCK_METHOD1(UnlockUserScreen, int32_t(uint32_t));
MOCK_METHOD2(GetLockScreenStatus, int32_t(uint32_t, bool &));
MOCK_METHOD2(UpdateMemoryPara, int32_t (int32_t, int32_t &));
MOCK_METHOD4(GetBundleStatsForIncrease, int32_t(uint32_t, const std::vector<std::string> &,
const std::vector<int64_t> &, std::vector<int64_t> &));
};
} // namespace StorageManager
} // namespace OHOS

View File

@ -150,6 +150,17 @@ int32_t StorageStatusService::GetUserStorageStats(int32_t userId, StorageStats &
return err;
}
int32_t StorageStatusService::GetBundleStatsForIncrease(uint32_t userId, const std::vector<std::string> &bundleNames,
const std::vector<int64_t> &incrementalBackTimes, std::vector<int64_t> &pkgFileSizes)
{
std::shared_ptr<StorageDaemonCommunication> sdCommunication;
sdCommunication = DelayedSingleton<StorageDaemonCommunication>::GetInstance();
int32_t err = sdCommunication->GetBundleStatsForIncrease(userId, bundleNames, incrementalBackTimes,
pkgFileSizes);
LOGI("StorageStatusService::GetBundleStatsForIncrease err is %{public}d", err);
return err;
}
int32_t StorageStatusService::GetCurrentBundleStats(BundleStats &bundleStats)
{
int userId = GetCurrentUserId();

View File

@ -356,6 +356,18 @@ int32_t StorageDaemonCommunication::MountCryptoPathAgain(int32_t userId)
return storageDaemon_->MountCryptoPathAgain(userId);
}
int32_t StorageDaemonCommunication::GetBundleStatsForIncrease(uint32_t userId,
const std::vector<std::string> &bundleNames, const std::vector<int64_t> &incrementalBackTimes,
std::vector<int64_t> &pkgFileSizes)
{
int32_t err = Connect();
if (err != E_OK) {
LOGE("Connect failed");
return err;
}
return storageDaemon_->GetBundleStatsForIncrease(userId, bundleNames, incrementalBackTimes, pkgFileSizes);
}
int32_t StorageDaemonCommunication::UpdateMemoryPara(int32_t size, int32_t &oldSize)
{
LOGI("StorageDaemonCommunication::UpdateMemoryPara");

View File

@ -49,8 +49,11 @@ ohos_fuzztest("StorageDaemonFuzzTest") {
deps = [ "${bundlemanager_framework_path}/services/bundlemgr:libbms" ]
external_deps = [
"ability_base:zuri",
"ability_runtime:abilitykit_native",
"app_file_service:fileshare_native",
"app_file_service:fileuri_native",
"app_file_service:sandbox_helper_native",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"hilog:libhilog",

View File

@ -51,8 +51,11 @@ ohos_fuzztest("StorageDaemonCreateShareFileFuzzTest") {
deps = [ "${bundlemanager_framework_path}/services/bundlemgr:libbms" ]
external_deps = [
"ability_base:zuri",
"ability_runtime:abilitykit_native",
"app_file_service:fileshare_native",
"app_file_service:fileuri_native",
"app_file_service:sandbox_helper_native",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"hilog:libhilog",

View File

@ -51,8 +51,11 @@ ohos_fuzztest("StorageDaemonDeleteShareFileFuzzTest") {
deps = [ "${bundlemanager_framework_path}/services/bundlemgr:libbms" ]
external_deps = [
"ability_base:zuri",
"ability_runtime:abilitykit_native",
"app_file_service:fileshare_native",
"app_file_service:fileuri_native",
"app_file_service:sandbox_helper_native",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"hilog:libhilog",