181b96c26Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
281b96c26Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
381b96c26Sopenharmony_ci# you may not use this file except in compliance with the License.
481b96c26Sopenharmony_ci# You may obtain a copy of the License at
581b96c26Sopenharmony_ci#
681b96c26Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
781b96c26Sopenharmony_ci#
881b96c26Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
981b96c26Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1081b96c26Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1181b96c26Sopenharmony_ci# See the License for the specific language governing permissions and
1281b96c26Sopenharmony_ci# limitations under the License.
1381b96c26Sopenharmony_ci
1481b96c26Sopenharmony_ciimport("//build/ohos.gni")
1581b96c26Sopenharmony_ciimport("../../../dlp_permission_service.gni")
1681b96c26Sopenharmony_ci
1781b96c26Sopenharmony_ciohos_prebuilt_etc("dlp_permission_service.rc") {
1881b96c26Sopenharmony_ci  source = "dlp_permission_service.cfg"
1981b96c26Sopenharmony_ci  relative_install_dir = "init"
2081b96c26Sopenharmony_ci  subsystem_name = "security"
2181b96c26Sopenharmony_ci  part_name = "dlp_permission_service"
2281b96c26Sopenharmony_ci}
2381b96c26Sopenharmony_ci
2481b96c26Sopenharmony_ciohos_static_library("dlp_hex_string_static") {
2581b96c26Sopenharmony_ci  branch_protector_ret = "pac_ret"
2681b96c26Sopenharmony_ci
2781b96c26Sopenharmony_ci  sanitize = {
2881b96c26Sopenharmony_ci    cfi = true
2981b96c26Sopenharmony_ci    cfi_cross_dso = true
3081b96c26Sopenharmony_ci    debug = false
3181b96c26Sopenharmony_ci  }
3281b96c26Sopenharmony_ci
3381b96c26Sopenharmony_ci  subsystem_name = "security"
3481b96c26Sopenharmony_ci  part_name = "dlp_permission_service"
3581b96c26Sopenharmony_ci
3681b96c26Sopenharmony_ci  include_dirs = [
3781b96c26Sopenharmony_ci    "${dlp_root_dir}/interfaces/inner_api/dlp_permission/include",
3881b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/common/include",
3981b96c26Sopenharmony_ci  ]
4081b96c26Sopenharmony_ci
4181b96c26Sopenharmony_ci  sources = [ "${dlp_root_dir}/frameworks/common/src/hex_string.cpp" ]
4281b96c26Sopenharmony_ci
4381b96c26Sopenharmony_ci  configs = [ "${dlp_root_dir}/config:coverage_flags" ]
4481b96c26Sopenharmony_ci
4581b96c26Sopenharmony_ci  cflags_cc = [ "-DHILOG_ENABLE" ]
4681b96c26Sopenharmony_ci
4781b96c26Sopenharmony_ci  external_deps = [ "hilog:libhilog" ]
4881b96c26Sopenharmony_ci}
4981b96c26Sopenharmony_ci
5081b96c26Sopenharmony_ciohos_static_library("dlp_permission_serializer_static") {
5181b96c26Sopenharmony_ci  branch_protector_ret = "pac_ret"
5281b96c26Sopenharmony_ci
5381b96c26Sopenharmony_ci  sanitize = {
5481b96c26Sopenharmony_ci    cfi = true
5581b96c26Sopenharmony_ci    cfi_cross_dso = true
5681b96c26Sopenharmony_ci    debug = false
5781b96c26Sopenharmony_ci  }
5881b96c26Sopenharmony_ci
5981b96c26Sopenharmony_ci  subsystem_name = "security"
6081b96c26Sopenharmony_ci  part_name = "dlp_permission_service"
6181b96c26Sopenharmony_ci
6281b96c26Sopenharmony_ci  include_dirs = [
6381b96c26Sopenharmony_ci    "sa_common",
6481b96c26Sopenharmony_ci    "${dlp_root_dir}/interfaces/inner_api/dlp_permission/include",
6581b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/common/include",
6681b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/dlp_permission/include",
6781b96c26Sopenharmony_ci  ]
6881b96c26Sopenharmony_ci
6981b96c26Sopenharmony_ci  sources = [ "sa_common/dlp_permission_serializer.cpp" ]
7081b96c26Sopenharmony_ci
7181b96c26Sopenharmony_ci  cflags_cc = [ "-DHILOG_ENABLE" ]
7281b96c26Sopenharmony_ci
7381b96c26Sopenharmony_ci  configs = [ "${dlp_root_dir}/config:coverage_flags" ]
7481b96c26Sopenharmony_ci
7581b96c26Sopenharmony_ci  deps = [ ":dlp_hex_string_static" ]
7681b96c26Sopenharmony_ci
7781b96c26Sopenharmony_ci  external_deps = [
7881b96c26Sopenharmony_ci    "c_utils:utils",
7981b96c26Sopenharmony_ci    "hilog:libhilog",
8081b96c26Sopenharmony_ci    "json:nlohmann_json_static",
8181b96c26Sopenharmony_ci    "os_account:os_account_innerkits",
8281b96c26Sopenharmony_ci  ]
8381b96c26Sopenharmony_ci
8481b96c26Sopenharmony_ci  if (dlp_credential_enable == true) {
8581b96c26Sopenharmony_ci    external_deps += [ "dlp_credential_service:dlp_credential_sdk" ]
8681b96c26Sopenharmony_ci  } else {
8781b96c26Sopenharmony_ci    include_dirs += [ "mock" ]
8881b96c26Sopenharmony_ci  }
8981b96c26Sopenharmony_ci}
9081b96c26Sopenharmony_ci
9181b96c26Sopenharmony_ciohos_shared_library("dlp_permission_service") {
9281b96c26Sopenharmony_ci  branch_protector_ret = "pac_ret"
9381b96c26Sopenharmony_ci
9481b96c26Sopenharmony_ci  sanitize = {
9581b96c26Sopenharmony_ci    cfi = true
9681b96c26Sopenharmony_ci    cfi_cross_dso = true
9781b96c26Sopenharmony_ci    debug = false
9881b96c26Sopenharmony_ci  }
9981b96c26Sopenharmony_ci
10081b96c26Sopenharmony_ci  subsystem_name = "security"
10181b96c26Sopenharmony_ci  part_name = "dlp_permission_service"
10281b96c26Sopenharmony_ci
10381b96c26Sopenharmony_ci  include_dirs = [
10481b96c26Sopenharmony_ci    "adapt",
10581b96c26Sopenharmony_ci    "callback/dlp_sandbox_change_callback",
10681b96c26Sopenharmony_ci    "callback/open_dlp_file_callback",
10781b96c26Sopenharmony_ci    "sa_main",
10881b96c26Sopenharmony_ci    "sa_common",
10981b96c26Sopenharmony_ci    "storage/include",
11081b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/common/include",
11181b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/dlp_permission/include",
11281b96c26Sopenharmony_ci    "${dlp_root_dir}/interfaces/inner_api/dlp_parse/include",
11381b96c26Sopenharmony_ci    "${dlp_root_dir}/interfaces/inner_api/dlp_permission/include",
11481b96c26Sopenharmony_ci  ]
11581b96c26Sopenharmony_ci
11681b96c26Sopenharmony_ci  sources = [
11781b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/common/src/cert_parcel.cpp",
11881b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/common/src/permission_policy.cpp",
11981b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/common/src/retention_sandbox_info.cpp",
12081b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/common/src/visited_dlp_file_info.cpp",
12181b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/dlp_permission/src/auth_user_info_parcel.cpp",
12281b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/dlp_permission/src/dlp_permission_info_parcel.cpp",
12381b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/dlp_permission/src/dlp_policy_parcel.cpp",
12481b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/dlp_permission/src/dlp_sandbox_callback_info_parcel.cpp",
12581b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/dlp_permission/src/open_dlp_file_callback_info_parcel.cpp",
12681b96c26Sopenharmony_ci    "adapt/account_adapt.cpp",
12781b96c26Sopenharmony_ci    "adapt/app_state_observer.cpp",
12881b96c26Sopenharmony_ci    "adapt/app_uninstall_observer.cpp",
12981b96c26Sopenharmony_ci    "adapt/file_operator.cpp",
13081b96c26Sopenharmony_ci    "adapt/retention_file_manager.cpp",
13181b96c26Sopenharmony_ci    "adapt/sandbox_json_manager.cpp",
13281b96c26Sopenharmony_ci    "adapt/visit_record_file_manager.cpp",
13381b96c26Sopenharmony_ci    "adapt/visit_record_json_manager.cpp",
13481b96c26Sopenharmony_ci    "callback/dlp_sandbox_change_callback/dlp_sandbox_change_callback_death_recipient.cpp",
13581b96c26Sopenharmony_ci    "callback/dlp_sandbox_change_callback/dlp_sandbox_change_callback_manager.cpp",
13681b96c26Sopenharmony_ci    "callback/dlp_sandbox_change_callback/dlp_sandbox_change_callback_proxy.cpp",
13781b96c26Sopenharmony_ci    "callback/open_dlp_file_callback/open_dlp_file_callback_death_recipient.cpp",
13881b96c26Sopenharmony_ci    "callback/open_dlp_file_callback/open_dlp_file_callback_manager.cpp",
13981b96c26Sopenharmony_ci    "callback/open_dlp_file_callback/open_dlp_file_callback_proxy.cpp",
14081b96c26Sopenharmony_ci    "sa_common/bundle_manager_adapter.cpp",
14181b96c26Sopenharmony_ci    "sa_main/dlp_credential.cpp",
14281b96c26Sopenharmony_ci    "sa_main/dlp_permission_async_proxy.cpp",
14381b96c26Sopenharmony_ci    "sa_main/dlp_permission_service.cpp",
14481b96c26Sopenharmony_ci    "sa_main/dlp_permission_stub.cpp",
14581b96c26Sopenharmony_ci    "storage/src/dlp_kv_data_storage.cpp",
14681b96c26Sopenharmony_ci    "storage/src/sandbox_config_kv_data_storage.cpp",
14781b96c26Sopenharmony_ci  ]
14881b96c26Sopenharmony_ci
14981b96c26Sopenharmony_ci  cflags_cc = [ "-DHILOG_ENABLE" ]
15081b96c26Sopenharmony_ci  cflags = [ "-DHILOG_ENABLE" ]
15181b96c26Sopenharmony_ci
15281b96c26Sopenharmony_ci  if (build_variant == "user") {
15381b96c26Sopenharmony_ci    cflags_cc += [ "-DDLP_DEBUG_ENABLE=0" ]
15481b96c26Sopenharmony_ci    cflags += [ "-DDLP_DEBUG_ENABLE=0" ]
15581b96c26Sopenharmony_ci  } else if (build_variant == "root") {
15681b96c26Sopenharmony_ci    cflags_cc += [ "-DDLP_DEBUG_ENABLE=1" ]
15781b96c26Sopenharmony_ci    cflags += [ "-DDLP_DEBUG_ENABLE=1" ]
15881b96c26Sopenharmony_ci  } else {
15981b96c26Sopenharmony_ci    cflags_cc += [ "-DDLP_DEBUG_ENABLE=1" ]
16081b96c26Sopenharmony_ci    cflags += [ "-DDLP_DEBUG_ENABLE=1" ]
16181b96c26Sopenharmony_ci  }
16281b96c26Sopenharmony_ci
16381b96c26Sopenharmony_ci  if (dlp_permission_service_gathering_policy) {
16481b96c26Sopenharmony_ci    cflags_cc += [ "-DDLP_GATHERING_SANDBOX" ]
16581b96c26Sopenharmony_ci    cflags += [ "-DDLP_GATHERING_SANDBOX" ]
16681b96c26Sopenharmony_ci  }
16781b96c26Sopenharmony_ci
16881b96c26Sopenharmony_ci  deps = [
16981b96c26Sopenharmony_ci    ":dlp_hex_string_static",
17081b96c26Sopenharmony_ci    ":dlp_permission_serializer_static",
17181b96c26Sopenharmony_ci    ":dlp_permission_service.rc",
17281b96c26Sopenharmony_ci  ]
17381b96c26Sopenharmony_ci
17481b96c26Sopenharmony_ci  deps += [ "etc:param_files" ]
17581b96c26Sopenharmony_ci
17681b96c26Sopenharmony_ci  configs = [ "${dlp_root_dir}/config:coverage_flags" ]
17781b96c26Sopenharmony_ci
17881b96c26Sopenharmony_ci  external_deps = [
17981b96c26Sopenharmony_ci    "ability_base:want",
18081b96c26Sopenharmony_ci    "ability_runtime:app_manager",
18181b96c26Sopenharmony_ci    "access_token:libaccesstoken_sdk",
18281b96c26Sopenharmony_ci    "bundle_framework:appexecfwk_base",
18381b96c26Sopenharmony_ci    "bundle_framework:appexecfwk_core",
18481b96c26Sopenharmony_ci    "c_utils:utils",
18581b96c26Sopenharmony_ci    "common_event_service:cesfwk_core",
18681b96c26Sopenharmony_ci    "common_event_service:cesfwk_innerkits",
18781b96c26Sopenharmony_ci    "config_policy:configpolicy_util",
18881b96c26Sopenharmony_ci    "hilog:libhilog",
18981b96c26Sopenharmony_ci    "hisysevent:libhisysevent",
19081b96c26Sopenharmony_ci    "init:libbegetutil",
19181b96c26Sopenharmony_ci    "ipc:ipc_core",
19281b96c26Sopenharmony_ci    "json:nlohmann_json_static",
19381b96c26Sopenharmony_ci    "kv_store:distributeddata_inner",
19481b96c26Sopenharmony_ci    "os_account:libaccountkits",
19581b96c26Sopenharmony_ci    "os_account:os_account_innerkits",
19681b96c26Sopenharmony_ci    "safwk:system_ability_fwk",
19781b96c26Sopenharmony_ci    "samgr:samgr_proxy",
19881b96c26Sopenharmony_ci  ]
19981b96c26Sopenharmony_ci
20081b96c26Sopenharmony_ci  if (dlp_credential_enable == true) {
20181b96c26Sopenharmony_ci    cflags_cc += [ "-DSUPPORT_DLP_CREDENTIAL" ]
20281b96c26Sopenharmony_ci    external_deps += [ "dlp_credential_service:dlp_credential_sdk" ]
20381b96c26Sopenharmony_ci  } else {
20481b96c26Sopenharmony_ci    include_dirs += [ "mock" ]
20581b96c26Sopenharmony_ci    sources += [
20681b96c26Sopenharmony_ci      "mock/dlp_credential_service.c",
20781b96c26Sopenharmony_ci      "mock/mock_utils.cpp",
20881b96c26Sopenharmony_ci    ]
20981b96c26Sopenharmony_ci  }
21081b96c26Sopenharmony_ci}
211