• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2013 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
15// Default flags to be used throughout all libraries in inputflinger.
16package {
17    default_team: "trendy_team_input_framework",
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "frameworks_native_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: ["frameworks_native_license"],
24}
25
26inputflinger_tidy_checks = [
27    "android-*",
28]
29
30cc_defaults {
31    name: "inputflinger_defaults",
32    host_supported: true,
33    cpp_std: "c++20",
34    cflags: [
35        "-Wall",
36        "-Wextra",
37        "-Werror",
38        "-Wno-unused-parameter",
39        "-Wthread-safety",
40        "-Wshadow",
41        "-Wshadow-field-in-constructor-modified",
42        "-Wshadow-uncaptured-local",
43        "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
44    ],
45    sanitize: {
46        misc_undefined: [
47            "bounds",
48        ],
49    },
50    tidy: true,
51    tidy_checks: [
52        "-*", // Disable all checks not explicitly enabled for now
53    ] + inputflinger_tidy_checks,
54    tidy_checks_as_errors: inputflinger_tidy_checks,
55    target: {
56        host: {
57            sanitize: {
58                address: true,
59                diag: {
60                    cfi: true,
61                    integer_overflow: true,
62                    memtag_heap: true,
63                    undefined: true,
64                    misc_undefined: [
65                        "bounds",
66                        "all",
67                    ],
68                },
69            },
70            include_dirs: [
71                "bionic/libc/kernel/android/uapi/",
72                "bionic/libc/kernel/uapi",
73            ],
74            cflags: [
75                "-D__ANDROID_HOST__",
76            ],
77        },
78    },
79}
80
81/////////////////////////////////////////////////
82// libinputflinger
83/////////////////////////////////////////////////
84
85filegroup {
86    name: "libinputflinger_sources",
87    srcs: [
88        "InputCommonConverter.cpp",
89        "InputDeviceMetricsCollector.cpp",
90        "InputFilter.cpp",
91        "InputFilterCallbacks.cpp",
92        "InputProcessor.cpp",
93        "PointerChoreographer.cpp",
94        "PreferStylusOverTouchBlocker.cpp",
95        "UnwantedInteractionBlocker.cpp",
96    ],
97}
98
99cc_defaults {
100    name: "libinputflinger_defaults",
101    srcs: [":libinputflinger_sources"],
102    shared_libs: [
103        "android.hardware.input.processor-V1-ndk",
104        "com.android.server.inputflinger-ndk",
105        "libbase",
106        "libbinder",
107        "libbinder_ndk",
108        "libchrome",
109        "libcrypto",
110        "libcutils",
111        "libhidlbase",
112        "libinput",
113        "libkll",
114        "liblog",
115        "libprotobuf-cpp-lite",
116        "libstatslog",
117        "libutils",
118        "libstatspull",
119        "libstatssocket",
120        "packagemanager_aidl-cpp",
121        "server_configurable_flags",
122    ],
123    static_libs: [
124        "libattestation",
125        "libperfetto_client_experimental",
126        "libpalmrejection",
127        "libui-types",
128    ],
129    generated_headers: [
130        "cxx-bridge-header",
131        "inputflinger_rs_bootstrap_bridge_header",
132    ],
133    header_libs: ["inputflinger_rs_bootstrap_cxx_headers"],
134    generated_sources: ["inputflinger_rs_bootstrap_bridge_code"],
135    whole_static_libs: ["libinputflinger_rs"],
136    export_shared_lib_headers: ["com.android.server.inputflinger-ndk"],
137    target: {
138        android: {
139            shared_libs: [
140                "libgui",
141            ],
142        },
143    },
144}
145
146cc_library_shared {
147    name: "libinputflinger",
148    host_supported: true,
149    defaults: [
150        "inputflinger_defaults",
151        "libinputflinger_defaults",
152    ],
153    srcs: [
154        "InputManager.cpp",
155        // other sources are added via "defaults"
156    ],
157    cflags: [
158        // TODO(b/23084678): Move inputflinger to its own process and mark it hidden
159        //-fvisibility=hidden
160    ],
161    shared_libs: [
162        // This should consist only of dependencies from inputflinger. Other dependencies should be
163        // in cc_defaults so that they are included in the tests.
164        "libinputflinger_base",
165        "libinputreader",
166        "libinputreporter",
167        "libPlatformProperties",
168    ],
169    static_libs: [
170        "libinputdispatcher",
171    ],
172    export_static_lib_headers: [
173        "libinputdispatcher",
174    ],
175    export_include_dirs: [
176        ".",
177        "include",
178    ],
179}
180
181/////////////////////////////////////////////////
182// libinputflinger_base
183/////////////////////////////////////////////////
184
185cc_library_headers {
186    name: "libinputflinger_headers",
187    host_supported: true,
188    export_include_dirs: ["include"],
189}
190
191filegroup {
192    name: "libinputflinger_base_sources",
193    srcs: [
194        "InputDeviceMetricsSource.cpp",
195        "InputListener.cpp",
196        "InputReaderBase.cpp",
197        "InputThread.cpp",
198        "NotifyArgs.cpp",
199        "VibrationElement.cpp",
200    ],
201}
202
203cc_defaults {
204    name: "libinputflinger_base_defaults",
205    srcs: [":libinputflinger_base_sources"],
206    shared_libs: [
207        "libbase",
208        "libbinder",
209        "libcutils",
210        "libinput",
211        "liblog",
212        "libstatslog",
213        "libutils",
214    ],
215    header_libs: [
216        "libinputflinger_headers",
217    ],
218}
219
220cc_library_shared {
221    name: "libinputflinger_base",
222    host_supported: true,
223    defaults: [
224        "inputflinger_defaults",
225        "libinputflinger_base_defaults",
226    ],
227    export_header_lib_headers: [
228        "libinputflinger_headers",
229    ],
230}
231
232// This target will build everything 'input-related'. This could be useful for
233// large refactorings of the input code. This is similar to 'm checkbuild', but
234// just for input code.
235// Use 'm checkinput' to build, and then (optionally) use 'm installclean' to
236// remove any of the installed artifacts that you may not want on your actual
237// build.
238phony {
239    name: "checkinput",
240    required: [
241        // native targets
242        "libgui_test",
243        "libinput",
244        "libinputreader_static",
245        "libinputflinger",
246        "inputflinger_tests",
247        "inputflinger_benchmarks",
248        "libinput_tests",
249        "libpalmrejection_test",
250        "libandroid_runtime",
251        "libinputservice_test",
252        "Bug-115739809",
253        "StructLayout_test",
254
255        // jni
256        "libservices.core",
257
258        // rust targets
259        "libinput_rust_test",
260
261        // native fuzzers
262        "inputflinger_latencytracker_fuzzer",
263        "inputflinger_cursor_input_fuzzer",
264        "inputflinger_keyboard_input_fuzzer",
265        "inputflinger_multitouch_input_fuzzer",
266        "inputflinger_switch_input_fuzzer",
267        "inputflinger_touchpad_input_fuzzer",
268        "inputflinger_input_reader_fuzzer",
269        "inputflinger_blocking_queue_fuzzer",
270        "inputflinger_input_classifier_fuzzer",
271        "inputflinger_input_dispatcher_fuzzer",
272
273        // Java/Kotlin targets
274        "CtsWindowManagerDeviceWindow",
275        "InputTests",
276        "CtsHardwareTestCases",
277        "CtsInputTestCases",
278        "CtsViewTestCases",
279        "CtsWidgetTestCases",
280        "FrameworksCoreTests",
281        "FrameworksServicesTests",
282        "CtsSecurityTestCases",
283        "CtsSecurityBulletinHostTestCases",
284        "monkey_test",
285    ],
286}
287