1# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("../../access_token.gni")
16
17config("accesstoken_service_common_public_config") {
18  visibility = [ ":*" ]
19  include_dirs = [
20    "app_manager/include",
21    "database/include",
22    "libraryloader/include",
23    "random/include",
24  ]
25  if (eventhandler_enable) {
26    include_dirs += [ "handler/include" ]
27  }
28}
29
30ohos_static_library("accesstoken_service_common") {
31  subsystem_name = "security"
32  part_name = "access_token"
33  sanitize = {
34    cfi = true
35    cfi_cross_dso = true
36    debug = false
37  }
38  branch_protector_ret = "pac_ret"
39  include_dirs = [
40    "${access_token_path}/frameworks/common/include",
41    "${access_token_path}/interfaces/innerkits/accesstoken/include",
42  ]
43
44  public_configs = [ ":accesstoken_service_common_public_config" ]
45
46  sources = [
47    "app_manager/src/ams_manager_access_proxy.cpp",
48    "app_manager/src/app_manager_access_client.cpp",
49    "app_manager/src/app_manager_access_proxy.cpp",
50    "app_manager/src/app_manager_death_recipient.cpp",
51    "app_manager/src/app_state_data.cpp",
52    "app_manager/src/app_status_change_callback.cpp",
53    "app_manager/src/process_data.cpp",
54    "database/src/generic_values.cpp",
55    "database/src/memory_guard.cpp",
56    "database/src/sqlite_helper.cpp",
57    "database/src/statement.cpp",
58    "database/src/variant_value.cpp",
59    "libraryloader/src/libraryloader.cpp",
60    "random/src/random_openssl.cpp",
61  ]
62
63  cflags_cc = [
64    "-DHILOG_ENABLE",
65    "-fvisibility=hidden",
66  ]
67  configs = [
68    "${access_token_path}/config:access_token_compile_flags",
69    "${access_token_path}/config:coverage_flags",
70  ]
71
72  external_deps = [
73    "c_utils:utils",
74    "hilog:libhilog",
75    "ipc:ipc_core",
76    "openssl:libcrypto_shared",
77    "safwk:system_ability_fwk",
78    "samgr:samgr_proxy",
79    "sqlite:sqlite",
80  ]
81  if (eventhandler_enable == true) {
82    cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
83    sources += [ "handler/src/access_event_handler.cpp" ]
84    external_deps += [ "eventhandler:libeventhandler" ]
85  }
86
87  if (ability_base_enable == true) {
88    include_dirs += [ "ability_manager/include" ]
89
90    sources += [
91      "ability_manager/src/ability_manager_access_client.cpp",
92      "ability_manager/src/ability_manager_access_death_recipient.cpp",
93      "ability_manager/src/ability_manager_access_proxy.cpp",
94    ]
95
96    external_deps += [ "ability_base:want" ]
97  }
98
99  if (use_musl) {
100    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
101      cflags_cc += [ "-DCONFIG_USE_JEMALLOC_DFX_INTF" ]
102    }
103  }
104}
105
106group("accesstoken_common") {
107  if (is_standard_system) {
108    deps = [
109      ":accesstoken_service_common",
110      "ability_manager:accesstoken_ability_manager_adapter",
111      "config_policy:accesstoken_config_policy",
112      "screenlock_manager:accesstoken_screenlock_manager",
113    ]
114  }
115}
116