1// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_team: "trendy_team_android_hardware_backed_security",
17    default_applicable_licenses: ["system_hwservicemanager_license"],
18}
19
20// Added automatically by a large-scale-change
21// http://go/android-license-faq
22license {
23    name: "system_hwservicemanager_license",
24    visibility: [":__subpackages__"],
25    license_kinds: [
26        "SPDX-license-identifier-Apache-2.0",
27    ],
28    license_text: [
29        "NOTICE",
30    ],
31}
32
33cc_defaults {
34    name: "hwservicemanager_defaults",
35    cflags: [
36        "-Wall",
37        "-Wextra",
38        "-Werror",
39    ],
40    shared_libs: [
41        "libhidlbase",
42        "liblog",
43    ],
44}
45
46cc_defaults {
47    name: "libhwservicemanager_shared_libs",
48    shared_libs: [
49        "libbase",
50        "libhidl-gen-utils",
51        "libselinux",
52        "libutils",
53        "libvintf",
54    ],
55}
56
57cc_library_static {
58    name: "libhwservicemanager",
59    host_supported: true,
60    defaults: [
61        "hwservicemanager_defaults",
62        "libhwservicemanager_shared_libs",
63    ],
64    srcs: [
65        "AccessControl.cpp",
66        "HidlService.cpp",
67        "ServiceManager.cpp",
68        "Vintf.cpp",
69    ],
70}
71
72cc_defaults {
73    name: "libtokenmanager_shared_libs",
74    shared_libs: [
75        "android.hidl.token@1.0",
76        "libcrypto",
77    ],
78}
79
80cc_library_static {
81    name: "libtokenmanager",
82    defaults: [
83        "hwservicemanager_defaults",
84        "libtokenmanager_shared_libs",
85    ],
86    srcs: [
87        "TokenManager.cpp",
88    ],
89}
90
91cc_binary {
92    name: "hwservicemanager",
93    defaults: [
94        "hwservicemanager_defaults",
95        "libhwservicemanager_shared_libs",
96        "libtokenmanager_shared_libs",
97    ],
98    init_rc: [
99        "hwservicemanager.rc",
100    ],
101    srcs: [
102        "service.cpp",
103    ],
104    shared_libs: [
105        "libcutils",
106    ],
107    static_libs: [
108        "libhwservicemanager",
109        "libtokenmanager",
110    ],
111    bootstrap: true,
112    system_ext_specific: true,
113}
114
115// Create symlink /system/bin/hwservicemanager -> /system/system_ext/bin/hwservicemanager
116// Old vendor libraries (like libhidlbase) may require /system/bin/hwservicemanager to be present
117install_symlink {
118    name: "hwservicemanager_compat_symlink_module",
119    symlink_target: "/system/system_ext/bin/hwservicemanager",
120    // installed_location is relative to /system because that's the default partition for soong
121    // modules, unless we add something like `system_ext_specific: true` like in hwservicemanager.
122    installed_location: "bin/hwservicemanager",
123}
124
125cc_test {
126    name: "hwservicemanager_test",
127    host_supported: true,
128    defaults: [
129        "hwservicemanager_defaults",
130        "libhwservicemanager_shared_libs",
131    ],
132    static_libs: [
133        "libgmock",
134        "libhwservicemanager",
135    ],
136    srcs: [
137        "test_lazy.cpp",
138    ],
139    test_suites: ["device-tests"],
140}
141