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