Storage:修改雷达打点

Signed-off-by: zhaoshuyuan <zhaoshuyuan2@huawei.com>
This commit is contained in:
zhaoshuyuan 2024-10-30 21:43:43 +08:00
parent 4fcd59aac7
commit 3c04b01a51
6 changed files with 119 additions and 199 deletions

29
hisysevent.yaml Normal file
View File

@ -0,0 +1,29 @@
# Copyright (c) 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
domain: FILEMANAGEMENT
FILE_STORAGE_MANAGER_FAULT:
__BASE: {type: "FAULT", level: "CRITICAL", privacy: 4, preserve: true}
ORG_PKG: {type: "STRING"}
USER_ID: {type: "INT32"}
FUNC: {type: "STRING"}
BIZ_SCENE: {type: "INT32"}
BIZ_STAGE: {type: "INT32"}
KEY_ELX_LEVEL: {type: "STRING"}
TO_CALL_PKG: {type: "STRING"}
DISK_VOLUME_INFO: {type: "STRING"}
FILE_STATUS: {type: "STRING"}
STAGE_RES: {type: "INT32"}
ERROR_CODE: {type: "INT32"}
BIZ_STATE: {type: "INT32"}

View File

@ -67,6 +67,7 @@ enum class BizStage : int32_t {
BIZ_STAGE_UNLOCK_USER_SCREEN,
BIZ_STAGE_GET_FILE_ENCRYPT_STATUS,
BIZ_STAGE_UPDATE_KEY_CONTEXT,
BIZ_STAGE_INIT_GLOBAL_KEY,
BIZ_STAGE_GET_TOTAL_SIZE = 31,
BIZ_STAGE_GET_FREE_SIZE,
@ -107,6 +108,10 @@ public:
const std::string &keyElxLevel);
static void ReportGetStorageStatus(const std::string &funcName, uint32_t userId, int ret,
const std::string &orgPkg);
static void ReportVolumeOperation(const std::string &funcName, int ret);
static void ReportInitGlobalKey(const std::string &funcName, uint32_t userId, int ret,
const std::string &keyElxLevel);
static void ReportUserManager(const std::string &funcName, uint32_t userId, int ret, enum BizStage bizStage);
private:
StorageRadar() = default;

View File

@ -86,16 +86,7 @@ int32_t StorageDaemon::Mount(const std::string &volId, uint32_t flags)
int32_t ret = VolumeManager::Instance()->Mount(volId, flags);
if (ret != E_OK) {
LOGW("Mount failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "Mount",
.bizScene = BizScene::EXTERNAL_VOLUME_MANAGER,
.bizStage = BizStage::BIZ_STAGE_MOUNT,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportVolumeOperation("VolumeManager::Mount", ret);
AuditLog storageAuditLog = { false, "FAILED TO Mount", "ADD", "Mount", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
} else {
@ -115,16 +106,7 @@ int32_t StorageDaemon::UMount(const std::string &volId)
int32_t ret = VolumeManager::Instance()->UMount(volId);
if (ret != E_OK) {
LOGW("UMount failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "UMount",
.bizScene = BizScene::EXTERNAL_VOLUME_MANAGER,
.bizStage = BizStage::BIZ_STAGE_UNMOUNT,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportVolumeOperation("VolumeManager::UMount", ret);
AuditLog storageAuditLog = { false, "FAILED TO UMount", "DEL", "UMount", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
} else {
@ -154,16 +136,7 @@ int32_t StorageDaemon::Format(const std::string &volId, const std::string &fsTyp
int32_t ret = VolumeManager::Instance()->Format(volId, fsType);
if (ret != E_OK) {
LOGW("Format failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "Format",
.bizScene = BizScene::EXTERNAL_VOLUME_MANAGER,
.bizStage = BizStage::BIZ_STAGE_FORMAT,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportVolumeOperation("VolumeManager::Format", ret);
AuditLog storageAuditLog = { true, "FAILED TO Format", "UPDATE", "Format", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
} else {
@ -183,16 +156,7 @@ int32_t StorageDaemon::Partition(const std::string &diskId, int32_t type)
int32_t ret = DiskManager::Instance()->HandlePartition(diskId);
if (ret != E_OK) {
LOGW("HandlePartition failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "HandlePartition",
.bizScene = BizScene::EXTERNAL_VOLUME_MANAGER,
.bizStage = BizStage::BIZ_STAGE_PARTITION,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportVolumeOperation("VolumeManager::Partition", ret);
AuditLog storageAuditLog = { true, "FAILED TO Partition", "UPDATE", "Partition", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
} else {
@ -212,16 +176,7 @@ int32_t StorageDaemon::SetVolumeDescription(const std::string &volId, const std:
int32_t ret = VolumeManager::Instance()->SetVolumeDescription(volId, description);
if (ret != E_OK) {
LOGW("SetVolumeDescription failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "SetVolumeDescription",
.bizScene = BizScene::EXTERNAL_VOLUME_MANAGER,
.bizStage = BizStage::BIZ_STAGE_SET_VOLUME_DESCRIPTION,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportVolumeOperation("VolumeManager::SetVolumeDescription", ret);
AuditLog storageAuditLog = { true, "FAILED TO SetVolumeDescription", "UPDATE", "SetVolumeDescription", 1,
"FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
@ -363,16 +318,6 @@ int32_t StorageDaemon::PrepareUserDirs(int32_t userId, uint32_t flags)
int32_t ret = KeyManager::GetInstance()->GenerateUserKeys(userId, flags);
#ifdef USER_CRYPTO_MIGRATE_KEY
if (ret == -EEXIST) {
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = userId,
.funcName = "GenerateUserKeys",
.bizScene = BizScene::USER_MOUNT_MANAGER,
.bizStage = BizStage::BIZ_STAGE_PREPARE_ADD_USER,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
AuditLog storageAuditLog = { false, "FAILED TO GenerateUserKeys", "ADD", "GenerateUserKeys", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
return RestoreUserKey(userId, flags);
@ -380,16 +325,8 @@ int32_t StorageDaemon::PrepareUserDirs(int32_t userId, uint32_t flags)
#endif
if (ret != E_OK) {
LOGE("Generate user %{public}d key error", userId);
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = userId,
.funcName = "GenerateUserKeys",
.bizScene = BizScene::USER_MOUNT_MANAGER,
.bizStage = BizStage::BIZ_STAGE_PREPARE_ADD_USER,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportUserManager("PrepareUserDirs::UserManager::GenerateUserKeys", userId, ret,
BizStage::BIZ_STAGE_PREPARE_ADD_USER);
AuditLog storageAuditLog = { false, "FAILED TO GenerateUserKeys", "ADD", "GenerateUserKeys", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
return ret;
@ -408,16 +345,7 @@ int32_t StorageDaemon::DestroyUserDirs(int32_t userId, uint32_t flags)
if (destroyUserRet != E_OK) {
errCode = destroyUserRet;
LOGW("Destroy user %{public}d dirs failed, please check", userId);
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = userId,
.funcName = "DestroyUserDirs",
.bizScene = BizScene::USER_MOUNT_MANAGER,
.bizStage = BizStage::BIZ_STAGE_REMOVE_USER,
.keyElxLevel = "EL1",
.errorCode = errCode
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportUserManager("DestroyUserDirs", userId, errCode, BizStage::BIZ_STAGE_REMOVE_USER);
AuditLog storageAuditLog = { false, "FAILED TO DestroyUserDirs", "DEL", "DestroyUserDirs", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
}
@ -427,16 +355,8 @@ int32_t StorageDaemon::DestroyUserDirs(int32_t userId, uint32_t flags)
if (destroyUserRet != E_OK) {
errCode = destroyUserRet;
LOGW("DeleteUserKeys failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = userId,
.funcName = "DeleteUserKeys",
.bizScene = BizScene::USER_MOUNT_MANAGER,
.bizStage = BizStage::BIZ_STAGE_REMOVE_USER,
.keyElxLevel = "EL1",
.errorCode = errCode
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportUserManager("DestroyUserDirs::DeleteUserKeys", userId, errCode,
BizStage::BIZ_STAGE_REMOVE_USER);
AuditLog storageAuditLog = { false, "FAILED TO DeleteUserKeys", "DEL", "DeleteUserKeys", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
}
@ -451,16 +371,7 @@ int32_t StorageDaemon::StartUser(int32_t userId)
int32_t ret = UserManager::GetInstance()->StartUser(userId);
if (ret != E_OK && ret != E_KEY_NOT_ACTIVED) {
LOGE("StartUser failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = userId,
.funcName = "StartUser",
.bizScene = BizScene::USER_MOUNT_MANAGER,
.bizStage = BizStage::BIZ_STAGE_START_USER,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportUserManager("StartUser", userId, ret, BizStage::BIZ_STAGE_START_USER);
AuditLog storageAuditLog = { false, "FAILED TO StartUser", "ADD", "StartUser", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
} else {
@ -475,16 +386,7 @@ int32_t StorageDaemon::StopUser(int32_t userId)
int32_t ret = UserManager::GetInstance()->StopUser(userId);
if (ret != E_OK) {
LOGE("StopUser failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = userId,
.funcName = "stopUser",
.bizScene = BizScene::USER_MOUNT_MANAGER,
.bizStage = BizStage::BIZ_STAGE_STOP_USER,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportUserManager("StopUser", userId, ret, BizStage::BIZ_STAGE_STOP_USER);
AuditLog storageAuditLog = { false, "FAILED TO StopUser", "DEL", "StopUser", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
} else {
@ -508,16 +410,6 @@ int32_t StorageDaemon::CompleteAddUser(int32_t userId)
}
(void)remove(elNeedRestorePath.c_str());
LOGI("CompleteAddUser remove el1 needRestore flag");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = userId,
.funcName = "CompleteAddUser",
.bizScene = BizScene::USER_MOUNT_MANAGER,
.bizStage = BizStage::BIZ_STAGE_GENERATE_USER_KEYS,
.keyElxLevel = "EL1",
.errorCode = E_OK
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
#endif
return E_OK;
}
@ -528,16 +420,7 @@ int32_t StorageDaemon::InitGlobalKey(void)
int ret = KeyManager::GetInstance()->InitGlobalDeviceKey();
if (ret != E_OK) {
LOGE("InitGlobalDeviceKey failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "InitGlobalDeviceKey",
.bizScene = BizScene::USER_KEY_ENCRYPTION,
.bizStage = BizStage::BIZ_STAGE_GENERATE_USER_KEYS,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportInitGlobalKey("InitGlobalKey", 0, ret, "EL1");
AuditLog storageAuditLog = { false, "FAILED TO InitGlobalDeviceKey", "ADD", "InitGlobalDeviceKey", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
}
@ -564,16 +447,7 @@ int32_t StorageDaemon::InitGlobalUserKeys(void)
int ret = KeyManager::GetInstance()->InitGlobalUserKeys();
if (ret) {
LOGE("Init global users els failed");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "InitGlobalUserKeys",
.bizScene = BizScene::USER_KEY_ENCRYPTION,
.bizStage = BizStage::BIZ_STAGE_GENERATE_USER_KEYS,
.keyElxLevel = "EL1",
.errorCode = ret
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportInitGlobalKey("InitGlobalUserKeys", GLOBAL_USER_ID, ret, "EL1");
AuditLog storageAuditLog = { false, "FAILED TO InitGlobalUserKeys", "ADD", "InitGlobalUserKeys", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
return ret;
@ -585,16 +459,7 @@ int32_t StorageDaemon::InitGlobalUserKeys(void)
auto result = UserManager::GetInstance()->PrepareUserDirs(GLOBAL_USER_ID, CRYPTO_FLAG_EL1);
if (result != E_OK) {
LOGE("PrepareUserDirs failed, please check");
RadarParameter parameterRes = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "PrepareUserDirs",
.bizScene = BizScene::USER_KEY_ENCRYPTION,
.bizStage = BizStage::BIZ_STAGE_GENERATE_USER_KEYS,
.keyElxLevel = "EL1",
.errorCode = result
};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportInitGlobalKey("InitGlobalUserKeys::PrepareUserDirs", GLOBAL_USER_ID, result, "EL1");
AuditLog storageAuditLog = { false, "FAILED TO PrepareUserDirs", "ADD", "PrepareUserDirs", 1, "FAIL" };
HiAudit::GetInstance().Write(storageAuditLog);
}

View File

@ -50,6 +50,51 @@ void StorageRadar::ReportGetStorageStatus(const std::string &funcName, uint32_t
};
StorageRadar::GetInstance().RecordFuctionResult(param);
}
void StorageRadar::ReportVolumeOperation(const std::string &funcName, int ret)
{
RadarParameter param = {
.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = funcName,
.bizScene = BizScene::EXTERNAL_VOLUME_MANAGER,
.bizStage = BizStage::BIZ_STAGE_MOUNT,
.keyElxLevel = "NA",
.errorCode = ret
};
StorageRadar::GetInstance().RecordFuctionResult(param);
}
void StorageRadar::ReportInitGlobalKey(const std::string &funcName, uint32_t userId, int ret,
const std::string &keyLevel)
{
RadarParameter param = {
.orgPkg = "init",
.userId = userId,
.funcName = funcName,
.bizScene = BizScene::USER_KEY_ENCRYPTION,
.bizStage = BizStage::BIZ_STAGE_INIT_GLOBAL_KEY,
.keyElxLevel = keyLevel,
.errorCode = ret
};
StorageRadar::GetInstance().RecordFuctionResult(param);
}
void StorageRadar::ReportUserManager(const std::string &funcName, uint32_t userId, int ret,
enum BizStage stage)
{
RadarParameter param = {
.orgPkg = "account_mgr",
.userId = userId,
.funcName = funcName,
.bizScene = BizScene::USER_MOUNT_MANAGER,
.bizStage = stage,
.keyElxLevel = "ELx",
.errorCode = ret
};
StorageRadar::GetInstance().RecordFuctionResult(param);
}
bool StorageRadar::RecordKillProcessResult(std::string processName, int32_t errcode)
{
int32_t res = E_OK;

View File

@ -77,7 +77,7 @@ void GetMediaTypeAndSize(const std::shared_ptr<DataShare::DataShareResultSet> &r
LOGE("get size column index or long value err.");
continue;
}
LOGI("media_type: %{public}d, size: %{public}lld", mediatype, static_cast<long long>(size));
if (mediatype == MEDIA_TYPE_IMAGE || mediatype == thumbnailType) {
storageStats.image_ += size;
} else if (mediatype == MEDIA_TYPE_AUDIO) {
@ -94,7 +94,7 @@ void GetMediaTypeAndSize(const std::shared_ptr<DataShare::DataShareResultSet> &r
int32_t GetMediaStorageStats(StorageStats &storageStats)
{
HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__);
LOGI("GetMediaStorageStats start");
LOGD("GetMediaStorageStats start");
#ifdef STORAGE_SERVICE_GRAPHIC
auto sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (sam == nullptr) {
@ -134,20 +134,20 @@ int32_t GetMediaStorageStats(StorageStats &storageStats)
GetMediaTypeAndSize(queryResultSet, storageStats);
dataShareHelper->Release();
#endif
LOGI("GetMediaStorageStats end");
LOGD("GetMediaStorageStats end");
return E_OK;
}
int32_t GetFileStorageStats(int32_t userId, StorageStats &storageStats)
{
HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__);
LOGI("GetFileStorageStats start");
LOGD("GetFileStorageStats start");
int32_t err = E_OK;
int32_t prjId = userId * USER_ID_BASE + UID_FILE_MANAGER;
std::shared_ptr<StorageDaemonCommunication> sdCommunication;
sdCommunication = DelayedSingleton<StorageDaemonCommunication>::GetInstance();
err = sdCommunication->GetOccupiedSpace(StorageDaemon::USRID, prjId, storageStats.file_);
LOGI("GetFileStorageStats end");
LOGD("GetFileStorageStats end");
return err;
}
@ -202,7 +202,7 @@ int32_t StorageStatusService::GetUserStorageStats(int32_t userId, StorageStats &
return err;
}
// appSize
LOGI("StorageStatusService::GetUserStorageStats userId is %{public}d", userId);
LOGD("StorageStatusService::GetUserStorageStats userId is %{public}d", userId);
int64_t appSize = 0;
err = GetAppSize(userId, appSize);
if (err != E_OK) {
@ -229,6 +229,13 @@ int32_t StorageStatusService::GetUserStorageStats(int32_t userId, StorageStats &
StorageRadar::ReportGetStorageStatus("GetUserStorageStats::GetFileStorageStats", userId, ret,
GetCallingPkgName());
}
LOGE("StorageStatusService::GetUserStorageStats success for userId=%{public}d, "
"totalSize=%{public}lld, appSize=%{public}lld, videoSize=%{public}lld, audioSize=%{public}lld, "
"imageSize=%{public}lld, fileSize=%{public}lld",
userId, static_cast<long long>(storageStats.total_), static_cast<long long>(storageStats.app_),
static_cast<long long>(storageStats.video_), static_cast<long long>(storageStats.audio_),
static_cast<long long>(storageStats.image_), static_cast<long long>(storageStats.file_));
return err;
}
@ -247,7 +254,7 @@ int32_t StorageStatusService::GetBundleStatsForIncrease(uint32_t userId, const s
int32_t StorageStatusService::GetCurrentBundleStats(BundleStats &bundleStats)
{
int userId = GetCurrentUserId();
LOGI("StorageStatusService::userId is: %{public}d", userId);
std::string pkgName = GetCallingPkgName();
int32_t ret = GetBundleStats(pkgName, userId, bundleStats, DEFAULT_APP_INDEX,
AppExecFwk::Constants::NoGetBundleStatsFlag::GET_BUNDLE_WITHOUT_CACHE_SIZE);
@ -299,13 +306,17 @@ int32_t StorageStatusService::GetBundleStats(const std::string &pkgName, int32_t
pkgStats.appSize_ = bundleStats[APP];
pkgStats.cacheSize_ = bundleStats[CACHE];
pkgStats.dataSize_ = bundleStats[LOCAL] + bundleStats[DISTRIBUTED] + bundleStats[DATABASE];
LOGE("StorageStatusService::GetBundleStats success for pkgName=%{public}s, userId=%{public}d, appIndex=%{public}d"
", appSize=%{public}lld, cacheSize=%{public}lld, dataSize=%{public}lld",
pkgName.c_str(), userId, appIndex, static_cast<long long>(pkgStats.appSize_),
static_cast<long long>(pkgStats.cacheSize_), static_cast<long long>(pkgStats.dataSize_));
return E_OK;
}
int32_t StorageStatusService::GetAppSize(int32_t userId, int64_t &appSize)
{
HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__);
LOGI("StorageStatusService::GetAppSize start");
LOGD("StorageStatusService::GetAppSize start");
auto bundleMgr = DelayedSingleton<BundleMgrConnector>::GetInstance()->GetBundleMgrProxy();
if (bundleMgr == nullptr) {
LOGE("StorageStatusService::GetUserStorageStats connect bundlemgr failed");
@ -323,7 +334,7 @@ int32_t StorageStatusService::GetAppSize(int32_t userId, int64_t &appSize)
for (uint i = 0; i < bundleStats.size(); i++) {
appSize += bundleStats[i];
}
LOGI("StorageStatusService::GetAppSize end");
LOGD("StorageStatusService::GetAppSize end");
return E_OK;
}

View File

@ -41,28 +41,14 @@ int32_t StorageTotalStatusService::GetSystemSize(int64_t &systemSize)
int32_t ret = GetTotalSize(roundSize);
if (ret != E_OK) {
LOGE("storage total status service GetTotalSize failed, please check");
RadarParameter parameterRes = {.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "GetTotalSize",
.bizScene = BizScene::SPACE_STATISTICS,
.bizStage = BizStage::BIZ_STAGE_GET_SYSTEM_SIZE,
.keyElxLevel = "EL1",
.errorCode = ret};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportGetStorageStatus("GetSystemSize::GetTotalSize", DEFAULT_USERID, ret, "setting");
return ret;
}
int64_t totalSize = 0;
ret = GetSizeOfPath(PATH_DATA, SizeType::TOTAL, totalSize);
if (ret != E_OK) {
LOGE("storage total status service GetSizeOfPath failed, please check");
RadarParameter parameterRes = {.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "GetSizeOfPath",
.bizScene = BizScene::SPACE_STATISTICS,
.bizStage = BizStage::BIZ_STAGE_GET_SYSTEM_SIZE,
.keyElxLevel = "EL1",
.errorCode = ret};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportGetStorageStatus("GetSystemSize::GetSizeOfPath", DEFAULT_USERID, ret, "setting");
return ret;
}
systemSize = roundSize - totalSize;
@ -80,28 +66,14 @@ int32_t StorageTotalStatusService::GetTotalSize(int64_t &totalSize)
int32_t ret = GetSizeOfPath(PATH_DATA, SizeType::TOTAL, dataSize);
if (ret != E_OK) {
LOGE("GetSizeOfPath of data size failed, please check");
RadarParameter parameterRes = {.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "GetTotalSize GetSizeOfPath for dataSize",
.bizScene = BizScene::SPACE_STATISTICS,
.bizStage = BizStage::BIZ_STAGE_GET_TOTAL_SIZE,
.keyElxLevel = "EL1",
.errorCode = ret};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportGetStorageStatus("GetTotalSize::GetSizeOfDataPath", DEFAULT_USERID, ret, "setting");
return ret;
}
int64_t rootSize = 0;
ret = GetSizeOfPath(PATH_ROOT, SizeType::TOTAL, rootSize);
if (ret != E_OK) {
LOGE("GetSizeOfPath of root size failed, please check");
RadarParameter parameterRes = {.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "GetTotalSize GetSizeOfPath for rootSize",
.bizScene = BizScene::SPACE_STATISTICS,
.bizStage = BizStage::BIZ_STAGE_GET_TOTAL_SIZE,
.keyElxLevel = "EL1",
.errorCode = ret};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportGetStorageStatus("GetSystemSize::GetSizeOfRootPath", DEFAULT_USERID, ret, "setting");
return ret;
}
totalSize = GetRoundSize(dataSize + rootSize);
@ -116,14 +88,7 @@ int32_t StorageTotalStatusService::GetFreeSize(int64_t &freeSize)
int32_t ret = GetSizeOfPath(PATH_DATA, SizeType::FREE, freeSize);
if (ret != E_OK) {
LOGE("GetFreeSize failed, please check");
RadarParameter parameterRes = {.orgPkg = DEFAULT_ORGPKGNAME,
.userId = DEFAULT_USERID,
.funcName = "GetFreeSize",
.bizScene = BizScene::SPACE_STATISTICS,
.bizStage = BizStage::BIZ_STAGE_GET_FREE_SIZE,
.keyElxLevel = "EL1",
.errorCode = ret};
StorageService::StorageRadar::GetInstance().RecordFuctionResult(parameterRes);
StorageRadar::ReportGetStorageStatus("GetFreeSize", DEFAULT_USERID, ret, "setting");
}
LOGE("StorageTotalStatusService::GetFreeSize success, (/data)freeSize=%{public}lld",
static_cast<long long>(freeSize));