mirror of
https://gitee.com/openharmony/security_asset
synced 2024-11-23 07:49:41 +00:00
!119 change inner_api to inner_kits
Merge pull request !119 from xinchengcai/master
This commit is contained in:
commit
e941994a8d
4
BUILD.gn
4
BUILD.gn
@ -16,7 +16,7 @@ import("//build/ohos.gni")
|
||||
|
||||
group("asset_component") {
|
||||
deps = [
|
||||
"interfaces/inner_api/rs:asset_sdk_rust",
|
||||
"interfaces/inner_kits/rs:asset_sdk_rust",
|
||||
"interfaces/kits/c:asset_ndk",
|
||||
"sa_profile:asset_sa_profiles",
|
||||
"services/core_service:asset_service",
|
||||
@ -36,7 +36,7 @@ group("asset_bin_test") {
|
||||
"test/unittest/module_test:asset_dependency_test",
|
||||
]
|
||||
if (enable_local_test) {
|
||||
deps += [ "test/unittest/inner_api_rust:asset_rust_test" ]
|
||||
deps += [ "test/unittest/inner_kits_rust:asset_rust_test" ]
|
||||
deps += [ "test/unittest/module_test:asset_module_test" ]
|
||||
deps += [ "services/common:asset_calling_info_test" ]
|
||||
deps += [ "services/db_operator:asset_db_operator_test" ]
|
||||
|
@ -17,12 +17,12 @@ members = [
|
||||
"frameworks/ipc",
|
||||
"frameworks/os_dependency/log",
|
||||
"frameworks/utils",
|
||||
"interfaces/inner_api/c",
|
||||
"interfaces/inner_kits/c",
|
||||
"services/common",
|
||||
"services/core_service",
|
||||
"services/crypto_manager",
|
||||
"services/db_operator",
|
||||
"services/db_key_operator",
|
||||
"test/unittest/inner_api_rust",
|
||||
"test/unittest/inner_kits_rust",
|
||||
"test/unittest/module_test"
|
||||
]
|
||||
|
@ -25,13 +25,14 @@ With the APIs provided by ASSET, you can quickly integrate system-wide encrypted
|
||||
|
||||
```bash
|
||||
├── frameworks # Framework code
|
||||
│ ├── c # Code for interaction between C and Rust
|
||||
│ ├── definition # Definitions of common data types
|
||||
│ ├── ipc # IPC APIs
|
||||
│ ├── js # Code for interaction between JS and C/C++
|
||||
│ ├── os_dependency # Adaptation of universal system capabilities
|
||||
│ └── utils # Utility APIs
|
||||
├── interfaces # APIs exposed externally
|
||||
│ ├── inner_api # APIs for system abilities (SAs)
|
||||
│ ├── inner_kits # APIs for system abilities (SAs)
|
||||
│ └── kits # APIs for user applications
|
||||
├── sa_profile # SA profiles
|
||||
└── services # Service layer code
|
||||
|
@ -25,13 +25,14 @@
|
||||
|
||||
```bash
|
||||
├── frameworks # 框架层代码
|
||||
│ ├── c # C-Rust交互模块
|
||||
│ ├── definition # 通用数据类型定义
|
||||
│ ├── ipc # IPC接口定义
|
||||
│ ├── js # JS-C/C++交互模块
|
||||
│ ├── os_dependency # 通用系统能力适配模块
|
||||
│ └── utils # 工具方法
|
||||
├── interfaces # 对外提供的接口
|
||||
│ ├── inner_api # 提供给系统服务调用的接口
|
||||
│ ├── inner_kits # 提供给系统服务调用的接口
|
||||
│ └── kits # 提供给应用调用的接口
|
||||
├── sa_profile # 系统服务配置文件
|
||||
└── services # 服务层代码
|
||||
|
@ -56,22 +56,22 @@
|
||||
"//base/security/asset:asset_component"
|
||||
]
|
||||
},
|
||||
"inner_api": [
|
||||
"inner_kits": [
|
||||
{
|
||||
"name": "//base/security/asset/interfaces/inner_api/rs:asset_sdk_rust",
|
||||
"name": "//base/security/asset/interfaces/inner_kits/rs:asset_sdk_rust",
|
||||
"header": {
|
||||
"header_files": [],
|
||||
"header_base": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "//base/security/asset/interfaces/inner_api/c:asset_sdk",
|
||||
"name": "//base/security/asset/frameworks/c/system_api:asset_sdk",
|
||||
"header": {
|
||||
"header_files": [
|
||||
"asset_system_api.h",
|
||||
"asset_system_type.h"
|
||||
],
|
||||
"header_base": "//base/security/asset/interfaces/inner_api/c/inc"
|
||||
"header_base": "//base/security/asset/interfaces/inner_kits/c/inc"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
20
interfaces/inner_api/c/BUILD.gn → frameworks/c/system_api/BUILD.gn
Executable file → Normal file
20
interfaces/inner_api/c/BUILD.gn → frameworks/c/system_api/BUILD.gn
Executable file → Normal file
@ -14,16 +14,16 @@
|
||||
import("//build/ohos.gni")
|
||||
|
||||
config("asset_config") {
|
||||
include_dirs = [ "inc" ]
|
||||
include_dirs = [ "../../../interfaces/inner_kits/c/inc" ]
|
||||
}
|
||||
|
||||
ohos_shared_library("asset_sdk") {
|
||||
public_configs = [ ":asset_config" ]
|
||||
sources = [ "src/asset_system_api.c" ]
|
||||
deps = [
|
||||
":asset_sdk_ffi",
|
||||
"../../../frameworks/os_dependency/log:asset_log",
|
||||
"../../../frameworks/os_dependency/memory:asset_mem",
|
||||
"../../../interfaces/inner_kits/c:asset_sdk_ffi",
|
||||
"../../os_dependency/log:asset_log",
|
||||
"../../os_dependency/memory:asset_mem",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
@ -49,15 +49,3 @@ ohos_shared_library("asset_sdk") {
|
||||
subsystem_name = "security"
|
||||
part_name = "asset"
|
||||
}
|
||||
|
||||
ohos_rust_shared_ffi("asset_sdk_ffi") {
|
||||
sources = [ "src/lib.rs" ]
|
||||
deps = [
|
||||
"../../../frameworks/os_dependency/log:asset_log",
|
||||
"../../../frameworks/os_dependency/memory:asset_mem",
|
||||
"../rs:asset_sdk_rust",
|
||||
]
|
||||
crate_name = "asset_sdk_ffi"
|
||||
subsystem_name = "security"
|
||||
part_name = "asset"
|
||||
}
|
0
interfaces/inner_api/c/src/asset_system_api.c → frameworks/c/system_api/src/asset_system_api.c
Executable file → Normal file
0
interfaces/inner_api/c/src/asset_system_api.c → frameworks/c/system_api/src/asset_system_api.c
Executable file → Normal file
@ -28,7 +28,7 @@ ohos_shared_library("asset_napi") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../../../interfaces/inner_api/c:asset_sdk",
|
||||
"../../c/system_api:asset_sdk",
|
||||
"../../os_dependency/memory:asset_mem",
|
||||
]
|
||||
|
||||
|
26
interfaces/inner_kits/c/BUILD.gn
Executable file
26
interfaces/inner_kits/c/BUILD.gn
Executable file
@ -0,0 +1,26 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
|
||||
ohos_rust_shared_ffi("asset_sdk_ffi") {
|
||||
sources = [ "src/lib.rs" ]
|
||||
deps = [
|
||||
"../../../frameworks/os_dependency/log:asset_log",
|
||||
"../../../frameworks/os_dependency/memory:asset_mem",
|
||||
"../rs:asset_sdk_rust",
|
||||
]
|
||||
crate_name = "asset_sdk_ffi"
|
||||
subsystem_name = "security"
|
||||
part_name = "asset"
|
||||
}
|
@ -20,7 +20,7 @@ config("asset_config") {
|
||||
ohos_shared_library("asset_ndk") {
|
||||
public_configs = [ ":asset_config" ]
|
||||
sources = [ "src/asset_api.c" ]
|
||||
deps = [ "../../inner_api/c:asset_sdk" ]
|
||||
deps = [ "../../../frameworks/c/system_api:asset_sdk" ]
|
||||
|
||||
external_deps = [ "hilog:libhilog" ]
|
||||
|
||||
|
@ -22,7 +22,7 @@ ohos_rust_shared_library("asset_service") {
|
||||
"../../frameworks/os_dependency/file:asset_file_operator",
|
||||
"../../frameworks/os_dependency/log:asset_log",
|
||||
"../../frameworks/utils:asset_utils",
|
||||
"../../interfaces/inner_api/rs:asset_sdk_rust",
|
||||
"../../interfaces/inner_kits/rs:asset_sdk_rust",
|
||||
"../common:asset_common",
|
||||
"../crypto_manager:asset_crypto_manager",
|
||||
"../db_key_operator:asset_db_key_operator",
|
||||
|
@ -36,5 +36,5 @@ asset_utils = { path = "../../frameworks/utils" }
|
||||
asset_ipc = { path = "../../frameworks/ipc" }
|
||||
asset_log = { path = "../../frameworks/os_dependency/log" }
|
||||
asset_plugin = { path = "../plugin" }
|
||||
asset_sdk = { path = "../../interfaces/inner_api/rs" }
|
||||
asset_sdk = { path = "../../interfaces/inner_kits/rs" }
|
||||
lazy_static = "1.0.0"
|
@ -261,8 +261,8 @@ pub(crate) extern "C" fn on_user_unlocked(user_id: i32) {
|
||||
|
||||
// Trigger upgrading ce db version and key alias
|
||||
match trigger_db_upgrade(user_id, true) {
|
||||
Ok(()) => logi!("upgrade de db version and key alias on user-unlocked success."),
|
||||
Err(e) => loge!("upgrade de db version and key alias on user-unlocked failed, err is: {}", e),
|
||||
Ok(()) => logi!("upgrade ce db version and key alias on user-unlocked success."),
|
||||
Err(e) => loge!("upgrade ce db version and key alias on user-unlocked failed, err is: {}", e),
|
||||
}
|
||||
|
||||
if let Ok(load) = AssetPlugin::get_instance().load_plugin() {
|
||||
|
@ -21,7 +21,7 @@ use asset_file_operator::de_operator::delete_user_de_dir;
|
||||
use asset_log::{loge, logi};
|
||||
use system_ability_fwk::cxx_share::SystemAbilityOnDemandReason;
|
||||
|
||||
use crate::common_event::listener;
|
||||
use crate::{common_event::listener, unload_handler::DELAYED_UNLOAD_TIME_IN_SEC, unload_sa};
|
||||
|
||||
const USER_ID: &str = "userId";
|
||||
const SANDBOX_APP_INDEX: &str = "sandbox_app_index";
|
||||
@ -128,4 +128,5 @@ pub(crate) fn handle_common_event(reason: SystemAbilityOnDemandReason) {
|
||||
logi!("[INFO]On user -{}- pin created.", reason.extra_data.code);
|
||||
listener::on_user_unlocked(reason.extra_data.code);
|
||||
}
|
||||
unload_sa(DELAYED_UNLOAD_TIME_IN_SEC as u64);
|
||||
}
|
||||
|
@ -71,13 +71,11 @@ impl Ability for AssetAbility {
|
||||
|
||||
let _ = upload_system_event(start_service(handler), &calling_info, start, func_name);
|
||||
common_event::handle_common_event(reason);
|
||||
unload_sa(DELAYED_UNLOAD_TIME_IN_SEC as u64);
|
||||
}
|
||||
|
||||
fn on_active(&self, reason: SystemAbilityOnDemandReason) {
|
||||
logi!("[INFO]Asset service on_active.");
|
||||
common_event::handle_common_event(reason);
|
||||
unload_sa(DELAYED_UNLOAD_TIME_IN_SEC as u64);
|
||||
}
|
||||
|
||||
fn on_idle(&self, _reason: SystemAbilityOnDemandReason) -> i32 {
|
||||
|
@ -20,7 +20,7 @@ ohos_rust_static_library("asset_plugin") {
|
||||
"../../frameworks/os_dependency/file:asset_file_operator",
|
||||
"../../frameworks/os_dependency/log:asset_log",
|
||||
"../../frameworks/utils:asset_utils",
|
||||
"../../interfaces/inner_api/rs:asset_sdk_rust",
|
||||
"../../interfaces/inner_kits/rs:asset_sdk_rust",
|
||||
"../common:asset_common",
|
||||
"../db_key_operator:asset_db_key_operator",
|
||||
"../db_operator:asset_db_operator",
|
||||
|
@ -22,7 +22,7 @@ edition = "2021"
|
||||
asset_common = { path = "../common" }
|
||||
asset_definition = { path = "../../frameworks/definition" }
|
||||
asset_log = { path = "../../frameworks/os_dependency/log" }
|
||||
asset_sdk = { path = "../../interfaces/inner_api/rs" }
|
||||
asset_sdk = { path = "../../interfaces/inner_kits/rs" }
|
||||
asset_db_key_operator = { path = "../db_key_operator" }
|
||||
asset_db_operator = { path = "../db_operator" }
|
||||
asset_file_operator = { path = "../../frameworks/os_dependency/file" }
|
||||
|
@ -18,13 +18,13 @@ ohos_static_library("asset_test_common") {
|
||||
sources = [ "src/asset_test_common.cpp" ]
|
||||
include_dirs = [
|
||||
"inc",
|
||||
"../../../interfaces/inner_api/c/inc",
|
||||
"../../../interfaces/inner_kits/c/inc",
|
||||
"../../../interfaces/kits/c/inc",
|
||||
]
|
||||
subsystem_name = "security"
|
||||
part_name = "asset"
|
||||
deps = [
|
||||
"../../../interfaces/inner_api/c:asset_sdk",
|
||||
"../../../frameworks/c/system_api:asset_sdk",
|
||||
"../../../interfaces/kits/c:asset_ndk",
|
||||
]
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ module_output_path = "asset/asset_UT_test"
|
||||
ohos_rust_unittest("asset_rust_test") {
|
||||
module_out_path = module_output_path
|
||||
sources = [ "src/main.rs" ]
|
||||
deps = [ "../../../interfaces/inner_api/rs:asset_sdk_rust" ]
|
||||
deps = [ "../../../interfaces/inner_kits/rs:asset_sdk_rust" ]
|
||||
subsystem_name = "security"
|
||||
part_name = "asset"
|
||||
}
|
@ -19,4 +19,4 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
asset_sdk = { path = "../../../interfaces/inner_api/rs" }
|
||||
asset_sdk = { path = "../../../interfaces/inner_kits/rs" }
|
@ -22,7 +22,7 @@ ohos_unittest("asset_ndk_test") {
|
||||
part_name = "asset"
|
||||
include_dirs = [
|
||||
"inc",
|
||||
"../../../interfaces/inner_api/c/inc",
|
||||
"../../../interfaces/inner_kits/c/inc",
|
||||
"../../../interfaces/kits/c/inc",
|
||||
"../common/inc",
|
||||
]
|
||||
@ -34,7 +34,7 @@ ohos_unittest("asset_ndk_test") {
|
||||
"src/asset_update_test.cpp",
|
||||
]
|
||||
deps = [
|
||||
"../../../interfaces/inner_api/c:asset_sdk",
|
||||
"../../../frameworks/c/system_api:asset_sdk",
|
||||
"../../../interfaces/kits/c:asset_ndk",
|
||||
"../common:asset_test_common",
|
||||
]
|
||||
|
@ -40,7 +40,7 @@ ohos_unittest("asset_dependency_test") {
|
||||
part_name = "asset"
|
||||
include_dirs = [
|
||||
"inc",
|
||||
"../../../interfaces/inner_api/c/inc",
|
||||
"../../../interfaces/inner_kits/c/inc",
|
||||
"../../../interfaces/kits/c/inc",
|
||||
"../../../services/os_dependency/inc",
|
||||
"../../../services/crypto_manager/src",
|
||||
@ -58,7 +58,7 @@ ohos_unittest("asset_dependency_test") {
|
||||
"src/system_event_wrapper_test.cpp",
|
||||
]
|
||||
deps = [
|
||||
"../../../interfaces/inner_api/c:asset_sdk",
|
||||
"../../../frameworks/c/system_api:asset_sdk",
|
||||
"../../../interfaces/kits/c:asset_ndk",
|
||||
"../../../services/crypto_manager:asset_huks_wrapper",
|
||||
"../../../services/os_dependency:asset_os_dependency",
|
||||
|
Loading…
Reference in New Issue
Block a user