mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2024-11-23 06:59:59 +00:00
!743 create bundle dir in grade scenario
Merge pull request !743 from gsl_1234/master
This commit is contained in:
commit
f7403d89e6
@ -114,6 +114,7 @@ ohos_executable("storage_daemon") {
|
|||||||
"ability_base:want",
|
"ability_base:want",
|
||||||
"ability_base:zuri",
|
"ability_base:zuri",
|
||||||
"app_file_service:fileshare_native",
|
"app_file_service:fileshare_native",
|
||||||
|
"bundle_framework:appexecfwk_core",
|
||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"init:libbegetutil",
|
"init:libbegetutil",
|
||||||
|
@ -35,6 +35,7 @@ public:
|
|||||||
int32_t DestroyUserDirs(int32_t userId, uint32_t flags);
|
int32_t DestroyUserDirs(int32_t userId, uint32_t flags);
|
||||||
int32_t StartUser(int32_t userId);
|
int32_t StartUser(int32_t userId);
|
||||||
int32_t StopUser(int32_t userId);
|
int32_t StopUser(int32_t userId);
|
||||||
|
void CreateBundleDataDir(uint32_t userId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t PrepareDirsFromIdAndLevel(int32_t userId, const std::string &level);
|
int32_t PrepareDirsFromIdAndLevel(int32_t userId, const std::string &level);
|
||||||
|
@ -194,6 +194,9 @@ int32_t StorageDaemon::RestoreUserOneKey(int32_t userId, KeyType type)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
(void)remove(elNeedRestorePath.c_str());
|
(void)remove(elNeedRestorePath.c_str());
|
||||||
|
if (type == EL4_KEY) {
|
||||||
|
UserManager::GetInstance()->CreateBundleDataDir(userId);
|
||||||
|
}
|
||||||
LOGI("restore User %{public}u el%{public}u success", userId, type);
|
LOGI("restore User %{public}u el%{public}u success", userId, type);
|
||||||
}
|
}
|
||||||
return E_OK;
|
return E_OK;
|
||||||
@ -460,6 +463,7 @@ int32_t StorageDaemon::ActiveUserKey(uint32_t userId,
|
|||||||
{
|
{
|
||||||
#ifdef USER_CRYPTO_MANAGER
|
#ifdef USER_CRYPTO_MANAGER
|
||||||
LOGI("userId %{public}u, tok empty %{public}d sec empty %{public}d", userId, token.empty(), secret.empty());
|
LOGI("userId %{public}u, tok empty %{public}d sec empty %{public}d", userId, token.empty(), secret.empty());
|
||||||
|
bool updateFlag = false;
|
||||||
int ret = KeyManager::GetInstance()->ActiveCeSceSeceUserKey(userId, EL2_KEY, token, secret);
|
int ret = KeyManager::GetInstance()->ActiveCeSceSeceUserKey(userId, EL2_KEY, token, secret);
|
||||||
if (ret != E_OK) {
|
if (ret != E_OK) {
|
||||||
#ifdef USER_CRYPTO_MIGRATE_KEY
|
#ifdef USER_CRYPTO_MIGRATE_KEY
|
||||||
@ -467,6 +471,7 @@ int32_t StorageDaemon::ActiveUserKey(uint32_t userId,
|
|||||||
userId, token.empty(), secret.empty());
|
userId, token.empty(), secret.empty());
|
||||||
std::string el2NeedRestorePath = GetNeedRestoreFilePath(userId, USER_EL2_DIR);
|
std::string el2NeedRestorePath = GetNeedRestoreFilePath(userId, USER_EL2_DIR);
|
||||||
if (std::filesystem::exists(el2NeedRestorePath) && (!token.empty() || !secret.empty())) {
|
if (std::filesystem::exists(el2NeedRestorePath) && (!token.empty() || !secret.empty())) {
|
||||||
|
updateFlag = true;
|
||||||
ret = PrepareUserDirsAndUpdateUserAuth(userId, EL2_KEY, token, secret);
|
ret = PrepareUserDirsAndUpdateUserAuth(userId, EL2_KEY, token, secret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -489,6 +494,9 @@ int32_t StorageDaemon::ActiveUserKey(uint32_t userId,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateFlag) {
|
||||||
|
UserManager::GetInstance()->CreateBundleDataDir(userId);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
#else
|
#else
|
||||||
return E_OK;
|
return E_OK;
|
||||||
|
@ -72,6 +72,7 @@ ohos_unittest("storage_daemon_test") {
|
|||||||
"ability_base:zuri",
|
"ability_base:zuri",
|
||||||
"access_token:libaccesstoken_sdk",
|
"access_token:libaccesstoken_sdk",
|
||||||
"app_file_service:fileshare_native",
|
"app_file_service:fileshare_native",
|
||||||
|
"bundle_framework:appexecfwk_core",
|
||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"dfs_service:cloud_daemon_kit_inner",
|
"dfs_service:cloud_daemon_kit_inner",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
@ -151,6 +152,7 @@ ohos_unittest("storage_daemon_stub_test") {
|
|||||||
|
|
||||||
external_deps = [
|
external_deps = [
|
||||||
"access_token:libaccesstoken_sdk",
|
"access_token:libaccesstoken_sdk",
|
||||||
|
"bundle_framework:appexecfwk_core",
|
||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"huks:libhukssdk",
|
"huks:libhukssdk",
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "user/user_manager.h"
|
#include "user/user_manager.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include "bundle_mgr_client.h"
|
||||||
#ifdef USER_CRYPTO_MANAGER
|
#ifdef USER_CRYPTO_MANAGER
|
||||||
#include "crypto/key_manager.h"
|
#include "crypto/key_manager.h"
|
||||||
#endif
|
#endif
|
||||||
@ -367,5 +368,13 @@ int32_t UserManager::CheckUserIdRange(int32_t userId)
|
|||||||
}
|
}
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserManager::CreateBundleDataDir(uint32_t userId)
|
||||||
|
{
|
||||||
|
OHOS::AppExecFwk::BundleMgrClient client;
|
||||||
|
LOGI("CreateBundleDataDir start: userId %{public}u", userId);
|
||||||
|
auto ret = client.CreateBundleDataDir(userId);
|
||||||
|
LOGI("CreateBundleDataDir end: userId %{public}u, ret %{public}d", userId, ret);
|
||||||
|
}
|
||||||
} // namespace StorageDaemon
|
} // namespace StorageDaemon
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -50,6 +50,7 @@ ohos_unittest("user_manager_test") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
external_deps = [
|
external_deps = [
|
||||||
|
"bundle_framework:appexecfwk_core",
|
||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"huks:libhukssdk",
|
"huks:libhukssdk",
|
||||||
|
@ -51,6 +51,7 @@ ohos_fuzztest("StorageDaemonFuzzTest") {
|
|||||||
external_deps = [
|
external_deps = [
|
||||||
"ability_runtime:abilitykit_native",
|
"ability_runtime:abilitykit_native",
|
||||||
"app_file_service:fileshare_native",
|
"app_file_service:fileshare_native",
|
||||||
|
"bundle_framework:appexecfwk_core",
|
||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"init:libbegetutil",
|
"init:libbegetutil",
|
||||||
|
@ -53,6 +53,7 @@ ohos_fuzztest("StorageDaemonCreateShareFileFuzzTest") {
|
|||||||
external_deps = [
|
external_deps = [
|
||||||
"ability_runtime:abilitykit_native",
|
"ability_runtime:abilitykit_native",
|
||||||
"app_file_service:fileshare_native",
|
"app_file_service:fileshare_native",
|
||||||
|
"bundle_framework:appexecfwk_core",
|
||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"init:libbegetutil",
|
"init:libbegetutil",
|
||||||
|
@ -53,6 +53,7 @@ ohos_fuzztest("StorageDaemonDeleteShareFileFuzzTest") {
|
|||||||
external_deps = [
|
external_deps = [
|
||||||
"ability_runtime:abilitykit_native",
|
"ability_runtime:abilitykit_native",
|
||||||
"app_file_service:fileshare_native",
|
"app_file_service:fileshare_native",
|
||||||
|
"bundle_framework:appexecfwk_core",
|
||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"init:libbegetutil",
|
"init:libbegetutil",
|
||||||
|
Loading…
Reference in New Issue
Block a user