mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2024-11-23 15:09:48 +00:00
delete os_account dep
Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
This commit is contained in:
parent
889821b5f2
commit
7ed4173818
@ -23,7 +23,6 @@
|
||||
"bundle_framework",
|
||||
"hiviewdfx_hilog_native",
|
||||
"ipc",
|
||||
"os_account_standard",
|
||||
"safwk",
|
||||
"samgr_standard",
|
||||
"ability_runtime",
|
||||
|
26
services/common/include/storage_service_constant.h
Normal file
26
services/common/include/storage_service_constant.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
#ifndef STORAGE_SERVICE_CONSTANTS_H
|
||||
#define STORAGE_SERVICE_CONSTANTS_H
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageService {
|
||||
const int START_USER_ID = 100;
|
||||
const int MAX_USER_ID = 1099;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // STORAGE_SERVICE_CONSTANTS_H
|
@ -51,7 +51,6 @@ ohos_shared_library("storage_manager") {
|
||||
|
||||
deps = [
|
||||
"../../interfaces/innerkits/storage_manager/native:storage_manager_sa_proxy",
|
||||
"//base/account/os_account/frameworks/common:libaccount_common",
|
||||
"//foundation/appexecfwk/standard/services/bundlemgr:libbms",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
@ -64,7 +63,6 @@ ohos_shared_library("storage_manager") {
|
||||
"ces_standard:cesfwk_innerkits",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
"os_account_standard:os_account_innerkits",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr_standard:samgr_proxy",
|
||||
]
|
||||
|
@ -14,8 +14,8 @@
|
||||
*/
|
||||
|
||||
#include "crypto/filesystem_crypto.h"
|
||||
#include "os_account_constants.h"
|
||||
#include "storage_daemon_communication/storage_daemon_communication.h"
|
||||
#include "storage_service_constant.h"
|
||||
#include "storage_service_log.h"
|
||||
#include "storage_service_errno.h"
|
||||
|
||||
@ -33,7 +33,7 @@ FileSystemCrypto::~FileSystemCrypto()
|
||||
|
||||
int32_t FileSystemCrypto::CheckUserIdRange(int32_t userId)
|
||||
{
|
||||
if (userId < AccountSA::Constants::START_USER_ID || userId > AccountSA::Constants::MAX_USER_ID) {
|
||||
if (userId < StorageService::START_USER_ID || userId > StorageService::MAX_USER_ID) {
|
||||
LOGE("FileSystemCrypto: userId:%{public}d is out of range", userId);
|
||||
return E_USERID_RANGE;
|
||||
}
|
||||
|
@ -14,11 +14,11 @@
|
||||
*/
|
||||
|
||||
#include "storage/storage_status_service.h"
|
||||
#include "storage_service_constant.h"
|
||||
#include "storage_service_errno.h"
|
||||
#include "storage_service_log.h"
|
||||
#include "installd_client.h"
|
||||
#include "os_account_manager.h"
|
||||
#include "os_account_constants.h"
|
||||
#include "ipc_skeleton.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -29,14 +29,10 @@ StorageStatusService::~StorageStatusService() {}
|
||||
|
||||
int StorageStatusService::GetCurrentUserId()
|
||||
{
|
||||
vector<int> osAccountInfos;
|
||||
if (AccountSA::OsAccountManager::QueryActiveOsAccountIds(osAccountInfos) == E_OK) {
|
||||
if (osAccountInfos.size() > 0) {
|
||||
return osAccountInfos[0];
|
||||
}
|
||||
}
|
||||
LOGE("StorageStatusService::An error occurred in querying current os account.");
|
||||
return DEFAULT_USER_ID;
|
||||
int uid = -1;
|
||||
uid = IPCSkeleton::GetCallingUid();
|
||||
int userId = uid / 200000;
|
||||
return userId;
|
||||
}
|
||||
|
||||
vector<int64_t> StorageStatusService::GetBundleStats(std::string pkgName)
|
||||
@ -44,7 +40,7 @@ vector<int64_t> StorageStatusService::GetBundleStats(std::string pkgName)
|
||||
vector<int64_t> result = {0, 0, 0};
|
||||
int userId = GetCurrentUserId();
|
||||
LOGI("StorageStatusService::userId is:%d", userId);
|
||||
if (userId < 0 || userId > AccountSA::Constants::MAX_USER_ID) {
|
||||
if (userId < 0 || userId > StorageService::MAX_USER_ID) {
|
||||
LOGI("StorageStatusService::Invaild userId.");
|
||||
return result;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
*/
|
||||
|
||||
#include "user/multi_user_manager_service.h"
|
||||
#include "os_account_constants.h"
|
||||
#include "storage_daemon_communication/storage_daemon_communication.h"
|
||||
#include "storage_service_constant.h"
|
||||
#include "storage_service_log.h"
|
||||
#include "storage_service_errno.h"
|
||||
|
||||
@ -33,7 +33,7 @@ MultiUserManagerService::~MultiUserManagerService()
|
||||
|
||||
int32_t MultiUserManagerService::CheckUserIdRange(int32_t userId)
|
||||
{
|
||||
if (userId < AccountSA::Constants::START_USER_ID || userId > AccountSA::Constants::MAX_USER_ID) {
|
||||
if (userId < StorageService::START_USER_ID || userId > StorageService::MAX_USER_ID) {
|
||||
LOGE("MultiUserManagerService: userId:%{public}d is out of range", userId);
|
||||
return E_USERID_RANGE;
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ ohos_unittest("multi_user_manager_service_test") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//base/account/os_account/frameworks/common:libaccount_common",
|
||||
"//third_party/googletest:gtest_main",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
@ -47,7 +46,6 @@ ohos_unittest("multi_user_manager_service_test") {
|
||||
external_deps = [
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
"os_account_standard:os_account_innerkits",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr_standard:samgr_proxy",
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user